changeset 38569:0321fb06a8c5

8157877: Clean up StackWalker permission checks Reviewed-by: lancea, ahgross
author mchung
date Wed, 25 May 2016 14:05:51 -0700
parents f992c34c85b3
children 97bcc3a1be3f
files jdk/src/java.base/share/classes/java/lang/StackWalker.java
diffstat 1 files changed, 9 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- 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() {