Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4978051

jvm rejects code generated by javac

    XMLWordPrintable

Details

    • generic
    • generic

    Description



      Name: viR10068 Date: 01/14/2004


      The spec for autoboxing says:
      "JLS 5.1.8. Unboxing conversion
      Unboxing conversion converts values of reference type to corresponding values
      of primitive type. The precise rules are as follows:
       - If r is a reference of type Boolean, then unboxing conversion converts r
         into r.booleanValue(). ...
      And:
      "If an array initializer is provided, the newly allocated array will be
      initialized with the values provided by the array initializer as described in 10.6."

      The compiler successfully generates code for the unboxing the Boolean value
      in the array initializer. But the JVM rejects this code with the VerifyError.

      The source:
      ------------------ Test.java -------------------
      class Test {

          public static void main(String args[]) {
              final boolean [] a = {Boolean.FALSE};
          }
      }
      ------------------------------------------------

      The output:
      % jdk1.5.0-b33/solaris-sparc/bin/javac -source 1.5 -target 1.5 Test.java &&
      jdk1.5.0-b33/solaris-sparc/bin/java -Xfuture -showversion Test
      java version "1.5.0-beta2"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-beta2-b33)
      Java HotSpot(TM) Client VM (build 1.5.0-beta2-b33, mixed mode)

      Exception in thread "main" java.lang.VerifyError: (class: Test, method: main signature:
      ([Ljava/lang/String;)V) Expecting to find integer on stack
      %

      ======================================================================

      Attachments

        Issue Links

          Activity

            People

              gafter Neal Gafter
              vivsunw Viv Viv (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: