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

javac produces unverifiable classfile compiling conditional operator

XMLWordPrintable

    • hopper
    • generic
    • generic



        Name: poR10007 Date: 07/23/2001



        Javac (jdk1.4.0beta-b72) produces unverifiable code compiling the following
        tests:

        --Test1.java------------------------------------------------------
        public class Test1 {
            public static void main (String[] args) {
        boolean b = true, c = false;
        if ((b || true) ? c : !c) ;
            }
        }
        ------------------------------------------------------------------

        --Test2.java------------------------------------------------------
        public class Test2 {
            public static void main (String[] args) {
        boolean b = true, c = false;
        if ((c && false) ? b : b) ;
            }
        }
        ------------------------------------------------------------------

        --Execution log---------------------------------------------------
        $ java -version
        java version "1.4.0-beta_refresh"
        Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-beta_refresh-b72)
        Java HotSpot(TM) Client VM (build 1.4.0-beta_refresh-b72, mixed mode)
        $ javac -d . Test1.java Test2.java; echo $?
        0
        $ java Test1; echo $?
        Exception in thread "main" java.lang.VerifyError: (class: Test1, method: main signature: ([Ljava/lang/String;)V) Inconsistent stack
        height 0 != 1
        1
        $ java Test2; echo $?
        Exception in thread "main" java.lang.VerifyError: (class: Test2, method: main signature: ([Ljava/lang/String;)V) Inconsistent stack
        height 0 != 1
        1
        $
        ------------------------------------------------------------------

        The failure is reproducible since jdk1.4.0beta-b51.

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

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

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: