Skip to content

"Find unused dependencies" does not consider dependencies for using method return types #2357

Description

@HeikoKlare

Let's assume you have bundle A exporting a type T, bundle B exporting a method m that returns T, and bundle C consuming method m and executing a method on T. Then C requires a dependency to bundle A to be able to execute that method. However, when using "find unused dependencies" on bundle C, the dependency to A will be removed.
The class of interested for this functionality should be this: https://github.com/eclipse-pde/eclipse.pde/blob/master/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/search/dependencies/GatherUnusedDependenciesOperation.java

The following archive contains projects demonstrating that situation: demo2.zip

Before "find unused dependencies":
Image

After removing unused dependencies:
Image

Of course, it's not nice that as a consumer of public methods you potentially need to define additional dependencies for being able to use the return type of the methods. But if I am not mistaken, the only way to avoid this would be some kind of reexport and it's not the idea to do this for every type used in some API, is it?

I plan to put this issue into the backlog of my team. But in case anyone has input the issue or a potential solution, please share that, or if anyone wants to pick this issue before we find the time to do so, of course feel free to do so.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions