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

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

Closed
f-ishikawa opened this issue May 26, 2020 · 2 comments
Closed

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

f-ishikawa opened this issue May 26, 2020 · 2 comments
Labels
bug Incorrect behaviour of the tool language Issues in parser, TC, interpreter, POG or CG Mergable A fix is available on a branch to merge for release
Milestone

Comments

@f-ishikawa
Copy link

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

@nickbattle nickbattle added bug Incorrect behaviour of the tool language Issues in parser, TC, interpreter, POG or CG labels May 26, 2020
@nickbattle
Copy link
Contributor

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.

@nickbattle nickbattle added the Mergable A fix is available on a branch to merge for release label May 26, 2020
@nickbattle
Copy link
Contributor

Fix now available in ncb/development.

@idhugoid idhugoid added this to the v3.0.0 milestone Aug 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Incorrect behaviour of the tool language Issues in parser, TC, interpreter, POG or CG Mergable A fix is available on a branch to merge for release
Projects
None yet
Development

No branches or pull requests

3 participants