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

'javac' compile fine but 'java' thrown a VerifyError

XMLWordPrintable

    • generic
    • generic



      Name: igT44549 Date: 02/09/99

      =20
      I not sure in which category should be this bug report.
      Please compile and run the code below:

      class Test
      {
          // Static constructor. If you don't put the second 'println'
          // in a "try-catch" statement, the bug disaspear.
          {
              System.out.println("Start static initializer");
      =09try
      =09{
              =09System.out.println(Test.class);
      =09}
      =09catch (Exception exception)
      =09{
      =09=09exception.printStackTrace();
      =09}
              System.out.println("Finished static initializer");
          }

          Test()
          {}

          // If you comment out this constructor,
          // the bug disaspear.
          Test(String parent)
          {}

          static void main(String[] args)
          {new Test();}
      }

      Compile this code using 'javac Test.java'. Everything goes fine.
      Now run this code using 'java Test'. We get the following error:

      Exception in thread "main" java.lang.VerifyError:
      (class: Test, method: <init> signature: (Ljava/lang/String;)V)
      Incompatible object argument for function call

      The second constructor is not use anywhere. But if you comment it out, ever=
      ything compile and run fine. If the second constructor is not commented-out=
      , even if it is not used, just because it exist the virtual machine fail to=
       run this code.
      (Review ID: 48650)
      ======================================================================

            wmaddoxsunw William Maddox (Inactive)
            iris Iris Clark
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: