You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
That use-case could be migrated to java.lang.StackWalker, with something like:
publicfinalclassCallerResolver {
privatestaticfinalStackWalkerSTACK_WALKER =
StackWalker.getInstance(StackWalker.Option.RETAIN_CLASS_REFERENCE);
privatestaticfinalintCALL_CONTEXT_OFFSET = 1; // may need to change if this class is redesigned/** * Indexes into the current method call context with a given offset. */publicstaticClassgetCallerClass(finalintcallerOffset) {
returnSTACK_WALKER
.walk(
s -> s.skip(CALL_CONTEXT_OFFSET + callerOffset)
.map(StackWalker.StackFrame::getDeclaringClass)
.findFirst())
.get();
}
}
The StackWalker API was added in Java 9, and I think procyon is compatible with JDK 7. To migrate while continuing to support JDK 7 it would be possible to use reflection to access StackWalker, or a multi-release jar.
The text was updated successfully, but these errors were encountered:
SecurityManager
is deprecated for removal, see also https://openjdk.org/jeps/486It is used in procyon in
CallerResolver
forSecurityManager#getClassContext
:https://github.com/mstrobel/procyon/blob/88a95fa93c58322393174f84543edc7a0a2ca44d/Procyon.Core/src/main/java/com/strobel/compilerservices/CallerResolver.java#L19C43-L19C58
That use-case could be migrated to
java.lang.StackWalker
, with something like:The
StackWalker
API was added in Java 9, and I think procyon is compatible with JDK 7. To migrate while continuing to support JDK 7 it would be possible to use reflection to accessStackWalker
, or a multi-release jar.The text was updated successfully, but these errors were encountered: