JDK 8 RFR for JDK-7185456 : (ann) Optimize Annotation handling in java/sun.reflect.* code for small number of annotationsC

Joel Borggrén-Franck joel.franck at oracle.com
Wed Mar 27 13:00:58 UTC 2013


Hi Peter,

On 03/27/2013 01:31 PM, Peter Levart wrote:

> I also don't know
> whether having LinkedHashMap instead of plain HashMap is necessary, since it
> is initialized with defaults from plain HashMap (which is hashCode %
> capacity ordered) and only some of defaults are overridden in parsing loop
> in general. For example, having this annotation:
>
> @interface Ann {
>      String one();
>      String two() default "2";
> }
>
> and usage:
>
> @Ann(one = "1")
>
> ...toString will print: @Ann(two = "2", one = "1")
>

While there perhaps is no natural ordering between the sets of default 
elements and non-default elements you probably want an order following 
source as closely as possible among the non-default elements.

cheers
/Joel



More information about the core-libs-dev mailing list