-
Bug
-
Resolution: Fixed
-
P2
-
5.0
-
b48
-
generic
-
generic
-
Verified
Name: siR10004 Date: 02/26/2004
The following classes -
-------------------------------------------------------------
java.util.concurrent.FutureTask
java.util.concurrent.ConcurrentHashMap$EntryIterator
java.util.concurrent.ConcurrentHashMap$KeyIterator
java.util.concurrent.ConcurrentHashMap$ValueIterator
java.util.AbstractList$ListItr
java.util.EnumMap$EntryIterator
java.util.EnumMap$KeyIterator
java.util.EnumMap$ValueIterator
java.util.IdentityHashMap$EntryIterator
java.util.IdentityHashMap$KeyIterator
java.util.IdentityHashMap$ValueIterator
java.util.WeakHashMap$EntryIterator
java.util.WeakHashMap$KeyIterator
java.util.WeakHashMap$ValueIterator
java.util.TreeMap$EntryIterator
java.util.TreeMap$KeyIterator
java.util.TreeMap$SubMapEntryIterator
java.util.TreeMap$ValueIterator
java.util.HashMap$EntryIterator
java.util.HashMap$KeyIterator
java.util.HashMap$ValueIterator
java.util.LinkedHashMap$EntryIterator
java.util.LinkedHashMap$KeyIterator
java.util.LinkedHashMap$ValueIterator
-------------------------------------------------------------
cause 'java.lang.reflect.GenericSignatureFormatError' thrown
when calling some of reflection methods to get generic types.
The following program can be used to reproduce the bug
-------------------------------------------------------------
import java.lang.reflect.*;
public class Probe {
public static void main (String[] args) throws Throwable
{
String name = args[0];
System.out.println("\nCLASS " + name);
Class c = Class.forName(name, false, null);
int errs = probe(c);
System.out.println(errs == 0 ? " ok" : " errors:" + errs);
}
static int probe (Class c)
{
int errs = 0;
try {
c.getTypeParameters();
c.getGenericSuperclass();
c.getGenericInterfaces();
}
catch (Throwable t) {
errs++;
System.err.println(t);
//t.printStackTrace();
}
Field[] fields = c.getDeclaredFields();
if (fields != null)
for (int i = 0; i < fields.length; i++) {
try {
fields[i].getGenericType();
}
catch (Throwable t) {
errs++;
System.err.println("FIELD " + fields[i]);
System.err.println(t);
//t.printStackTrace();
}
}
Method[] methods = c.getDeclaredMethods();
if (methods != null)
for (int i = 0; i < methods.length; i++) {
try {
methods[i].getTypeParameters();
methods[i].getGenericReturnType();
methods[i].getGenericParameterTypes();
methods[i].getGenericExceptionTypes();
}
catch (Throwable t) {
errs++;
System.err.println("METHOD " + methods[i]);
System.err.println(t);
//t.printStackTrace();
}
}
Constructor[] ctors = c.getDeclaredConstructors();
if (ctors != null)
for (int i = 0; i < ctors.length; i++) {
try {
ctors[i].getTypeParameters();
ctors[i].getGenericParameterTypes();
ctors[i].getGenericExceptionTypes();
}
catch (Throwable t) {
errs++;
System.err.println("CONSTRUCTOR " + ctors[i]);
System.err.println(t);
//t.printStackTrace();
}
}
return errs;
}
}
-------------------------------------------------------------
This bug causes failure of JCK signature test on b40.
Not reproducible on b39.
It seems that root of the problem is in invalid 'Signature' attributes.
For example, field
java.util.concurrent.FutureTask.sync
has the following attribute
Ljava/util/concurrent/FutureTask<TV;>.Sync;
(note that '.Sync' violates the signature attribute syntax).
======================================================================
- relates to
-
JDK-6704655 Test test/java/lang/reflect/Generics/Probe.java fails under OpenJDK
- Resolved
-
JDK-4942991 Signatures for nested classes contain redundant information
- Resolved
-
JDK-6873951 [TEST_BUG] test/java/lang/reflect/Generics/Probe.java fails
- Resolved
-
JDK-7052360 (reflect) GenericSignatureFormatError When signature includes nested inner classes
- Closed
-
JDK-4992019 Invalid generic signature attributes in two javax.crypto classes
- Closed
-
JDK-4992021 Extra '.' character in generic signature attributes
- Closed
(1 relates to)