Change of the toString implementation for annotations

Rafael Winterhalter rafael.wth at
Tue Jul 19 00:43:20 UTC 2016

I recognized a failing test on Java 9 caused by a changed return value
returned by toString on an annotation with a class-property.

When calling toString on an annotation: @interface Foo { Class<?> value();
} instantiated as @Foo(Bar.class) with Java 8 it would be printed as:

@Foo(class Bar)

while in Java 9 it is printed as:


Is this change intended? I do not see a big benefit of this implementation
change and it could break code. In my case, the problem is not that big, it
is an easy fix but still, I found it a bit surprising.

Thank you.
Best regards, Rafael

More information about the core-libs-dev mailing list