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

    Details

    • Subcomponent:
    • Resolved In Build:
      1.2fcs
    • CPU:
      sparc
    • OS:
      solaris_2.4
    • Verification:
      Verified

      Description



      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%

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

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

        Attachments

          Activity

            People

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

              Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: