reflections
reflections copied to clipboard
Doesnt find classes annotated with annotation that have fields.
If annotation have parameters like
@java.lang.SuppressWarnings(value = "TESTS 2")
It won't be founded using:
List<ClassLoader> classLoadersList = new LinkedList<>();
classLoadersList.add(ClasspathHelper.contextClassLoader());
classLoadersList.add(ClasspathHelper.staticClassLoader());
Reflections reflections = new Reflections(new ConfigurationBuilder()
.setScanners(new SubTypesScanner(), new TypeAnnotationsScanner(), new ResourcesScanner())
.setUrls(ClasspathHelper.forPackage(packageToScan))
.filterInputsBy(new FilterBuilder().include(FilterBuilder.prefix(packageToScan))));
Set<Class<?>> classes = reflections.getTypesAnnotatedWith(SuppressWarnings.class);
In java.lang.SuppressWarnings you can see that the annotations is annotated with @Retention(RetentionPolicy.SOURCE). It does not exist anymore when your application is running.