You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@netbeans.apache.org by Patrik Karlström <pa...@trixon.se> on 2025/02/01 18:51:30 UTC

NB25rc1 Bug in 'record' Organize Members?

When I organize members of a record like
public record Settings(Color borderColor, double borderSize, int width, int
height) {
it changes to
public record Settings(Color borderColor, double borderSize, int height,
int width) {

notice the swap of width & height.

This only happens when a record is in its own file, as a nested object, no
swapping occurs.

I don't see this behavior in NB24.

/Patrik

Re: NB25rc1 Bug in 'record' Organize Members?

Posted by Michael Bien <mb...@gmail.com>.
btw this might fix it: https://github.com/apache/netbeans/pull/8220

This feature is technically a refactoring since member order is also 
initialization order and can influence classloading and all kinds of 
other things. I thought it is curious that it is configured via 
formatter settings but it doesn't run on re-format (which is good IMO - 
i feared it would).

-mbien


On 02.02.25 14:41, Patrik Karlström wrote:
> Thanks for confirming.
>
> There is no need to organize members on a record but I did it on a package
> level and thankfully the record was open so I was able to notice the swap.
> :)
>
> Den lör 1 feb. 2025 kl 21:09 skrev Michael Bien <mb...@gmail.com>:
>
>> I don't think this is a regression. added it to the reprorepo
>>
>>
>> https://github.com/mbien/nb-reprorepo/blob/302ef1cc3cb0f829dc97dcf6843c270c4170364c/tinybugs/src/main/java/bugs/organizerecordmembers/OrderMembersRecord.java#L5
>>
>> but still worth fixing, formatter should not refactor code ;)
>>
>> -mbien
>>
>> On 01.02.25 19:51, Patrik Karlström wrote:
>>> When I organize members of a record like
>>> public record Settings(Color borderColor, double borderSize, int width,
>> int
>>> height) {
>>> it changes to
>>> public record Settings(Color borderColor, double borderSize, int height,
>>> int width) {
>>>
>>> notice the swap of width & height.
>>>
>>> This only happens when a record is in its own file, as a nested object,
>> no
>>> swapping occurs.
>>>
>>> I don't see this behavior in NB24.
>>>
>>> /Patrik
>>>
>>


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@netbeans.apache.org
For additional commands, e-mail: dev-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists




Re: NB25rc1 Bug in 'record' Organize Members?

Posted by Patrik Karlström <pa...@trixon.se>.
Thanks for confirming.

There is no need to organize members on a record but I did it on a package
level and thankfully the record was open so I was able to notice the swap.
:)

Den lör 1 feb. 2025 kl 21:09 skrev Michael Bien <mb...@gmail.com>:

> I don't think this is a regression. added it to the reprorepo
>
>
> https://github.com/mbien/nb-reprorepo/blob/302ef1cc3cb0f829dc97dcf6843c270c4170364c/tinybugs/src/main/java/bugs/organizerecordmembers/OrderMembersRecord.java#L5
>
> but still worth fixing, formatter should not refactor code ;)
>
> -mbien
>
> On 01.02.25 19:51, Patrik Karlström wrote:
> > When I organize members of a record like
> > public record Settings(Color borderColor, double borderSize, int width,
> int
> > height) {
> > it changes to
> > public record Settings(Color borderColor, double borderSize, int height,
> > int width) {
> >
> > notice the swap of width & height.
> >
> > This only happens when a record is in its own file, as a nested object,
> no
> > swapping occurs.
> >
> > I don't see this behavior in NB24.
> >
> > /Patrik
> >
>
>

Re: NB25rc1 Bug in 'record' Organize Members?

Posted by Michael Bien <mb...@gmail.com>.
I don't think this is a regression. added it to the reprorepo

https://github.com/mbien/nb-reprorepo/blob/302ef1cc3cb0f829dc97dcf6843c270c4170364c/tinybugs/src/main/java/bugs/organizerecordmembers/OrderMembersRecord.java#L5

but still worth fixing, formatter should not refactor code ;)

-mbien

On 01.02.25 19:51, Patrik Karlström wrote:
> When I organize members of a record like
> public record Settings(Color borderColor, double borderSize, int width, int
> height) {
> it changes to
> public record Settings(Color borderColor, double borderSize, int height,
> int width) {
>
> notice the swap of width & height.
>
> This only happens when a record is in its own file, as a nested object, no
> swapping occurs.
>
> I don't see this behavior in NB24.
>
> /Patrik
>


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@netbeans.apache.org
For additional commands, e-mail: dev-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists




Re: NB25rc1 Bug in 'record' Organize Members?

Posted by Michael Bien <mb...@gmail.com>.
record components are essentially final fields in a class. The contract 
is that the order reflects in the record declaration. So i could imagine 
that the organize members refactoring could rearrange record components 
if it doesn't check for it.

Although there wouldn't be much else to do, outside the occasional 
static field I suppose. Might be easy to fix.

-mbien

On 01.02.25 19:51, Patrik Karlström wrote:
> When I organize members of a record like
> public record Settings(Color borderColor, double borderSize, int width, int
> height) {
> it changes to
> public record Settings(Color borderColor, double borderSize, int height,
> int width) {
>
> notice the swap of width & height.
>
> This only happens when a record is in its own file, as a nested object, no
> swapping occurs.
>
> I don't see this behavior in NB24.
>
> /Patrik
>


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@netbeans.apache.org
For additional commands, e-mail: dev-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists