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

Cannot use @CompileStatic with Thread.start method

    XMLWordPrintableJSON

Details

    Description

      Example:

      @groovy.transform.CompileStatic
      def foo() {
        Thread.start {
            println "boo"
        }
      }
      
      foo()
      

      Produces

      org.codehaus.groovy.runtime.typehandling.GroovyCastException: Cannot cast object 'class java.lang.Thread' with class 'java.lang.Class' to class 'java.lang.Thread'
      	at org.codehaus.groovy.runtime.typehandling.DefaultTypeTransformation.castToType(DefaultTypeTransformation.java:360)
      	at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.castToType(ScriptBytecodeAdapter.java:599)
      
      

      Attachments

        Activity

          People

            guillaume Guillaume Sauthier
            graemerocher Graeme Rocher
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: