I have a setup like this:
public final class RequestContext<T extends Cache> {
T roleSpecificCache;
public static final class Spec implements Supplier<RequestContext> {
private Spec() {
}
T roleSpecificCache; // << Getting error here
}
private RequestContext(Spec b) {
this.roleSpecificCache = b.roleSpecificCache; // << I want to do this
}
}
However on the line T roleSpecificCache
, I get the following error
:
RequestContext.this cannot be referenced from a static context
I understand the reason why I'm getting this error (i.e. there's no direct link between the two classes), but don't know how to fix it. I want to to be able to do what I'm doing at the end.
Also, I cannot make Spec
non-static (out of my hands).