Hi
I'm having trouble with the returned list of a java service.
When i try to use the list i get always this message error:
org.eclipse.acceleo.engine.AcceleoEvaluationException: Invalid result for expression self.invoke('org.eclipse.acceleo.module.sample.services.Service', 'getAList(java.lang.String)', Sequence {arg0}) at line 13 in Module service for query getAList(String).
This is the java file.
public List <String> getAList(String s){
Class clazz = Class.forName(s);
Method[] publicMethods= clazz.getDeclaredMethods();
List<String> list=new ArrayList<>();
List<String> list2=new ArrayList<>();
for (Method met : publicMethods){
Class[] parameter= met.getParameterTypes();
for(Class parameter1: parameter){
list2.add(parameter1.getName());
}
list.add(met.getName() +"(" + list2 + ")");
list2.clear();
}
return list;
}
Then the query in the mtl file.
[query public getAList(arg0 : String) : Sequence(OclAny)
= invoke('org.eclipse.acceleo.module.sample.services.Service', 'getAList(java.lang.String)', Sequence{arg0})
/]
And this is where i try to use the java service.
[let a: Sequence (String) = getAList(var) ]
[a/]
[/let]
Anyone can help me understand what is wrong? Does acceleo have a problem with java reflection?
[Updated on: Tue, 02 October 2018 11:44]
Report message to a moderator