mvvmfx/src/main/java/de/saxsys/mvvmfx/internal/viewloader/ReflectionUtils.java
public static void accessMember(final AccessibleObject member, final SideEffectWithException sideEffect, String errorMessage) {
		if (sideEffect == null) {
			return;
		}
		AccessController.doPrivileged((PrivilegedAction<?>) () -> {
			boolean wasAccessible = member.isAccessible();
			try {
				member.setAccessible(true);
				sideEffect.call();
			} catch (Exception exception) {
				throw new IllegalStateException(errorMessage, exception);
			} finally {
				member.setAccessible(wasAccessible);
			}
			return null;
		});
	}
public static void accessMember(final AccessibleObject member, final SideEffectWithException sideEffect, String errorMessage) {
		if (sideEffect == null) {
			return;
		}
		AccessController.doPrivileged((PrivilegedAction<?>) () -> {
			boolean wasAccessible = member.isAccessible();
			try {
				member.setAccessible(true);
				sideEffect.call();
			} catch (Exception exception) {
				throw new IllegalStateException(errorMessage, exception);
			} finally {
				member.setAccessible(wasAccessible);
			}
			return null;
		});
	}
Helper method to execute a callback on a given member. This method encapsulates the error handling logic and the
handling of accessibility of the member. The difference to
{@link ReflectionUtils#accessMember(AccessibleObject, Callable, String)} is that this method takes a callback that doesn't
return anything but only creates a sideeffect.

After the callback is executed the accessibility of the member will be reset to the originally state.

@param member
the member that is made accessible to run the callback
@param sideEffect
the callback that will be executed.
@param errorMessage
the error message that is used in the exception when something went wrong.

@throws IllegalStateException
when something went wrong.