Details
-
Bug
-
Status: Closed
-
Critical
-
Resolution: Fixed
-
5.0M5
-
None
Description
Class Method methods getGenericParameterTypes(), getGenericReturnType() and toGenericString() throw NPE if called for a parametrized method in an interface.
Here's the test demonstrating the problem:
import java.lang.reflect.Method;
public class Test {
public static void main(String[] args) {
boolean success = true;
try {
Method method = Sample.class.getMethods()[0];
for (int i = 0; i < 5; i++) {
try {
switch
} catch (Exception e)
{ success = false; System.out.print("FAIL: "); e.printStackTrace(System.out); } }
System.out.println(success ? "SUCCESS" : "FAILURE");
} catch (Exception e)
}
}
interface Sample {
public <T extends Sample, E extends Throwable> T test(T param) throws E;
}
Output on RI:
SUCCESS
Output on Harmony:
FAIL: java.lang.NullPointerException
at org.apache.harmony.lang.reflect.support.AuxiliaryFinder.findTypeVariable(AuxiliaryFinder.java:293)
at org.apache.harmony.lang.reflect.parser.Parser.getGenericParameterTypes(Parser.java:742)
at java.lang.reflect.Method.getGenericParameterTypes(Method.java:110)
at Test.main(Test.java:10)
FAIL: java.lang.NullPointerException
at org.apache.harmony.lang.reflect.support.AuxiliaryFinder.findTypeVariable(AuxiliaryFinder.java:293)
at org.apache.harmony.lang.reflect.parser.Parser.getGenericReturnTypeImpl(Parser.java:447)
at java.lang.reflect.Method.getGenericReturnType(Method.java:126)
at Test.main(Test.java:12)
FAIL: java.lang.NullPointerException
at org.apache.harmony.lang.reflect.support.AuxiliaryFinder.findTypeVariable(AuxiliaryFinder.java:293)
at org.apache.harmony.lang.reflect.parser.Parser.getGenericParameterTypes(Parser.java:742)
at java.lang.reflect.Method.toGenericString(Method.java:150)
at Test.main(Test.java:18)
FAILURE
This issue is critical as it prevents Geronimo Deployer from working on Harmony.
Attachments
Attachments
Issue Links
- is related to
-
HARMONY-5005 [drlvm][kernel][geronimo] Field.getGenericType() fails on a parametrized class from custom classloader
- Closed
-
HARMONY-5086 [drlvm][kernel][geronimo] AnnotatedElement.getDeclaredAnnotations() throws exception if annotation is not available
- Closed
-
HARMONY-5180 [drlvm][kernel][geronimo] Annotations get loaded with wrong classloader
- Closed
- relates to
-
HARMONY-5790 [drlvm][interpreter] Stack size is not enough
- Open