RFR: JDK-8318563: GetClassFields should not use random access to field [v2]

Chris Plummer cjplummer at openjdk.org
Wed Jan 10 17:31:25 UTC 2024


On Wed, 10 Jan 2024 10:16:01 GMT, Hannes Greule <hgreule at openjdk.org> wrote:

>> You said in the description that the order was reversed, but I don't see where that is getting fixed. It seems it was partially fixed by [JDK-8317692](https://bugs.openjdk.org/browse/JDK-8317692), but it is only preserving the class hierarchy order, but not the order of fields within each class. If that's all you are attempting to do, then please make it clear in the description.
>
> FieldStream from reflectionUtils iterates fields in reverse order, so reversing again was previously needed here. JavaFieldStream from fieldStreams (and the new FilteredJavaFieldStream) iterate in the order the fields actually occur, so this double-reversing isn't needed anymore.
> 
> It's a bit confusing to have FilteredJavaFieldStream in reflectionUtils; eventually it would probably make sense to move the FilteredFieldsMap and FilteredjavaFieldStream into fieldStreams instead?

Ok. I see now how the old code was actually reversing the order to undo the reversing that was already done.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/17094#discussion_r1447702578


More information about the hotspot-dev mailing list