Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-6135

Groovy classes with @CompileStatic can't infer generic types in some cases

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.1.3
    • Fix Version/s: 2.3.0
    • Component/s: Static compilation
    • Labels:
      None
    • Environment:
      Windows 7, Java 1.6, Groovy 2.1.3

      Description

      The following gives a compiler error:

      import javax.xml.ws.Holder
      
      @groovy.transform.CompileStatic
      class MyClass {
          public static void main(String[] args) {
              Holder<Integer> holder = new Holder<Integer>()
              holder.value = 5
              println holder.value > 4
          }
      }
      

      [Static type checking] - Cannot find matching method java.lang.Object#compareTo(int). Please check if the declared type is right and if the method exists.

        Attachments

          Activity

            People

            • Assignee:
              blackdrag Jochen Theodorou
              Reporter:
              bborchardt Brett Borchardt
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: