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

Static compilation fails around byte arrays

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Not A Problem
    • 2.3.0, 2.4.0-rc-1
    • None
    • Static compilation
    • None

    Description

      @groovy.transform.CompileStatic
      class Test {
          byte[] parseStructuredString(String s) {
              byte[] data = new byte[s.length() / 2];
              for (int i = 0; i < s.length(); i += 2) {
                  data[i / 2] = (byte) ((Character.digit(s.charAt(i), 16) << 4) + Character.digit(s.charAt(i+1), 16));
              }
              return data
          }
      }
      

      Error:(11, 13) Groovyc: [Static type checking] - Cannot find matching method [B#getAt(java.math.BigDecimal). Please check if the declared type is right and if the method exists.

      Error:(11, 27) Groovyc: [Static type checking] - Cannot assign value of type byte to variable of type byte[]

      Attachments

        Activity

          People

            daniel_sun Daniel Sun
            ddimitrov Dimitar Dimitrov
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: