Skip to content

Commit ddbb7c1

Browse files
committed
Avoid use of Supplier in MergedAnnotationReadingVisitor.get
1 parent 2bc7a3a commit ddbb7c1

File tree

3 files changed

+4
-6
lines changed

3 files changed

+4
-6
lines changed

spring-core/src/main/java/org/springframework/core/type/classreading/MergedAnnotationReadingVisitor.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2019 the original author or authors.
2+
* Copyright 2002-2021 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -23,7 +23,6 @@
2323
import java.util.List;
2424
import java.util.Map;
2525
import java.util.function.Consumer;
26-
import java.util.function.Supplier;
2726

2827
import org.springframework.asm.AnnotationVisitor;
2928
import org.springframework.asm.SpringAsmInfo;
@@ -121,7 +120,7 @@ private <T extends Annotation> AnnotationVisitor visitAnnotation(
121120
@SuppressWarnings("unchecked")
122121
@Nullable
123122
static <A extends Annotation> AnnotationVisitor get(@Nullable ClassLoader classLoader,
124-
@Nullable Supplier<Object> sourceSupplier, String descriptor, boolean visible,
123+
@Nullable Object source, String descriptor, boolean visible,
125124
Consumer<MergedAnnotation<A>> consumer) {
126125

127126
if (!visible) {
@@ -133,7 +132,6 @@ static <A extends Annotation> AnnotationVisitor get(@Nullable ClassLoader classL
133132
return null;
134133
}
135134

136-
Object source = (sourceSupplier != null ? sourceSupplier.get() : null);
137135
try {
138136
Class<A> annotationType = (Class<A>) ClassUtils.forName(typeName, classLoader);
139137
return new MergedAnnotationReadingVisitor<>(classLoader, source, annotationType, consumer);

spring-core/src/main/java/org/springframework/core/type/classreading/SimpleAnnotationMetadataReadingVisitor.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ else if (this.className.equals(outerClassName)) {
117117
@Override
118118
@Nullable
119119
public AnnotationVisitor visitAnnotation(String descriptor, boolean visible) {
120-
return MergedAnnotationReadingVisitor.get(this.classLoader, this::getSource,
120+
return MergedAnnotationReadingVisitor.get(this.classLoader, getSource(),
121121
descriptor, visible, this.annotations::add);
122122
}
123123

spring-core/src/main/java/org/springframework/core/type/classreading/SimpleMethodMetadataReadingVisitor.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ final class SimpleMethodMetadataReadingVisitor extends MethodVisitor {
7272
@Override
7373
@Nullable
7474
public AnnotationVisitor visitAnnotation(String descriptor, boolean visible) {
75-
return MergedAnnotationReadingVisitor.get(this.classLoader, this::getSource,
75+
return MergedAnnotationReadingVisitor.get(this.classLoader, getSource(),
7676
descriptor, visible, this.annotations::add);
7777
}
7878

0 commit comments

Comments
 (0)