Skip to content

NotSerializableException when saving a type checked specification through the bundled version of VDMJ #785

@donbex

Description

@donbex

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:

} 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

  1. Download an unpack the attached test.tar.gz
  2. Run VDMJ on the Test.vdmsl specification file, using the -o option. 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

Metadata

Metadata

Assignees

Labels

MergableA fix is available on a branch to merge for releasebugIncorrect behaviour of the toollanguageIssues in parser, TC, interpreter, POG or CG

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions