Skip to content

Commit da62bc3

Browse files
committed
#36 - Fix bug in AnnotationTargetSupport#locateAnnotationUsage
1 parent da57465 commit da62bc3

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

src/main/java/org/hibernate/models/internal/AnnotationTargetSupport.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -66,17 +66,16 @@ default <A extends Annotation> AnnotationUsage<A> getAnnotationUsage(Class<A> an
6666
@Override
6767
default <A extends Annotation> AnnotationUsage<A> locateAnnotationUsage(Class<A> annotationType) {
6868
// e.g., locate `@Nationalized`
69-
// 1. direct - look for `Nationalized.class` in the usage map (direct local use on the target)
70-
// 2. "meta annotations" - for each local usage, check that annotation's annotations for `Nationalized.class` (one level deep)
7169

72-
73-
// first, see if we can find it directly...
70+
// first, check for direct use
71+
// - look for `Nationalized.class` in the usage map of the target
7472
final AnnotationUsage<A> localUsage = getAnnotationUsage( annotationType );
7573
if ( localUsage != null ) {
76-
return null;
74+
return localUsage;
7775
}
7876

79-
// check as "meta annotations" (annotations on our annotations)...
77+
// next, check as a "meta annotation"
78+
// - for each local usage, check that annotation's annotations for `Nationalized.class` (one level deep)
8079
final Map<Class<? extends Annotation>, AnnotationUsage<? extends Annotation>> localUsageMap = getUsageMap();
8180
for ( Map.Entry<Class<? extends Annotation>, AnnotationUsage<? extends Annotation>> usageEntry : localUsageMap.entrySet() ) {
8281
final AnnotationUsage<? extends Annotation> usage = usageEntry.getValue();

0 commit comments

Comments
 (0)