< prev index next >

test/jdk/java/util/concurrent/atomic/AtomicUpdaters.java

Print this page
rev 47439 : 8189291: Test policy should extend the default system policy
Reviewed-by:

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License version 2 only, as
  * published by the Free Software Foundation.

@@ -21,11 +21,11 @@
  * questions.
  */
 
 /*
  * @test
- * @bug 7103570
+ * @bug 7103570 8189291
  * @author David Holmes
  * @run main/othervm AtomicUpdaters
  * @run main/othervm AtomicUpdaters UseSM
  * @summary Checks the (in)ability to create field updaters for differently
  *          accessible fields in different locations with/without a security

@@ -45,10 +45,12 @@
 import java.util.concurrent.atomic.AtomicLongFieldUpdater;
 import java.util.concurrent.atomic.AtomicReference;
 import java.util.concurrent.atomic.AtomicReferenceFieldUpdater;
 
 public class  AtomicUpdaters {
+    static final Policy DEFAULT_POLICY = Policy.getPolicy();
+
     enum TYPE { INT, LONG, REF }
 
     static class Config {
         final Class<?> clazz;
         final String field;

@@ -214,9 +216,10 @@
             return Policy.UNSUPPORTED_EMPTY_COLLECTION;
         }
 
         @Override
         public boolean implies(ProtectionDomain pd, Permission p) {
-            return Policy.UNSUPPORTED_EMPTY_COLLECTION.implies(p);
+            return Policy.UNSUPPORTED_EMPTY_COLLECTION.implies(p) ||
+                    DEFAULT_POLICY.implies(pd, p);
         }
     }
 }
< prev index next >