Details
-
Bug
-
Resolution: Duplicate
-
P4
-
None
-
8u25
-
x86_64
-
linux
Description
FULL PRODUCT VERSION :
java version "1.8.0_25"
Java(TM) SE Runtime Environment (build 1.8.0_25-b17)
Java HotSpot(TM) 64-Bit Server VM (build 25.25-b02, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Linux ivostmaina 3.17.1-gentoo-r1 #2 SMP PREEMPT Wed Nov 5 12:40:42 CET 2014 x86_64 AMD FX(tm)-9590 Eight-Core Processor AuthenticAMD GNU/Linux
A DESCRIPTION OF THE PROBLEM :
There are instances of java.lang.reflect.Parameter that throws an IndexOutOfBounds exception when calling toString() method. I appended a Testcase that reproduces the bug allways.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Run the appended testcase
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import static org.junit.Assert.assertEquals;
import java.lang.reflect.Constructor;
import java.lang.reflect.Parameter;
import org.junit.Test;
public class bug1 {
@Test
public void paramter_tostring_exception() throws NoSuchMethodException, SecurityException {
class OuterClass {
class GenericClass<T> {
}
class InnerClass<T> {
@SuppressWarnings("unused")
public InnerClass(GenericClass<T> p) {
}
}
}
@SuppressWarnings("rawtypes")
Constructor<OuterClass.InnerClass> constructor = OuterClass.InnerClass.class.getConstructor(OuterClass.class,
OuterClass.GenericClass.class);
assertEquals(2, constructor.getParameters().length);
Parameter p0 = constructor.getParameters()[0];
Parameter p1 = constructor.getParameters()[1];
p0.toString(); // <<<< THROWS INDEX OUT OF BOUNDS EXCEPTION
p1.toString();
}
}
---------- END SOURCE ----------
java version "1.8.0_25"
Java(TM) SE Runtime Environment (build 1.8.0_25-b17)
Java HotSpot(TM) 64-Bit Server VM (build 25.25-b02, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Linux ivostmaina 3.17.1-gentoo-r1 #2 SMP PREEMPT Wed Nov 5 12:40:42 CET 2014 x86_64 AMD FX(tm)-9590 Eight-Core Processor AuthenticAMD GNU/Linux
A DESCRIPTION OF THE PROBLEM :
There are instances of java.lang.reflect.Parameter that throws an IndexOutOfBounds exception when calling toString() method. I appended a Testcase that reproduces the bug allways.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Run the appended testcase
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import static org.junit.Assert.assertEquals;
import java.lang.reflect.Constructor;
import java.lang.reflect.Parameter;
import org.junit.Test;
public class bug1 {
@Test
public void paramter_tostring_exception() throws NoSuchMethodException, SecurityException {
class OuterClass {
class GenericClass<T> {
}
class InnerClass<T> {
@SuppressWarnings("unused")
public InnerClass(GenericClass<T> p) {
}
}
}
@SuppressWarnings("rawtypes")
Constructor<OuterClass.InnerClass> constructor = OuterClass.InnerClass.class.getConstructor(OuterClass.class,
OuterClass.GenericClass.class);
assertEquals(2, constructor.getParameters().length);
Parameter p0 = constructor.getParameters()[0];
Parameter p1 = constructor.getParameters()[1];
p0.toString(); // <<<< THROWS INDEX OUT OF BOUNDS EXCEPTION
p1.toString();
}
}
---------- END SOURCE ----------
Attachments
Issue Links
- duplicates
-
JDK-8055063 Parameter#toString() fails w/ AIOOBE for ctr of inner class w/ generic type
-
- Resolved
-