-
Notifications
You must be signed in to change notification settings - Fork 24
NotSerializableException when saving a type checked specification through the bundled version of VDMJ #785
Description
Description
Our Gradle plugin leverages the Overture engine to programmatically animate a specification. As part of the process, it saves a copy of parsed and type checked specifications using the -o argument of the VDMJ class:
overture/core/interpreter/src/main/java/org/overture/interpreter/VDMJ.java
Lines 146 to 159 in 8e73876
| } else if (arg.equals("-o")) | |
| { | |
| if (i.hasNext()) | |
| { | |
| if (outfile != null) | |
| { | |
| usage("Only one -o option allowed"); | |
| } | |
| outfile = i.next(); | |
| } else | |
| { | |
| usage("-o option requires a filename"); | |
| } |
However, certain specifications parse and type check correctly, but raise a "cannot write" error due to a NotSerializableException on org.overture.typechecker.assistant.TypeCheckerAssistantFactory.
Steps to Reproduce
- Download an unpack the attached test.tar.gz
- Run VDMJ on the
Test.vdmslspecification file, using the-ooption. For example, assuming Overture was downloaded to Maven Local:
$ java -cp /Users/alessandro.pezzoni/.m2/repository/org/overturetool/core/interpreter/3.0.2/interpreter-3.0.2.jar:/Users/alessandro.pezzoni/.m2/repository/org/overturetool/core/typechecker/3.0.2/typechecker-3.0.2.jar:/Users/alessandro.pezzoni/.m2/repository/org/overturetool/core/ast/3.0.2/ast-3.0.2.jar:/Users/alessandro.pezzoni/.m2/repository/org/overturetool/core/parser/3.0.2/parser-3.0.2.jar org.overture.interpreter.VDMJ -vdmsl -o test.lib Test.vdmsl
Expected behavior: The specification is parsed, type checked, and saved into the file test.lib.
Actual behavior: The specification is parsed and type checked correctly, but saving fails.
Parsed 1 module in 0.06 secs. No syntax errors
Warning 5000: Definition 'TestAdd' not used in 'Test' (Test.vdmsl) at line 12:3
Type checked 1 module in 0.054 secs. No type errors and 1 warning
Cannot write test.lib: org.overture.typechecker.assistant.TypeCheckerAssistantFactory
Reproduces how often: Always.
Versions
Overture version 3.0.2, OpenJDK version 17.0.2 (also tested with version 11), MacOS Monterey version 12.2.1.
Additional Information
The expected behaviour is observed with Overture version 2.6.4.
Interestingly, the -o option was removed from VDMJ itself: nickbattle/vdmj#59