reflections
reflections copied to clipboard
anonymous classes scanning
this is more of a question, rather than an issue. some time ago I accidentally answered a question on stackoverflow about this library, specifically here.
I will not repeat myself as all the details are there. My question is should such functionality be supported out of the box via a custom Scanner may be that is build in?
Firstly, sub-type extends Object
are removed in reflections.
So I create a new class named MySuperClass
as the super class,
then you can get access to the anonymous class with
Set<Class<?>> subTypes = reflections.get(SubTypes.of(MySuperClass.class).asClass());
But the case
Set<Class<?>> result = reflections.getTypesAnnotatedWith(DemoAnnotation.class);
still failed.
I found the classFile
read from non-anonymous class (like class in org.reflections.TestModel
) has an attribute named AnnotationsAttribute
, which saves the information of annotations of this class. but neither to anonymous class. So reflections cannot assign the anonymous class to its annotation.
Any idea about this?
@ronmamo I update a case about this in #370 . Please have a review and test.