eclipse-gemoc / eclipse-gemoc/gemoc-studio-execution-ale

Pb with support for @init method with multiple arguments

Open
#17 1 comment 0 reactions 0 assignees View on GitHub
bug
Dominant language
Java
Stars
0
Forks
7
PR merge metrics
No merged PRs in 30d

Description

In Java execution engine, the launcher can use an initModel method using either a single String or a List<String>, the launcher then use the carriage return as a separator in order to provide a list of strings to the init method.

In ALE (which reuse a lot of the Java engine launcher) the tooltip on the "Model Initialization arguments" field also indicates "one line per argument" but trying to have a method
```
@init
def void initializeModel(Sequence(String) input) {
('hello from initializeModel').log();
('input='+input+' - '+input.eClass()+' - ').log();
for(inp in input){
('input line='+inp).log();
}
/// more stuff
}
```
fails with a
```
hello from initializeModel
input=aa bb cc - -
java.lang.ClassCastException: java.lang.String cannot be cast to java.util.Collection
at org.eclipse.emf.ecoretools.ale.core.interpreter.MethodEvaluator.caseForEach(MethodEvaluator.java:306)
at org.eclipse.emf.ecoretools.ale.implementation.util.ImplementationSwitch.doSwitch(ImplementationSwitch.java:225)
at org.eclipse.emf.ecore.util.Switch.doSwitch(Switch.java:53)
at org.eclipse.emf.ecore.util.Switch.doSwitch(Switch.java:69)
at org.eclipse.emf.ecoretools.ale.core.interpreter.MethodEvaluator.lambda$0(MethodEvaluator.java:116)
at java.util.Iterator.forEachRemaining(Iterator.java:116)
at java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1801)
at java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:580)
at org.eclipse.emf.ecoretools.ale.core.interpreter.MethodEvaluator.caseBlock(MethodEvaluator.java:116)
at org.eclipse.emf.ecoretools.ale.implementation.util.ImplementationSwitch.doSwitch(ImplementationSwitch.java:143)
at org.eclipse.emf.ecore.util.Switch.doSwitch(Switch.java:53)
at org.eclipse.emf.ecore.util.Switch.doSwitch(Switch.java:69)
at org.eclipse.emf.ecoretools.ale.core.interpreter.MethodEvaluator.eval(MethodEvaluator.java:91)
at org.eclipse.emf.ecoretools.ale.core.interpreter.ALEEngine.eval(ALEEngine.java:30)
at org.eclipse.emf.ecoretools.ale.ALEInterpreter.doEval(ALEInterpreter.java:299)
at org.eclipse.emf.ecoretools.ale.ALEInterpreter.eval(ALEInterpreter.java:234)
at org.eclipse.gemoc.ale.interpreted.engine.AleEngine.initializeModel(AleEngine.java:144)
```

also notice that in the message, the input.eClass() does not print any information about the current type of the argument "input" (probably another bug ?)

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.