Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fail to serialize NoViableAltException #3201

Open
jbnas opened this issue Jun 8, 2021 · 0 comments
Open

Fail to serialize NoViableAltException #3201

jbnas opened this issue Jun 8, 2021 · 0 comments

Comments

@jbnas
Copy link

jbnas commented Jun 8, 2021

Attempting to serialize a NoViableAltException, or an Exception whose cause chain contains an instance of NoViableAltException fails because the ctx member (RuleContext) from parent class RecognitionException is not serializable.

Need to make the ANTLR classes that can be included in ANTLR exceptions serializable, or need to make the members of these classes in ANTLR exceptions transient.

public static class GSContext extends ParserRuleContext {
...
}
Caused by: java.io.NotSerializableException: c.n.j.j.parser.antlr.JP$GSContext
	at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1184)
	at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1548)
	at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1509)
	at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1432)
	at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1178)
	at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1548)
	at java.io.ObjectOutputStream.defaultWriteObject(ObjectOutputStream.java:441)
	at java.lang.Throwable.writeObject(Throwable.java:1024)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:1155)
	at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1496)
	at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1432)
	at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1178)
	at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:348)
	at c.n.j.d.s.s.jse.writeRes(jse.java:880)
	at c.n.j.d.s.s.jse.writeScriptRes(jse.java:994)
	at c.n.j.d.s.s.jse.main(jse.java:944)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant