You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by GitBox <gi...@apache.org> on 2020/07/18 23:20:16 UTC

[GitHub] [groovy] eric-milles commented on pull request #1318: GROOVY-5103: allow plain star imports to pick up static inner types

eric-milles commented on pull request #1318:
URL: https://github.com/apache/groovy/pull/1318#issuecomment-660556422


   > ... your patch doesn't extend to another "exotic" case we currently support.
   > 
   > ```
   > import java.util.Map as SomeMap
   > import static SomeMap.Entry as SomeEntry
   > 
   > assert SomeEntry instanceof Class
   > ```
   > 
   > works but not without the static. It is also somewhat unusual but accounts for aliases to some degree and we have supported it for along time too. We can cover that off separately.
   
   If you wanted to shut down this "exotic" behavior, you could change this bit:
   ```
       public void visitClass(final ClassNode node) {
           ...
               for (ImportNode importNode : module.getStaticImports().values()) {
                   ClassNode type = importNode.getType();
                   if (resolve(type, true, true, true)) continue; // set flags to "false, false, true" to not use other imports to help resolve this import
                   addError("unable to resolve class " + type.getName(), type);
               }
   ```
   
   Just an option to consider.  I don't think anyone coming into the language is expecting one import to influence another.


----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org