Skip to content

Commit

Permalink
#76 - Fix NPE stemming from bug in replaceAnnotationUsage
Browse files Browse the repository at this point in the history
  • Loading branch information
sebersole committed Apr 26, 2024
1 parent 3594aa8 commit ad8f7a4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,8 @@ default <S extends Annotation, P extends Annotation> MutableAnnotationUsage<P> r
final MutableAnnotationUsage<P> containerTypeUsage = containerType.createUsage( buildingContext );
// effectively overwrites any previous registrations
getUsageMap().put( containerType.getAnnotationType(), containerTypeUsage );
getUsageMap().put( repeatableType.getAnnotationType(), null );
// remove any entry for the repeatable/singular form
getUsageMap().remove( repeatableType.getAnnotationType() );

return containerTypeUsage;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ void basicReplacementChecks(Index index) {
buildingContext
);

assertThat( classDetails.hasAnnotationUsage( SecondaryTable.class ) ).isTrue();
assertThat( classDetails.hasAnnotationUsage( SecondaryTable.class ) ).isFalse();
assertThat( classDetails.hasAnnotationUsage( SecondaryTables.class ) ).isTrue();

List<MutableAnnotationUsage<SecondaryTable>> valueList = replacement.getList( "value" );
Expand All @@ -75,6 +75,9 @@ void basicReplacementChecks(Index index) {

final AnnotationUsage<SecondaryTables> annotationUsage1 = classDetails.getAnnotationUsage( SecondaryTables.class );
assertThat( annotationUsage1.getList( "value" ) ).isSameAs( valueList );

// see #76
classDetails.locateAnnotationUsage( SecondaryTable.class );
}

}

0 comments on commit ad8f7a4

Please sign in to comment.