RFR: 9999: avoiding NPE for callers of TransformRegistry#getTransformData(…

Gunnar Morling github.com+28612+gunnarmorling at openjdk.java.net
Sun Nov 29 19:30:59 UTC 2020


…) of no transform data exists

@thegreystone, @Josh-Matsuoka, et al., this fixes an NPE in the `Transformer` class if there is no metadata for the given class (we unconditionally try to iterate over the returned list). I noticed this while debugging something else, it seems this NPE gets swallowed elsewhere, but creating it over and over is costly of course.

I think never returning null from a collection method is a good practice anyways, so I've changed it accordingly. Could someone log an issue for this, so I can reference it? Thanks!

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

Commit messages:
 - 9999: avoiding NPE for callers of TransformRegistry#getTransformData() of no transform data exists

Changes: https://git.openjdk.java.net/jmc/pull/169/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jmc&pr=169&range=00
  Issue: https://bugs.openjdk.java.net/browse/JMC-9999
  Stats: 38 lines in 3 files changed: 10 ins; 1 del; 27 mod
  Patch: https://git.openjdk.java.net/jmc/pull/169.diff
  Fetch: git fetch https://git.openjdk.java.net/jmc pull/169/head:pull/169

PR: https://git.openjdk.java.net/jmc/pull/169


More information about the jmc-dev mailing list