Merge "Updated the warning about old-style inner class metadata to reflect the current understanding of the situation." into gingerbread
diff --git a/tests/060-reflection-security/expected.txt b/tests/060-reflection-security/expected.txt
deleted file mode 100644
index 69d6da8..0000000
--- a/tests/060-reflection-security/expected.txt
+++ /dev/null
@@ -1,58 +0,0 @@
-Setting SecurityManager.
-checkPermission: (java.security.SecurityPermission getProperty.package.access)
-checkPackageAccess: java.lang
-Running tests.
-
-getFields A
-checkMemberAccess: other.Blort, PUBLIC
-getFields B
-checkMemberAccess: other.Blort, PUBLIC
-java.lang.SecurityException: Denied!
-
-getDeclaredFields A
-checkMemberAccess: other.Blort, DECLARED
-checkPermission: (java.lang.RuntimePermission accessDeclaredMembers)
-getDeclaredFields B
-checkMemberAccess: other.Blort, DECLARED
-java.lang.SecurityException: Denied!
-
-getMethods A
-checkMemberAccess: other.Blort, PUBLIC
-getMethods B
-checkMemberAccess: other.Blort, PUBLIC
-java.lang.SecurityException: Denied!
-
-getDeclaredMethods A
-checkMemberAccess: other.Blort, DECLARED
-checkPermission: (java.lang.RuntimePermission accessDeclaredMembers)
-getDeclaredMethods B
-checkMemberAccess: other.Blort, DECLARED
-java.lang.SecurityException: Denied!
-
-getConstructors A
-checkMemberAccess: other.Blort, PUBLIC
-getConstructors B
-checkMemberAccess: other.Blort, PUBLIC
-java.lang.SecurityException: Denied!
-
-getDeclaredConstructors A
-checkMemberAccess: other.Blort, DECLARED
-checkPermission: (java.lang.RuntimePermission accessDeclaredMembers)
-getDeclaredConstructors B
-checkMemberAccess: other.Blort, DECLARED
-java.lang.SecurityException: Denied!
-
-getClasses A
-checkMemberAccess: other.Blort, PUBLIC
-getClasses B
-checkMemberAccess: other.Blort, PUBLIC
-java.lang.SecurityException: Denied!
-
-getDeclaredClasses A
-checkMemberAccess: other.Blort, DECLARED
-checkPermission: (java.lang.RuntimePermission accessDeclaredMembers)
-getDeclaredClasses B
-checkMemberAccess: other.Blort, DECLARED
-java.lang.SecurityException: Denied!
-
-Done!
diff --git a/tests/060-reflection-security/info.txt b/tests/060-reflection-security/info.txt
deleted file mode 100644
index ed0adf5..0000000
--- a/tests/060-reflection-security/info.txt
+++ /dev/null
@@ -1 +0,0 @@
-This is a basic test of how a SecurityManager can impact reflection calls.
diff --git a/tests/060-reflection-security/src/Enforcer.java b/tests/060-reflection-security/src/Enforcer.java
deleted file mode 100644
index ad68817..0000000
--- a/tests/060-reflection-security/src/Enforcer.java
+++ /dev/null
@@ -1,66 +0,0 @@
-import java.lang.reflect.Member;
-import java.security.Permission;
-
-public class Enforcer extends SecurityManager {
- public static final Enforcer THE_ONE = new Enforcer();
-
- /** whether to deny the next request */
- private boolean deny;
-
- /**
- * Not publicly constructable. Use {@link #THE_ONE}.
- */
- private Enforcer() {
- deny = false;
- }
-
- /**
- * Deny the next request.
- */
- public void denyNext() {
- deny = true;
- }
-
- /**
- * Throw an exception if the instance had been asked to deny a request.
- */
- private void denyIfAppropriate() {
- if (deny) {
- deny = false;
- throw new SecurityException("Denied!");
- }
- }
-
- public void checkPackageAccess(String pkg) {
- System.out.println("checkPackageAccess: " + pkg);
- denyIfAppropriate();
- super.checkPackageAccess(pkg);
- }
-
- public void checkMemberAccess(Class c, int which) {
- String member;
-
- switch (which) {
- case Member.DECLARED: member = "DECLARED"; break;
- case Member.PUBLIC: member = "PUBLIC"; break;
- default: member = "<" + which + ">?"; break;
- }
-
- System.out.println("checkMemberAccess: " + c.getName() + ", " +
- member);
- denyIfAppropriate();
- super.checkMemberAccess(c, which);
- }
-
- public void checkPermission(Permission perm) {
- System.out.println("checkPermission: " + perm);
- denyIfAppropriate();
- super.checkPermission(perm);
- }
-
- public void checkPermission(Permission perm, Object context) {
- System.out.println("checkPermission: " + perm + ", " + context);
- denyIfAppropriate();
- super.checkPermission(perm, context);
- }
-}
diff --git a/tests/060-reflection-security/src/Main.java b/tests/060-reflection-security/src/Main.java
deleted file mode 100644
index 9db0251..0000000
--- a/tests/060-reflection-security/src/Main.java
+++ /dev/null
@@ -1,158 +0,0 @@
-import other.Blort;
-
-public class Main {
- static public boolean VERBOSE = false;
-
- static public void main(String[] args) {
- if (args.length > 0) {
- if (args[0].equals("--verbose")) {
- VERBOSE = true;
- }
- }
-
- System.out.println("Setting SecurityManager.");
- System.setSecurityManager(Enforcer.THE_ONE);
- System.out.println("Running tests.");
- accessStuff();
- System.out.println("\nDone!");
- }
-
- static public void report(Throwable t) {
- if (VERBOSE) {
- t.printStackTrace(System.out);
- } else {
- System.out.println(t);
- }
- }
-
- static public void accessStuff() {
- Class c = other.Blort.class;
-
- /*
- * Note: We don't use reflection to factor out these tests,
- * becuase reflection also calls into the SecurityManager, and
- * we don't want to conflate the calls nor assume too much
- * in general about what calls reflection will cause.
- */
-
- System.out.println("\ngetFields A");
- try {
- c.getFields();
- } catch (Exception ex) {
- report(ex);
- }
-
- System.out.println("getFields B");
- Enforcer.THE_ONE.denyNext();
- try {
- c.getFields();
- } catch (Exception ex) {
- report(ex);
- }
-
- System.out.println("\ngetDeclaredFields A");
- try {
- c.getDeclaredFields();
- } catch (Exception ex) {
- report(ex);
- }
-
- System.out.println("getDeclaredFields B");
- Enforcer.THE_ONE.denyNext();
- try {
- c.getDeclaredFields();
- } catch (Exception ex) {
- report(ex);
- }
-
- System.out.println("\ngetMethods A");
- try {
- c.getMethods();
- } catch (Exception ex) {
- report(ex);
- }
-
- System.out.println("getMethods B");
- Enforcer.THE_ONE.denyNext();
- try {
- c.getMethods();
- } catch (Exception ex) {
- report(ex);
- }
-
- System.out.println("\ngetDeclaredMethods A");
- try {
- c.getDeclaredMethods();
- } catch (Exception ex) {
- report(ex);
- }
-
- System.out.println("getDeclaredMethods B");
- Enforcer.THE_ONE.denyNext();
- try {
- c.getDeclaredMethods();
- } catch (Exception ex) {
- report(ex);
- }
-
- System.out.println("\ngetConstructors A");
- try {
- c.getConstructors();
- } catch (Exception ex) {
- report(ex);
- }
-
- System.out.println("getConstructors B");
- Enforcer.THE_ONE.denyNext();
- try {
- c.getConstructors();
- } catch (Exception ex) {
- report(ex);
- }
-
- System.out.println("\ngetDeclaredConstructors A");
- try {
- c.getDeclaredConstructors();
- } catch (Exception ex) {
- report(ex);
- }
-
- System.out.println("getDeclaredConstructors B");
- Enforcer.THE_ONE.denyNext();
- try {
- c.getDeclaredConstructors();
- } catch (Exception ex) {
- report(ex);
- }
-
- System.out.println("\ngetClasses A");
- try {
- c.getClasses();
- } catch (Exception ex) {
- report(ex);
- }
-
- System.out.println("getClasses B");
- Enforcer.THE_ONE.denyNext();
- try {
- c.getClasses();
- } catch (Exception ex) {
- report(ex);
- }
-
- System.out.println("\ngetDeclaredClasses A");
- try {
- c.getDeclaredClasses();
- } catch (Exception ex) {
- report(ex);
- }
-
- System.out.println("getDeclaredClasses B");
- Enforcer.THE_ONE.denyNext();
- try {
- c.getDeclaredClasses();
- } catch (Exception ex) {
- report(ex);
- }
- }
-}
diff --git a/tests/060-reflection-security/src/other/Blort.java b/tests/060-reflection-security/src/other/Blort.java
deleted file mode 100644
index 033ae69..0000000
--- a/tests/060-reflection-security/src/other/Blort.java
+++ /dev/null
@@ -1,24 +0,0 @@
-package other;
-
-public class Blort {
- private int privateField;
- /*package*/ int packageField;
- protected int protectedField;
- public int publicField;
-
- private void privateMethod() {
- // This space intentionally left blank.
- }
-
- /*package*/ void packageMethod() {
- // This space intentionally left blank.
- }
-
- protected void protectedMethod() {
- // This space intentionally left blank.
- }
-
- public void publicMethod() {
- // This space intentionally left blank.
- }
-}