Annotations - Fix class annotation detection

findClosest/FarthestClass didn't support inherited annotations
correctly.
This commit is contained in:
Emmanuel BENOîT 2015-09-12 14:08:21 +02:00
parent 722f071674
commit 4366b4198d

View file

@ -162,7 +162,7 @@ public final class Annotations
{
Class< ? super T > current = klass;
while ( current != null ) {
if ( current.isAnnotationPresent( annotation ) ) {
if ( current.getDeclaredAnnotation( annotation ) != null ) {
return current;
}
current = current.getSuperclass( );
@ -189,7 +189,7 @@ public final class Annotations
{
Class< ? super T > found = null , current = klass;
while ( current != null ) {
if ( current.isAnnotationPresent( annotation ) ) {
if ( current.getDeclaredAnnotation( annotation ) != null ) {
found = current;
}
current = current.getSuperclass( );