RFR: 8029019: (ann) Optimize annotation handling in core reflection

Claes Redestad claes.redestad at oracle.com
Mon Oct 16 18:26:48 UTC 2017

Hi Peter,

On 2017-10-13 12:05, Peter Levart wrote:
>> Forgive me the maybe stupid question, but isn't your proposed code 
>> changing semantics because it doesn't check for the first parameter 
>> in equals() to be of type java.lang.Object anymore? E.g. like 
>> "method.getParameterTypes()[0] == Object.class". Am I missing 
>> something? Personally, I find this a bit too "magic" overall. I don't 
>> know what Claes thinks about that.
> There's only one method named "equals" declared in either Object or 
> Annotation (currently :-). So it's enough to check for declaringClass 
> and name to identify the correct method.

I'm somewhat strapped for cycles right now, so do you mind if I move 
ahead with the simpler patch Christoph proposed initially (and which 
Joel has already reviewed)?

I filed https://bugs.openjdk.java.net/browse/JDK-8189266 for this 
purpose, but feel free to assign this task to yourself if you want to 
work with Christoph to sponsor an improved version.

Looking back at the history of JDK-8029019 I personally prefer adding a 
way to get non-copying access to the Method parameter array rather than 
the declaringClass origin checking.



More information about the core-libs-dev mailing list