hotspot/src/share/vm/runtime/reflection.cpp
changeset 22897 77e1024a4a14
parent 22551 9bf46d16dcc6
child 24426 0a69c8cdfca9
equal deleted inserted replaced
22896:2cafca0e0be0 22897:77e1024a4a14
    34 #include "memory/universe.inline.hpp"
    34 #include "memory/universe.inline.hpp"
    35 #include "oops/instanceKlass.hpp"
    35 #include "oops/instanceKlass.hpp"
    36 #include "oops/objArrayKlass.hpp"
    36 #include "oops/objArrayKlass.hpp"
    37 #include "oops/objArrayOop.hpp"
    37 #include "oops/objArrayOop.hpp"
    38 #include "prims/jvm.h"
    38 #include "prims/jvm.h"
       
    39 #include "prims/jvmtiExport.hpp"
    39 #include "runtime/arguments.hpp"
    40 #include "runtime/arguments.hpp"
    40 #include "runtime/handles.inline.hpp"
    41 #include "runtime/handles.inline.hpp"
    41 #include "runtime/javaCalls.hpp"
    42 #include "runtime/javaCalls.hpp"
    42 #include "runtime/reflection.hpp"
    43 #include "runtime/reflection.hpp"
    43 #include "runtime/reflectionUtils.hpp"
    44 #include "runtime/reflectionUtils.hpp"
   939           method = resolve_interface_call(klass, reflected_method, target_klass, receiver, THREAD);
   940           method = resolve_interface_call(klass, reflected_method, target_klass, receiver, THREAD);
   940           if (HAS_PENDING_EXCEPTION) {
   941           if (HAS_PENDING_EXCEPTION) {
   941           // Method resolution threw an exception; wrap it in an InvocationTargetException
   942           // Method resolution threw an exception; wrap it in an InvocationTargetException
   942             oop resolution_exception = PENDING_EXCEPTION;
   943             oop resolution_exception = PENDING_EXCEPTION;
   943             CLEAR_PENDING_EXCEPTION;
   944             CLEAR_PENDING_EXCEPTION;
       
   945             // JVMTI has already reported the pending exception
       
   946             // JVMTI internal flag reset is needed in order to report InvocationTargetException
       
   947             if (THREAD->is_Java_thread()) {
       
   948               JvmtiExport::clear_detected_exception((JavaThread*) THREAD);
       
   949             }
   944             JavaCallArguments args(Handle(THREAD, resolution_exception));
   950             JavaCallArguments args(Handle(THREAD, resolution_exception));
   945             THROW_ARG_0(vmSymbols::java_lang_reflect_InvocationTargetException(),
   951             THROW_ARG_0(vmSymbols::java_lang_reflect_InvocationTargetException(),
   946                 vmSymbols::throwable_void_signature(),
   952                 vmSymbols::throwable_void_signature(),
   947                 &args);
   953                 &args);
   948           }
   954           }
  1071 
  1077 
  1072   if (HAS_PENDING_EXCEPTION) {
  1078   if (HAS_PENDING_EXCEPTION) {
  1073     // Method threw an exception; wrap it in an InvocationTargetException
  1079     // Method threw an exception; wrap it in an InvocationTargetException
  1074     oop target_exception = PENDING_EXCEPTION;
  1080     oop target_exception = PENDING_EXCEPTION;
  1075     CLEAR_PENDING_EXCEPTION;
  1081     CLEAR_PENDING_EXCEPTION;
       
  1082     // JVMTI has already reported the pending exception
       
  1083     // JVMTI internal flag reset is needed in order to report InvocationTargetException
       
  1084     if (THREAD->is_Java_thread()) {
       
  1085       JvmtiExport::clear_detected_exception((JavaThread*) THREAD);
       
  1086     }
       
  1087 
  1076     JavaCallArguments args(Handle(THREAD, target_exception));
  1088     JavaCallArguments args(Handle(THREAD, target_exception));
  1077     THROW_ARG_0(vmSymbols::java_lang_reflect_InvocationTargetException(),
  1089     THROW_ARG_0(vmSymbols::java_lang_reflect_InvocationTargetException(),
  1078                 vmSymbols::throwable_void_signature(),
  1090                 vmSymbols::throwable_void_signature(),
  1079                 &args);
  1091                 &args);
  1080   } else {
  1092   } else {