axkr/symja_android_library

BooleanMinimize & BooleanConvert seem to crash using symja_java8-2018-06-18

Closed this issue · 2 comments

Submit a feature request or bug report

Replace any "X" with your information.


Is this a request for a feature or a bug report?

Bug Report

What is the current behavior?

Crashes calc.eval engine

If this is a bug report, please provide steps to reproduce:

private static final EvalEngine engine = new EvalEngine(true);
public static final ExprEvaluator calc = new ExprEvaluator(engine,true,HISTORY_CAPACITY);

IExpr res = CalculateService.calc.eval("BooleanMinimize(x&&y||(!x)&&y)");
IExpr res = CalculateService.calc.eval("BooleanConvert(Xor(x,y))");

What is the expected or desired behavior?

Please provide use cases for changing the current behavior:

X

Please describe your development environment (OS, browser, etc.):

used 'symja_java8-2018-06-18' on android platform.

gradle file:
compileSdkVersion 27
buildToolsVersion '27.0.3'

Other relevant information:

Produces the following messages in logcat:

07-19 12:38:34.710 28847-28847/com.example.sympycalculator E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.sympycalculator, PID: 28847
java.lang.ExceptionInInitializerError
at org.logicng.io.parsers.PseudoBooleanParser.(PseudoBooleanParser.java:74)
at org.logicng.formulas.FormulaFactory.(FormulaFactory.java:139)
at org.logicng.formulas.FormulaFactory.(FormulaFactory.java:157)
at org.matheclipse.core.builtin.BooleanFunctions$BooleanMinimize.evaluate(BooleanFunctions.java:591)
at org.matheclipse.core.eval.EvalEngine.evalASTBuiltinFunction(EvalEngine.java:638)
at org.matheclipse.core.eval.EvalEngine.evalRules(EvalEngine.java:1092)
at org.matheclipse.core.eval.EvalEngine.evalAST(EvalEngine.java:510)
at org.matheclipse.core.expression.AbstractAST.evaluate(AbstractAST.java:643)
at org.matheclipse.core.eval.EvalEngine.evalLoop(EvalEngine.java:937)
at org.matheclipse.core.eval.EvalEngine.evalWithoutNumericReset(EvalEngine.java:1423)
at org.matheclipse.core.eval.EvalEngine.evaluate(EvalEngine.java:1355)
at org.matheclipse.core.eval.ExprEvaluator.eval(ExprEvaluator.java:362)
at org.matheclipse.core.eval.ExprEvaluator.eval(ExprEvaluator.java:405)
at com.example.symjacalculator.CalculateService.onCreate(CalculateService.java:374)
at android.app.Activity.performCreate(Activity.java:6942)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1126)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2880)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2988)
at android.app.ActivityThread.-wrap14(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1631)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6682)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1534)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1424)
Caused by: java.lang.UnsupportedOperationException: java.io.InvalidClassException: org.antlr.v4.runtime.atn.ATN; Could not deserialize ATN with UUID 59627784-3be5-417a-b9eb-8131a7286089 (expected aadb8d7e-aeef-4415-ad2b-8204d6cf042e or a legacy UUID).
at org.antlr.v4.runtime.atn.ATNDeserializer.deserialize(ATNDeserializer.java:129)
at org.logicng.io.parsers.LogicNGPseudoBooleanLexer.(LogicNGPseudoBooleanLexer.java:136)
at org.logicng.io.parsers.PseudoBooleanParser.(PseudoBooleanParser.java:74) 
at org.logicng.formulas.FormulaFactory.(FormulaFactory.java:139) 
at org.logicng.formulas.FormulaFactory.(FormulaFactory.java:157) 
at org.matheclipse.core.builtin.BooleanFunctions$BooleanMinimize.evaluate(BooleanFunctions.java:591) 
at org.matheclipse.core.eval.EvalEngine.evalASTBuiltinFunction(EvalEngine.java:638) 
at org.matheclipse.core.eval.EvalEngine.evalRules(EvalEngine.java:1092) 
at org.matheclipse.core.eval.EvalEngine.evalAST(EvalEngine.java:510) 
at org.matheclipse.core.expression.AbstractAST.evaluate(AbstractAST.java:643) 
at org.matheclipse.core.eval.EvalEngine.evalLoop(EvalEngine.java:937) 
at org.matheclipse.core.eval.EvalEngine.evalWithoutNumericReset(EvalEngine.java:1423) 
at org.matheclipse.core.eval.EvalEngine.evaluate(EvalEngine.java:1355) 
at org.matheclipse.core.eval.ExprEvaluator.eval(ExprEvaluator.java:362) 
at org.matheclipse.core.eval.ExprEvaluator.eval(ExprEvaluator.java:405) 
at com.example.symjacalculator.CalculateService.onCreate(CalculateService.java:374) 
at android.app.Activity.performCreate(Activity.java:6942) 
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1126) 
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2880) 
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2988) 
at android.app.ActivityThread.-wrap14(ActivityThread.java) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1631) 
at android.os.Handler.dispatchMessage(Handler.java:102) 
at android.os.Looper.loop(Looper.java:154) 
at android.app.ActivityThread.main(ActivityThread.java:6682) 
at java.lang.reflect.Method.invoke(Native Method) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1534) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1424) 
Caused by: java.io.InvalidClassException: org.antlr.v4.runtime.atn.ATN; Could not deserialize ATN with UUID 59627784-3be5-417a-b9eb-8131a7286089 (expected aadb8d7e-aeef-4415-ad2b-8204d6cf042e or a legacy UUID).
at org.antlr.v4.runtime.atn.ATNDeserializer.deserialize(ATNDeserializer.java:129) 
at org.logicng.io.parsers.LogicNGPseudoBooleanLexer.(LogicNGPseudoBooleanLexer.java:136) 
at org.logicng.io.parsers.PseudoBooleanParser.(PseudoBooleanParser.java:74) 
at org.logicng.formulas.FormulaFactory.(FormulaFactory.java:139) 
at org.logicng.formulas.FormulaFactory.(FormulaFactory.java:157) 
at org.matheclipse.core.builtin.BooleanFunctions$BooleanMinimize.evaluate(BooleanFunctions.java:591) 
at org.matheclipse.core.eval.EvalEngine.evalASTBuiltinFunction(EvalEngine.java:638) 
at org.matheclipse.core.eval.EvalEngine.evalRules(EvalEngine.java:1092) 
at org.matheclipse.core.eval.EvalEngine.evalAST(EvalEngine.java:510) 
at org.matheclipse.core.expression.AbstractAST.evaluate(AbstractAST.java:643) 
at org.matheclipse.core.eval.EvalEngine.evalLoop(EvalEngine.java:937) 
at org.matheclipse.core.eval.EvalEngine.evalWithoutNumericReset(EvalEngine.java:1423) 
at org.matheclipse.core.eval.EvalEngine.evaluate(EvalEngine.java:1355) 
at org.matheclipse.core.eval.ExprEvaluator.eval(ExprEvaluator.java:362) 
at org.matheclipse.core.eval.ExprEvaluator.eval(ExprEvaluator.java:405) 
at com.example.symjacalculator.CalculateService.onCreate(CalculateService.java:374) 
at android.app.Activity.performCreate(Activity.java:6942) 
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1126) 
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2880) 
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2988) 
at android.app.ActivityThread.-wrap14(ActivityThread.java) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1631) 
at android.os.Handler.dispatchMessage(Handler.java:102) 
at android.os.Looper.loop(Looper.java:154) 
at android.app.ActivityThread.main(ActivityThread.java:6682) 
at java.lang.reflect.Method.invoke(Native Method) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1534) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1424) 

axkr commented

Different versions of ANTLR use different serialized ATN representations, so the version used for generating the code must be the same as the one running it.

Do you have versions:

antlr4-runtime-4.7.jar
logicng-1.4.0

installed in the classpath?