mirror of
https://github.com/spring-projects/spring-framework.git
synced 2026-09-17 16:39:29 +00:00
Use empty array constants instead of repeatedly creating new ones
Closes gh-35660 Signed-off-by: Kamil Krzywański <kamilkrzywanski01@gmail.com> Signed-off-by: Kamil Krzywanski <kamilkrzywanski01@gmail.com>
This commit is contained in:
committed by
Sam Brannen
parent
687bc7652d
commit
948367092c
+3
-1
@@ -40,6 +40,8 @@ import org.springframework.util.Assert;
|
||||
*/
|
||||
final class MergedAnnotationsCollection implements MergedAnnotations {
|
||||
|
||||
private static final MergedAnnotation<?> [] EMPTY_ANNOTATIONS = new MergedAnnotation<?>[0];
|
||||
|
||||
private final MergedAnnotation<?>[] annotations;
|
||||
|
||||
private final AnnotationTypeMappings[] mappings;
|
||||
@@ -47,7 +49,7 @@ final class MergedAnnotationsCollection implements MergedAnnotations {
|
||||
|
||||
private MergedAnnotationsCollection(Collection<MergedAnnotation<?>> annotations) {
|
||||
Assert.notNull(annotations, "Annotations must not be null");
|
||||
this.annotations = annotations.toArray(new MergedAnnotation<?>[0]);
|
||||
this.annotations = annotations.toArray(EMPTY_ANNOTATIONS);
|
||||
this.mappings = new AnnotationTypeMappings[this.annotations.length];
|
||||
for (int i = 0; i < this.annotations.length; i++) {
|
||||
MergedAnnotation<?> annotation = this.annotations[i];
|
||||
|
||||
Reference in New Issue
Block a user