[ 
https://issues.apache.org/jira/browse/GROOVY-6591?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Eric Milles resolved GROOVY-6591.
---------------------------------
    Fix Version/s: 5.0.0-alpha-1
       Resolution: Fixed

The error message reflects the LUB types now:
{code}
No such property: MAX_VALUE for class: (java.io.Serializable or 
java.lang.Comparable or java.lang.constant.Constable or 
java.lang.constant.ConstantDesc)
{code}

> error message glitch for LUB
> ----------------------------
>
>                 Key: GROOVY-6591
>                 URL: https://issues.apache.org/jira/browse/GROOVY-6591
>             Project: Groovy
>          Issue Type: Bug
>          Components: Static Type Checker
>    Affects Versions: 2.2.1, 2.3.0
>            Reporter: Jochen Theodorou
>            Assignee: Eric Milles
>            Priority: Major
>             Fix For: 5.0.0-alpha-1
>
>
> the static compiled script {code:Java}def i="d"
> def tmp = {i=1}
> tmp()
> i.MAX_VALUE{code}
> is supposed to give an error message mentioning the open block usage and the 
> LUB, but not this: "No such property: MAX_VALUE for class: java.lang.String"
> Using toUpperCase() instead of MAX_VALUE for example reports the correct 
> message:
> A closure shared variable [i] has been assigned with various types and the 
> method [toUpperCase()] does not exist in the lowest upper bound of those 
> types: [java.io.Serializable <? extends java.lang.Object>]. In general, this 
> is a bad practice (variable reuse) because the compiler cannot determine 
> safely what is the type of the variable at the moment of the call in a 
> multithreaded context.



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

Reply via email to