Question around getClassesWithAnnotation() and classes outside the scanSpec. #697
Replies: 2 comments
-
Hi, are the extra annotations meta-annotations, ie. do they annotate annotation classes in the scanned packages? See #559. |
Beta Was this translation helpful? Give feedback.
-
Hi, That issue was interesting, but in this case, these are pretty bland classes. I have to go back and see about making a reproduction since I've moved on with the code. But now I am seeing a situation where if I do not add a package to the scan, then I get null for some ClassInfo objects, it was either parameter or return types, I'll have to check that too. But I am seeing a method called enableExternalClasses() and it seems that it should be included in the ClassGraph.enableAllInfo() method. But as it stands, it seems they are all related, I am able to get the correct results but with a wrinkle. |
Beta Was this translation helpful? Give feedback.
-
Hello, I am pretty excited about your project.
I have a clarification of usage question because I am seemingly getting strange results and perhaps I have not delved into the api enough yet.
Firstly, I will show my setup. Secondly, I will describe how I'm having unexpected results.
The issue I am seeing is there are 3 classes showing up in the 'subset' list which are not present in the 'all' list.
Also, the classes that show up in the subset list are not within the single supplied base package "XYZ", they are in "ABC" which is not scanned for.
Is there something about getClassesWithAnnotation() which I would need to better understand (like expected side effects), or is this the correct usage?
Thanks!
===============
My current thinking is that getClassesWithAnnotation() does not mean "filter getAllClasses by annotation" but rather means all classes (which includes fields and parameters) encountered by the scan of classes in the base-package.
In this case, then I would call getAllClasses() and then do the filtering.
Is this the correct approach?
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions