-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
[MNG-8195] Add DependencyResolverResult.getModuleName(Path)
method
#1625
Conversation
6989ba4
to
52db57c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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)
DependencyResolverResult.getModuleName(Path)
methodDependencyResolverResult.getModuleName(Path)
method
No additional change envisioned for this pull request if the alternative (methods added in the |
Could we move the subproject thing into a separate PR ? |
No problem. I will try to apply this separation and other comments in the next few days. |
Done with #1649. |
@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
Done. |
Clarify the meaning of "module" in documentation, then add two methods for getting Java module information from a
DependencyResolverResult
:getModuleName(Path)
returns ajava.lang.String
getModuleDescription(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-Name
attribute ofMETA-INF/MANIFEST.MF
if 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
DefaultDependencyResolverResult
implementation. It avoids decoding many times themodule-info.class
files. Plugins need those information for managing--add-reads
and 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