You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "paolo di tommaso (JIRA)" <ji...@apache.org> on 2018/06/12 06:08:00 UTC

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

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)