I did small research. Attached is small test. It shows interesting results for me.
If I compare best with worst case I found 13ms difference for calling simple/empty method 10 million times.
Aren't we really solving non-existing problem? I would really like hear you thought about this. For me what we are generating is overcomplicated but till it's working, I'm fine with it.
However I'm still not very happy with next-Xxx methods. After applying annotation on e.g. Properties, try to press CTRL+SPACE in some template using static import of Properties.
My detection of 'dispatch' method is simple. I remember all _Xxx and check if here is also Xxx method with same signature.
protected static def getOverrideableMethods(MutableClassDeclaration annotatedClass) {
val noTransform = annotatedClass.declaredMethods.filter[m | m.simpleName.startsWith("_")].map[m | m.simpleName.substring(1)].toSet
annotatedClass.declaredMethods.filter[m | m.static == false &&
(m.visibility == Visibility::PUBLIC && !noTransform.exists[it == m.simpleName])
|| (m.visibility == Visibility::PROTECTED && noTransform.exists["_" + it == m.simpleName])
].toList
}
Regards
Pavel