jdk/src/java.base/share/classes/java/lang/StackWalker.java
changeset 38569 0321fb06a8c5
parent 37819 8a2559d6fe5b
child 38784 c0a88deb692a
--- a/jdk/src/java.base/share/classes/java/lang/StackWalker.java	Wed May 25 13:53:03 2016 -0700
+++ b/jdk/src/java.base/share/classes/java/lang/StackWalker.java	Wed May 25 14:05:51 2016 -0700
@@ -306,8 +306,9 @@
             return DEFAULT_WALKER;
         }
 
-        checkPermission(options);
-        return new StackWalker(toEnumSet(options));
+        EnumSet<Option> optionSet = toEnumSet(options);
+        checkPermission(optionSet);
+        return new StackWalker(optionSet);
     }
 
     /**
@@ -341,8 +342,9 @@
         if (estimateDepth <= 0) {
             throw new IllegalArgumentException("estimateDepth must be > 0");
         }
-        checkPermission(options);
-        return new StackWalker(toEnumSet(options), estimateDepth);
+        EnumSet<Option> optionSet = toEnumSet(options);
+        checkPermission(optionSet);
+        return new StackWalker(optionSet, estimateDepth);
     }
 
     // ----- private constructors ------
@@ -540,13 +542,11 @@
     }
 
     // ---- package access ----
-    static StackWalker newInstanceNoCheck(EnumSet<Option> options) {
-        return new StackWalker(options, 0, null);
-    }
 
     static StackWalker newInstance(Set<Option> options, ExtendedOption extendedOption) {
-        checkPermission(options);
-        return new StackWalker(toEnumSet(options), 0, extendedOption);
+        EnumSet<Option> optionSet = toEnumSet(options);
+        checkPermission(optionSet);
+        return new StackWalker(optionSet, 0, extendedOption);
     }
 
     int estimateDepth() {