[
https://issues.apache.org/jira/browse/GROOVY-9273?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18146525#comment-18146525
]
ASF GitHub Bot commented on GROOVY-9273:
----------------------------------------
daniellansun commented on PR #3235:
URL: https://github.com/apache/groovy/pull/3235#issuecomment-6968749839
Thank you for raising these two design points, and for putting the
discussion at this level first. I agree with both of them, and the current tip
follows that direction.
1. The module declaration is now a member of the compilation-unit model.
`CompileUnit` holds the `ModuleInfoNode` explicitly. `ModuleInfoNode.of` reads
that declaration from the class's own compile unit, or from a fallback unit
when the class no longer points at its module. Node metadata is not consulted.
The synthetic `module-info` carrier is still what the existing per-class
pipeline visits for resolution, annotation checking, and writing
`module-info.class`, but it is no longer the primary representation of the
declaration. A second module declaration in the same compilation unit is
rejected, and the first is kept.
For joint compilation, `JavaStubGenerator` and `JavaStubCompilationUnit`
also use `ModuleInfoNode.of` with the caller's compile unit, so a module-info
carrier is not written or counted as a type stub. A type declaration in
`module-info.java` is not a modular compilation unit, and sibling `.java` files
in this joint compiler are compiled from the classpath, so they do not need a
module-info stub. Groovy still writes `module-info.class` at class generation.
2. The AST `CompileUnit` no longer records which class files javac produced.
Those names are kept in the joint-compilation implementation, on
`CompiledClassIndex`. The index includes in-memory javac output when that
option is on. In that case the default snapshot does not walk the target
directory, so leftover files on disk are not treated as this invocation's
output, and a walk failure there cannot fail the compile. `module-info` is not
added to the index. A reused compilation unit clears the index at the start of
`compile`.
I would be very grateful for any further thoughts on this direction.
> Support module descriptor, aka. module-info
> -------------------------------------------
>
> Key: GROOVY-9273
> URL: https://issues.apache.org/jira/browse/GROOVY-9273
> Project: Groovy
> Issue Type: New Feature
> Reporter: Daniel Sun
> Priority: Major
>
>
> [https://openjdk.java.net/projects/jigsaw/quick-start]
> [http://tutorials.jenkov.com/java/modules.html#java-module-basics]
> [https://www.oracle.com/corporate/features/understanding-java-9-modules.html]
> [https://www.concretepage.com/java/java-9/java-module]
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)