--- a/langtools/src/share/classes/com/sun/tools/classfile/Type.java Tue Jul 08 16:59:27 2008 -0700
+++ b/langtools/src/share/classes/com/sun/tools/classfile/Type.java Tue Jul 08 17:14:22 2008 -0700
@@ -36,10 +36,6 @@
public class Type {
protected Type() { }
- public boolean isObject() {
- return false;
- }
-
protected static void append(StringBuilder sb, String prefix, List<? extends Type> types, String suffix) {
sb.append(prefix);
String sep = "";
@@ -66,11 +62,6 @@
return name;
}
- @Override
- public boolean isObject() {
- return name.equals("java.lang.Object");
- }
-
public final String name;
}
@@ -129,7 +120,7 @@
public String toString() {
StringBuilder sb = new StringBuilder();
appendIfNotEmpty(sb, "<", typeArgTypes, ">");
- if (superclassType != null && !superclassType.isObject()) {
+ if (superclassType != null) {
sb.append(" extends ");
sb.append(superclassType);
}
@@ -188,7 +179,7 @@
StringBuilder sb = new StringBuilder();
sb.append(name);
String sep = " extends ";
- if (classBound != null && !classBound.isObject()) {
+ if (classBound != null) {
sb.append(sep);
sb.append(classBound);
sep = " & ";
--- a/langtools/src/share/classes/com/sun/tools/javap/ClassWriter.java Tue Jul 08 16:59:27 2008 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javap/ClassWriter.java Tue Jul 08 17:14:22 2008 -0700
@@ -104,14 +104,10 @@
Signature_attribute sigAttr = getSignature(cf.attributes);
if (sigAttr == null) {
// use info from class file header
- if (classFile.isClass()) {
- if (classFile.super_class != 0 ) {
- String sn = getJavaSuperclassName(cf);
- if (!sn.equals("java.lang.Object") || options.compat) { // BUG XXXXXXXX
- print(" extends ");
- print(sn);
- }
- }
+ if (classFile.isClass() && classFile.super_class != 0 ) {
+ String sn = getJavaSuperclassName(cf);
+ print(" extends ");
+ print(sn);
}
for (int i = 0; i < classFile.interfaces.length; i++) {
print(i == 0 ? (classFile.isClass() ? " implements " : " extends ") : ",");
@@ -124,7 +120,7 @@
// FieldType and a ClassSignatureType that only contains a superclass type.
if (t instanceof Type.ClassSigType)
print(t);
- else if (!t.isObject()) {
+ else {
print(" extends ");
print(t);
}
--- a/langtools/test/tools/javap/4870651/T4870651.java Tue Jul 08 16:59:27 2008 -0700
+++ b/langtools/test/tools/javap/4870651/T4870651.java Tue Jul 08 17:14:22 2008 -0700
@@ -23,8 +23,9 @@
/*
* @test
- * @bug 4870651
- * @summary javap should recognize generics, varargs, enum
+ * @bug 4870651 6715757
+ * @summary javap should recognize generics, varargs, enum;
+ * javap prints "extends java.lang.Object"
* @build T4870651 Test
* @run main T4870651
*/
@@ -38,7 +39,9 @@
public void run() throws IOException {
verify("Test",
- "class Test<T, E extends java.lang.Exception & java.lang.Comparable<T>, U extends java.lang.Comparable>",
+ "class Test<T extends java.lang.Object, " +
+ "E extends java.lang.Exception & java.lang.Comparable<T>, " +
+ "U extends java.lang.Comparable>",
"v1(java.lang.String...)");
verify("Test$Enum",
--- a/langtools/test/tools/javap/T4880663.java Tue Jul 08 16:59:27 2008 -0700
+++ b/langtools/test/tools/javap/T4880663.java Tue Jul 08 17:14:22 2008 -0700
@@ -23,8 +23,9 @@
/*
* @test
- * @bug 4880663
+ * @bug 4880663 6715757
* @summary javap could output whitespace between class name and opening brace
+ * javap prints "extends java.lang.Object"
*/
@@ -38,7 +39,7 @@
public void run() throws IOException {
File javaFile = writeTestFile();
File classFile = compileTestFile(javaFile);
- verify(classFile, "class Test {");
+ verify(classFile, "class Test extends java.lang.Object {");
if (errors > 0)
throw new Error(errors + " found.");