/** * Try to call {@link AccessibleObject#setAccessible(boolean)} but will catch any {@link SecurityException} and * {@link java.lang.reflect.InaccessibleObjectException} and return it. * The caller must check if it returns {@code null} and if not handle the returned exception. */ public static Throwable trySetAccessible(AccessibleObject object, boolean checkAccessible) { if (checkAccessible && !PlatformDependent0.isExplicitTryReflectionSetAccessible()) { return new UnsupportedOperationException("Reflective setAccessible(true) disabled"); } try { object.setAccessible(true); return null; } catch (SecurityException e) { return e; } catch (RuntimeException e) { return handleInaccessibleObjectException(e); } }
/** * Try to call {@link AccessibleObject#setAccessible(boolean)} but will catch any {@link SecurityException} and * {@link java.lang.reflect.InaccessibleObjectException} and return it. * The caller must check if it returns {@code null} and if not handle the returned exception. */ public static Throwable trySetAccessible(AccessibleObject object, boolean checkAccessible) { if (checkAccessible && !PlatformDependent0.isExplicitTryReflectionSetAccessible()) { return new UnsupportedOperationException("Reflective setAccessible(true) disabled"); } try { object.setAccessible(true); return null; } catch (SecurityException e) { return e; } catch (RuntimeException e) { return handleInaccessibleObjectException(e); } }
/** * Try to call {@link AccessibleObject#setAccessible(boolean)} but will catch any {@link SecurityException} and * {@link java.lang.reflect.InaccessibleObjectException} and return it. * The caller must check if it returns {@code null} and if not handle the returned exception. */ public static Throwable trySetAccessible(AccessibleObject object, boolean checkAccessible) { if (checkAccessible && !PlatformDependent0.isExplicitTryReflectionSetAccessible()) { return new UnsupportedOperationException("Reflective setAccessible(true) disabled"); } try { object.setAccessible(true); return null; } catch (SecurityException e) { return e; } catch (RuntimeException e) { return handleInaccessibleObjectException(e); } }
/** * Try to call {@link AccessibleObject#setAccessible(boolean)} but will catch any {@link SecurityException} and * {@link java.lang.reflect.InaccessibleObjectException} and return it. * The caller must check if it returns {@code null} and if not handle the returned exception. */ public static Throwable trySetAccessible(AccessibleObject object, boolean checkAccessible) { if (checkAccessible && !PlatformDependent0.isExplicitTryReflectionSetAccessible()) { return new UnsupportedOperationException("Reflective setAccessible(true) disabled"); } try { object.setAccessible(true); return null; } catch (SecurityException e) { return e; } catch (RuntimeException e) { return handleInaccessibleObjectException(e); } }
/** * Try to call {@link AccessibleObject#setAccessible(boolean)} but will catch any {@link SecurityException} and * {@link java.lang.reflect.InaccessibleObjectException} and return it. * The caller must check if it returns {@code null} and if not handle the returned exception. */ public static Throwable trySetAccessible(AccessibleObject object, boolean checkAccessible) { if (checkAccessible && !PlatformDependent0.isExplicitTryReflectionSetAccessible()) { return new UnsupportedOperationException("Reflective setAccessible(true) disabled"); } try { object.setAccessible(true); return null; } catch (SecurityException e) { return e; } catch (RuntimeException e) { return handleInaccessibleObjectException(e); } }
/** * Try to call {@link AccessibleObject#setAccessible(boolean)} but will catch any {@link SecurityException} and * {@link java.lang.reflect.InaccessibleObjectException} and return it. * The caller must check if it returns {@code null} and if not handle the returned exception. */ public static Throwable trySetAccessible(AccessibleObject object, boolean checkAccessible) { if (checkAccessible && !PlatformDependent0.isExplicitTryReflectionSetAccessible()) { return new UnsupportedOperationException("Reflective setAccessible(true) disabled"); } try { object.setAccessible(true); return null; } catch (SecurityException e) { return e; } catch (RuntimeException e) { return handleInaccessibleObjectException(e); } }
/** * Try to call {@link AccessibleObject#setAccessible(boolean)} but will catch any {@link SecurityException} and * {@link java.lang.reflect.InaccessibleObjectException} and return it. * The caller must check if it returns {@code null} and if not handle the returned exception. */ public static Throwable trySetAccessible(AccessibleObject object, boolean checkAccessible) { if (checkAccessible && !PlatformDependent0.isExplicitTryReflectionSetAccessible()) { return new UnsupportedOperationException("Reflective setAccessible(true) disabled"); } try { object.setAccessible(true); return null; } catch (SecurityException e) { return e; } catch (RuntimeException e) { return handleInaccessibleObjectException(e); } }