|
Quick Lists
|
|
Bug ID:
|
5023741
|
|
Votes
|
0
|
|
Synopsis
|
getSuperclass returns AbstractStringBuilder instead of Object
|
|
Category
|
java:classes_lang
|
|
Reported Against
|
tiger-beta
|
|
Release Fixed
|
|
|
State
|
11-Closed,
Not a Defect,
bug
|
|
Priority:
|
4-Low
|
|
Related Bugs
|
4780441
,
6182000
|
|
Submit Date
|
30-MAR-2004
|
|
Description
|
FULL PRODUCT VERSION :
java version "1.5.0-beta"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-beta-b32c)
Java HotSpot(TM) Client VM (build 1.5.0-beta-b32c, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
customer Windows 2000 [Version 5.00.2195]
A DESCRIPTION OF THE PROBLEM :
When I call the method getSuperClass on the StringBuilder i get a class AbstractStringBuilder instead of customer . I also noticed that the AbstractStringBuilder contains methods with a corresponding signature, (see code below). Is the signature of the method changed or does the keyword volatile hide the method.
package java.lang;
import java.io.IOException;
import sun.misc.FloatingDecimal;
abstract class AbstractStringBuilder
implements Appendable, CharSequence
{
....
public AbstractStringBuilder append(CharSequence charsequence)
{
}
....
public AbstractStringBuilder append(char c)
{
}
....
public volatile Appendable append(char c)
throws IOException
{
}
public volatile Appendable append(CharSequence charsequence)
throws IOException
{
}
}
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
StringBuilder.class.getSuperclass()
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
I would expect the super class of the StringBuilder would be Object as indicated in the documentation
ACTUAL -
Super class StringBuilder: class java.lang.AbstractStringBuilder
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
/*
* TestStringBuilder.java
*
* Created on March 30, 2004, 2:34 PM
*/
import java.lang.StringBuilder;
/**
*
* @author schenk_m
*/
public class TestStringBuilder {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
System.out.println("Super class StringBuilder: " +
StringBuilder.class.getSuperclass());
}
}
---------- END SOURCE ----------
(Incident Review ID: 245603)
======================================================================
xxxxx@xxxxx 10/20/04 22:46 GMT
|
|
Work Around
|
N/A
|
|
Evaluation
|
getSuperclass returns the real superclass of StringBuilder, the documentation reports public classes only.
xxxxx@xxxxx 2004-04-08
Current behavior is as expected.
Information on the documentation-related aspects of this can be
found in the bug reports noted in the "See Also" section.
xxxxx@xxxxx 10/20/04 22:46 GMT
|
|
Comments
|
Submitted On 11-OCT-2004
AchimWestermann
Take a look at bug: 4874845 (http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4874845)
It seems to be the decision, that non-public classes should be hidden from the API-user's eye. But the way of declaring that Object is the superclass really is a lie.
I found an additional bug related to the StringBuffer/Builder redesign in 1.5.0 that will require to declare AbstractStringBuilder public, if not dropped. That solution will make this one obsolete, but it should be discussed, what policy javadoc should follow...
PLEASE NOTE: JDK6 is formerly known as Project Mustang
|
|
|
 |