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

Daniel Sun commented on GROOVY-8263:
------------------------------------

Fixed on master; added a regression test in 
8d7589fa7cbeb534d77d75e9553906587b135be1 
(https://github.com/apache/groovy/commit/8d7589fa7cbeb534d77d75e9553906587b135be1).

> Import alias introduces weird property
> --------------------------------------
>
>                 Key: GROOVY-8263
>                 URL: https://issues.apache.org/jira/browse/GROOVY-8263
>             Project: Groovy
>          Issue Type: Bug
>          Components: Compiler
>    Affects Versions: 2.4.12
>            Reporter: Daniil Ovchinnikov
>            Assignee: Daniel Sun
>            Priority: Major
>             Fix For: 7.0.0-alpha-1
>
>
> {code:title=com/foo/Bar.java}
> package com.foo;
> public class Bar {
>     public static Object getSome() {return 42;}
> }
> {code}
> {code:title=playground.groovy}
> import static com.foo.Bar.some as getAbc
> println abc // 42
> println getAbc
> println getGetAbc()
> {code}
> AFAIU an alias introduces property into a file which is being compiled (in 
> this case {{getAbc}} and {{getGetAbc()}} become valid). This works as 
> expected.
> But {{abc}} should fail with MPE, instead it's actually resolved into a 
> {{getSome()}}.
> This happens when alias is itself a valid getter name.
> Is it a bug or a feature?
> One more thing to consider.
> Given {{abc}} is valid, {{getAbc()}} should be valid too. Instead it behaves 
> like {{getAbc.call()}}. 



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to