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

ReferenceType.isStatic() returns true for arrays

    Details

    • Subcomponent:
    • Resolved In Build:
      b04
    • CPU:
      generic
    • OS:
      generic

      Backports

        Description



        Name: abR10010 Date: 10/16/2001



        The specification for the method ReferenceType.isStatic():

            public boolean isStatic()
                Determines if this type was declared static.
                Only nested types, can be declared static,
                so false is returned for any
                package-level type, array type, or primitive class.
            Returns: true if this type is static; false otherwise.

        states that if the method is being invoked on a mirror of an array
        the returned value is false.

        However, a test shows that
        if an element type is InterfaceType or static ClassType
        the returned value is true.


        This unspecified result is observed
        when HS 1.4.0-beta-b83 is runnning a test program
        on the following H/S configurations:

         - SUNW Ultra1: sparc 200MHz, RAM 128Mb;
           OS: Solaris-8;
           JVM: Client & Server
         - Intel: 2-processor i686 600MHz processor, RAM 512Mb;
           OS: Solaris-8;
           JVM: Client & Server
         - Intel: 2-processor i686 600MHz processor, RAM 512Mb;
           OS: Linux/RedHat6.2;
           JVM: Client & Server
         - Intel: Pentium-II 350MHz, RAM 128Mb;
           OS: WinNT/4-Workstation;
           JVM: Client & Server


        Corresponding code fragments in a debugger and a debuggee
        and corresponding log for the tested case are below.


        Steps to reproduce the bug:
        1. cd /net/sqesvr.sfbay/export/vsn/GammaBase/Bugs/{this bug ID}
        2. sh doit.sh {JAVA_HOME}


            This bug affects the following testbase_nsk test:
            
            nsk/jdi/ReferenceType/isStatic/isstatic002


        The tests will be in the next release of testbase_nsk;
        the current release of testbase_nsk (1.4) is accessible through:

            /net/sqesvr.sfbay/export/vsn/VM/testbase/testbase_nsk.v14


        ///////////////////////////////////////////////////////////////////////

        // code fragments in the debugger

                   String names1[] = {

                              ".TestClass$NestedIface1[]", "f",
                              ".TestClass$NestedIface2[]", "f",
                              ".TestClass$StaticNestedClass[]", "f"
                    };

                    log2("----- Cases for testing: ReferenceTypes");
                    for (int i1 = 0; i1 < names1.length; i1 += 2) {

        String typeForCheck = mName + names1[i1];
        log2("......typeForCheck: " + typeForCheck);

        log2(" getting: List classList =
        vm.classesByName(typeForCheck);");
        List classList = vm.classesByName(typeForCheck);
        if (classList.size() != 1) {
        log3("ERROR: classList.size() != 1 : " + classList.size());
        testExitCode = FAILED;
        continue;
        }

        log2(" getting: ReferenceType referenceType =
        (ReferenceType) classList.get(0);");
        ReferenceType referenceType = (ReferenceType) classList.get(0);

        log2(" getting: boolean isStatic =
        referenceType.isStatic();");
        boolean isStatic = referenceType.isStatic();

                        if ( names1[i1+1].equals("t") ) {
                            log2(" expected value of isStatic is 'true'");
                            if (!isStatic) {
                                log3("ERROR: isStatic != true for: " + typeForCheck);
                                testExitCode = FAILED;
                            }
                        } else {
                            log2(" expected value of isStatic is 'false'");
                            if (isStatic) {
                                log3("ERROR: isStatic != false for: " + typeForCheck);
                                testExitCode = FAILED;
                            }
                        }
                    }

        -------------------------------------------------------------------------
        // code fragment in the debuggee

        class TestClass {

            interface NestedIface1 {
                boolean bnf = true;
            }
            static class NestedClass1 implements NestedIface1 {
                boolean bnc = true;
            }
            NestedIface1 nestedIfaceArray1[] = { new NestedClass1() };


            interface NestedIface2 {
                boolean bnf = true;
            }
            class NestedClass2 implements NestedIface2 {
                boolean bnc = true;
            }
            NestedIface2 nestedIfaceArray2[] = { new NestedClass2() };


            static class StaticNestedClass {
                boolean bsnc = true;
            }
            StaticNestedClass staticNestedClassArray[] = { new StaticNestedClass() };

        }
        ======================================================
        // log

        ==> nsk/jdi/ReferenceType/isStatic/isstatic002 TESTING BEGINS
        --> debugger: breakpointForCommunication
        debugee.stderr> **> debuggee: debuggee started!

        ==> nsk/jdi/ReferenceType/isStatic/isstatic002 :::::: case: # 0
        --> debugger: ----- Cases for testing: ReferenceTypes
        --> debugger: ......typeForCheck:
        nsk.jdi.ReferenceType.isStatic.TestClass$NestedIface1[]
        --> debugger: getting: List classList = vm.classesByName(typeForCheck);
        --> debugger: getting: ReferenceType referenceType = (ReferenceType)
        classList.get(0);
        --> debugger: getting: boolean isStatic = referenceType.isStatic();
        --> debugger: expected value of isStatic is 'false'
        # ERROR: ##> debugger: ERROR: isStatic != false for:
        nsk.jdi.ReferenceType.isStatic.TestClass$NestedIface1[]
                                      
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

        --> debugger: ......typeForCheck:
        nsk.jdi.ReferenceType.isStatic.TestClass$NestedIface2[]
        --> debugger: getting: List classList = vm.classesByName(typeForCheck);
        --> debugger: getting: ReferenceType referenceType = (ReferenceType)
        classList.get(0);
        --> debugger: getting: boolean isStatic = referenceType.isStatic();
        --> debugger: expected value of isStatic is 'false'
        # ERROR: ##> debugger: ERROR: isStatic != false for:
        nsk.jdi.ReferenceType.isStatic.TestClass$NestedIface2[]
                                      
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

        --> debugger: ......typeForCheck:
        nsk.jdi.ReferenceType.isStatic.TestClass$StaticNestedClass[]
        --> debugger: getting: List classList = vm.classesByName(typeForCheck);
        --> debugger: getting: ReferenceType referenceType = (ReferenceType)
        classList.get(0);
        --> debugger: getting: boolean isStatic = referenceType.isStatic();
        --> debugger: expected value of isStatic is 'false'
        # ERROR: ##> debugger: ERROR: isStatic != false for:
        nsk.jdi.ReferenceType.isStatic.TestClass$StaticNestedClass[]
                                      
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        ^^^

        --> debugger: breakpointForCommunication

        ==> nsk/jdi/ReferenceType/isStatic/isstatic002 TESTING ENDS

        ----------------------------------------------------------------------

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

          Activity

          Hide
          defectconv Defect Conversion BT2 (Inactive) added a comment -
          BT2:EVALUATION

          Carlos.Lucasius@Canada (May 15, 2002):

          Using the /net/jano.sfbay/export/disk20/serviceability/runnsb.sh script, I
          ran the test nsk/jdi/ReferenceType/isStatic/isstatic002 on Solaris for all
          possible combinations of builds {1.4FCS, 1.4.1b11} and debugee options {,
          -server, -Xint, -Xcomp}. In all cases, I was able to confirm that the test
          failed.
          Show
          defectconv Defect Conversion BT2 (Inactive) added a comment - BT2:EVALUATION Carlos.Lucasius@Canada (May 15, 2002): Using the /net/jano.sfbay/export/disk20/serviceability/runnsb.sh script, I ran the test nsk/jdi/ReferenceType/isStatic/isstatic002 on Solaris for all possible combinations of builds {1.4FCS, 1.4.1b11} and debugee options {, -server, -Xint, -Xcomp}. In all cases, I was able to confirm that the test failed.
          Hide
          hgupdate HG Updates added a comment -
          URL: http://hg.openjdk.java.net/jdk9/dev/jdk/rev/281577c18568
          User: sla
          Date: 2014-02-18 10:29:37 +0000
          Show
          hgupdate HG Updates added a comment - URL: http://hg.openjdk.java.net/jdk9/dev/jdk/rev/281577c18568 User: sla Date: 2014-02-18 10:29:37 +0000
          Hide
          hgupdate HG Updates added a comment -
          URL: http://hg.openjdk.java.net/jdk9/jdk9/jdk/rev/281577c18568
          User: lana
          Date: 2014-03-01 00:14:01 +0000
          Show
          hgupdate HG Updates added a comment - URL: http://hg.openjdk.java.net/jdk9/jdk9/jdk/rev/281577c18568 User: lana Date: 2014-03-01 00:14:01 +0000

            People

            • Assignee:
              farvidsson Fredrik Arvidsson (Inactive)
              Reporter:
              bondsunw Bond Bond (Inactive)
            • Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Imported:
                Indexed: