I'm migrating from Xtext 2.6.x to 2.7.3 and I stumbled over a sporadic compile error in some Xtend code.
The minimal example requires two files:
package xxx
abstract class Base{
Child childExtension
def protected dispatch Boolean foo(Object it){
null
}
def protected dispatch Boolean foo(Integer it){
val Boolean x = childExtension.foo(it) // required for bug
x
}
}
and the other file:
package xxx
class Child extends Base {
def protected dispatch Boolean foo(String it){
val x = foo(null) // first occurrence always OK
x
}
def protected dispatch Boolean foo(StringBuilder it){
val x = foo(null) // second and following occurrences fail, but are marked only sometimes
// Ambiguous feature call. The methods foo(Object) in Child and foo(Object) in Base both match.
x
}
}
The strange parts are:
- The compiler thinks that the two generated dispatch methods in Base and Child are in conflict. But only in this specific situation.
- The delegation call in Base is required for the error.
- The first call to the method is not marked as an error.
- Touching the file (SAPCE-BACKSPACE-SAVE) removes the error from the editor but not from the Problems View. Closing and reopening the editor shows the error again.
- Building with Maven sometimes show the error, sometimes not.
So my questions are:
- Is there a workaround?
- Should I file a bug?
- Is there a chance that this is solved before 2.8? (i.e. will there be a version 2.7.4)
Regards,
Andreas