JDK 8 RFR: 8009267: Restore isAnnotationPresent methods in public AnnotatedElement implementations

Joe Darcy joe.darcy at oracle.com
Mon Mar 4 16:15:59 UTC 2013


On 03/02/2013 02:34 PM, Uwe Schindler wrote:
> Looks good to me!
> Are this the only methods in the corelib that were removed in favour of a default implementation in the interface?

I would not described the method as "removed," but to my knowledge 
AnnotatedElement.isAnnotationPresent was the only existing interface 
method in the core libraries replaced by a default method. The intended 
use case for default methods is adding new methods to interface and that 
change has certainly been done in other parts of the API.

Cheers,

-Joe

>
> Uwe
>
> -----
> Uwe Schindler
> uschindler at apache.org
> Apache Lucene PMC Member / Committer
> Bremen, Germany
> http://lucene.apache.org/
>
>> -----Original Message-----
>> From: Joe Darcy [mailto:joe.darcy at oracle.com]
>> Sent: Saturday, March 02, 2013 3:06 AM
>> To: Core-Libs-Dev
>> Cc: Jonathan Gibbons; Alexander Buckley; Maurizio Cimadamore;
>> uschindler at apache.org
>> Subject: JDK 8 RFR: 8009267: Restore isAnnotationPresent methods in public
>> AnnotatedElement implementations
>>
>> Hello,
>>
>> The changes pushed under
>>
>>       8007113: Upgrade AnnotatedElement.isAnnotionPresent to be a default
>> method
>>       http://hg.openjdk.java.net/jdk8/tl/jdk/rev/e04467fa13af
>>
>> combined with how javac currently models default methods under pre-JDK-8
>> source versions can result in some source compatibility impacts for those
>> using JDK 8 to compile under older source versions if the recommended
>> practice of setting the bootclasspath is not followed. [1]
>>
>> To mitigate these impacts, I'm proposing the changes in
>>
>>       8009267: Restore isAnnotationPresent methods in public
>> AnnotatedElement implementations
>>       http://cr.openjdk.java.net/~darcy/8009267.1/
>>
>> which have the effect of restoring a concrete isAnnotationPresent method
>> to Class, Package, Field, Method, and Constructor. The implementation
>> delegates to the default method on the AnnotatedElement interface.
>>
>> Thanks,
>>
>> -Joe
>>
>> [1]
>> http://mail.openjdk.java.net/pipermail/compiler-dev/2013-
>> February/005738.html




More information about the core-libs-dev mailing list