RFR: CODETOOLS-7902695: JMH should not try to access inaccessible fields [v2]

Aleksey Shipilev shade at openjdk.java.net
Thu Jan 14 10:46:19 UTC 2021


> JDK 9+ reluctantly allows accessing `Console.cs` field to get the console encoding for e.g. Windows. JDK 16+ disallows it point-blank. JDK 9+ still prints the warning. Given that we would not be able to do this in future, it makes sense to check for field accessibility before trying to `setAccessible` the field for JDK 9+.

Aleksey Shipilev has updated the pull request incrementally with two additional commits since the last revision:

 - Allow breaking in with jmh.forceSetAccessible
 - Fix up comments

-------------

Changes:
  - all: https://git.openjdk.java.net/jmh/pull/18/files
  - new: https://git.openjdk.java.net/jmh/pull/18/files/6ab68e2b..7239912c

Webrevs:
 - full: https://webrevs.openjdk.java.net/?repo=jmh&pr=18&range=01
 - incr: https://webrevs.openjdk.java.net/?repo=jmh&pr=18&range=00-01

  Stats: 15 lines in 1 file changed: 7 ins; 3 del; 5 mod
  Patch: https://git.openjdk.java.net/jmh/pull/18.diff
  Fetch: git fetch https://git.openjdk.java.net/jmh pull/18/head:pull/18

PR: https://git.openjdk.java.net/jmh/pull/18


More information about the jmh-dev mailing list