JDK-4515292 : ReferenceType.isStatic() returns true for arrays
  • Type: Bug
  • Component: core-svc
  • Sub-Component: debugger
  • Affected Version: 1.4.0,1.4.2,5.0,6,8,8u111
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2001-10-16
  • Updated: 2018-07-31
  • Resolved: 2014-02-18
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 8 JDK 9
8u102Fixed 9 b04Fixed
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

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

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

Comments
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.
11-06-2004