Skip to content

Commit

Permalink
Do not waste memory on empty hash maps in annotations
Browse files Browse the repository at this point in the history
  • Loading branch information
Vasiliy Kudriavtsev committed Dec 26, 2022
1 parent 32e1a64 commit 8aa642e
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,11 @@ public AnnotationVisitor visitArray(String name) {
}

@Override
public void visitEnd() {
public void visitEnd() {M
Map<String, Object> compactedAttributes
= this.attributes.size() == 0 ? Map.of() : this.attributes;
MergedAnnotation<A> annotation = MergedAnnotation.of(
this.classLoader, this.source, this.annotationType, this.attributes);
this.classLoader, this.source, this.annotationType, compactedAttributes);
this.consumer.accept(annotation);
}

Expand Down

0 comments on commit 8aa642e

Please sign in to comment.