Java 类java.lang.StackWalker.Option 实例源码

项目:openjdk-jdk10    文件:HiddenFrames.java   
void walk() {
   Stream.of(0).forEach(i -> walker.walk(s ->
   {
       s.forEach(this::checkFrame);
       return null;
   }));

    // only check hidden frames but not reflection frames
    // walk is not invoked via reflection
    if (option == null && !lambdas.isEmpty()) {
        throw new RuntimeException("Hidden frames are shown");
    }

    if (option == Option.SHOW_HIDDEN_FRAMES && lambdas.isEmpty()) {
        throw new RuntimeException("No hidden Lambda frame");
    }
}
项目:openjdk-jdk10    文件:HiddenFrames.java   
void walkFromReflection() throws Exception {
    Method m = HiddenFrames.class.getDeclaredMethod("walk");
    m.invoke(this);

    if (option == null && !lambdas.isEmpty()) {
        throw new RuntimeException("Hidden frames are shown");
    }

    if (option == Option.SHOW_HIDDEN_FRAMES && lambdas.isEmpty()) {
        throw new RuntimeException("No hidden Lambda frame");
    }

    if (option != null && reflects.isEmpty()) {
        throw new RuntimeException("No reflection frame");
    }
}
项目:openjdk9    文件:HiddenFrames.java   
void walk() {
   Stream.of(0).forEach(i -> walker.walk(s ->
   {
       s.forEach(this::checkFrame);
       return null;
   }));

    // only check hidden frames but not reflection frames
    // walk is not invoked via reflection
    if (option == null && !lambdas.isEmpty()) {
        throw new RuntimeException("Hidden frames are shown");
    }

    if (option == Option.SHOW_HIDDEN_FRAMES && lambdas.isEmpty()) {
        throw new RuntimeException("No hidden Lambda frame");
    }
}
项目:openjdk9    文件:HiddenFrames.java   
void walkFromReflection() throws Exception {
    Method m = HiddenFrames.class.getDeclaredMethod("walk");
    m.invoke(this);

    if (option == null && !lambdas.isEmpty()) {
        throw new RuntimeException("Hidden frames are shown");
    }

    if (option == Option.SHOW_HIDDEN_FRAMES && lambdas.isEmpty()) {
        throw new RuntimeException("No hidden Lambda frame");
    }

    if (option != null && reflects.isEmpty()) {
        throw new RuntimeException("No reflection frame");
    }
}
项目:openjdk-jdk10    文件:StackStreamFactory.java   
private int toStackWalkMode(StackWalker walker, int mode) {
    int newMode = mode;
    if (walker.hasOption(Option.SHOW_HIDDEN_FRAMES) &&
            (mode & FILL_CLASS_REFS_ONLY) != FILL_CLASS_REFS_ONLY)
        newMode |= SHOW_HIDDEN_FRAMES;
    if (walker.hasLocalsOperandsOption())
        newMode |= FILL_LIVE_STACK_FRAMES;
    return newMode;
}
项目:openjdk9    文件:StackStreamFactory.java   
private int toStackWalkMode(StackWalker walker, int mode) {
    int newMode = mode;
    if (walker.hasOption(Option.SHOW_HIDDEN_FRAMES) &&
            (mode & FILL_CLASS_REFS_ONLY) != FILL_CLASS_REFS_ONLY)
        newMode |= SHOW_HIDDEN_FRAMES;
    if (walker.hasLocalsOperandsOption())
        newMode |= FILL_LIVE_STACK_FRAMES;
    return newMode;
}
项目:openjdk-jdk10    文件:StackStreamFactory.java   
private boolean skipReflectionFrames() {
    return !walker.hasOption(Option.SHOW_REFLECT_FRAMES) &&
               !walker.hasOption(Option.SHOW_HIDDEN_FRAMES);
}
项目:openjdk-jdk10    文件:StackRecorderUtil.java   
public StackRecorderUtil(Set<StackWalker.Option> swOptions) {
    compareClasses = swOptions.contains(Option.RETAIN_CLASS_REFERENCE);
    compareSTEs = true;
}
项目:openjdk-jdk10    文件:HiddenFrames.java   
public static void main(String... args) throws Exception {
    new HiddenFrames().test();
    new HiddenFrames(Option.SHOW_REFLECT_FRAMES).test();
    new HiddenFrames(Option.SHOW_HIDDEN_FRAMES).test();
}
项目:openjdk-jdk10    文件:HiddenFrames.java   
HiddenFrames(Option option) {
    this.option = option;
    this.walker = StackWalker.getInstance(option);
}
项目:openjdk-jdk10    文件:NativeMethod.java   
NativeMethod() {
    this.walker = StackWalker.getInstance(Option.SHOW_REFLECT_FRAMES);
}
项目:openjdk9    文件:StackStreamFactory.java   
private boolean skipReflectionFrames() {
    return !walker.hasOption(Option.SHOW_REFLECT_FRAMES) &&
               !walker.hasOption(Option.SHOW_HIDDEN_FRAMES);
}
项目:openjdk9    文件:StackRecorderUtil.java   
public StackRecorderUtil(Set<StackWalker.Option> swOptions) {
    compareClasses = swOptions.contains(Option.RETAIN_CLASS_REFERENCE);
    compareSTEs = true;
}
项目:openjdk9    文件:HiddenFrames.java   
public static void main(String... args) throws Exception {
    new HiddenFrames().test();
    new HiddenFrames(Option.SHOW_REFLECT_FRAMES).test();
    new HiddenFrames(Option.SHOW_HIDDEN_FRAMES).test();
}
项目:openjdk9    文件:HiddenFrames.java   
HiddenFrames(Option option) {
    this.option = option;
    this.walker = StackWalker.getInstance(option);
}