Common utility routines used by both java.lang and
java.lang.reflect
Used to filter out fields and methods from certain classes from public
view, where they are sensitive or they may contain VM-internal objects.
These Maps are updated very rarely. Rather than synchronize on
each access, we use copy-on-write
new String[] {"fieldFilterMap", "methodFilterMap"});Returns the class of the method
realFramesToSkip
frames up the stack (zero-based), ignoring frames associated
with java.lang.reflect.Method.invoke() and its implementation.
The first frame is that associated with this method, so
getCallerClass(0) returns the Class object for
sun.reflect.Reflection. Frames associated with
java.lang.reflect.Method.invoke() and its implementation are
completely ignored and do not count toward the number of "real"
frames skipped.
Retrieves the access flags written to the class file. For
inner classes these flags may differ from those returned by
Class.getModifiers(), which searches the InnerClasses
attribute to find the source-level access flags. This is used
instead of Class.getModifiers() for run-time access checks due
to compatibility reasons; see 4471811. Only the values of the
low 13 bits (i.e., a mask of 0x1FFF) are guaranteed to be
valid.
A quick "fast-path" check to try to avoid getCallerClass()
calls.
if (currentClass == null || memberClass == null) { " can not access a member of class " +
boolean gotIsSameClassPackage = false;
boolean isSameClassPackage = false;
if (currentClass == memberClass) { gotIsSameClassPackage = true;
if (!isSameClassPackage) { boolean successSoFar = false;
if (!successSoFar && !Modifier.isPrivate(modifiers)) { if (!gotIsSameClassPackage) { gotIsSameClassPackage = true;
if (isSameClassPackage) { Class targetClass = (target == null ? memberClass : target.getClass());
if (targetClass != currentClass) { if (!gotIsSameClassPackage) { gotIsSameClassPackage = true;
if (!isSameClassPackage) {Returns true if two classes are in the same package; classloader
and classname information is enough to determine a class's package
if (loader1 != loader2) { if ((lastDot1 == -1) || (lastDot2 == -1)) { return (lastDot1 == lastDot2);
if (name1.charAt(idx1) == '[') { } while (name1.charAt(idx1) == '[');
if (name1.charAt(idx1) != 'L') { if (name2.charAt(idx2) == '[') { } while (name2.charAt(idx2) == '[');
if (name2.charAt(idx2) != 'L') { int length1 = lastDot1 - idx1;
int length2 = lastDot2 - idx2;
if (length1 != length2) { while (queryClass != null) { if (queryClass == ofClass) { if (map.get(containingClass) != null) { ("Filter already registered: " + containingClass); map.put(containingClass, names);
if ((filteredNames == null) || (members.length == 0)) { for (Member member : members) { boolean shouldSkip = false;
for (String filteredName : filteredNames) { if (member.getName() == filteredName) { for (Member member : members) { boolean shouldSkip = false;
for (String filteredName : filteredNames) { if (member.getName() == filteredName) { newMembers[destIdx++] = member;