spoon
spoon copied to clipboard
class objects as annotation parameters are not correctly pretty-printed
@Foo(value=Bar.class) is rewritten @Foo(value=Bar)
Hi @maxcleme,
With 5.1.0-SNAPSHOT and with this class:
public class Foo {
@Bar(value = Foo.class)
public void m() {
}
}
The Spoon output is:
public class Foo {
@spoon.test.annotation.testclasses2.Bar(value = spoon.test.annotation.testclasses2.Foo.class)
public void m() {
}
}
- Which version of Spoon do you use?
- Can you give us more context?
Thanks.
Hi @GerardPaligot
When I'm running this code with the 5.0.1 version :
getFactory().Annotation().annotate(parentTestClass, RunWith.class, "value", _CollectorRunner.class)
The output is :
@RunWith(value = _CollectorRunner)
Obviously, it doesn't compile. ( the .class is missing )
Ok, I see the issue. Before Spoon 5, a class access was a CtFieldRead and now, it is a CtTypeAccess. Factories haven't been updated. PR soon.