getAnnotations & getAllRawInterfaces falsely return empty lists #1255
Replies: 2 comments 1 reply
-
Hi i dont know the mentioned annotation but it might be due to it not being retained in runtime? |
Beta Was this translation helpful? Give feedback.
-
I would check if the classes that puzzle you are really directly imported. I.e. are those classes that the You can either check the trace logs by hooking into Slf4j, or check |
Beta Was this translation helpful? Give feedback.
-
Hello everyone,
I am developing a test to detect unreferenced classes and i have encountered this issue.
I've defined two DescribedPredicate instances for JavaClass objects:
Implementing Interfaces Check: This predicate checks if a class implements any interfaces.
Matching Annotations Check: This predicate verifies if a class's methods are annotated with any annotations from a predefined list (e.g., @EventListener).
These predicates have worked well across most of my project, effectively flagging classes that are not directly referenced or are potentially redundant. However, I've noticed some anomalies where certain classes are incorrectly marked as unreferenced. Specifically:
I'm puzzled by these false negatives and would greatly appreciate any advice on why these methods might not be returning the expected results. Is there a known limitation or a specific scenario under which getAllRawInterfaces and getAnnotations might fail to detect existing interfaces and annotations?
Thank you in advance for your help and insights!
Beta Was this translation helpful? Give feedback.
All reactions