Closed mypsycho closed 2 years ago
Following patch in ssh://user@git.eclipse.org:29418/acceleo/org.eclipse.acceleo.git seems to be enough.
diff --git a/query/plugins/org.eclipse.acceleo.query/src/org/eclipse/acceleo/query/runtime/impl/JavaMethodService.java b/query/plugins/org.eclipse.acceleo.query/src/org/eclipse/acceleo/query/runtime/impl/JavaMethodService.java
index 460ecdd..72f5d2b 100644
--- a/query/plugins/org.eclipse.acceleo.query/src/org/eclipse/acceleo/query/runtime/impl/JavaMethodService.java
+++ b/query/plugins/org.eclipse.acceleo.query/src/org/eclipse/acceleo/query/runtime/impl/JavaMethodService.java
@@ -262,7 +262,7 @@
Class<?> cls;
final IType iType = argumentTypes[i];
if (iType instanceof EClassifierLiteralType) {
- cls = EClass.class;
+ cls = ((EClassifierLiteralType)iType).getType().getInstanceClass();
} else if (iType instanceof EClassifierType) {
cls = queryEnvironment.getEPackageProvider().getClass(((EClassifierType)iType).getType());
if (cls == null) {
Thank you for reporting this issue. The fix seems a bit odd... This part of the code is used when providing an EClass to a service via pkg::EClass
so the type of the element passed here is an EClass. Maybe something is missing in the initialization of the AQL interperter when evaluating a template construct...
I'm submitting a...
Current behavior
Template Construct does not support the use of service provided by IServicesConfigurator. Validation fails when invocation is template construct. On the other side, validation does not fail when used in the body of the document.
Error is due to org.eclipse.acceleo.query.runtime.impl.JavaMethodService#matches(IReadOnlyQueryEnvironment, IType[]) When iType instanceof EClassifierLiteralType, 'cls' has a wrong value.
Expected behavior
In such case, validation should not fail and generation should be allowed.
Minimal reproduction of the problem with instructions
What is the motivation / use case for changing the behavior?
When a metamodel has inheritance, template construct is needed.
Environment