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

add method JavaClass.getTransitiveDependenciesFromSelf #401

Merged
merged 3 commits into from
Dec 16, 2020

Conversation

hankem
Copy link
Member

@hankem hankem commented Jul 15, 2020

Instead of the initial getTransitiveDependenciesFromSelfWithinPackage(String packageNamePrefix), I now suggest the simpler API:

    /**
     * Returns the transitive closure of all dependencies originating from this class, i.e. its direct dependencies
     * and the dependencies from all imported target classes.
     * @return all transitive dependencies (including direct dependencies) from this class
     * @see #getDirectDependenciesFromSelf()
     */
    @PublicAPI(usage = ACCESS)
    public Set<Dependency> getTransitiveDependenciesFromSelf() {
        return JavaClassTransitiveDependencies.findTransitiveDependenciesFrom(this);
    }

Signed-off-by: Manfred Hanke [email protected]

@hankem hankem requested a review from codecholeric July 15, 2020 15:36
@hankem hankem marked this pull request as draft July 15, 2020 15:49
@hankem hankem marked this pull request as ready for review July 15, 2020 17:20
@codecholeric
Copy link
Collaborator

Also compare #253?

@hankem hankem force-pushed the transitive-dependencies branch from d412d65 to 6a88816 Compare September 13, 2020 13:47
@hankem hankem changed the title add method JavaClass.getTransitiveDependenciesFromSelfWithinPackage add method JavaClass.getTransitiveDependenciesFromSelf Sep 13, 2020
@hankem hankem force-pushed the transitive-dependencies branch from 6a88816 to d7047ed Compare December 6, 2020 21:35
@hankem hankem force-pushed the transitive-dependencies branch from d7047ed to e9ead20 Compare December 15, 2020 21:30
@codecholeric codecholeric force-pushed the transitive-dependencies branch from e9ead20 to 1050e6e Compare December 16, 2020 21:03
@hankem hankem force-pushed the transitive-dependencies branch from 1a60645 to 7cb1b76 Compare December 16, 2020 22:18
So far, if a user would call `JavaClass.getDirectDependency{From/To}Self()` on a class that was not directly imported (e.g. a class that was not present in the original import, but accessed by a class from that import) it would cause a NPE. While we do want to cut the class graph at that point (i.e. not further track dependencies for classes that are not part of the import), we do not want this exceptional behavior. This change fixes the behavior and sets empty dependencies for all non-directly imported classes, be it classes that have been resolved from the classpath later on, or stub classes, because further resolution has been turned off.

Resolves: #397

Signed-off-by: Manfred Hanke <[email protected]>
@hankem hankem force-pushed the transitive-dependencies branch from 7cb1b76 to 184e2e0 Compare December 16, 2020 22:21
This method reports whether the class is completed from the ImportContext.
Take an import of package `com.foo`, where some class `com.foo.Foo` accesses another class `com.bar.Bar`, then `Foo` would be `isFullyImported() == true`, because it was explicitly covered by the package to be imported, but `Bar` would have `isFullyImported() == false`, because it was not covered by the original package. This method is useful, because it has strong implications, whether the class is fully imported or not. For example only a fully imported classes has its dependencies imported, a class that was just imported as a dependency of a fully imported class will have its dependencies cut off to avoid uncontrollably huge imports.

Signed-off-by: Manfred Hanke <[email protected]>
@codecholeric codecholeric force-pushed the transitive-dependencies branch from 184e2e0 to 27dae94 Compare December 16, 2020 22:23
@codecholeric codecholeric merged commit fd57c1f into master Dec 16, 2020
@codecholeric codecholeric deleted the transitive-dependencies branch December 16, 2020 22:56
codecholeric added a commit that referenced this pull request Feb 21, 2021
hankem added a commit that referenced this pull request Dec 9, 2022
Bumps [actions/setup-java](https://github.com/actions/setup-java) from
3.6.0 to 3.8.0.

from [actions/setup-java's releases](https://github.com/actions/setup-java/releases):

> # v3.8.0
> 
> In scope of this release we added logic to pass the token input through on GHES for Microsoft Build of OpenJDK ([actions/setup-java#395](https://github-redirect.dependabot.com/actions/setup-java/pull/395)) and updated [minimatch](https://github-redirect.dependabot.com/actions/setup-java/pull/413) dependency.

Commits

*   [`c3ac5dd`](actions/setup-java@c3ac5dd) Revert "Add support for Oracle JDK ([#401](https://github-redirect.dependabot.com/actions/setup-java/issues/401))" ([#421](https://github-redirect.dependabot.com/actions/setup-java/issues/421))
*   [`dcd29da`](actions/setup-java@dcd29da) Fix typo in README.md ([#419](https://github-redirect.dependabot.com/actions/setup-java/issues/419))
*   [`19eeec5`](actions/setup-java@19eeec5) Update to latest `actions/publish-action` ([#411](https://github-redirect.dependabot.com/actions/setup-java/issues/411))
*   [`bd7e5d2`](actions/setup-java@bd7e5d2) Update minimatch to 3.1.2 ([#413](https://github-redirect.dependabot.com/actions/setup-java/issues/413))
*   [`6cdf39a`](actions/setup-java@6cdf39a) Add support for Oracle JDK ([#401](https://github-redirect.dependabot.com/actions/setup-java/issues/401))
*   [`7db6b45`](actions/setup-java@7db6b45) Eclipse Temurin instead of Adopt OpenJDK ([#398](https://github-redirect.dependabot.com/actions/setup-java/issues/398))
*   [`bf2f02c`](actions/setup-java@bf2f02c) Pass the token input through on GHES for Microsoft Build of OpenJDK ([#395](https://github-redirect.dependabot.com/actions/setup-java/issues/395))
*   See full diff in [compare view](actions/setup-java@v3.6.0...v3.8.0)
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

Successfully merging this pull request may close these issues.

2 participants