Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
-
None
-
None
-
None
Description
bugs/A.java
package bugs; public class A { public interface Inner {} }
bugs/B.java
package bugs; public class B { public interface Inner {} }
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()
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 ^
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
Attachments
Issue Links
- is related to
-
GROOVY-8359 Nested class is not resolved if compiled separately
- Closed