JDK-4394613 : JDI spec: ReferenceType.equals() does not throw any Exception for unloaded class
  • Type: Bug
  • Component: core-svc
  • Sub-Component: debugger
  • Affected Version: 1.4.0
  • Priority: P5
  • Status: Closed
  • Resolution: Duplicate
  • OS: solaris_7
  • CPU: sparc
  • Submitted: 2000-12-04
  • Updated: 2001-06-02
  • Resolved: 2001-05-17
Related Reports
Duplicate :  
Relates :  
Description

Name: abR10010			Date: 12/04/2000




The Java Debug Interface specification for ReferenceType.equals()
method says:
"...
Throws:
       ObjectCollectedException - if this reference type has been
       unloaded and garbage collected.
..." 

But the nsk/jdi/ReferenceType/equals/equals002 test
shows that this assertion is violated.

The test loads a class, gets a ReferenceType instance for this
class, then enforces the class to be unloaded and calls the
equals() method - the com.sun.jdi.ObjectCollectedException
should be thrown in this case.
In fact, there is no Exception thrown.

In order to be convinced that the checked class has been unloaded
really before the equals() method call the test try to get
a ReferenceType instance for the class again and only if
this ReferenceType instance could not be got the test consideres
that the checked class has been unloaded and executes the check
of the equals() method.

This happens on both Solaris-Sparc and Win32.

To reproduce the bug on Solaris run doit.sh in
/net/sqesvr/export/vsn/GammaBase/Bugs/<this bug number>.

The first parameter for doit.sh should be JDK root directory
(e.g. /java/jdk1.4/solsparc) and the other parameter(s) -
VM option(s) (optional).
  
See log:

% doit.sh /export/java/dest/jdk1.4.0beta-b43/solsparc
java version "1.4.0beta"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0beta-b43)
Java HotSpot(TM) Client VM (build 1.4beta-B43, mixed mode)
==> nsk/jdi/ReferenceType/equals/equals002 test LOG:
--> test checks equals() method of ReferenceType interface 
    of the com.sun.jdi package for UNLOADED class

--> equals002: check ReferenceType.equals() method for unloaded class...
##> equals002: FAILED: NO any Exception thrown!
##>            expected Exception - com.sun.jdi.ObjectCollectedException

==> nsk/jdi/ReferenceType/equals/equals002 test FAILED


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

Comments
PUBLIC COMMENTS .
10-06-2004

EVALUATION equal doesn't need to call the VM. No user need to throw this exception. "may" should be the operative word. robert.field@Eng 2001-05-15 4460188 is now the uber bug for exception specification. Closed as a duplicate of 4460188. robert.field@Eng 2001-05-17
15-05-2001