actually get the annotation metadata from classes

This commit is contained in:
Jake Potrebic 2021-04-06 16:18:32 -07:00
parent 7b490320fa
commit b50f3e7b8e
No known key found for this signature in database
GPG Key ID: 7C58557EC9C421F8

View File

@ -1,5 +1,6 @@
package io.papermc.hangar.security;
import io.papermc.hangar.controller.internal.ReviewController;
import org.jetbrains.annotations.NotNull;
import org.springframework.core.GenericTypeResolver;
import org.springframework.core.annotation.MergedAnnotations;
@ -16,6 +17,7 @@ import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
import java.util.stream.Collectors;
import java.util.stream.Stream;
@SuppressWarnings("rawtypes")
@ -40,7 +42,17 @@ public class HangarMetadataSources extends AbstractFallbackMethodSecurityMetadat
@Override
protected Collection<ConfigAttribute> findAttributes(Method method, Class<?> targetClass) {
return annotationExtractors.entrySet().stream().map(entry -> processAnnotation(method, entry)).flatMap(Collection::stream).collect(Collectors.toList());
if (targetClass.equals(ReviewController.class)) {
System.out.println(targetClass);
}
return Stream.concat(
annotationExtractors.entrySet().stream()
.map(entry -> processAnnotation(method, entry))
.flatMap(Collection::stream),
annotationExtractors.entrySet().stream()
.map(entry -> processAnnotation(targetClass, entry))
.flatMap(Collection::stream)
).collect(Collectors.toUnmodifiableSet());
}
@Override