You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@netbeans.apache.org by "Svatopluk Dedic (Jira)" <ji...@apache.org> on 2021/08/23 11:15:00 UTC

[jira] [Created] (NETBEANS-5945) Groovy StaticTypeCheckingVisitor evaluates String assignment as Object type

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: commits-unsubscribe@netbeans.apache.org
For additional commands, e-mail: commits-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists