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

vm permits to have methods with the same signature for a class

    Details

    • Subcomponent:
    • Resolved In Build:
      1.2fcs
    • CPU:
      sparc
    • OS:
      solaris_2.4, solaris_2.5.1
    • Verification:
      Not verified

      Description



      Name: szC45993 Date: 05/12/98



      The vm/instr/invokespecial/invokespecial011/invokespecial01101.html test shows
      that jdk1.2b4C vm permits to have methods with the same signature for a class.
      The vm spec, chapter 2.10.2 Signature, demands the following:

      "The signature of a method consists of the name of the method and the number and type of formal parameters (?2.10.1) to the method. A class may not declare two methods with the same signature."

      The vm spec does not define the vm behaviour if same signature methods
      have been found. It would be better if such behaviour will be explained
      clearly.

      The methods lookup procedure of the vm implementation selects the first
      method with a demanded signature. So, it may lead to different results
      of the test run under the changing of the same signature methods order.

      SOURCE:


      --------------------- invokespecial01101.jasm
      // Ident: %Z%%M% %I% %E%
      // Copyright %G% Sun Microsystems, Inc. All Rights Reserved
      package javasoft/sqe/tests/vm/invokespecial/invokespecial011/invokespecial01101;

      public class invokespecial01101
      extends java/lang/Object
      {

      static Field ret_flag:"I" = 2;

      //###################################################################
      //###################################################################
      //demanded method:
      private Method proc2:"(IIIIIIIIIIIIIIIIIIII)I"
      stack 1 locals 22
      {
      iconst_0;
      ireturn;
      }

      //others same signature methods:
      static Method proc2:"(IIIIIIIIIIIIIIIIIIII)I"
      stack 1 locals 22
      {
      iconst_2;
      ireturn;
      }

      public Method proc2:"(IIIIIIIIIIIIIIIIIIII)I"
      stack 1 locals 22
      {
      iconst_2;
      ireturn;
      }
      //###################################################################
      //###################################################################

      public static Method proc1:"()V"
      stack 25 locals 4
      {

      iconst_5;
      new class invokespecial01101;
      dup;

      invokespecial Method <init>:"()V";

      iconst_1;
      iconst_1;
      iconst_1;
      iconst_1;
      iconst_1;
      iconst_1;
      iconst_1;
      iconst_1;
      iconst_1;
      iconst_1;
      iconst_1;
      iconst_1;
      iconst_1;
      iconst_1;
      iconst_1;
      iconst_1;
      iconst_1;
      iconst_1;
      iconst_1;
      iconst_1;
      invokespecial Method proc2:"(IIIIIIIIIIIIIIIIIIII)I"; // "The named class and method are resolved."
      putstatic Field ret_flag:"I";
      iconst_5;
      if_icmpeq L1;
      L2: iconst_2;
      putstatic Field ret_flag:"I";
      L1: return;
      }

      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 run:"([Ljava/lang/String;Ljava/io/PrintStream;)I";
      bipush 95/*STATUS_TEMP*/;
      iadd;
      invokestatic Method java/lang/System.exit:"(I)V";
      return;
      }

      public static Method run:"([Ljava/lang/String;Ljava/io/PrintStream;)I"
      stack 1 locals 4
      {
      invokestatic Method proc1:"()V";
      getstatic Field ret_flag:"I";
      ireturn;
      }

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

      } // end Class invokespecial01101
      ======================================================================

      Hook 5(hook5): test

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

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                hongzh Hong Zhang
                Reporter:
                zsssunw Zss Zss (Inactive)
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Imported:
                  Indexed: