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

VM let to declare several fields with the same name and descriptor in the same c

XMLWordPrintable

    • 1.2fcs
    • sparc
    • solaris_2.4
    • Verified



      Name: akC45999 Date: 07/15/98



      The Java VM spec chapter "4.5 Fields" reads:
      ...
      No two fields in one class file may have the same name and descriptor (4.3.2).

      But the attached test shows that VM doesn't reject a class containing
      several fields with the same name and descriptor.

      --------------------------------- fldsnd00101m.java

      public class fldsnd00101m {

        public static void main(String argv[]) {

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

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

      public class fldsnd00101
      {

      Field a:I;
      Field a:I;

      } // end Class fldsnd00101
      ------------------------------------- dotest

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

      jasm -d $TESTCLASSES fldsnd00101.jasm
      javac -d $TESTCLASSES fldsnd00101m.java
      java -verify fldsnd00101m;

      echo res=$?
      ----------------------------------------

      Running the test:

      novo49% dotest
      res=97
      novo49%

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

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

            hongzh Hong Zhang
            rfqsunw Rfq Rfq (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: