[MNG-8195] Add DependencyResolverResult.getModuleName(Path) method#1625
Merged
gnodet merged 1 commit intoapache:masterfrom Aug 16, 2024
Merged
[MNG-8195] Add DependencyResolverResult.getModuleName(Path) method#1625gnodet merged 1 commit intoapache:masterfrom
DependencyResolverResult.getModuleName(Path) method#1625gnodet merged 1 commit intoapache:masterfrom
Conversation
6989ba4 to
52db57c
Compare
gnodet
approved these changes
Aug 5, 2024
Contributor
gnodet
left a comment
There was a problem hiding this comment.
LGTM, I'd try to:
- add an alias in the xml to replace the
<modules>element - make this element optional (discover them if not specified explicitely)
cstamas
approved these changes
Aug 5, 2024
DependencyResolverResult.getModuleName(Path) methodDependencyResolverResult.getModuleName(Path) method
Contributor
Author
|
No additional change envisioned for this pull request if the alternative (methods added in the |
Contributor
|
Could we move the subproject thing into a separate PR ? |
Contributor
Author
|
No problem. I will try to apply this separation and other comments in the next few days. |
Contributor
Author
|
Done with #1649. |
Contributor
@desruisseaux Could you remove the commit to rename module -> subproject from this PR ? |
… `DependencyResolverResult`. Those methods are helpful for plugins that need to provide `--add-reads` and similar options, as they allow to reuse the cached values instead of decoding `module-info.class` many times.
52db57c to
80932d4
Compare
Contributor
Author
|
Done. |
|
Resolve #9802 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Clarify the meaning of "module" in documentation, then add two methods for getting Java module information from a
DependencyResolverResult:getModuleName(Path)returns ajava.lang.StringgetModuleDescription(Path)returns ajava.lang.module.ModuleDescriptor"Get name" may seem redundant with "get description" because the name can be obtained from the description by
ModuleDescriptor.name(). The difference is that "get name" fallbacks on theAutomatic-Module-Nameattribute ofMETA-INF/MANIFEST.MFif the module descriptor is not found.The rational for providing those methods in the API is because it allows to use the cache managed by the
DefaultDependencyResolverResultimplementation. It avoids decoding many times themodule-info.classfiles. Plugins need those information for managing--add-readsand similar options.Alternative
It would be more natural to have
getModuleName()andgetModuleDescription()methods inDependency. But it would imply that dependency contains agetPath()method. I'm not sure why it is not already the case.https://issues.apache.org/jira/browse/MNG-8195