Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
2.2.1, 2.3.0
-
None
Description
the static compiled script
def i="d"
def tmp = {i=1}
tmp()
i.MAX_VALUE
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.