Java Code Examples for sun.reflect.Reflection#ensureMemberAccess()
The following examples show how to use
sun.reflect.Reflection#ensureMemberAccess() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AccessibleObject.java From dragonwell8_jdk with GNU General Public License v2.0 | 6 votes |
void slowCheckMemberAccess(Class<?> caller, Class<?> clazz, Object obj, int modifiers, Class<?> targetClass) throws IllegalAccessException { Reflection.ensureMemberAccess(caller, clazz, obj, modifiers); // Success: Update the cache. Object cache = ((targetClass == clazz) ? caller : new Class<?>[] { caller, targetClass }); // Note: The two cache elements are not volatile, // but they are effectively final. The Java memory model // guarantees that the initializing stores for the cache // elements will occur before the volatile write. securityCheckCache = cache; // write volatile }
Example 2
Source File: AccessibleObject.java From openjdk-8-source with GNU General Public License v2.0 | 6 votes |
void slowCheckMemberAccess(Class<?> caller, Class<?> clazz, Object obj, int modifiers, Class<?> targetClass) throws IllegalAccessException { Reflection.ensureMemberAccess(caller, clazz, obj, modifiers); // Success: Update the cache. Object cache = ((targetClass == clazz) ? caller : new Class<?>[] { caller, targetClass }); // Note: The two cache elements are not volatile, // but they are effectively final. The Java memory model // guarantees that the initializing stores for the cache // elements will occur before the volatile write. securityCheckCache = cache; // write volatile }
Example 3
Source File: AccessibleObject.java From Java8CN with Apache License 2.0 | 6 votes |
void slowCheckMemberAccess(Class<?> caller, Class<?> clazz, Object obj, int modifiers, Class<?> targetClass) throws IllegalAccessException { Reflection.ensureMemberAccess(caller, clazz, obj, modifiers); // Success: Update the cache. Object cache = ((targetClass == clazz) ? caller : new Class<?>[] { caller, targetClass }); // Note: The two cache elements are not volatile, // but they are effectively final. The Java memory model // guarantees that the initializing stores for the cache // elements will occur before the volatile write. securityCheckCache = cache; // write volatile }
Example 4
Source File: AccessibleObject.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
void slowCheckMemberAccess(Class<?> caller, Class<?> clazz, Object obj, int modifiers, Class<?> targetClass) throws IllegalAccessException { Reflection.ensureMemberAccess(caller, clazz, obj, modifiers); // Success: Update the cache. Object cache = ((targetClass == clazz) ? caller : new Class<?>[] { caller, targetClass }); // Note: The two cache elements are not volatile, // but they are effectively final. The Java memory model // guarantees that the initializing stores for the cache // elements will occur before the volatile write. securityCheckCache = cache; // write volatile }
Example 5
Source File: AccessibleObject.java From openjdk-8 with GNU General Public License v2.0 | 6 votes |
void slowCheckMemberAccess(Class<?> caller, Class<?> clazz, Object obj, int modifiers, Class<?> targetClass) throws IllegalAccessException { Reflection.ensureMemberAccess(caller, clazz, obj, modifiers); // Success: Update the cache. Object cache = ((targetClass == clazz) ? caller : new Class<?>[] { caller, targetClass }); // Note: The two cache elements are not volatile, // but they are effectively final. The Java memory model // guarantees that the initializing stores for the cache // elements will occur before the volatile write. securityCheckCache = cache; // write volatile }
Example 6
Source File: AccessibleObject.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
void slowCheckMemberAccess(Class<?> caller, Class<?> clazz, Object obj, int modifiers, Class<?> targetClass) throws IllegalAccessException { Reflection.ensureMemberAccess(caller, clazz, obj, modifiers); // Success: Update the cache. Object cache = ((targetClass == clazz) ? caller : new Class<?>[] { caller, targetClass }); // Note: The two cache elements are not volatile, // but they are effectively final. The Java memory model // guarantees that the initializing stores for the cache // elements will occur before the volatile write. securityCheckCache = cache; // write volatile }
Example 7
Source File: AccessibleObject.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 6 votes |
void slowCheckMemberAccess(Class<?> caller, Class<?> clazz, Object obj, int modifiers, Class<?> targetClass) throws IllegalAccessException { Reflection.ensureMemberAccess(caller, clazz, obj, modifiers); // Success: Update the cache. Object cache = ((targetClass == clazz) ? caller : new Class<?>[] { caller, targetClass }); // Note: The two cache elements are not volatile, // but they are effectively final. The Java memory model // guarantees that the initializing stores for the cache // elements will occur before the volatile write. securityCheckCache = cache; // write volatile }
Example 8
Source File: AccessibleObject.java From JDKSourceCode1.8 with MIT License | 6 votes |
void slowCheckMemberAccess(Class<?> caller, Class<?> clazz, Object obj, int modifiers, Class<?> targetClass) throws IllegalAccessException { Reflection.ensureMemberAccess(caller, clazz, obj, modifiers); // Success: Update the cache. Object cache = ((targetClass == clazz) ? caller : new Class<?>[] { caller, targetClass }); // Note: The two cache elements are not volatile, // but they are effectively final. The Java memory model // guarantees that the initializing stores for the cache // elements will occur before the volatile write. securityCheckCache = cache; // write volatile }
Example 9
Source File: AccessibleObject.java From jdk-1.7-annotated with Apache License 2.0 | 6 votes |
void slowCheckMemberAccess(Class<?> caller, Class<?> clazz, Object obj, int modifiers, Class<?> targetClass) throws IllegalAccessException { Reflection.ensureMemberAccess(caller, clazz, obj, modifiers); // Success: Update the cache. Object cache = ((targetClass == clazz) ? caller : new Class<?>[] { caller, targetClass }); // Note: The two cache elements are not volatile, // but they are effectively final. The Java memory model // guarantees that the initializing stores for the cache // elements will occur before the volatile write. securityCheckCache = cache; // write volatile }
Example 10
Source File: AccessibleObject.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
void slowCheckMemberAccess(Class<?> caller, Class<?> clazz, Object obj, int modifiers, Class<?> targetClass) throws IllegalAccessException { Reflection.ensureMemberAccess(caller, clazz, obj, modifiers); // Success: Update the cache. Object cache = ((targetClass == clazz) ? caller : new Class<?>[] { caller, targetClass }); // Note: The two cache elements are not volatile, // but they are effectively final. The Java memory model // guarantees that the initializing stores for the cache // elements will occur before the volatile write. securityCheckCache = cache; // write volatile }
Example 11
Source File: AccessibleObject.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
void slowCheckMemberAccess(Class<?> caller, Class<?> clazz, Object obj, int modifiers, Class<?> targetClass) throws IllegalAccessException { Reflection.ensureMemberAccess(caller, clazz, obj, modifiers); // Success: Update the cache. Object cache = ((targetClass == clazz) ? caller : new Class<?>[] { caller, targetClass }); // Note: The two cache elements are not volatile, // but they are effectively final. The Java memory model // guarantees that the initializing stores for the cache // elements will occur before the volatile write. securityCheckCache = cache; // write volatile }
Example 12
Source File: AccessibleObject.java From jdk1.8-source-analysis with Apache License 2.0 | 6 votes |
void slowCheckMemberAccess(Class<?> caller, Class<?> clazz, Object obj, int modifiers, Class<?> targetClass) throws IllegalAccessException { Reflection.ensureMemberAccess(caller, clazz, obj, modifiers); // Success: Update the cache. Object cache = ((targetClass == clazz) ? caller : new Class<?>[] { caller, targetClass }); // Note: The two cache elements are not volatile, // but they are effectively final. The Java memory model // guarantees that the initializing stores for the cache // elements will occur before the volatile write. securityCheckCache = cache; // write volatile }
Example 13
Source File: ReflectUtil.java From openjdk-8 with GNU General Public License v2.0 | 4 votes |
public static void ensureMemberAccess(Class<?> currentClass, Class<?> memberClass, Object target, int modifiers) throws IllegalAccessException { if (target == null && Modifier.isProtected(modifiers)) { int mods = modifiers; mods = mods & (~Modifier.PROTECTED); mods = mods | Modifier.PUBLIC; /* * See if we fail because of class modifiers */ Reflection.ensureMemberAccess(currentClass, memberClass, target, mods); try { /* * We're still here so class access was ok. * Now try with default field access. */ mods = mods & (~Modifier.PUBLIC); Reflection.ensureMemberAccess(currentClass, memberClass, target, mods); /* * We're still here so access is ok without * checking for protected. */ return; } catch (IllegalAccessException e) { /* * Access failed but we're 'protected' so * if the test below succeeds then we're ok. */ if (isSubclassOf(currentClass, memberClass)) { return; } else { throw e; } } } else { Reflection.ensureMemberAccess(currentClass, memberClass, target, modifiers); } }
Example 14
Source File: ReflectUtil.java From TencentKona-8 with GNU General Public License v2.0 | 4 votes |
public static void ensureMemberAccess(Class<?> currentClass, Class<?> memberClass, Object target, int modifiers) throws IllegalAccessException { if (target == null && Modifier.isProtected(modifiers)) { int mods = modifiers; mods = mods & (~Modifier.PROTECTED); mods = mods | Modifier.PUBLIC; /* * See if we fail because of class modifiers */ Reflection.ensureMemberAccess(currentClass, memberClass, target, mods); try { /* * We're still here so class access was ok. * Now try with default field access. */ mods = mods & (~Modifier.PUBLIC); Reflection.ensureMemberAccess(currentClass, memberClass, target, mods); /* * We're still here so access is ok without * checking for protected. */ return; } catch (IllegalAccessException e) { /* * Access failed but we're 'protected' so * if the test below succeeds then we're ok. */ if (isSubclassOf(currentClass, memberClass)) { return; } else { throw e; } } } else { Reflection.ensureMemberAccess(currentClass, memberClass, target, modifiers); } }
Example 15
Source File: ReflectUtil.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 4 votes |
public static void ensureMemberAccess(Class<?> currentClass, Class<?> memberClass, Object target, int modifiers) throws IllegalAccessException { if (target == null && Modifier.isProtected(modifiers)) { int mods = modifiers; mods = mods & (~Modifier.PROTECTED); mods = mods | Modifier.PUBLIC; /* * See if we fail because of class modifiers */ Reflection.ensureMemberAccess(currentClass, memberClass, target, mods); try { /* * We're still here so class access was ok. * Now try with default field access. */ mods = mods & (~Modifier.PUBLIC); Reflection.ensureMemberAccess(currentClass, memberClass, target, mods); /* * We're still here so access is ok without * checking for protected. */ return; } catch (IllegalAccessException e) { /* * Access failed but we're 'protected' so * if the test below succeeds then we're ok. */ if (isSubclassOf(currentClass, memberClass)) { return; } else { throw e; } } } else { Reflection.ensureMemberAccess(currentClass, memberClass, target, modifiers); } }
Example 16
Source File: ReflectUtil.java From javaide with GNU General Public License v3.0 | 4 votes |
public static void ensureMemberAccess(Class currentClass, Class memberClass, Object target, int modifiers) throws IllegalAccessException { if (target == null && Modifier.isProtected(modifiers)) { int mods = modifiers; mods = mods & (~Modifier.PROTECTED); mods = mods | Modifier.PUBLIC; /* * See if we fail because of class modifiers */ Reflection.ensureMemberAccess(currentClass, memberClass, target, mods); try { /* * We're still here so class access was ok. * Now try with default field access. */ mods = mods & (~Modifier.PUBLIC); Reflection.ensureMemberAccess(currentClass, memberClass, target, mods); /* * We're still here so access is ok without * checking for protected. */ return; } catch (IllegalAccessException e) { /* * Access failed but we're 'protected' so * if the test below succeeds then we're ok. */ if (isSubclassOf(currentClass, memberClass)) { return; } else { throw e; } } } else { Reflection.ensureMemberAccess(currentClass, memberClass, target, modifiers); } }
Example 17
Source File: ReflectUtil.java From jdk8u-jdk with GNU General Public License v2.0 | 4 votes |
public static void ensureMemberAccess(Class<?> currentClass, Class<?> memberClass, Object target, int modifiers) throws IllegalAccessException { if (target == null && Modifier.isProtected(modifiers)) { int mods = modifiers; mods = mods & (~Modifier.PROTECTED); mods = mods | Modifier.PUBLIC; /* * See if we fail because of class modifiers */ Reflection.ensureMemberAccess(currentClass, memberClass, target, mods); try { /* * We're still here so class access was ok. * Now try with default field access. */ mods = mods & (~Modifier.PUBLIC); Reflection.ensureMemberAccess(currentClass, memberClass, target, mods); /* * We're still here so access is ok without * checking for protected. */ return; } catch (IllegalAccessException e) { /* * Access failed but we're 'protected' so * if the test below succeeds then we're ok. */ if (isSubclassOf(currentClass, memberClass)) { return; } else { throw e; } } } else { Reflection.ensureMemberAccess(currentClass, memberClass, target, modifiers); } }
Example 18
Source File: ReflectUtil.java From dragonwell8_jdk with GNU General Public License v2.0 | 4 votes |
public static void ensureMemberAccess(Class<?> currentClass, Class<?> memberClass, Object target, int modifiers) throws IllegalAccessException { if (target == null && Modifier.isProtected(modifiers)) { int mods = modifiers; mods = mods & (~Modifier.PROTECTED); mods = mods | Modifier.PUBLIC; /* * See if we fail because of class modifiers */ Reflection.ensureMemberAccess(currentClass, memberClass, target, mods); try { /* * We're still here so class access was ok. * Now try with default field access. */ mods = mods & (~Modifier.PUBLIC); Reflection.ensureMemberAccess(currentClass, memberClass, target, mods); /* * We're still here so access is ok without * checking for protected. */ return; } catch (IllegalAccessException e) { /* * Access failed but we're 'protected' so * if the test below succeeds then we're ok. */ if (isSubclassOf(currentClass, memberClass)) { return; } else { throw e; } } } else { Reflection.ensureMemberAccess(currentClass, memberClass, target, modifiers); } }
Example 19
Source File: ReflectUtil.java From openjdk-8-source with GNU General Public License v2.0 | 4 votes |
public static void ensureMemberAccess(Class<?> currentClass, Class<?> memberClass, Object target, int modifiers) throws IllegalAccessException { if (target == null && Modifier.isProtected(modifiers)) { int mods = modifiers; mods = mods & (~Modifier.PROTECTED); mods = mods | Modifier.PUBLIC; /* * See if we fail because of class modifiers */ Reflection.ensureMemberAccess(currentClass, memberClass, target, mods); try { /* * We're still here so class access was ok. * Now try with default field access. */ mods = mods & (~Modifier.PUBLIC); Reflection.ensureMemberAccess(currentClass, memberClass, target, mods); /* * We're still here so access is ok without * checking for protected. */ return; } catch (IllegalAccessException e) { /* * Access failed but we're 'protected' so * if the test below succeeds then we're ok. */ if (isSubclassOf(currentClass, memberClass)) { return; } else { throw e; } } } else { Reflection.ensureMemberAccess(currentClass, memberClass, target, modifiers); } }
Example 20
Source File: ReflectUtil.java From hottub with GNU General Public License v2.0 | 4 votes |
public static void ensureMemberAccess(Class<?> currentClass, Class<?> memberClass, Object target, int modifiers) throws IllegalAccessException { if (target == null && Modifier.isProtected(modifiers)) { int mods = modifiers; mods = mods & (~Modifier.PROTECTED); mods = mods | Modifier.PUBLIC; /* * See if we fail because of class modifiers */ Reflection.ensureMemberAccess(currentClass, memberClass, target, mods); try { /* * We're still here so class access was ok. * Now try with default field access. */ mods = mods & (~Modifier.PUBLIC); Reflection.ensureMemberAccess(currentClass, memberClass, target, mods); /* * We're still here so access is ok without * checking for protected. */ return; } catch (IllegalAccessException e) { /* * Access failed but we're 'protected' so * if the test below succeeds then we're ok. */ if (isSubclassOf(currentClass, memberClass)) { return; } else { throw e; } } } else { Reflection.ensureMemberAccess(currentClass, memberClass, target, modifiers); } }