| Summary: | Calling java methods fails when multiple parameters are given | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| Product: | [Modeling] Acceleo | Reporter: | heppg | ||||||||
| Component: | Core | Assignee: | Project Inbox <acceleo-inbox> | ||||||||
| Status: | CLOSED FIXED | QA Contact: | |||||||||
| Severity: | normal | ||||||||||
| Priority: | P3 | CC: | laurent.goubet | ||||||||
| Version: | 3.0.0 | Keywords: | contributed | ||||||||
| Target Milestone: | --- | ||||||||||
| Hardware: | PC | ||||||||||
| OS: | Windows XP | ||||||||||
| Whiteboard: | |||||||||||
| Attachments: |
|
||||||||||
Created attachment 173390 [details]
stack trace
Hi,
This closely resembles a known issue with multiple parameters calls. Namely, you cannot use
[type.getStereotypeValue('native','schema')/]
but should use
[getStereotypeValue(type, 'native','schema')/]
instead.
We are trying to narrow down and fix this issue. Could you confirm that this change fixes the issue for your case too?
...
> Namely, you cannot use
> [type.getStereotypeValue('native','schema')/]
> but should use
> [getStereotypeValue(type, 'native','schema')/]
> ..
> Could you confirm that this change fixes the issue for your
> case too?
I checked this, but I get this Exception too. So both
[type.getStereotypeValue('native','schema')/]
[getStereotypeValue(type, 'native','schema')/]
produce the same error message.
Thanks for the verification ... which means this indeed is a separate issue :'(. Hi i have also the same problem there is a bug in org.eclipse.acceleo.engine.internal.environment.AcceleoLibraryOperationVisitor. In indexOf method the character to find and the offset were inverted. With this inevrsion the list of arguments are not correctly parsed I spent a little time to understand why indexOf returned -1 ^^ I send you the patch Created attachment 175847 [details]
mylyn/context/zip
this is the patch fixing the problem
Created attachment 175849 [details]
the correct patch
sorry this is the patch
Thanks Tristan! This has been committed on HEAD, and will soon be committed on the 3.0 maintenance branch. Looking at the code I wrote (and which you patched), I believe I was a little sleepy that day :p. I should set up my Eclipse to forbid me from relying on autoboxing ^^. |
Build Identifier: acceleo 3.0.0 acceleo 3.0.0 When calling java-Methods with multiple parameters, the call fails with Exception org.eclipse.acceleo.engine.AcceleoEvaluationException: Undefined result for expression ... see stack trace In mtl, the call is [type.getStereotypeValue('native','schema')/] The query definition is [query private getStereotypeValue(arg0 : Element, arg1 : String, arg2 : String) : String = invoke('org.acceleo.modules.uml2.services.Uml2ServicesX', 'getStereotypeValue(org.eclipse.uml2.uml.Element, java.lang.String, java.lang.String)', Sequence{arg0, arg1, arg2}) /] The java-code signature is public String getStereotypeValue(org.eclipse.uml2.uml.Element elt, String stereotype, String property) throws Exception{ ... } The java-method is not called. In order to validate the setup, a modified java-method was created which does not need the two Strings as arguments: public String getStereotypeValueNS(Element elt) throws Exception { log("getStereotypeValueNSN"); return getStereotypeValue(elt, "native", "schema"); } The query for this is: [query private getStereotypeValueNS(arg0 : Element) : String = invoke('org.acceleo.modules.uml2.services.Uml2ServicesX', 'getStereotypeValueNS(org.eclipse.uml2.uml.Element)', Sequence{arg0}) /] This modified method/query returns the correct results --> java code is correct. Reproducible: Always Steps to Reproduce: 1. create mtl-file and java-code 2. run mtl directly or run java-code produced from mtl.