RFR: 8264001: JFR: Modernize implementation

Erik Gahlin egahlin at openjdk.java.net
Wed Mar 24 21:16:40 UTC 2021


On Wed, 24 Mar 2021 17:52:13 GMT, Andrey Turbanov <github.com+741251+turbanoff at openjdk.org> wrote:

>> Hi,
>> 
>> Could I have a review of changes that updates the Java implementation of JFR with newer language constructs and library calls.  I also removed unused imports, dead code and added @Override where approriate.
>> 
>> Testing: jdk/jdk/jfr
>
> src/jdk.jfr/share/classes/jdk/jfr/consumer/RecordedStackTrace.java line 54:
> 
>> 52:         Object[] array = getTyped("frames", Object[].class, null);
>> 53:         if (array == null) {
>> 54:             return new ArrayList<>(0);
> 
> Why ArrayList is used here and not List.of() as everywhere else?

I wanted it to be consistent.

Now the list is always modifiable, regardless of how it is constructed. One could argue for always returning an  unmodifiable list, but it would require a spec change.

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

PR: https://git.openjdk.java.net/jdk/pull/3138


More information about the hotspot-jfr-dev mailing list