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

VM let to declare several methods with the same signature in the same class.

    Details

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

      Description



      Name: akC45999 Date: 07/03/98



      The Java VM spec chapter "2.10.2 Signature" reads:
      ...
      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.

      But the attached test shows that VM doesn't reject a class containing
      several methods with the same signature.

      --------------------------------- methods00101z.java

      public class methods00101z {

        public static void main(String argv[]) {

      try{
      Class.forName("methods00101");
      System.exit(97);

      } catch (Throwable e) {
      System.exit(95);
      }
        }
      }

      --------------------------------- methods00101.jasm

      public class methods00101
      {

      static Method proc2:"(I)V" { return; }
      static Method proc2:"(I)V" { return; }

      } // end Class methods00101

      ------------------------------------- dotest

      #!/bin/sh
      TESTCLASSES=/opt/home/testclasses
      CLASSPATH=$TESTCLASSES
      export CLASSPATH

      jasm -d $TESTCLASSES methods00101.jasm
      javac -d $TESTCLASSES methods00101z.java
      java -verify methods00101z;

      echo res=$?

      ----------------------------------------
      Running the test:

      novo48% dotest
      res=97
      novo48%

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

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

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Imported:
                  Indexed: