I have an issue when I want to include anonymous class definition in my DSL.
When I wrote the following code, it is compiling:
class XXX {
protected def setMouseTargetOnScreen(obj : Object) : void {
}
new {
new MouseMotionListener {
override mouseDragged(e : MouseEvent) {
}
override mouseMoved(e : MouseEvent) {
XXX.this.setMouseTargetOnScreen(new Object)
}
}
}
}
When I move the function definition after the constructor definition, I obtain the error "The method setMouseTargetOnScreen() is undefined in type XXX".
class XXX {
new {
new MouseMotionListener {
override mouseDragged(e : MouseEvent) {
}
override mouseMoved(e : MouseEvent) {
XXX.this.setMouseTargetOnScreen(new Object)
}
}
}
protected def setMouseTargetOnScreen(obj : Object) : void {
}
}
Is something encountered this issue, or give me a starting point for debugging?
My DSL override a part of Xtend.
I have defined my grammar here.
The JVM model inferrer is defined here.
The reentrant type resolver is defined here.