Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -99,26 +99,15 @@ final class ExpressionTemplateSecurityAnnotationScanner<A extends Annotation>
@Override
@Nullable MergedAnnotation<A> merge(AnnotatedElement element, @Nullable Class<?> targetClass) {
if (element instanceof Parameter parameter) {
MergedAnnotation<A> annotation = this.unique.merge(parameter, targetClass);
if (annotation == null) {
return null;
}
return resolvePlaceholders(annotation);
return resolvePlaceholders(this.unique.merge(parameter, targetClass));
}
if (element instanceof Method method) {
MergedAnnotation<A> annotation = this.unique.merge(method, targetClass);
if (annotation == null) {
return null;
}
return resolvePlaceholders(annotation);
return resolvePlaceholders(this.unique.merge(method, targetClass));
}
throw new IllegalArgumentException("Unsupported element of type " + element.getClass());
}

private MergedAnnotation<A> resolvePlaceholders(MergedAnnotation<A> mergedAnnotation) {
if (this.templateDefaults == null) {
return mergedAnnotation;
}
if (mergedAnnotation.getMetaSource() == null) {
return mergedAnnotation;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ private List<MergedAnnotation<A>> findParameterAnnotations(Parameter current) {

private List<MergedAnnotation<A>> findClosestParameterAnnotations(Method method, Class<?> clazz, Parameter current,
Set<Class<?>> visited) {
if (clazz == null || clazz == Object.class || !visited.add(clazz)) {
if (clazz == Object.class || !visited.add(clazz)) {
return Collections.emptyList();
}
List<MergedAnnotation<A>> directAnnotations = findDirectParameterAnnotations(method, clazz, current);
Expand Down Expand Up @@ -224,7 +224,7 @@ private List<MergedAnnotation<A>> findMethodAnnotations(Method method, @Nullable

private List<MergedAnnotation<A>> findClosestMethodAnnotations(Method method, Class<?> targetClass,
Set<Class<?>> classesToSkip) {
if (targetClass == null || classesToSkip.contains(targetClass) || targetClass == Object.class) {
if (classesToSkip.contains(targetClass) || targetClass == Object.class) {
return Collections.emptyList();
}
classesToSkip.add(targetClass);
Expand All @@ -244,7 +244,7 @@ private List<MergedAnnotation<A>> findClosestMethodAnnotations(Method method, Cl
}

private List<MergedAnnotation<A>> findClosestClassAnnotations(Class<?> targetClass, Set<Class<?>> classesToSkip) {
if (targetClass == null || classesToSkip.contains(targetClass) || targetClass == Object.class) {
if (classesToSkip.contains(targetClass) || targetClass == Object.class) {
return Collections.emptyList();
}
classesToSkip.add(targetClass);
Expand Down
Loading