Add the "verifyATN" deserialization option
This commit is contained in:
parent
affbe51077
commit
c4c2546fc9
|
@ -44,11 +44,14 @@ public class ATNDeserializationOptions {
|
|||
}
|
||||
|
||||
private boolean readOnly;
|
||||
private boolean verifyATN;
|
||||
|
||||
public ATNDeserializationOptions() {
|
||||
this.verifyATN = true;
|
||||
}
|
||||
|
||||
public ATNDeserializationOptions(ATNDeserializationOptions options) {
|
||||
this.verifyATN = options.verifyATN;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
@ -64,6 +67,15 @@ public class ATNDeserializationOptions {
|
|||
readOnly = true;
|
||||
}
|
||||
|
||||
public final boolean isVerifyATN() {
|
||||
return verifyATN;
|
||||
}
|
||||
|
||||
public final void setVerifyATN(boolean verifyATN) {
|
||||
throwIfReadOnly();
|
||||
this.verifyATN = verifyATN;
|
||||
}
|
||||
|
||||
protected void throwIfReadOnly() {
|
||||
if (isReadOnly()) {
|
||||
throw new IllegalStateException("The object is read only.");
|
||||
|
|
|
@ -358,7 +358,10 @@ public class ATNDeserializer {
|
|||
decState.decision = i-1;
|
||||
}
|
||||
|
||||
verifyATN(atn);
|
||||
if (deserializationOptions.isVerifyATN()) {
|
||||
verifyATN(atn);
|
||||
}
|
||||
|
||||
return atn;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue