/** * Determine whether the call stack contains a given class. Useful for assertions. * * @param clazz the class to test * @return {@code true} if the call stack contains the class */ public boolean callStackContains(Class<?> clazz) { final Class<?>[] stack = WildFlySecurityManager.getCallStack(); for (int i = 2; i < stack.length; i ++) { if (stack[i] == clazz) return true; } return false; } }
/** * Get the call stack. * * @return the call stack */ public Class<?>[] getCallStack() { final Class<?>[] stack = WildFlySecurityManager.getCallStack(); return copyOfRange(stack, 2, stack.length); }
/** * Get all or a portion of the call stack. The {@code numFrames} argument specifies how many frames should be * returned. * * @param skipFrames the number of frames to skip; 0 will include the immediate caller at index 0 * @return the partial call stack */ public Class<?>[] getCallStack(int skipFrames) { final Class<?>[] stack = WildFlySecurityManager.getCallStack(); final int from = max(0, skipFrames) + 2; return copyOfRange(stack, from, stack.length); }
/** * Get all or a portion of the call stack. The {@code numFrames} argument specifies how many frames should be * returned. * * @param skipFrames the number of frames to skip; 0 will include the immediate caller at index 0 * @param numFrames the maximum number of frames to return * @return the partial call stack */ public Class<?>[] getCallStack(int skipFrames, int numFrames) { final Class<?>[] stack = WildFlySecurityManager.getCallStack(); final int from = max(0, skipFrames) + 2; return copyOfRange(stack, from, min(from + numFrames, stack.length)); }
@SuppressWarnings("deprecation") static Class<?> getCallerClass(int n) { if (hasGetCallerClass) { return JDKSpecific.getCallerClass(n + callerOffset); } else { return getCallStack()[n + callerOffset]; } }
/** * Determine whether the call stack contains a given class. Useful for assertions. * * @param clazz the class to test * @return {@code true} if the call stack contains the class */ public boolean callStackContains(Class<?> clazz) { final Class<?>[] stack = WildFlySecurityManager.getCallStack(); for (int i = 2; i < stack.length; i ++) { if (stack[i] == clazz) return true; } return false; } }
/** * Get the call stack. * * @return the call stack */ public Class<?>[] getCallStack() { final Class<?>[] stack = WildFlySecurityManager.getCallStack(); return copyOfRange(stack, 2, stack.length); }
/** * Get the call stack. * * @return the call stack */ public Class<?>[] getCallStack() { final Class<?>[] stack = WildFlySecurityManager.getCallStack(); return copyOfRange(stack, 2, stack.length); }
/** * Get the call stack. * * @return the call stack */ public Class<?>[] getCallStack() { final Class<?>[] stack = WildFlySecurityManager.getCallStack(); return copyOfRange(stack, 2, stack.length); }
/** * Get the call stack. * * @return the call stack */ public Class<?>[] getCallStack() { final Class<?>[] stack = WildFlySecurityManager.getCallStack(); return copyOfRange(stack, 2, stack.length); }
/** * Get all or a portion of the call stack. The {@code numFrames} argument specifies how many frames should be * returned. * * @param skipFrames the number of frames to skip; 0 will include the immediate caller at index 0 * @return the partial call stack */ public Class<?>[] getCallStack(int skipFrames) { final Class<?>[] stack = WildFlySecurityManager.getCallStack(); final int from = max(0, skipFrames) + 2; return copyOfRange(stack, from, stack.length); }
/** * Get all or a portion of the call stack. The {@code numFrames} argument specifies how many frames should be * returned. * * @param skipFrames the number of frames to skip; 0 will include the immediate caller at index 0 * @return the partial call stack */ public Class<?>[] getCallStack(int skipFrames) { final Class<?>[] stack = WildFlySecurityManager.getCallStack(); final int from = max(0, skipFrames) + 2; return copyOfRange(stack, from, stack.length); }
/** * Get all or a portion of the call stack. The {@code numFrames} argument specifies how many frames should be * returned. * * @param skipFrames the number of frames to skip; 0 will include the immediate caller at index 0 * @return the partial call stack */ public Class<?>[] getCallStack(int skipFrames) { final Class<?>[] stack = WildFlySecurityManager.getCallStack(); final int from = max(0, skipFrames) + 2; return copyOfRange(stack, from, stack.length); }
/** * Get all or a portion of the call stack. The {@code numFrames} argument specifies how many frames should be * returned. * * @param skipFrames the number of frames to skip; 0 will include the immediate caller at index 0 * @return the partial call stack */ public Class<?>[] getCallStack(int skipFrames) { final Class<?>[] stack = WildFlySecurityManager.getCallStack(); final int from = max(0, skipFrames) + 2; return copyOfRange(stack, from, stack.length); }
/** * Get all or a portion of the call stack. The {@code numFrames} argument specifies how many frames should be * returned. * * @param skipFrames the number of frames to skip; 0 will include the immediate caller at index 0 * @param numFrames the maximum number of frames to return * @return the partial call stack */ public Class<?>[] getCallStack(int skipFrames, int numFrames) { final Class<?>[] stack = WildFlySecurityManager.getCallStack(); final int from = max(0, skipFrames) + 2; return copyOfRange(stack, from, min(from + numFrames, stack.length)); }
/** * Get all or a portion of the call stack. The {@code numFrames} argument specifies how many frames should be * returned. * * @param skipFrames the number of frames to skip; 0 will include the immediate caller at index 0 * @param numFrames the maximum number of frames to return * @return the partial call stack */ public Class<?>[] getCallStack(int skipFrames, int numFrames) { final Class<?>[] stack = WildFlySecurityManager.getCallStack(); final int from = max(0, skipFrames) + 2; return copyOfRange(stack, from, min(from + numFrames, stack.length)); }
@SuppressWarnings("deprecation") static Class<?> getCallerClass(int n) { if (hasGetCallerClass) { return JDKSpecific.getCallerClass(n + callerOffset); } else { return getCallStack()[n + callerOffset]; } }
@SuppressWarnings("deprecation") static Class<?> getCallerClass(int n) { if (hasGetCallerClass) { return Reflection.getCallerClass(n + callerOffset); } else { return getCallStack()[n + callerOffset]; } }
@SuppressWarnings("deprecation") static Class<?> getCallerClass(int n) { if (hasGetCallerClass) { return Reflection.getCallerClass(n + callerOffset); } else { return getCallStack()[n + callerOffset]; } }
@SuppressWarnings("deprecation") static Class<?> getCallerClass(int n) { if (hasGetCallerClass) { return JDKSpecific.getCallerClass(n + callerOffset); } else { return getCallStack()[n + callerOffset]; } }