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

VM throws an error "java.lang.VerifyError" (-target 1.4 versus inner cls)

    XMLWordPrintable

Details

    • beta2
    • generic
    • generic
    • Verified

    Description

      VM throws error "java.lang.VerifyError" when I use a class which is compiled with "-target 1.4" but it works fine if the class is not compiled with "-target 1.4" option.

      ******************
      javasupport2:/home/sulthanm/feb16/javac/tests/src 22 % java -version
      java version "1.4.0-beta"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-beta-b52)
      Java HotSpot(TM) Client VM (build 1.4beta-B52, mixed mode)
      javasupport2:/home/sulthanm/feb16/javac/tests/src 23 % javac A.java B.java
      Note: A.java uses or overrides a deprecated API.
      Note: Recompile with -deprecation for details.
      javasupport2:/home/sulthanm/feb16/javac/tests/src 24 % java A
      javasupport2:/home/sulthanm/feb16/javac/tests/src 25 % javac -target 1.4 A.java B.java
      Note: A.java uses or overrides a deprecated API.
      Note: Recompile with -deprecation for details.
      javasupport2:/home/sulthanm/feb16/javac/tests/src 26 % java A
      Exception in thread "main" java.lang.VerifyError: (class: A$1$Class_B, method: <init> signature: (LA;)V) Expecting to find object/array on stack
              at A.check_blk_decl(A.java:135)
              at A.check_access(A.java:197)
              at A.main(A.java:209)
      javasupport2:/home/sulthanm/feb16/javac/tests/src 27 %
      **********************

      How to reproduce
      ----------------
      1. javac -target 1.4 A.java B.java
      2. java A


      ** A.java B.java is attached

      In javac version 1.4, wrong byte code is generated in <init> method in certain situations. In this example, method <init> in class A$1$Class_B accesses instance field before calling any instance initialization method. This is not allowed according to the VM spec 2nd edition 4.8.2.

      Related bugid: 4408261

      wei.tao@eng 2001/3/29

      Attachments

        Issue Links

          Activity

            People

              gafter Neal Gafter
              duke J. Duke
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: