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

Compile static: report null assignments to variables with primitive types

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.1.1
    • 2.1.2
    • Static Type Checker
    • None

    Description

      @CompileStatic
      def foo() {
          boolean b = null  //register error here
          print b
      }
      
      foo()
      

      I get this at runtime

      Caught: java.lang.VerifyError: (class: a/foo, method: foo signature: ()Ljava/lang/Object; ) Expecting to find integer on stack
      java.lang.VerifyError: (class: a/foo, method: foo signature: ()Ljava/lang/Object; ) Expecting to find integer on stack
      	at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)
      

      BTW quite confusing message

      Attachments

        Activity

          People

            melix Cédric Champeau
            mxm-groovy Maxim Medvedev
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: