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

Pb with support for @init method with multiple arguments #17

Open
dvojtise opened this issue Jun 13, 2019 · 1 comment
Open

Pb with support for @init method with multiple arguments #17

dvojtise opened this issue Jun 13, 2019 · 1 comment
Labels
bug Something isn't working

Comments

@dvojtise
Copy link
Contributor

dvojtise commented Jun 13, 2019

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 ?)

@dvojtise dvojtise added the bug Something isn't working label Jun 13, 2019
@dvojtise
Copy link
Contributor Author

(for the above trace, the arguments passed in the launcher dialog were:

aa bb cc
dd ee ff
gg hh ii

)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant