Community
Participate
Working Groups
When trying to call a regular method defined in the same class (or superclass) which receives a varargs of the same class, then xtend includes the "this" (target object) both, as real target of the method, but also as first parameter within the varargs. So it treats it as an extension method. It's actually easier to explain in code :) Here's a sample code: class AClass { def doSomething(AClass... otherInstance) { print("blah") } def doSomeOtherThingWith(AClass other) { this.doSomething(other) } } What's important here is that in the "doSomeOtherThingWith" we will like to call ourselves the doSomething() just passing the "other" instance as a single parameter to "doSomething". The problem arises because xtend thinks that we are trying to it as an extension methods, and generates this: String _doSomething = this.doSomething(this, other); I know using varargs is not always a good idea, but in this case the real problem (this is just a simplified version) comes using Apache Wicket's "add(Component...)" method which unfortunately I cannot change. Also I would think that any non-static method defined in the same class or superclass would be more like a regular method, unless specified somehow as extension method. I think that I've faced a similar issue in some other case without a vararg, but I cannot reproduce it anymore :(
Thanks for the repro. I pushed the fix to review. It'll be available in the next nightly build and the next release respectively.
Requested via bug 522520. -M.