RFR: 8267121: Illegal access to private "size" field of ArrayList from build.gradle

Kevin Rushforth kcr at openjdk.java.net
Sat May 15 14:08:05 UTC 2021


A test of our CI build with gradle 7.0.1 and JDK 16.0.1 revealed a latent bug in `build.gradle` in the `fetchExternalTools()` method. It checks the size of an `ArrayList` in two places, but rather than calling the `size()` method it omits the `()` which means it is accessing the private `size` field.

Starting in JDK 16, which has default strong encapsulation, this no longer works, so we need to fix this before switching. We really should fix it anyway, since accessing the internal field is both unnecessary and wrong.

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

Commit messages:
 - 8267121: Illegal access to private "size" field of ArrayList from build.gradle

Changes: https://git.openjdk.java.net/jfx/pull/503/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jfx&pr=503&range=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8267121
  Stats: 2 lines in 1 file changed: 0 ins; 0 del; 2 mod
  Patch: https://git.openjdk.java.net/jfx/pull/503.diff
  Fetch: git fetch https://git.openjdk.java.net/jfx pull/503/head:pull/503

PR: https://git.openjdk.java.net/jfx/pull/503


More information about the openjfx-dev mailing list