From 4366b4198d0b241c08968d63ffca03b03870d9ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emmanuel=20Beno=C3=AEt?= Date: Sat, 12 Sep 2015 14:08:21 +0200 Subject: [PATCH] Annotations - Fix class annotation detection findClosest/FarthestClass didn't support inherited annotations correctly. --- src/main/java/info/ebenoit/ebul/reflection/Annotations.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/info/ebenoit/ebul/reflection/Annotations.java b/src/main/java/info/ebenoit/ebul/reflection/Annotations.java index f1d28cc..8418ef2 100644 --- a/src/main/java/info/ebenoit/ebul/reflection/Annotations.java +++ b/src/main/java/info/ebenoit/ebul/reflection/Annotations.java @@ -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( );