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 f41d348
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,10 @@ public AnnotationVisitor visitArray(String name) {

@Override
public void visitEnd() {
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 f41d348

Please sign in to comment.