Skip to content

CIF code generator crashes on certain models with multiple initial locations (Java/C/JavaScript)

When running the (Java) export feature on a CIF file (right-click -> CIF implementation tools -> Generate code for CIF specification), some features/syntax result in a crash:

Code (from merged CIF file, have changed names):

automaton a:
  alg bool x = true;
  location loc1:
    initial x;
  location loc2:
    initial not x;
end

Exception:

[Exception]
java.lang.AssertionError
	at org.eclipse.escet.common.java.Assert.check(Assert.java:38)
	at org.eclipse.escet.cif.codegen.java.JavaCodeGen.addStateVars(JavaCodeGen.java:188)
	at org.eclipse.escet.cif.codegen.CodeGen.generate(CodeGen.java:777)
	at org.eclipse.escet.cif.codegen.CodeGen.generate(CodeGen.java:397)
	at org.eclipse.escet.cif.codegen.CodeGenApp.runInternal(CodeGenApp.java:96)
	at org.eclipse.escet.common.app.framework.Application.run(Application.java:343)
	at org.eclipse.escet.common.app.framework.Application.run(Application.java:183)
	at org.eclipse.escet.common.eclipse.ui.BaseFileCommandHandler.run(BaseFileCommandHandler.java:261)
	at org.eclipse.escet.common.eclipse.ui.BaseFileCommandHandler$1.run(BaseFileCommandHandler.java:102)
	at java.base/java.lang.Thread.run(Thread.java:833)

Apparently the multiple "initial" tags are causing the issue, which were generated when merging CIF files via ToolDef.

EDIT: Switched to multi-line code blocks (triple back-ticks at the line before and after the code).
EDIT: Simpler example model.

Edited by Dennis Hendriks