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

(1.1) IncompatibleClassChangeError when implementation of an interface method

XMLWordPrintable

    • sparc
    • solaris_2.4



      Name: akC45999 Date: 03/09/98



      Though the Java Language Specification requires that a concrete method wich implements
      interface method must be public, the Java Virtual Machine Specification does not
      require this. Instead, it states that IllegalAccessError would be thrown
      when the method is accessed with invokeinterface instruction.

      The test below does not use invokeinterface instruction and so does not expect any
      exception to be thrown.

      However, JDK1.1.6 throws IncompatibleClassChangeError: Unimplemented interface method.

      Note that jdk1.2 passes the test.

      The test consists of two files, cplmbr02302.java and cplmbr02302i.java.
      Note that interface cplmbr02302i is declared in both files as different variants
      of it are used.

      ========================== cplmbr02302i.java
      // package javasoft.sqe.tests.vm.classfmt.cpl.cplmbr023;

      interface cplmbr02302i {
        void m();
      }
      ========================== cplmbr02302.java
      // package javasoft.sqe.tests.vm.classfmt.cpl.cplmbr023;

      import java.io.PrintStream;

      interface cplmbr02302i {
      // void m();
      }

      class cplmbr02302p implements cplmbr02302i {
      // public
        void m() { }

        cplmbr02302p() {
      m();
        }

      } // end Class cplmbr02302p


      public class cplmbr02302 {

        public static int run(String argv[], PrintStream out) {
      Class goodClass;
      try {
      goodClass = Class.forName("cplmbr02302p");
      } catch (Throwable e) {
      out.println("test cplmbr02302 failed to load good classfile cplmbr02302p:"+e.toString());
      return 2;
      }
      try {
      Object obj=goodClass.newInstance();
      return 0;
      } catch (Throwable e) {
      out.println("test cplmbr02302 failed to instantiate good classfile cplmbr02302p:"+e.toString());
      return 2;
      }
      }

        public static void main(String args[]) {
      System.exit(run(args, System.out) + 95/*STATUS_TEMP*/);
        }

      }

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

      to run the test, first compile cplmbr02302.java and then
      cplmbr02302i.java separately.

      novo64% setenv CLASSPATH .
      novo64% javac cplmbr02302.java
      novo64% javac cplmbr02302i.java
      novo64% java cplmbr02302
      test cplmbr02302 failed to load good classfile cplmbr02302p:java.lang.IncompatibleClassChangeError: Unimplemented interface method
      novo64%


       

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

            Unassigned Unassigned
            rfqsunw Rfq Rfq (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: