You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Paul King (Jira)" <ji...@apache.org> on 2020/07/18 12:18:00 UTC
[jira] [Resolved] (GROOVY-8715) Cannot resolve array of inner class
from type in same package (no import)
[ https://issues.apache.org/jira/browse/GROOVY-8715?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Paul King resolved GROOVY-8715.
-------------------------------
Fix Version/s: 3.0.5
4.0.0-alpha-1
Resolution: Fixed
Proposed PR merged. Thanks all.
> Cannot resolve array of inner class from type in same package (no import)
> -------------------------------------------------------------------------
>
> Key: GROOVY-8715
> URL: https://issues.apache.org/jira/browse/GROOVY-8715
> Project: Groovy
> Issue Type: Bug
> Affects Versions: 3.0.0-alpha-3, 2.5.0, 3.0.0, 3.0.1
> Reporter: Ian
> Assignee: Eric Milles
> Priority: Major
> Fix For: 4.0.0-alpha-1, 3.0.5
>
> Time Spent: 40m
> Remaining Estimate: 0h
>
> Two files in the 'pkg' package:
> {code:java|title=MyClass.groovy}
> package pkg
> class HasClass { static class MyClass {} }
> {code}
>
> {code:java|title=HasClass.groovy}
> package pkg
> private static void foo(HasClass.MyClass... val) {}
> //pkg.HasClass.MyClass[] val // Also Fails
> //pkg.HasClass.MyClass val // Does not fail
> {code}
> Results in the following error:
>
> {code:java}
> /home/ianl/IdeaProjects/VariousGroovy/src/main/groovy/pkg/UsesClass.groovy: 3: unable to resolve class HasClass.MyClass[]
> @ line 3, column 25.
> private static void foo(HasClass.MyClass... val) {}
> ^
> {code}
> This fails only for arrays, not single references. It does not occur if the files are in the default package.
> It is also possible to work around it with a static import:
>
> {code:java|title=HasClass.groovy}
> package pkg
> import static HasClass.MyClass // Now it doesn't fail
> private static void foo(MyClass... val) {}
> {code}
--
This message was sent by Atlassian Jira
(v8.3.4#803005)