jdk/src/share/classes/sun/reflect/NativeMethodAccessorImpl.java
changeset 21609 f23c375e4baf
parent 5506 202f599c92aa
--- a/jdk/src/share/classes/sun/reflect/NativeMethodAccessorImpl.java	Mon Nov 04 17:47:59 2013 +0000
+++ b/jdk/src/share/classes/sun/reflect/NativeMethodAccessorImpl.java	Mon Nov 04 10:12:18 2013 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,7 @@
 package sun.reflect;
 
 import java.lang.reflect.*;
+import sun.reflect.misc.ReflectUtil;
 
 /** Used only for the first few invocations of a Method; afterward,
     switches to bytecode-based implementation */
@@ -42,7 +43,11 @@
     public Object invoke(Object obj, Object[] args)
         throws IllegalArgumentException, InvocationTargetException
     {
-        if (++numInvocations > ReflectionFactory.inflationThreshold()) {
+        // We can't inflate methods belonging to vm-anonymous classes because
+        // that kind of class can't be referred to by name, hence can't be
+        // found from the generated bytecode.
+        if (++numInvocations > ReflectionFactory.inflationThreshold()
+                && !ReflectUtil.isVMAnonymousClass(method.getDeclaringClass())) {
             MethodAccessorImpl acc = (MethodAccessorImpl)
                 new MethodAccessorGenerator().
                     generateMethod(method.getDeclaringClass(),