I am trying to upgrade to Java 17 (from 11) and Spring 6 (from 5) and when I try to run a test I get
java.lang.IllegalAccessException: expected a non-static field: me.common.context.ContextManager.contextClassRegistry/me.common.context.ContextClassRegistry/getStatic
The field looks like
private static final ContextClassRegistry contextClassRegistry = new ContextClassRegistry();
The code causing the issue is
VarHandle modifiersHandle = lookup.findVarHandle(ContextManager.class, "contextClassRegistry", ContextClassRegistry.class);
How do I allow access through both the static final
?