RFR: 8293879: Remove unnecessary castings in jdk.hotspot.agent
Chris Plummer
cjplummer at openjdk.org
Thu Sep 15 22:34:40 UTC 2022
On Thu, 15 Sep 2022 20:49:14 GMT, Andrey Turbanov <aturbanov at openjdk.org> wrote:
> Redundant castings make code harder to read.
> Found them by IntelliJ IDEA.
> I tried to choose only casts which are definitely safe to remove.
> Most generification was done in [JDK-8241618](https://bugs.openjdk.org/browse/JDK-8241618), but casts weren't removed.
Looks good. Nice cleanup.
It looks like a lot of these got introduced by [JDK-8241618](https://bugs.openjdk.org/browse/JDK-8241618), which says:
> I started to address the unchecked warnings. Unfortunately, this was a much bigger task than I anticipated. I had to generify most of the module.
So I guess with the new use of generics in place, the existing casts became unnecessary.
src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/shared/GenCollectedHeap.java line 134:
> 132: } else {
> 133: return VMObjectFactory.newObject(GenerationSpec.class,
> 134: oldGenSpecField.getAddress());
Maybe make each of these one line instead of two.
-------------
Marked as reviewed by cjplummer (Reviewer).
PR: https://git.openjdk.org/jdk/pull/10295
More information about the serviceability-dev
mailing list