< prev index next >
test/jdk/java/lang/reflect/Proxy/nonPublicProxy/NonPublicProxyClass.java
Print this page
rev 47439 : 8189291: Test policy should extend the default system policy
Reviewed-by:
@@ -1,7 +1,7 @@
/*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 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.
@@ -37,19 +37,21 @@
import java.security.SecurityPermission;
import java.util.*;
/*
* @test
- * @bug 8004260
+ * @bug 8004260 8189291
* @summary Test proxy classes that implement non-public interface
*
* @build p.Foo
* @run main/othervm NonPublicProxyClass grant
* @run main/othervm NonPublicProxyClass deny
* @run main/othervm NonPublicProxyClass
*/
public class NonPublicProxyClass {
+ static final Policy DEFAULT_POLICY = Policy.getPolicy();
+
public interface PublicInterface {
void foo();
}
interface NonPublicInterface {
void bar();
@@ -198,11 +200,12 @@
public PermissionCollection getPermissions(CodeSource codesource) {
return permissions;
}
public boolean implies(ProtectionDomain domain, Permission perm) {
- return permissions.implies(perm);
+ return permissions.implies(perm) ||
+ DEFAULT_POLICY.implies(domain, perm);
}
public String toString() {
StringBuilder sb = new StringBuilder("policy: ");
Enumeration<Permission> perms = permissions.elements();
< prev index next >