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

Aleksey Shipilev shade at openjdk.java.net
Thu Jan 14 10:24:18 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+.

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

Commit messages:
 - Trying to shun the warnings

Changes: https://git.openjdk.java.net/jmh/pull/18/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jmh&pr=18&range=00
  Issue: https://bugs.openjdk.java.net/browse/CODETOOLS-7902695
  Stats: 23 lines in 1 file changed: 20 ins; 0 del; 3 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