You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@netbeans.apache.org by Scott Palmer <sw...@gmail.com> on 2022/11/29 01:59:35 UTC

'Move Inner to Outer...' refactoring of a nested record fails

I had a class that has within it a simple record:

 // class and interface names changed for my amusement
public abstract class ScottsAwesomeClass implements AmazingThings { 

    static record Location(int line, int column) {}

    // … a lot more stuff ...
}


I placed the cursor on the word “Location” and right-clicked to select the refactoring “Move Inner to Outer Level…”
Leaving the defaults in the dialog that appeared and hit “Refactor”.

The result was a new source file for a *class* named Location in the same package:

class Location {
}

Oh and the new Location.java file did NOT contain the configured license header.
And it is very much not at all the equivalent of:

record Location(int line, int column) {}

It also changed the references to the record, in a different source file for a class extending ScottsAwesomeClass, to fully qualified references to the new Location class, despite all classes/records being in the same package and the original reference using the ‘var’ keyword.

In other words, it went badly. ;-)

I’m guessing the refactoring has simply not been updated to handle records?


Scott


---------------------------------------------------------------------
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