--- old/src/share/vm/runtime/reflection.cpp 2016-09-02 08:39:29.004650513 -0400 +++ new/src/share/vm/runtime/reflection.cpp 2016-09-02 08:39:27.897730178 -0400 @@ -412,13 +412,13 @@ return result; } -static bool under_host_klass(const InstanceKlass* ik, const Klass* host_klass) { +static bool under_host_klass(const InstanceKlass* ik, const InstanceKlass* host_klass) { DEBUG_ONLY(int inf_loop_check = 1000 * 1000 * 1000); for (;;) { - const Klass* hc = (const Klass*)ik->host_klass(); + const InstanceKlass* hc = ik->host_klass(); if (hc == NULL) return false; if (hc == host_klass) return true; - ik = InstanceKlass::cast(hc); + ik = hc; // There's no way to make a host class loop short of patching memory. // Therefore there cannot be a loop here unless there's another bug. @@ -436,8 +436,8 @@ // If either is on the other's host_klass chain, access is OK, // because one is inside the other. - if (under_host_klass(accessor_ik, accessee) || - under_host_klass(accessee_ik, accessor)) + if (under_host_klass(accessor_ik, accessee_ik) || + under_host_klass(accessee_ik, accessor_ik)) return true; if ((RelaxAccessControlCheck &&