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/17 19:47:00 UTC
[jira] [Updated] (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 ]
Eric Milles updated GROOVY-8715:
--------------------------------
Summary: Cannot resolve array of inner class from type in same package (no import) (was: Cannot Resolve Arrays of Inner Class)
> 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
> Time Spent: 10m
> 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)