-
Bug
-
Resolution: Fixed
-
P2
-
7
-
b144
-
generic
-
generic
-
Verified
Please see the minimized test:
-------------------------------------------
import java.dyn.*;
public class TestGeneric {
public static <T> T foo(T param){
return null;
}
public static void main(String argv[]) throws Exception {
MethodHandle handle = MethodHandles.lookup().findStatic
(TestGeneric.class, "foo",
MethodType.methodType(Object.class, Object.class));
try {
String mh1 = (String) handle.invokeGeneric("");
} catch (Throwable thr) {
thr.printStackTrace();
}
try {
Byte mh2 = (Byte) handle.invokeGeneric((Byte) 0);
} catch (Throwable thr) {
thr.printStackTrace();
}
}
}
-------------------------------------------
Its output is:
java.lang.RuntimeException: NYI
at sun.dyn.InvokeGeneric.addReturnConversion(InvokeGeneric.java:147)
at sun.dyn.InvokeGeneric.dispatchWithConversion(InvokeGeneric.java:129)
at sun.dyn.FilterGeneric$F3.invoke_F2(FilterGeneric.java:573)
at TestGeneric.main(TestGeneric.java:11)
java.lang.RuntimeException: NYI
at sun.dyn.InvokeGeneric.addReturnConversion(InvokeGeneric.java:147)
at sun.dyn.InvokeGeneric.dispatchWithConversion(InvokeGeneric.java:129)
at sun.dyn.FilterGeneric$F3.invoke_F2(FilterGeneric.java:573)
at TestGeneric.main(TestGeneric.java:16)
-------------------------------------------
import java.dyn.*;
public class TestGeneric {
public static <T> T foo(T param){
return null;
}
public static void main(String argv[]) throws Exception {
MethodHandle handle = MethodHandles.lookup().findStatic
(TestGeneric.class, "foo",
MethodType.methodType(Object.class, Object.class));
try {
String mh1 = (String) handle.invokeGeneric("");
} catch (Throwable thr) {
thr.printStackTrace();
}
try {
Byte mh2 = (Byte) handle.invokeGeneric((Byte) 0);
} catch (Throwable thr) {
thr.printStackTrace();
}
}
}
-------------------------------------------
Its output is:
java.lang.RuntimeException: NYI
at sun.dyn.InvokeGeneric.addReturnConversion(InvokeGeneric.java:147)
at sun.dyn.InvokeGeneric.dispatchWithConversion(InvokeGeneric.java:129)
at sun.dyn.FilterGeneric$F3.invoke_F2(FilterGeneric.java:573)
at TestGeneric.main(TestGeneric.java:11)
java.lang.RuntimeException: NYI
at sun.dyn.InvokeGeneric.addReturnConversion(InvokeGeneric.java:147)
at sun.dyn.InvokeGeneric.dispatchWithConversion(InvokeGeneric.java:129)
at sun.dyn.FilterGeneric$F3.invoke_F2(FilterGeneric.java:573)
at TestGeneric.main(TestGeneric.java:16)
- duplicates
-
JDK-7034316 MethodType.hasWrappers() returns 'true' for method types like '()Comparable' or '()Deprecated'
- Closed
- relates to
-
JDK-7044892 JSR 292: API entry points sometimes throw the wrong exceptions or doesn't throw the expected one
- Closed
-
JDK-6939861 JVM should handle more conversion operations
- Closed