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

CompileStatic cannot cast int to char

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.0.5
    • 2.0.6
    • Static compilation
    • None

    Description

      @groovy.transform.CompileStatic
      char m( int v ) {
        char c = (char)v
        c
      }
      
      println m( 65 )
      

      Gives:

      [Static type checking] - Inconvertible types: cannot cast int to char
      

      Removing CompileStatic or just doing:

      @groovy.transform.CompileStatic
      char m( int v ) {
        v
      }
      
      println m( 65 )
      

      Works

      Attachments

        Issue Links

          Activity

            People

              melix Cédric Champeau
              tim_yates Tim Yates
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: