Skip to content

Braces not correctly matched in Groovy due to closures #139

@Mahesha999

Description

@Mahesha999

I have Eclipse Luna (Service Release 1a (4.4.1)) with following plugins installed:

Groovy-Eclipse Feature
Groovy Compiler 2.0 Feature 2.9.1.xx-201412191752-e44
Grails IDE 3.6.3.201411271013-RELEASE

I have a simple class:

class Utilities 
{
    public static boolean hasValue(List list){
        return !(list == null || list.isEmpty());
    }
}

Another simple class:

class Test2 {        
    static main(def args)
    {
        def var1 = [2]        
        if(Utilities.hasValue((List)var1)  //here one bracket is less but still compiler does not give any error
        {
            println "hello"               
        }
    }
}

It is only when I run Test2, it gives me following exception:

No signature of method: static Utilities.hasValue() is applicable for argument types: (java.util.ArrayList, Test2$_main_closure1)

Also when I add another if() to Test2, then it gives not much sensing error description:

class Test2 {        
    static main(def args)
    {
        def var1 = [2]        
        if(Utilities.hasValue((List)var1)  
        {
            println "hello"               
        }
        if(true) { }  //Groovy:Expecting '}', found 'if'
    }
}

I tried same in Groovy/Grails Tool Suite (which is also eclipse based) by GoPivotal v 3.3.0.RELEASE. It also gives same error.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions