[
https://issues.apache.org/jira/browse/GROOVY-8358?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Eric Milles resolved GROOVY-8358.
---------------------------------
Resolution: Fixed
Works in Groovy 3 -- test cases added. Both cases are looking to outer types
of super class before outer types of outer class(es).
> Nested class resolution behaves differently depending on class order
> --------------------------------------------------------------------
>
> Key: GROOVY-8358
> URL: https://issues.apache.org/jira/browse/GROOVY-8358
> Project: Groovy
> Issue Type: Bug
> Reporter: Daniil Ovchinnikov
> Priority: Critical
>
> {code}
> package bugs
> class Outer implements OuterI {
> static class Current extends CurrentParent {
> static usage() {
> new Target()
> }
> }
> }
> class CurrentParent implements CurrentParentI {}
> interface CurrentParentI {
> static class Target {}
> }
> interface OuterI {
> static class Target {}
> }
> println Outer.Current.usage() // bugs.OuterI$Target@3eb7fc54
> {code}
> If {{CurrentParent}} definition is moved before {{Outer}}, then {{new
> Target}} will be resolved to {{bugs.CurrentParentI$Target}}:
> {code}
> package bugs
> class CurrentParent implements CurrentParentI {}
> class Outer implements OuterI {
> class Current extends CurrentParent {
> static usage() {
> new Target()
> }
> }
> }
> interface CurrentParentI {
> static class Target {}
> }
> interface OuterI {
> static class Target {}
> }
> println Outer.Current.usage() // bugs.CurrentParentI$Target@3eb7fc54
> {code}
> Moving classes must not affect results of compilation.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)