Community
Participate
Working Groups
In this Xtend-based example, Xbase allows the following package foo class X { def void foo() { val x = super } } but that compiles to this Java code that in turn doesn't actually compile: package foo; @SuppressWarnings("all") public class X { public void foo() { final Object x = super; } } There needs to be some constraint defined that super is only allowed in the context of a feature call. I'm not sure if such a constraint can be defined in Xbase, but Xtend and Xcore should not consider something valid if it won't compile to valid Java code.
Note that I think the handling of super is also problematic in the interpreter. Specifically XbaseInterpreter.invokeOperation(JvmOperation, Object, List<Object>) does not know if it must just invoke the method, or must invoke it on super. I suppose the interpretation of "super" itself needs to return some special object that's handled by this method. Any thoughts on how that should work? I suppose you can't really test calls via "super" in Xbase itself...
Yes, interpreting in the context of a certain instance is problematic. Also visibilities etc. are different. But we should add a validation for the problem in comment #0.