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

interface resolution is initiated inopportunely

    Details

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

      Description



      Name: szC45993 Date: 12/12/97



      The Java Virtual Machine, chapter 5 Constant Pool Resolution,
      introduction, says:

      "Constant pool resolution is normally initiated by the execution of
      a Java Virtual Machine instruction that references the constant pool."

      The JCK test below uses invalid interface (Common00202i.jasm with
      verification stage error: invalid field name) to determine the moment of the
      interface resolution. This test shows that verification exception is not thrown
      from the try block that contains instruction initiating interface resolution
      (see ClassInterf01102.java for beginning):

      novo7% setenv CLASSPATH /export/home/JAVA/workdir/classes:/export/home/JAVA/sqe_my/harness_release/classes
      novo7% /export/ld14/java/dest/jdk1.2Z/solaris/bin/java -verify javasoft.sqe.tests.vm.constantpool.Common002.Common00202.Common00202
      java.lang.ClassFormatError: javasoft/sqe/tests/vm/constantpool/Common002/Common00202/Common00202i (Illegal Field name "f^l^d")
      novo7%

      SOURCES:

      --------------------- ClassInterf01102.java
      //File: @(#)Common00202.java 1.1 97/12/11
      //Copyright 12/11/97 Sun Microsystems, Inc. All Rights Reserved

      package javasoft.sqe.tests.vm.constantpool.Common002.Common00202;

      import java.io.PrintStream;

      public class Common00202 {

        public static int run(String argv[], PrintStream out) {

      try {
      ((Common00202i) new Common00202n()).mtd();
      out.println("test Common00202 failed to reject bad classfile Common00202i");
      } catch (Throwable e) {
      out.println("test Common00202 exception:"+e.toString()+" while loading bad classfile Common00202i");
        return 0;
          }

          return 2;
        }

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

      }

      --------------------- Common00202i.jasm
      //File: @(#)Common00202i.jasm 1.1 97/12/11
      //Copyright 12/11/97 Sun Microsystems, Inc. All Rights Reserved

      package javasoft/sqe/tests/vm/constantpool/Common002/Common00202;

      abstract interface Common00202i
      {
      // Compiled from "Common00202i.java"
      // Compiler version 3.45;

      public static final Field "f^l^d":I = int 333;

      public abstract Method mtd:"()V";

      } // end Class Common00202i

      --------------------- Common00202n.jasm
      //File: @(#)Common00202n.jasm 1.1 97/12/11
      //Copyright 12/11/97 Sun Microsystems, Inc. All Rights Reserved

      package javasoft/sqe/tests/vm/constantpool/Common002/Common00202;

      public super class Common00202n
      implements Common00202i
      {
      // Compiled from "Common00202n.java"
      // Compiler version 3.45;

      public static Field field:"Ljavasoft/sqe/tests/vm/constantpool/Common002/Common00202/Common00202n;";

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

      public Method mtd:"()V"
      stack 2 locals 1
      {
      new class Common00202n;
      dup;
      invokespecial Method "<init>":"()V";
      putstatic Field field:"Ljavasoft/sqe/tests/vm/constantpool/Common002/Common00202/Common00202n;";
      return;
      }

      } // end Class Common00202n
      ---------------------

      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: