diff -r 8c4bc3fa4c4e -r e4a51c336a52 jdk/src/share/classes/java/lang/invoke/InvokerBytecodeGenerator.java --- a/jdk/src/share/classes/java/lang/invoke/InvokerBytecodeGenerator.java Tue Jun 17 10:01:16 2014 +0200 +++ b/jdk/src/share/classes/java/lang/invoke/InvokerBytecodeGenerator.java Tue Jun 17 13:06:05 2014 +0400 @@ -40,6 +40,7 @@ import static java.lang.invoke.MethodHandleNatives.Constants.*; import static java.lang.invoke.LambdaForm.BasicType.*; import sun.invoke.util.VerifyType; +import sun.reflect.misc.ReflectUtil; /** * Code generation backend for LambdaForm. @@ -594,6 +595,8 @@ return false; // inner class of some sort if (cls.getClassLoader() != MethodHandle.class.getClassLoader()) return false; // not on BCP + if (ReflectUtil.isVMAnonymousClass(cls)) // FIXME: switch to supported API once it is added + return false; MethodType mtype = member.getMethodOrFieldType(); if (!isStaticallyNameable(mtype.returnType())) return false; @@ -612,6 +615,8 @@ cls = cls.getComponentType(); if (cls.isPrimitive()) return true; // int[].class, for example + if (ReflectUtil.isVMAnonymousClass(cls)) // FIXME: switch to supported API once it is added + return false; // could use VerifyAccess.isClassAccessible but the following is a safe approximation if (cls.getClassLoader() != Object.class.getClassLoader()) return false;