[ https://issues.apache.org/jira/browse/GROOVY-8364?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Daniil Ovchinnikov updated GROOVY-8364: --------------------------------------- Description: {code:title=bugs/A.java} package bugs; public class A { public interface Inner {} } {code} {code:title=bugs/B.java} package bugs; public class B { public interface Inner {} } {code} {code:title=bugs/test/test.groovy} package bugs.test import bugs.A //import static bugs.B.Inner class Current extends A { static usage() { return Inner // here } } println Current.usage() {code} {noformat} Apparent variable 'Inner' was found in a static scope but doesn't refer to a local variable, static field or class. Possible causes: You attempted to reference a variable in the binding or an instance variable from a static context. You misspelled a classname or statically imported field. Please check the spelling. You attempted to use a method 'Inner' but left out brackets in a place not allowed by the grammar. @ line 8, column 12. return Inner ^ {noformat} Note the class could be resolved only via import. Now try to uncomment a static import. While usually the nested class takes precedence over an import, in this case the failure to resolve a nested class results in a silent resolution to {{bugs.B.Inner}}, i.e. no error is reported. In both cases the reference is expected to be resolved to {{bugs.A.Inner}} was: {code:title=bugs/A.java} package bugs; public class A { public interface Inner {} } {code} {code:title=bugs/B.java} package bugs; public class B { public interface Inner {} } {code} {code:title=bugs/test/test.groovy} package bugs.test import bugs.A //import static bugs.B.Inner class Current extends A { static usage() { return Inner // here } } println Current.usage() {code} {noformat} Apparent variable 'Inner' was found in a static scope but doesn't refer to a local variable, static field or class. Possible causes: You attempted to reference a variable in the binding or an instance variable from a static context. You misspelled a classname or statically imported field. Please check the spelling. You attempted to use a method 'Inner' but left out brackets in a place not allowed by the grammar. @ line 8, column 12. return Inner ^ {noformat} Note the class could be resolved only via import. Now try to uncomment a static import. While usually the nested class takes precedence over an import, in this case the failure to resolve a nested class results in a silent resolution to {{bugs.B.Inner}}, i.e. no error is reported. > Nested class of parent Java class is not resolved > ------------------------------------------------- > > Key: GROOVY-8364 > URL: https://issues.apache.org/jira/browse/GROOVY-8364 > Project: Groovy > Issue Type: Bug > Reporter: Daniil Ovchinnikov > > {code:title=bugs/A.java} > package bugs; > public class A { > public interface Inner {} > } > {code} > {code:title=bugs/B.java} > package bugs; > public class B { > public interface Inner {} > } > {code} > {code:title=bugs/test/test.groovy} > package bugs.test > import bugs.A > //import static bugs.B.Inner > class Current extends A { > static usage() { > return Inner // here > } > } > println Current.usage() > {code} > {noformat} > Apparent variable 'Inner' was found in a static scope but doesn't refer to a > local variable, static field or class. Possible causes: > You attempted to reference a variable in the binding or an instance variable > from a static context. > You misspelled a classname or statically imported field. Please check the > spelling. > You attempted to use a method 'Inner' but left out brackets in a place not > allowed by the grammar. > @ line 8, column 12. > return Inner > ^ > {noformat} > Note the class could be resolved only via import. > Now try to uncomment a static import. > While usually the nested class takes precedence over an import, in this case > the failure to resolve a nested class results in a silent resolution to > {{bugs.B.Inner}}, i.e. no error is reported. > In both cases the reference is expected to be resolved to {{bugs.A.Inner}} -- This message was sent by Atlassian JIRA (v6.4.14#64029)