overturetool/overture

"Illegal clone" "Main 206: Error evaluating code" error

f-ishikawa opened this issue · 2 comments

Description

The following error occurs during execution of the interpreter.

Illegal clone: java.io.NotSerializableException: org.overture.ast.lex.LexComment

Main 206: Error evaluating code
Detailed Message: Illegal clone: java.io.NotSerializableException: org.overture.ast.lex.LexComment

Steps to Reproduce

Run Test.test() in the attached model.
Hope it is ok it includes JP characters in the comments (encoding: MS932).

Roughly speaking, the structure is something like what follows.

Test

IO`println("here1");
r := someobj.methodCall(...);
IO`println("here2");
r := someobj.methodCall(...); -- The error occurs before this call (before check of precond violation)
IO`println("here3"); -- This is not displayed

It seems that the error occurs before the second invocation of methodCall because println at the beginning of methodCall is not executed. Also, if I make the second call of methodCall violates the precondition, it is not checked (the error occurs before the precondition check of the second call).

The class of someobj consistes of data structure of maps and uses inheritance

  • map token to SomeClass
  • map token to (map int to token)

I could not replay with a simple model built from scratch.

Versions

This occurred with 2.7.0, 2.7.2, and 2.7.4. The model worked with 2.6.4.
IllegalCloneModel.zip

Thank you for reporting, Fuyuki-san :) I was able to reproduce the problem.

It was a missing Serializable interface in one of the new classes that was added in 2.7.0, called LexComment, part of the annotation feature. The same problem does not occur in VDMJ because it has a slightly different class structure with a Serializable parent.

The problem will occur when you have object values that are involved in "old" clauses within postconditions, like reservations~. This has to clone the original object value, and the cloning process comes across the missing Serialization if the object concerned has any comments.

I'll push the fix now.

Fix now available in ncb/development.