Skip to content

Commit

Permalink
cleaning up unnecessary condition and adding a comment
Browse files Browse the repository at this point in the history
  • Loading branch information
akulk022 committed Nov 26, 2023
1 parent ef844c8 commit 79bc579
Showing 1 changed file with 5 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -170,15 +170,11 @@ public TypeMetadata create(com.sun.tools.javac.util.List<Attribute.TypeCompound>
@Override
public Type cloneTypeWithMetaData(Type typeToBeCloned, TypeMetadata metaData) {
try {
Type clonedType = null;
if (metaData.getClass().getComponentType() != null) {
clonedType = (Type) cloneAddMetadataHandle.invoke(typeToBeCloned, metaData);
} else {
Type clonedTypeDrop =
(Type) cloneDropMetadataHandle.invoke(typeToBeCloned, metaData.getClass());
clonedType = (Type) cloneAddMetadataHandle.invoke(clonedTypeDrop, metaData);
}
return clonedType;
// In Jdk21 addMetadata works if there is no metadata associated with the type, so we create
// a copy without the existing metadata first and then add it
Type clonedTypeWithoutMetadata =
(Type) cloneDropMetadataHandle.invoke(typeToBeCloned, metaData.getClass());
return (Type) cloneAddMetadataHandle.invoke(clonedTypeWithoutMetadata, metaData);
} catch (Throwable e) {
throw new RuntimeException(e);

Check warning on line 179 in nullaway/src/main/java/com/uber/nullaway/generics/PreservedAnnotationTreeVisitor.java

View check run for this annotation

Codecov / codecov/patch

nullaway/src/main/java/com/uber/nullaway/generics/PreservedAnnotationTreeVisitor.java#L175-L179

Added lines #L175 - L179 were not covered by tests
}
Expand Down

0 comments on commit 79bc579

Please sign in to comment.