Details
-
Bug
-
Resolution: Fixed
-
P3
-
8
-
b15
-
x86_64
-
linux
-
Verified
Backports
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8045673 | 8u25 | Joel Borggrén-Franck | P3 | Resolved | Fixed | b01 |
JDK-8043320 | 8u20 | Joel Borggrén-Franck | P3 | Resolved | Fixed | b17 |
JDK-8053618 | emb-8u26 | Joel Borggrén-Franck | P3 | Resolved | Fixed | b17 |
Description
FULL PRODUCT VERSION :
1.8.0-b132
ADDITIONAL OS VERSION INFORMATION :
Linux ivostmaina 3.13.6-gentoo #1 SMP Thu Mar 20 02:22:16 CET 2014 x86_64 AMD FX(tm)-8350 Eight-Core Processor AuthenticAMD GNU/Linux
A DESCRIPTION OF THE PROBLEM :
The getAnnotatedBounds(); method of the TypeVariable interface may return AnnotatedType instances where the getType(); method returns null.
class MyClass<T> {
}
TypeVariable<Class<MyClass>> tv = MyClass.class.getTypeParameters()[0];
tv.getAnnotatedBounds()[0].getType() is NULL
I expect that
tv.getAnnotatedBounds()[0].getType() equals tv.getBounds()[0]
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
@Test
public void java8_typevariable_bug_or_not1() {
class MyClass<T> {
}
assertEquals(1, MyClass.class.getTypeParameters().length);
@SuppressWarnings("rawtypes")
TypeVariable<Class<MyClass>> tv = MyClass.class.getTypeParameters()[0];
assertNotNull(tv);
Type[] bs = tv.getBounds();
assertNotNull(bs);
assertEquals(1, bs.length);
AnnotatedType[] abs = tv.getAnnotatedBounds();
assertNotNull(abs);
assertEquals(1, abs.length);
Type t = bs[0];
assertNotNull(t);
assertEquals(Object.class, t);
AnnotatedType at = abs[0];
assertNotNull(at);
assertNotNull(at.getType()); // FAILS HERE
assertEquals(t, at);
}
@Test
public void java8_typevariable_bug_or_not2() {
class MyClass<T extends Number> {
}
assertEquals(1, MyClass.class.getTypeParameters().length);
@SuppressWarnings("rawtypes")
TypeVariable<Class<MyClass>> tv = MyClass.class.getTypeParameters()[0];
assertNotNull(tv);
Type[] bs = tv.getBounds();
assertNotNull(bs);
assertEquals(1, bs.length);
AnnotatedType[] abs = tv.getAnnotatedBounds();
assertNotNull(abs);
assertEquals(1, abs.length);
Type t = bs[0];
assertNotNull(t);
assertEquals(Number.class, t);
AnnotatedType at = abs[0];
assertNotNull(at);
assertNotNull(at.getType()); // FAILS HERE
assertEquals(t, at);
}
---------- END SOURCE ----------
1.8.0-b132
ADDITIONAL OS VERSION INFORMATION :
Linux ivostmaina 3.13.6-gentoo #1 SMP Thu Mar 20 02:22:16 CET 2014 x86_64 AMD FX(tm)-8350 Eight-Core Processor AuthenticAMD GNU/Linux
A DESCRIPTION OF THE PROBLEM :
The getAnnotatedBounds(); method of the TypeVariable interface may return AnnotatedType instances where the getType(); method returns null.
class MyClass<T> {
}
TypeVariable<Class<MyClass>> tv = MyClass.class.getTypeParameters()[0];
tv.getAnnotatedBounds()[0].getType() is NULL
I expect that
tv.getAnnotatedBounds()[0].getType() equals tv.getBounds()[0]
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
@Test
public void java8_typevariable_bug_or_not1() {
class MyClass<T> {
}
assertEquals(1, MyClass.class.getTypeParameters().length);
@SuppressWarnings("rawtypes")
TypeVariable<Class<MyClass>> tv = MyClass.class.getTypeParameters()[0];
assertNotNull(tv);
Type[] bs = tv.getBounds();
assertNotNull(bs);
assertEquals(1, bs.length);
AnnotatedType[] abs = tv.getAnnotatedBounds();
assertNotNull(abs);
assertEquals(1, abs.length);
Type t = bs[0];
assertNotNull(t);
assertEquals(Object.class, t);
AnnotatedType at = abs[0];
assertNotNull(at);
assertNotNull(at.getType()); // FAILS HERE
assertEquals(t, at);
}
@Test
public void java8_typevariable_bug_or_not2() {
class MyClass<T extends Number> {
}
assertEquals(1, MyClass.class.getTypeParameters().length);
@SuppressWarnings("rawtypes")
TypeVariable<Class<MyClass>> tv = MyClass.class.getTypeParameters()[0];
assertNotNull(tv);
Type[] bs = tv.getBounds();
assertNotNull(bs);
assertEquals(1, bs.length);
AnnotatedType[] abs = tv.getAnnotatedBounds();
assertNotNull(abs);
assertEquals(1, abs.length);
Type t = bs[0];
assertNotNull(t);
assertEquals(Number.class, t);
AnnotatedType at = abs[0];
assertNotNull(at);
assertNotNull(at.getType()); // FAILS HERE
assertEquals(t, at);
}
---------- END SOURCE ----------
Attachments
Issue Links
- backported by
-
JDK-8043320 AnnotatedType.getType() of a TypeVariable boundary without annotations return null
-
- Resolved
-
-
JDK-8045673 AnnotatedType.getType() of a TypeVariable boundary without annotations return null
-
- Resolved
-
-
JDK-8053618 AnnotatedType.getType() of a TypeVariable boundary without annotations return null
-
- Resolved
-