On 05/22/2018 12:36 PM, Peter Levart wrote:
So how about putting the nestmate access logic just before the last if (!successSoFar) { return false; }:

        // Check for nestmate access if member is private
        if (!successSoFar && Modifier.isPrivate(modifiers)) {
          // assert: targetClass == null || isSubclassof(targetClass, memberClass)
          // Note: targetClass may be outside the nest, but that is okay
          //       as long as memberClass is in the nest.
          successSoFar = areNestMates(currentClass, memberClass);
        }

        if (!successSoFar) {
            return false;
        }


This would not penalize access to package-private and protected members with areNestMates() JNI calls and maybe caching will not be needed at all.

Ah, just leave it as is. The if (Modifier.isPrivate(modifiers)) already makes sure that areNestMates is called only for private members.

Peter

Reply via email to