Hi, This is a review for a new test which has a different implementation for JDK 8 & JDK 9
During the review of JDK-8065552: setAccessible(true) on fields of Class may throw a SecurityException, it was remarked that such a test would be useful. So here is such a test that loads all classes from the BCL, calls getDeclaredFields() for each of them, and attempt to set each field to accessible. On JDK 8 and JDK 9 this is quite fast (~ 3.2sec when a security manager is on). The differences between 8 & 9 are limited to: - ClassLoader: - on 8 we use 'null' (BCL) - on 9 we use the system class loader. - Building the stream of class names: - on 8 we have jars & folders in the boot class path - on 9 we have .jimage files webrev jdk8: http://cr.openjdk.java.net/~dfuchs/webrev_8066612/webrev-jdk8.00/ webrev jdk9: http://cr.openjdk.java.net/~dfuchs/webrev_8066612/webrev-jdk9.00/ best regards, -- daniel PS: For the curious I have also experimented with a version of this test for JDK 7u [1] (where Streams have been replaced by Lists). On 7 you need to either increase the PermGen size or split the test into several invocations (the method I chose in [1]). [1] don't review the link below - it's just for the record if/when someone wants to backport on 7u... http://cr.openjdk.java.net/~dfuchs/webrev_8066612/webrev-jdk7.00