You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Daniil Ovchinnikov (JIRA)" <ji...@apache.org> on 2017/10/20 15:29:00 UTC
[jira] [Updated] (GROOVY-8358) Nested class resolution behaves
differently depending on class order
[ https://issues.apache.org/jira/browse/GROOVY-8358?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Daniil Ovchinnikov updated GROOVY-8358:
---------------------------------------
Summary: Nested class resolution behaves differently depending on class order (was: Inner class resolution behaves differently depending on class order)
> 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
(v6.4.14#64029)