Svatopluk Dedic created NETBEANS-5945:
-----------------------------------------
Summary: Groovy StaticTypeCheckingVisitor evaluates String
assignment as Object type
Key: NETBEANS-5945
URL: https://issues.apache.org/jira/browse/NETBEANS-5945
Project: NetBeans
Issue Type: Bug
Components: groovy - Editor
Reporter: Svatopluk Dedic
Conside the following Groovy completion testcase:
{code:java}
class Klazz { def fieldA = new String("Hello")
def fieldA1 = "Hello"
def fieldB = fieldA.c
def fieldB1 = fieldA1.c
def fieldC = fieldA.concat("b").c
def fieldC1 = fieldA1.concat("b").c
def fieldD = "hi"
def fieldE = fieldA.concat(fieldD)
def fieldE1 = fieldA1.concat(fieldD)
def fieldF = fieldE.c
def fieldF1 = fieldE1.c
def m() {
def localA = "Hello"
localA.c
localA.concat("b").c
def localB = "hi"
localA.concat(localB).c
def localC = localA.concat(localB)
localC.c
}
}
{code}
*fieldA* is inferred to be java.lang.Object; but it is String all the time.
Maybe the parser uses Visitor in some screwed way, or the visitor must be
somehow augmented or fixed to handle this case ?
--
This message was sent by Atlassian Jira
(v8.3.4#803005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists