[
https://issues.apache.org/jira/browse/GROOVY-9273?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18148432#comment-18148432
]
ASF GitHub Bot commented on GROOVY-9273:
----------------------------------------
blackdrag commented on PR #3235:
URL: https://github.com/apache/groovy/pull/3235#issuecomment-7051909720
> 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.
I started with "x\module-info.groovy is a legal source file name on linux."
and was thinking more and more on the integration and I think we should go
further. I think this needs to be a first class citizen. For processing the AST
I see several points:
* annotation processsing: I wold do this with a temporary class node if we
really need one
* class generation is really parallel for the module to ordinary classes,
this does not really overlap
* resolving imports and class usages . A simplified resolve visitor can do
this. That and the real one can share infrastructure
* old random AST transform should not accidently transform the module node
because they think it is a normal class node
* static/dynamic compilation is no question here, there is no dynamic code
in a module-info class
* processing pipeline: I would process the module info before normal classes
on each phase and add a new phase operation for that.
We also have to consider that recent PRs do a lot in the direction of
testing if a class is accessible. The rules for that change if modules are
involved in the sources. That is why I want the module-info be processed before
the source classes in in case of the resolve visitor.
I hope that also reduces the joint compilation surface
> 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 am not sure yet about this part. I think if we do the big changes in (1),
then maybe some things here can be solved differently.
> 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)