wrprice commented on PR #9802:
URL: https://github.com/apache/netbeans/pull/9802#issuecomment-6998670778

   > You simply don't want to allow the user to perform a refactoring when they 
are doing something invalid, such as moving a non-static, uninitialized field 
to an interface. Instead, the user needs to fix the source code and return to 
the refactoring. Could you confirm that?
   
   Disallowing the refactoring operation is one potential solution to prevent 
the IDE from happily assisting the developer to shoot themselves in the foot.  
In the proper circumstances (IMO, this may qualify as one of them) denial could 
be the better result along the lines of IDEA's behavior (as you noted).
   
   NB32 will currently let you perform refactoring operations that break the 
code; this case of a missing initializer is just one minor example.  Should 
NB's behavior change to be more like IDEA's?  I'm not the arbiter of that, I'm 
not even a maintainer. But if the Pull-Up operation is allowed to execute 
hopefully we agree that there will be consequences to the program behavior that 
the developer **may** have to fix and **might not** have intended:
   
   1. If non-public, access changes to `public`
   2. If instance level, becomes `static` *on a different type*
   3. If non-final, becomes `final`
   4. If not initialized, it will need to be initialized (because of 2 & 3 
above) \[yours, NEW]
   
   As you noted, NB32 currently shows only a single warning in the Pull Up 
dialog for (1):
   
   > Warning: Member "val" is being moved to interface, but is not public.
   
   IMO, the importance of these changes from most- to least-impactful 
(importance) is: **2, 3, 1, 4**
   
   So I'm not saying that adding an error/warning about (4) is wrong, but if it 
hides 2, 3, or 1 it is not doing the developer a favor.  NB's prior behavior of 
warning about (1) and not (2) or (3) is problematic IMO.
   
   **So I do like your proposed UI change to display more than one 
warning/error.**
   
   With those details surfaced, the developer can make an informed decision on 
whether or not to click the "Refactor" button.  We can't force them to fully 
understand or even read the messages, but we did our due diligence.
   


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

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

Reply via email to