< prev index next >

src/java.base/share/classes/java/lang/LiveStackFrame.java

Print this page




 155     }
 156 
 157     /**
 158      * Gets a {@code StackWalker} instance with the given options specifying
 159      * the stack frame information it can access, and which will traverse at most
 160      * the given {@code maxDepth} number of stack frames.  If no option is
 161      * specified, this {@code StackWalker} obtains the method name and
 162      * the class name with all
 163      * {@linkplain StackWalker.Option#SHOW_HIDDEN_FRAMES hidden frames} skipped.
 164      * The returned {@code StackWalker} can get locals and operands.
 165      *
 166      * @param options stack walk {@link StackWalker.Option options}
 167      *
 168      * @throws SecurityException if the security manager is present and
 169      * it denies access to {@code RuntimePermission("liveStackFrames")};
 170      * or if the given {@code options} contains
 171      * {@link StackWalker.Option#RETAIN_CLASS_REFERENCE Option.RETAIN_CLASS_REFERENCE}
 172      * and it denies access to {@code RuntimePermission("getStackWalkerWithClassReference")}.
 173      */
 174     public static StackWalker getStackWalker(Set<StackWalker.Option> options) {






















 175         SecurityManager sm = System.getSecurityManager();
 176         if (sm != null) {
 177             sm.checkPermission(new RuntimePermission("liveStackFrames"));
 178         }
 179         return StackWalker.newInstance(options, LOCALS_AND_OPERANDS);






































 180     }
 181 }


 155     }
 156 
 157     /**
 158      * Gets a {@code StackWalker} instance with the given options specifying
 159      * the stack frame information it can access, and which will traverse at most
 160      * the given {@code maxDepth} number of stack frames.  If no option is
 161      * specified, this {@code StackWalker} obtains the method name and
 162      * the class name with all
 163      * {@linkplain StackWalker.Option#SHOW_HIDDEN_FRAMES hidden frames} skipped.
 164      * The returned {@code StackWalker} can get locals and operands.
 165      *
 166      * @param options stack walk {@link StackWalker.Option options}
 167      *
 168      * @throws SecurityException if the security manager is present and
 169      * it denies access to {@code RuntimePermission("liveStackFrames")};
 170      * or if the given {@code options} contains
 171      * {@link StackWalker.Option#RETAIN_CLASS_REFERENCE Option.RETAIN_CLASS_REFERENCE}
 172      * and it denies access to {@code RuntimePermission("getStackWalkerWithClassReference")}.
 173      */
 174     public static StackWalker getStackWalker(Set<StackWalker.Option> options) {
 175         return getStackWalker(options, null);
 176     }
 177 
 178     /**
 179      * Gets a {@code StackWalker} instance with the given options specifying
 180      * the stack frame information it can access, and which will traverse at most
 181      * the given {@code maxDepth} number of stack frames.  If no option is
 182      * specified, this {@code StackWalker} obtains the method name and
 183      * the class name with all
 184      * {@linkplain StackWalker.Option#SHOW_HIDDEN_FRAMES hidden frames} skipped.
 185      * The returned {@code StackWalker} can get locals and operands.
 186      *
 187      * @param options stack walk {@link StackWalker.Option options}
 188      * @param contScope the continuation scope up to which (inclusive) to walk the stack
 189      *
 190      * @throws SecurityException if the security manager is present and
 191      * it denies access to {@code RuntimePermission("liveStackFrames")}; or
 192      * or if the given {@code options} contains
 193      * {@link StackWalker.Option#RETAIN_CLASS_REFERENCE Option.RETAIN_CLASS_REFERENCE}
 194      * and it denies access to {@code RuntimePermission("getStackWalkerWithClassReference")}.
 195      */
 196     public static StackWalker getStackWalker(Set<StackWalker.Option> options, ContinuationScope contScope) {
 197         SecurityManager sm = System.getSecurityManager();
 198         if (sm != null) {
 199             sm.checkPermission(new RuntimePermission("liveStackFrames"));
 200         }
 201         return StackWalker.newInstance(options, LOCALS_AND_OPERANDS, contScope);
 202     }
 203 
 204     /**
 205      * Gets {@code StackWalker} of the given unmounted continuation, that can get locals and operands.
 206      *
 207      * @param continuation the continuation to walk
 208      * 
 209      * @throws SecurityException if the security manager is present and
 210      * denies access to {@code RuntimePermission("liveStackFrames")}
 211      */
 212     public static StackWalker getStackWalker(Continuation continuation) {
 213         return getStackWalker(EnumSet.noneOf(StackWalker.Option.class), continuation.getScope(), continuation);
 214     }
 215 
 216     /**
 217      * Gets a {@code StackWalker} instance with the given options specifying
 218      * the stack frame information it can access, and which will traverse at most
 219      * the given {@code maxDepth} number of stack frames.  If no option is
 220      * specified, this {@code StackWalker} obtains the method name and
 221      * the class name with all
 222      * {@linkplain StackWalker.Option#SHOW_HIDDEN_FRAMES hidden frames} skipped.
 223      * The returned {@code StackWalker} can get locals and operands.
 224      *
 225      * @param options stack walk {@link StackWalker.Option options}
 226      * @param continuation the continuation to walk
 227      *
 228      * @throws SecurityException if the security manager is present and
 229      * it denies access to {@code RuntimePermission("liveStackFrames")}; or
 230      * or if the given {@code options} contains
 231      * {@link StackWalker.Option#RETAIN_CLASS_REFERENCE Option.RETAIN_CLASS_REFERENCE}
 232      * and it denies access to {@code RuntimePermission("getStackWalkerWithClassReference")}.
 233      */
 234     public static StackWalker getStackWalker(Set<StackWalker.Option> options, ContinuationScope contScope, Continuation continuation) {
 235         SecurityManager sm = System.getSecurityManager();
 236         if (sm != null) {
 237             sm.checkPermission(new RuntimePermission("liveStackFrames"));
 238         }
 239         return StackWalker.newInstance(options, LOCALS_AND_OPERANDS, contScope, continuation);
 240     }
 241 }
< prev index next >