smallrye / jandex

Java Annotation Indexer
Apache License 2.0
394 stars 94 forks source link

Reduce allocations when creating immutable array-backed lists #317

Closed Ladicek closed 1 year ago

Ladicek commented 1 year ago

This commit replaces Collections.unmodifiableList(Arrays.asList(array)) with new ImmutableArrayList<>(array), where ImmutableArrayList is a simple implementation of an immutable array-backed list. This reduces the number of allocations from 2 to 1 on many places in the code.

Additionally, this commit slightly improves javadoc of some methods in the AnnotationInstance class.