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

Modification of a private field in another class allowed by 1.1.1 VM.

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P2 P2
    • None
    • 1.1.1
    • hotspot
    • generic
    • solaris_2.5.1


      allan.jacobs@Eng 1997-05-22

      The JCK-111a test putfield01902 tests whether a class can set the
      private field Integer.value. The class returns with exit code 0
      instead of aborting. This is true for both green and native threads,
      JIT enabled and disabled, on both Sparc and x86 Solaris systems.

      algol% cat /net/mulder/export/mulder3/JCK-111a/tests/vm/instr/putfieldputfield019/putfield01902/putfield01902.jasm
      package javasoft/sqe/tests/vm/putfield/putfield019/putfield01902;

      public class putfield01902 {

      public static Method run:"([Ljava/lang/String;Ljava/io/PrintStream;)I"
      stack 3 locals 3
      {
      new class java/lang/Integer; dup;
      iconst_0;
      invokespecial java/lang/Integer.<init>:"(I)V";
      dup;
      iconst_0/*STATUS_PASSED*/; //negative test failed
      putfield java/lang/Integer.value:I;
      getfield java/lang/Integer.value:I;
      ireturn;
      }

      public static Method main:"([Ljava/lang/String;)V"
      stack 2 locals 1
      {
      aload_0;
      getstatic java/lang/System.out:"Ljava/io/PrintStream;";
      invokestatic run:"([Ljava/lang/String;Ljava/io/PrintStream;)I";
      invokestatic java/lang/System.exit:"(I)V";
      return;
      }

      }

      With native threads:

      algol% printenv CLASSPATH
      .:/net/mulder/export/mulder3/JCK-111a/classes
      algol% which java
      /usr/java/bin/java
      algol% java -fullversion
      java full version "jvm111_20n:97.05.20"
      algol% java -Djava.compiler=sunwjit -verify \ javasoft.sqe.tests.vm.putfield.putfield019.putfield01902.putfield01902
      algol% echo $status
      0
      algol% java -Djava.compiler=none -verify \ javasoft.sqe.tests.vm.putfield.putfield019.putfield01902.putfield01902
      algol% echo $status
      0

      After changing the JDK to green threads:

      algol% which java
      /usr/java/bin/java
      algol% java -fullversion
      java full version "jvm111_20g:97.05.20"
      algol% java -Djava.compiler=sunwjit -verify \ javasoft.sqe.tests.vm.putfield.putfield019.putfield01902.putfield01902
      algol% echo $status
      0
      algol% java -Djava.compiler=none -verify \ javasoft.sqe.tests.vm.putfield.putfield019.putfield01902.putfield01902
      algol% echo $status
      0

      On an x86, the situation is identical. First with native threads:

      x86-sirius% printenv CLASSPATH
      .:/net/mulder/export/mulder3/JCK-111a/classes
      x86-sirius% which java
      /usr/java/bin/java
      x86-sirius% java -fullversion
      java full version "jvm111_20n:97.05.20"
      x86-sirius% java -Djava.compiler=sunwjit -verify \ javasoft.sqe.tests.vm.putfield.putfield019.putfield01902.putfield01902
      x86-sirius% echo $status
      0
      x86-sirius% java -Djava.compiler=none -verify \ javasoft.sqe.tests.vm.putfield.putfield019.putfield01902.putfield01902
      x86-sirius% echo $status
      0

      Finally, on an x86 with green threads:

      x86-sirius% which java
      /usr/java/bin/java
      x86-sirius% java -fullversion
      java full version "jvm111_20g:97.05.20"
      x86-sirius% java -Djava.compiler=sunwjit -verify \ javasoft.sqe.tests.vm.putfield.putfield019.putfield01902.putfield01902
      x86-sirius% echo $status
      0
      x86-sirius% java -Djava.compiler=none -verify \ javasoft.sqe.tests.vm.putfield.putfield019.putfield01902.putfield01902
      x86-sirius% echo $status
      0

            nsaraiyasunw Nakul Saraiya (Inactive)
            ajacobssunw Allan Jacobs (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: