JDK-8219599 : Deleting method with RedefineClasses breaks java.lang.reflect.Method
  • Type: Bug
  • Component: hotspot
  • Sub-Component: jvmti
  • Affected Version: 13
  • Priority: P3
  • Status: Closed
  • Resolution: Won't Fix
  • Submitted: 2019-02-22
  • Updated: 2019-04-25
  • Resolved: 2019-04-25
Related Reports
Relates :  
Description
If you create a java.lang.reflect.Method to a Method that is deleted during redefinition, the method.invoke gets InternalError exception, and not a NoSuchMethodError wrapped in InvocationTargetException.   If you add the method back, you still get InternalError.

from reflection.cpp:

  InstanceKlass* klass = InstanceKlass::cast(java_lang_Class::as_Klass(mirror));
  Method* m = klass->method_with_idnum(slot);
  if (m == NULL) {
    THROW_MSG_0(vmSymbols::java_lang_InternalError(), "invoke");
  }

Comments
The RI was changed to implement the JVM TI Specification in JDK-8192936 so this is now not allowed unless in compatibility mode. Closing as WNF.
25-04-2019