1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
# HG changeset patch
# User smarks
# Date 1363655131 25200
# Node ID 2899c3dbf5e8791b559c39a75a820c17c729c20f
# Parent b453d9be6b3f5496aa217ade7478d3b7fa32b13b
8009857: Problem with plugin
Reviewed-by: jdn, mchung
diff --git openjdk/jdk/src/share/classes/sun/reflect/misc/MethodUtil.java openjdk/jdk/src/share/classes/sun/reflect/misc/MethodUtil.java
--- jdk/src/share/classes/sun/reflect/misc/MethodUtil.java
+++ jdk/src/share/classes/sun/reflect/misc/MethodUtil.java
@@ -50,8 +50,27 @@ import sun.security.util.SecurityConstan
class Trampoline {
+ static {
+ if (Trampoline.class.getClassLoader() == null) {
+ throw new Error(
+ "Trampoline must not be defined by the bootstrap classloader");
+ }
+ }
+
+ private static void ensureInvocableMethod(Method m)
+ throws InvocationTargetException
+ {
+ Class<?> clazz = m.getDeclaringClass();
+ if (clazz.equals(AccessController.class) ||
+ clazz.equals(Method.class))
+ throw new InvocationTargetException(
+ new UnsupportedOperationException("invocation not supported"));
+ }
+
private static Object invoke(Method m, Object obj, Object[] params)
- throws InvocationTargetException, IllegalAccessException {
+ throws InvocationTargetException, IllegalAccessException
+ {
+ ensureInvocableMethod(m);
return m.invoke(obj, params);
}
}
@@ -255,10 +275,6 @@ public final class MethodUtil extends Se
*/
public static Object invoke(Method m, Object obj, Object[] params)
throws InvocationTargetException, IllegalAccessException {
- if (m.getDeclaringClass().equals(AccessController.class) ||
- m.getDeclaringClass().equals(Method.class))
- throw new InvocationTargetException(
- new UnsupportedOperationException("invocation not supported"));
try {
return bounce.invoke(null, new Object[] {m, obj, params});
} catch (InvocationTargetException ie) {
@@ -292,10 +307,10 @@ public final class MethodUtil extends Se
types = new Class[] {Method.class, Object.class, Object[].class};
b = t.getDeclaredMethod("invoke", types);
- ((AccessibleObject)b).setAccessible(true);
- return b;
- }
- });
+ b.setAccessible(true);
+ return b;
+ }
+ });
} catch (Exception e) {
throw new InternalError("bouncer cannot be found");
}
|