diff options
| author | 2012-04-03 13:07:11 -0700 | |
|---|---|---|
| committer | 2012-04-03 13:07:11 -0700 | |
| commit | 6a144338023bdc0ca6954fc71a1f9b4d94088ee4 (patch) | |
| tree | 51efa8edbf277f2fa73f7e21b36fec4cb1a3339d /src/java_lang_Class.cc | |
| parent | cb67388650ac7cedfc80b524adebd595147d4d3f (diff) | |
Switch to Thread::WalkStack rather than manual Frame::Next.
Also fix test 039.
Change-Id: I07d0559bb86d67a7f7947768bd8370fb4cf06c26
Diffstat (limited to 'src/java_lang_Class.cc')
| -rw-r--r-- | src/java_lang_Class.cc | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/java_lang_Class.cc b/src/java_lang_Class.cc index fcd168974c..17b584a340 100644 --- a/src/java_lang_Class.cc +++ b/src/java_lang_Class.cc @@ -17,6 +17,7 @@ #include "jni_internal.h" #include "class_linker.h" #include "class_loader.h" +#include "nth_caller_visitor.h" #include "object.h" #include "object_utils.h" #include "ScopedLocalRef.h" @@ -422,12 +423,10 @@ static jobject Class_newInstanceImpl(JNIEnv* env, jobject javaThis) { // Second, make sure it has permission to invoke the constructor. The // constructor must be public or, if the caller is in the same package, // have package scope. - // TODO: need SmartFrame (Thread::WalkStack-like iterator). - Frame frame = Thread::Current()->GetTopOfStack(); - frame.Next(); - frame.Next(); - Method* caller_caller = frame.GetMethod(); - Class* caller_class = caller_caller->GetDeclaringClass(); + + NthCallerVisitor visitor(2); + Thread::Current()->WalkStack(&visitor); + Class* caller_class = visitor.declaring_class; ClassHelper caller_ch(caller_class); if (!caller_class->CanAccess(c)) { |