Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Dependency usages from annotations with RetentionPolicy.SOURCE are not considered as used #125

Closed
cesarsotovalero opened this issue Apr 2, 2022 · 0 comments · Fixed by #126
Labels
bug Something isn't working

Comments

@cesarsotovalero
Copy link
Collaborator

Describe the bug
The DepClean analysis is based on the information in the compiled .class files (bytecode). Therefore, DepClean only detects the usage information located in the bytecode of the application.

DepClean uses ASM for bytecode analysis, see related SO question: https://stackoverflow.com/questions/63465374/how-to-visit-annotation-inside-method-in-asm.

To Reproduce
I've investigated this issue in the project https://github.com/INRIA/spoon (see INRIA/spoon#4649). In this case, the MetaInfServices annotation from the dependency org.kohsuke.metainf-services is implemented with RetentionPolicy.SOURCE, see here. This means that the annotation is only available in the source code, and not in the .class files or at runtime.

Expected behavior
DepClean should consider dependencies used via annotations with RetentionPolicy.SOURCE as used.

@cesarsotovalero cesarsotovalero added the bug Something isn't working label Apr 2, 2022
cesarsotovalero added a commit that referenced this issue Apr 4, 2022
cesarsotovalero added a commit that referenced this issue Apr 5, 2022
* Fix MavenInvokerTest

* Add explicit encoding for the failsafe-plugin to avoid log warnings

* Edit description

* Update to JDK17 and prepare for new release

* Fix IT

* Consider classes from imports in the source code of the Maven project as used

* Add test

* Fix IT

* bugfix: class files in dependencies where not analyzed

* Remove logs

* Workaround

* Fix IT and remove logs

* Fix #125

* Fix checkstyle error

* Refactoring workaround

* Fix test

* Test DefaultCallGraph
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant