RFR: 8310335 JFR: Modernize collections and switch statements
Hannes Greule
duke at openjdk.org
Tue Jun 20 06:51:06 UTC 2023
On Mon, 19 Jun 2023 18:38:57 GMT, Erik Gahlin <egahlin at openjdk.org> wrote:
> Could I have a review of an update to the jfr modules to use more recent APIs and language constructs.
>
> Testing: test/jdk/jdk/jfr
>
> Thanks
> Erik
src/jdk.jfr/share/classes/jdk/jfr/consumer/RecordedObject.java line 505:
> 503: return b;
> 504: }
> 505: if (o instanceof UnsignedValue unsigned) {
I think this can be further simplified, e.g.,
return switch(o) {
case Short s -> s;
case Byte b -> b;
case UnsignedValue(Short s) -> s;
case UnsignedValue(Byte b) -> (short) Byte.toUnsignedInt(b);
case null, default -> throw newIllegalArgumentException(name, "short");
};
What do you think?
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/14547#discussion_r1234810812
More information about the hotspot-jfr-dev
mailing list