JDK-4508592 : (reflect spec) Class.getMethods() returns non-empty array for array classes
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.lang:reflect
  • Affected Version: 1.1,1.4.0,5.0
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2001-09-28
  • Updated: 2017-05-16
  • Resolved: 2004-02-20
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.
Other
5.0 b40Fixed
Related Reports
Relates :  
Description

Name: nt126004			Date: 09/28/2001


java version "1.4.0-beta2"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-beta2-b77)
Java HotSpot(TM) Client VM (build 1.4.0-beta2-b77, mixed mode)

The following example should return "0" as mentioned in the Java API
Documentation for java.lang.Class.getMethods():

-- extracted from documentation:

This method returns an array of length 0 if this Class object represents a class
or interface that has no public member methods, or if this Class object
represents an array class, primitive type, or void.

---

public class test
{
    public static void main(String[] args) {
        System.out.println(args.getClass().getMethods().length);
    }
}

=> returns 9 (all inherited Methods from java/lang/Object).
(Review ID: 132553) 
======================================================================

Comments
CONVERTED DATA BugTraq+ Release Management Values COMMIT TO FIX: tiger-beta2 FIXED IN: tiger-beta2 INTEGRATED IN: tiger-b40 tiger-beta2
14-06-2004

EVALUATION Submitter is correct: The specification clearly implies that the given program should print 0, not 9. This bug has existed since 1.1, however, so fixing it is not urgent and, due to compatibility concerns, might not even be desirable. -- ###@###.### 2001/10/3 Modifying the spec to reflect the current behaviour. -- iag@sfbay 2003-01-09
10-09-0169