[jira] [Created] (GROOVY-8640) Cannot find matching comparator method

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[jira] [Created] (GROOVY-8640) Cannot find matching comparator method

JIRA jira@apache.org
paolo di tommaso created GROOVY-8640:
----------------------------------------

             Summary: Cannot find matching comparator method
                 Key: GROOVY-8640
                 URL: https://issues.apache.org/jira/browse/GROOVY-8640
             Project: Groovy
          Issue Type: Bug
          Components: Static compilation
    Affects Versions: 2.5.0
            Reporter: paolo di tommaso


The following class static compilation fails
{code:java}
@CompileStatic
class Test  {

    static private int MAX_LINES = 100

    private static class Nested  {

        @Delegate
        private Map<String,Object> delegate = [:]

        private String fetch(Path path) {
            int c=0
            def result = new StringBuilder()
            path.withReader { reader ->
                String line
                while( (line=reader.readLine()) && c++<MAX_LINES ) {
                    result << line
                }
            }

            result
        }
    }
}{code}
 

Reported error: 
{code:java}
Test.groovy: 45: [Static type checking] - Cannot find matching method java.lang.Integer#compareTo(java.lang.Object). Please check if the declared type is correct and if the method exists.

@ line 45, column 55.

   line=reader.readLine()) && c++<MAX_LINES

                                 ^{code}
 



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)