Browse Source

Avoid use of Supplier in MergedAnnotationReadingVisitor.get

pull/27100/head
Sam Brannen 4 years ago
parent
commit
ddbb7c1b5b
  1. 6
      spring-core/src/main/java/org/springframework/core/type/classreading/MergedAnnotationReadingVisitor.java
  2. 2
      spring-core/src/main/java/org/springframework/core/type/classreading/SimpleAnnotationMetadataReadingVisitor.java
  3. 2
      spring-core/src/main/java/org/springframework/core/type/classreading/SimpleMethodMetadataReadingVisitor.java

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

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 the original author or authors.
* Copyright 2002-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -23,7 +23,6 @@ import java.util.LinkedHashMap; @@ -23,7 +23,6 @@ import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.function.Consumer;
import java.util.function.Supplier;
import org.springframework.asm.AnnotationVisitor;
import org.springframework.asm.SpringAsmInfo;
@ -121,7 +120,7 @@ class MergedAnnotationReadingVisitor<A extends Annotation> extends AnnotationVis @@ -121,7 +120,7 @@ class MergedAnnotationReadingVisitor<A extends Annotation> extends AnnotationVis
@SuppressWarnings("unchecked")
@Nullable
static <A extends Annotation> AnnotationVisitor get(@Nullable ClassLoader classLoader,
@Nullable Supplier<Object> sourceSupplier, String descriptor, boolean visible,
@Nullable Object source, String descriptor, boolean visible,
Consumer<MergedAnnotation<A>> consumer) {
if (!visible) {
@ -133,7 +132,6 @@ class MergedAnnotationReadingVisitor<A extends Annotation> extends AnnotationVis @@ -133,7 +132,6 @@ class MergedAnnotationReadingVisitor<A extends Annotation> extends AnnotationVis
return null;
}
Object source = (sourceSupplier != null ? sourceSupplier.get() : null);
try {
Class<A> annotationType = (Class<A>) ClassUtils.forName(typeName, classLoader);
return new MergedAnnotationReadingVisitor<>(classLoader, source, annotationType, consumer);

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

@ -117,7 +117,7 @@ final class SimpleAnnotationMetadataReadingVisitor extends ClassVisitor { @@ -117,7 +117,7 @@ final class SimpleAnnotationMetadataReadingVisitor extends ClassVisitor {
@Override
@Nullable
public AnnotationVisitor visitAnnotation(String descriptor, boolean visible) {
return MergedAnnotationReadingVisitor.get(this.classLoader, this::getSource,
return MergedAnnotationReadingVisitor.get(this.classLoader, getSource(),
descriptor, visible, this.annotations::add);
}

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

@ -72,7 +72,7 @@ final class SimpleMethodMetadataReadingVisitor extends MethodVisitor { @@ -72,7 +72,7 @@ final class SimpleMethodMetadataReadingVisitor extends MethodVisitor {
@Override
@Nullable
public AnnotationVisitor visitAnnotation(String descriptor, boolean visible) {
return MergedAnnotationReadingVisitor.get(this.classLoader, this::getSource,
return MergedAnnotationReadingVisitor.get(this.classLoader, getSource(),
descriptor, visible, this.annotations::add);
}

Loading…
Cancel
Save