typetools/annotation-tools

Inserting using ASTPaths on missing class extends bound puts the annotation on the declaration

Closed this issue · 0 comments

If a class is missing an extends bound, e.g.
class MyClass

then any annotations inserted on the extends bound via AST Paths are place as declaration annotations. E.g.,
@MyAnno class MyClass

If a class has an extends bound, e.g.,
class MyClass extends Object

then any annotations inserted on the extends bound apply to the bound, e.g.,
class MyClass extends @MyAnno Object

I believe the first example is wrong; the annotation should be placed on a newly created extends bound.
See the following Gist for test files:
https://gist.github.com/JonathanBurke/008727a98c9e35887890