svatoun commented on a change in pull request #361: my first refactoring session
URL: https://github.com/apache/incubator-netbeans/pull/361#discussion_r161165802
 
 

 ##########
 File path: 
refactoring.api/src/org/netbeans/modules/refactoring/api/RefactoringSession.java
 ##########
 @@ -256,6 +248,19 @@ private Problem reallyUndoRefactoring(boolean 
saveAfterDone) {
         return null;
     }
 
+    private void changeRefactoringElement(RefactoringElementImplementation 
element, boolean change) {
+        boolean enabled = element.isEnabled();
+        boolean guarded = element.getStatus() == RefactoringElement.GUARDED;
+        boolean readOnly = element.getStatus() == RefactoringElement.READ_ONLY;
+        if (enabled && !(guarded || readOnly)) {
 
 Review comment:
   you can count on private methods calls being inlined by optimizing VM, this 
is not counted as perf decrease.
   
   You can also can
   
   ````
   if (!element.isEnabled()) {
       return;
   }
   // ....
   if (readOnly || guarded) {
       return;
   }
   ````
   or
   ````
   if (!enabled || guarded || readOnly) {
       return;
   }
   ````
   
   Which saves you complex conditions and nested blocks.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

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