You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@netbeans.apache.org by GitBox <gi...@apache.org> on 2023/01/05 01:05:32 UTC

[GitHub] [netbeans] tbw777 opened a new pull request, #5205: Removed double null check with instance operator

tbw777 opened a new pull request, #5205:
URL: https://github.com/apache/netbeans/pull/5205

   Sometimes found usage of instance operator with variable superflous  check for null. But also there is not only variables. Additional null check performs with map.get() or method() and so on.


-- 
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-unsubscribe@netbeans.apache.org

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


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

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


[GitHub] [netbeans] tbw777 commented on pull request #5205: Removed double null check with instance operator

Posted by GitBox <gi...@apache.org>.
tbw777 commented on PR #5205:
URL: https://github.com/apache/netbeans/pull/5205#issuecomment-1372070300

   This can affect performance, it's not just for beauty


-- 
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-unsubscribe@netbeans.apache.org

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


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

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


[GitHub] [netbeans] tbw777 commented on pull request #5205: Removed double null check with instance operator

Posted by GitBox <gi...@apache.org>.
tbw777 commented on PR #5205:
URL: https://github.com/apache/netbeans/pull/5205#issuecomment-1373426104

   Continues in https://github.com/apache/netbeans/pull/5224 PR


-- 
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-unsubscribe@netbeans.apache.org

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


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

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


[GitHub] [netbeans] mbien commented on a diff in pull request #5205: Removed double null check with instance operator

Posted by GitBox <gi...@apache.org>.
mbien commented on code in PR #5205:
URL: https://github.com/apache/netbeans/pull/5205#discussion_r1063264306


##########
platform/openide.awt/src/org/openide/awt/SplittedPanel.java:
##########
@@ -779,10 +779,10 @@ private void initAccessible() {
         getAccessibleContext().setAccessibleName(
             nameFormat.format(
                 new Object[] {
-                    ((firstComponent == null) || !(firstComponent instanceof Accessible)) ? null
+                    (!(firstComponent instanceof Accessible)) ? null
                                                                                           : firstComponent.getAccessibleContext()
                                                                                                           .getAccessibleName(),
-                    ((secondComponent == null) || !(secondComponent instanceof Accessible)) ? null
+                    (!(secondComponent instanceof Accessible)) ? null
                                                                                             : secondComponent.getAccessibleContext()
                                                                                                              .getAccessibleName()

Review Comment:
   same here



##########
platform/openide.awt/src/org/openide/awt/SplittedPanel.java:
##########
@@ -779,10 +779,10 @@ private void initAccessible() {
         getAccessibleContext().setAccessibleName(
             nameFormat.format(
                 new Object[] {
-                    ((firstComponent == null) || !(firstComponent instanceof Accessible)) ? null
+                    (!(firstComponent instanceof Accessible)) ? null
                                                                                           : firstComponent.getAccessibleContext()
                                                                                                           .getAccessibleName(),

Review Comment:
   could you adjust the formatting here a little bit? this could be one line now.
   ```java
   (!(firstComponent instanceof Accessible)) ? null : firstComponent.getAccessibleContext().getAccessibleName(),
   ```



##########
platform/openide.awt/src/org/openide/awt/SplittedPanel.java:
##########
@@ -797,10 +797,10 @@ private void initAccessible() {
         getAccessibleContext().setAccessibleDescription(
             descriptionFormat.format(
                 new Object[] {
-                    ((firstComponent == null) || !(firstComponent instanceof Accessible)) ? null
+                    (!(firstComponent instanceof Accessible)) ? null
                                                                                           : firstComponent.getAccessibleContext()
                                                                                                           .getAccessibleDescription(),

Review Comment:
   same here



##########
platform/openide.awt/src/org/openide/awt/SplittedPanel.java:
##########
@@ -797,10 +797,10 @@ private void initAccessible() {
         getAccessibleContext().setAccessibleDescription(
             descriptionFormat.format(
                 new Object[] {
-                    ((firstComponent == null) || !(firstComponent instanceof Accessible)) ? null
+                    (!(firstComponent instanceof Accessible)) ? null
                                                                                           : firstComponent.getAccessibleContext()
                                                                                                           .getAccessibleDescription(),
-                    ((secondComponent == null) || !(secondComponent instanceof Accessible)) ? null
+                    (!(secondComponent instanceof Accessible)) ? null
                                                                                             : secondComponent.getAccessibleContext()
                                                                                                              .getAccessibleDescription()

Review Comment:
   same here



-- 
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-unsubscribe@netbeans.apache.org

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


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

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


[GitHub] [netbeans] tbw777 closed pull request #5205: Removed double null check with instance operator

Posted by GitBox <gi...@apache.org>.
tbw777 closed pull request #5205: Removed double null check with instance operator
URL: https://github.com/apache/netbeans/pull/5205


-- 
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-unsubscribe@netbeans.apache.org

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


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

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