Description
The method RecordedEvent#getThread returns the thread that is related to the event. In the current implementation, the value of the property eventThread is returned by this method. But ExecutionSample and NativeMethodSample events don't have a value for this property, only a value for the sampledThread property. Therefore the RecordedEvent#getThread returns always null for these events, which is confusing. A better behaviour would be to check first the eventThread and then the sampledThread property before finally returning null if there really is no related thread property.
This could arguably include the allocStatisticsThread for ThreadAllocationStatistics events too, as shown by https://github.com/openjdk/jmc/blob/master/core/org.openjdk.jmc.flightrecorder/src/main/java/org/openjdk/jmc/flightrecorder/parser/synthetic/SyntheticAttributeExtension.java#L101 which normalizes the different thread property names in JMC.
This could arguably include the allocStatisticsThread for ThreadAllocationStatistics events too, as shown by https://github.com/openjdk/jmc/blob/master/core/org.openjdk.jmc.flightrecorder/src/main/java/org/openjdk/jmc/flightrecorder/parser/synthetic/SyntheticAttributeExtension.java#L101 which normalizes the different thread property names in JMC.