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

checkUnusedDependencies doesn't respect the entire dependency hierarchy #2250

Open
mglazer opened this issue May 3, 2022 · 0 comments
Open

Comments

@mglazer
Copy link
Contributor

mglazer commented May 3, 2022

What happened?

Imagine I have a class hierarchy like the following:

class SomeClassA extends Parent { // parent comes from parent.jar
}
class Parent extends GrandParent { // GrandParent comes from grandparent.jar
}

And if parent.jar doesn't declare an API dependency on grandparent.jar (sadly, this doesn't always happen, and obviously requires fixing the upstream libraries before I can take a dependency on parent.jar), then I'm forced to do the following in my build.gradle:

implementation 'parent'
implementation 'grandparent'

The problem comes in with checkUnusedDependencies which will flag that grandparent is an unnecessary declaration.

I believe this is because the ASMDependencyAnalyzer which is utilized has a "bug" in its usage. Particularly, if you read through the implementation, it only parses classes at a single layer of hierarchy. Therefore, if will include Parent as being a dependency, but will not include GrandParent as it doesn't recursively traverse up the hierarchy.

What did you want to happen?

At the moment, I'm forced to add grandparent as an ignored dependency in checkUnusedDependencies even though it is really only added because of a dependency issue from parent.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant