paulk-asert commented on PR #2429: URL: https://github.com/apache/groovy/pull/2429#issuecomment-4242885938
> Overall, I agree that following Java's example seems more prudent than Scala's. > > I suspect that treating module imports as a distinct thing from static star imports, at least at some level in the AST, might be prudent. That could be because I never fully recovered from the psychic damage I took in the OSGi salt mines. 🙂 > > That caveat aside, it does seem like there's something from the module imports JEP that we're not supporting: Transitive dependencies across modules (as described in [JEP 476](https://openjdk.org/jeps/476)). > > > The ability to import at the level of modules would be especially helpful when APIs in one module have a close relationship with APIs in another module. This is common in large multi-module libraries such as the JDK. For example, the [java.sql](https://docs.oracle.com/en/java/javase/22/docs/api/java.sql/module-summary.html) module provides database access via its java.sql and javax.sql packages, but one of its interfaces, [java.sql.SQLXML](https://docs.oracle.com/en/java/javase/22/docs/api/java.sql/java/sql/SQLXML.html), declares public methods whose signatures use interfaces from the javax.xml.transform package in the [java.xml](https://docs.oracle.com/en/java/javase/22/docs/api/java.xml/module-summary.html) module. Developers who call these methods in java.sql.SQLXML typically import both the java.sql package and the javax.xml.transform package. To facilitate this extra import, the java.sql module depends on the java.xml module [transitively](https://dev.java/learn/modules/i mplied-readability/), so that a program which depends on the java.sql module depends automatically on the java.xml module. > > Unless I have made an error, the existing branch does not do this. I've added a test to my fork (see [301582f](https://github.com/apache/groovy/commit/301582fa4d7337f8eff7643ec3cd05e68e4e20e5)) that demonstrates the issue. > > This is part of what makes me think we may well need specific semantics for the AST of module imports. There are additional expectations built into the JEP that make me think we'd need some specific things to handle them properly. Nice catch @jonnybot0! I updated the PR to include this ability. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
