You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Eric Milles (Jira)" <ji...@apache.org> on 2020/07/13 18:46:00 UTC
[jira] [Resolved] (GROOVY-8364) Nested class of parent Java class
is not resolved
[ https://issues.apache.org/jira/browse/GROOVY-8364?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Eric Milles resolved GROOVY-8364.
---------------------------------
Resolution: Fixed
Fixed as part of or before Groovy 2.4
> 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
> Priority: Major
>
> {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
(v8.3.4#803005)