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

Static Type checker reporting invalid error

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Critical
    • Resolution: Fixed
    • 2.0-beta-3
    • 2.0-beta-3
    • Static Type Checker
    • None
    • java 7, groovy 2.0-beta-3-snapshot

    Description

      ClassA.java
      public class ClassA<T> {
          <X> Class<X> foo(Class<X> classType){
              return classType;
          }
      }
      
      ClassB.groovy
      import groovy.transform.CompileStatic
      
      @CompileStatic
      class ClassB {
          void bar() {
              def ClassA<Long> a = new ClassA<Long>();
              a.foo(this.getClass());
          }
      }
      

      ClassB.groovy: 13: [Static type checking] - Cannot find matching method ClassA#foo(java.lang.Class <java.lang.Object extends java.lang.Object>)
      @ line 13, column 9.
      a.foo(this.getClass());
      ^

      Attachments

        Activity

          People

            melix Cédric Champeau
            mmrath Murali Mohan Rath
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: