src/share/classes/java/lang/invoke/MethodHandleProxies.java
Index
Unified diffs
Context diffs
Sdiffs
Patch
New
Old
Previous File
Next File
*** old/src/share/classes/java/lang/invoke/MethodHandleProxies.java Fri Jul 11 20:08:52 2014
--- new/src/share/classes/java/lang/invoke/MethodHandleProxies.java Fri Jul 11 20:08:52 2014
*** 31,40 ****
--- 31,41 ----
import sun.invoke.WrapperInstance;
import java.util.ArrayList;
import sun.reflect.CallerSensitive;
import sun.reflect.Reflection;
import sun.reflect.misc.ReflectUtil;
+ import static java.lang.invoke.MethodHandleStatics.*;
/**
* This class consists exclusively of static methods that help adapt
* method handles to other JVM types, such as interfaces.
*/
*** 146,156 ****
--- 147,157 ----
//
@CallerSensitive
public static
<T> T asInterfaceInstance(final Class<T> intfc, final MethodHandle target) {
if (!intfc.isInterface() || !Modifier.isPublic(intfc.getModifiers()))
! throw new IllegalArgumentException("not a public interface: "+intfc.getName());
! throw newIllegalArgumentException("not a public interface", intfc.getName());
final MethodHandle mh;
if (System.getSecurityManager() != null) {
final Class<?> caller = Reflection.getCallerClass();
final ClassLoader ccl = caller != null ? caller.getClassLoader() : null;
ReflectUtil.checkProxyPackageAccess(ccl, intfc);
*** 163,173 ****
--- 164,174 ----
ClassLoader cl = Thread.currentThread().getContextClassLoader(); // avoid use of BCP
proxyLoader = cl != null ? cl : ClassLoader.getSystemClassLoader();
}
final Method[] methods = getSingleNameMethods(intfc);
if (methods == null)
! throw new IllegalArgumentException("not a single-method interface: "+intfc.getName());
! throw newIllegalArgumentException("not a single-method interface", intfc.getName());
final MethodHandle[] vaTargets = new MethodHandle[methods.length];
for (int i = 0; i < methods.length; i++) {
Method sm = methods[i];
MethodType smMT = MethodType.methodType(sm.getReturnType(), sm.getParameterTypes());
MethodHandle checkTarget = mh.asType(smMT); // make throw WMT
*** 187,197 ****
--- 188,198 ----
}
if (method.getDeclaringClass() == WrapperInstance.class)
return getArg(method.getName());
if (isObjectMethod(method))
return callObjectMethod(proxy, method, args);
- throw new InternalError("bad proxy method: "+method);
}
};
final Object proxy;
if (System.getSecurityManager() != null) {
*** 238,248 ****
--- 239,249 ----
try {
if (x != null)
return (WrapperInstance) x;
} catch (ClassCastException ex) {
}
- throw new IllegalArgumentException("not a wrapper instance");
}
/**
* Produces or recovers a target method handle which is behaviorally
* equivalent to the unique method of this wrapper instance.
src/share/classes/java/lang/invoke/MethodHandleProxies.java
Index
Unified diffs
Context diffs
Sdiffs
Patch
New
Old
Previous File
Next File