[9] RFR: 8168921: Inconsistent Annotation.toString()

Ivan Gerasimov ivan.gerasimov at oracle.com
Sun Oct 30 01:42:13 UTC 2016


Suppose an annotation is of form

     @interface MyAnnotation {
         long value();

Create the annotation object with 
Map.of("value", some_value)).

Annotation.toString() method, called for the object, will produce a 
string containing that 'some_value' with the optional 'L' suffix appended.
Normally, the suffix is not appended for values that can be represented 
with int, and is appended otherwise.
However, the logic does not hold for values Long.MIN_VALUE and 
Integer.MIN_VALUE:  For the former the suffix is not appended and for 
the later the suffix L is appended.

Would you please help review the fix, which removes this tiny inconsistency?

BUGURL: https://bugs.openjdk.java.net/browse/JDK-8168921
WEBREV: http://cr.openjdk.java.net/~igerasim/8168921/00/webrev/

I also took a chance to perform some pico-optimizations around the 
modified code.

With kind regards,

More information about the core-libs-dev mailing list