[ 
https://issues.apache.org/jira/browse/GROOVY-8254?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17786100#comment-17786100
 ] 

Eric Milles commented on GROOVY-8254:
-------------------------------------

JLS 7.5.1 says it’s an error to import a name that is the same as a top-level 
type in the compilation unit. So maybe we should go there. Groovy does the last 
name wins thing, but maybe it is time to be a bit stricter. 

> Alias is ignored in constructor call
> ------------------------------------
>
>                 Key: GROOVY-8254
>                 URL: https://issues.apache.org/jira/browse/GROOVY-8254
>             Project: Groovy
>          Issue Type: Bug
>    Affects Versions: 2.4.12
>            Reporter: Daniil Ovchinnikov
>            Assignee: Eric Milles
>            Priority: Major
>              Labels: breaking, breaking_change
>             Fix For: 5.0.0-alpha-3
>
>
> {code:title=foo/Foo.groovy}
> package foo
> class Foo {}
> {code}
> {code:title=test/test.groovy}
> package test
> import foo.Foo as Bar
> class Bar {}
> def regular = new Bar()
> def anonymous = new Bar() {}
> println regular.class // class test.Bar
> println anonymous.class.superclass // class foo.Foo
> {code}
> Either both of the invocations should use alias or both of them should use 
> class defined in the same file. 



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to