On Mon, 5 May 2025 13:44:32 GMT, Hannes Greule <hgre...@openjdk.org> wrote:

>> For the record, in the ideal case I would like to backport this into JDK 21 
>> as well. Do you think that the change in iteration order would be 
>> problematic for that?
>
>> For the record, in the ideal case I would like to backport this into JDK 21 
>> as well. Do you think that the change in iteration order would be 
>> problematic for that?
> 
> I think that also affects iteration order of Java methods like 
> `Class#getDeclaredFields()` etc.? While the order is unspecified there, I'm 
> pretty certain that it would break existing code. But even worse, [JVM TI 
> specifies that `GetClassFields` returns fields in the order they occur in the 
> class 
> file](https://docs.oracle.com/en/java/javase/21/docs/specs/jvmti.html#GetClassFields).
>  I assume this is currently broken?

@SirYwell Oh, that's correct. I haven't noticed that requirement; I guess that 
this means that the PR needs to be updated. 

How does the order of iteration cooperate with `@Contended`, though? In 
`FieldLayoutBuilder::regular_field_sorting` we separate static and contended 
fields; doesn't that break the requirement?

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

PR Comment: https://git.openjdk.org/jdk/pull/24847#issuecomment-2851099200

Reply via email to