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

JVM does not detect abstract method in non-abstract class

    Details

    • Subcomponent:
    • CPU:
      sparc
    • OS:
      solaris_2.5

      Description



      Name: szC45993 Date: 03/18/98



      The JCK
      vm/concepts/execution/execution010/execution01002/execution01002.html
      test shows that jvm last releases (jdk1.1.6J and jdk1.2b3L) do not detect
      the abstract method which is erroneously placed in the non-abstract
      class, see LOG below. The test works fine in JDK1.2P.
      The jvm spec says about it, for example, in 2.16.3 Linking: Verification,
      Preparation, and Resolution:

      "Java implementations must detect the following error during preparation:

      AbstractMethodError: A class that is not declared to be abstract has an
      abstract method."

      ========================================== LOG:
      novo7% setenv CLASSPATH /export/home/JAVA/workdir/classes:/export/home/JAVA/sqe_my/harness_release/classes
      novo7% /export/ld14/java/dest/jdk1.1.6J/solaris/bin/java -verify javasoft.sqe.tests.vm.constantpool.execution010.execution01002.execution01002
      novo7% echo $status
      95
      novo7% /export/ld14/java/dest/jdk1.2b3L/solaris/bin/java -verify javasoft.sqe.tests.vm.constantpool.execution010.execution01002.execution01002
      novo7% echo $status
      95
      novo7% /export/ld14/java/dest/jdk1.2P/solaris/bin/java -verify javasoft.sqe.tests.vm.constantpool.execution010.execution01002.execution01002
      java.lang.AbstractMethodError: proc
      novo7% echo $status
      1
      novo7%

      ========================================== SOURCE:

      --------------------- execution01002.jasm
      //File: @(#)execution01002.jasm 1.3 97/07/22
      //Copyright 07/22/97 Sun Microsystems, Inc. All Rights Reserved
      package javasoft/sqe/tests/vm/constantpool/execution010/execution01002;

      public super class execution01002
      {
      // Compiled from execution01002.java
      // Compiler version 3.45;


      //#################################################################
      abstract public Method proc:"()V"; //The following error must be detected on the preparation stage: abstract method is contained into non-abstract class
      //#################################################################

      public static Method run:"([Ljava/lang/String;Ljava/io/PrintStream;)I"
      stack 2 locals 2
      {
      aload_1;
      ldc String "Could not setup test.";
      invokevirtual Method java/io/PrintStream.println:"(Ljava/lang/String;)V";
      iconst_0;
      ireturn;
      }

      public static Method run2:"([Ljava/lang/String;Ljava/io/PrintStream;)I"
      stack 1 locals 2
      {
      iconst_0;
      ireturn;
      }

      public static Method main:"([Ljava/lang/String;)V"
      stack 2 locals 1
      {
      aload_0;
      getstatic Field java/lang/System.out:"Ljava/io/PrintStream;";
      invokestatic Method run2:"([Ljava/lang/String;Ljava/io/PrintStream;)I";
      bipush 95;
      iadd;
      invokestatic Method java/lang/System.exit:"(I)V";
      return;
      }

      public Method <init>:"()V"
      stack 1 locals 1
      {
      aload_0;
      invokespecial Method java/lang/Object.<init>:"()V";
      return;
      }

      } // end Class execution01002
      ---------------------

      Hook 5(hook5): test

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

        Attachments

          Activity

            People

            • Assignee:
              sliangsunw Sheng Liang (Inactive)
              Reporter:
              zsssunw Zss Zss (Inactive)
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Imported:
                Indexed: