homberghp opened a new issue, #8290:
URL: https://github.com/apache/netbeans/issues/8290

   ### Apache NetBeans version
   
   Apache NetBeans 24
   
   ### What happened
   
   When you try to pull up a record (static) member of the record type, 
refactoring  drops the record information.
   
   Context; School extends Institute.
   Pull up member Student to institute
   
   The code in class School 
   ```
       record Student(int id, String name, LocalDate dob, String... grades) 
implements Serializable {
   
           Student    {
               // ensure valid id
               assert id > 0;
               assert name != null && !name.isBlank();
               assert dob.isAfter(LocalDate.EPOCH);
           }
   
           String gradesAsString() {
               return Arrays.toString(grades);
           }
       }
   ```
   
   After pull up Student to Institute:
   
   ```
   class Institute {
       class Student implements Serializable {
   
           private final int id;
           private final String name;
           private final LocalDate dob;
           private final String[] grades;
   
           Student(int id, String name, LocalDate dob, String... grades) {
               super();
               // ensure valid id
               assert id > 0;
               assert name != null && !name.isBlank();
               assert dob.isAfter(LocalDate.EPOCH);
           }
   
           String gradesAsString() {
               return Arrays.toString(grades);
           }
       }
   }
   ```
   
   ```
   
   ### Language / Project Type / NetBeans Component
   
   j17 netbeans  25 and earlier
   
   ### How to reproduce
   
   
[recordast.zip](https://github.com/user-attachments/files/19053718/recordast.zip)
   
   Unpack the zip file, open resulting project with netbeans, and try to 
refactor the teacher or student class by pull up to super (institute). 
   Resulting code is wrong because no longer A RECORD and incomplete 
(constructor does not initialize final fields). 
   
   
   
   ### Did this work correctly in an earlier version?
   
   No / Don't know
   
   ### Operating System
   
   ubuntu 24.04 
   
   ### JDK
   
   17
   
   ### Apache NetBeans packaging
   
   Apache NetBeans binary zip
   
   ### Anything else
   
   I am working on #7044, in PR but my solution is not yet complete, because it 
is quite hard to find the relevant places where the distinction should be made 
between normal classes and records.
   
   I'm  currently working on #7044 and create a PR, nut that should be held up 
until it is complete.
   
   
   ### Are you willing to submit a pull request?
   
   Yes


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscr...@netbeans.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscr...@netbeans.apache.org
For additional commands, e-mail: notifications-h...@netbeans.apache.org

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

Reply via email to