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 2020/11/30 08:26:59 UTC

[GitHub] [netbeans] Mohan-Sarilla opened a new pull request #2570: [NETBEANS:4447]:Fixed NullPointerException while computing switch exp…

Mohan-Sarilla opened a new pull request #2570:
URL: https://github.com/apache/netbeans/pull/2570


   Fixed NullPointerException while computing switch expression conversion and formatting issue


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

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] lkishalmi commented on pull request #2570: [NETBEANS:4447]:Fixed NullPointerException while computing switch exp…

Posted by GitBox <gi...@apache.org>.
lkishalmi commented on pull request #2570:
URL: https://github.com/apache/netbeans/pull/2570#issuecomment-803448860


   @Mohan-Sarilla Can we have unit tests for this one?


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

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] arvindaprameya commented on pull request #2570: [NETBEANS:4447]:Fixed NullPointerException while computing switch exp…

Posted by GitBox <gi...@apache.org>.
arvindaprameya commented on pull request #2570:
URL: https://github.com/apache/netbeans/pull/2570#issuecomment-755141642


   Approved


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

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] junichi11 commented on a change in pull request #2570: [NETBEANS:4447]:Fixed NullPointerException while computing switch exp…

Posted by GitBox <gi...@apache.org>.
junichi11 commented on a change in pull request #2570:
URL: https://github.com/apache/netbeans/pull/2570#discussion_r535111709



##########
File path: java/java.source.base/src/org/netbeans/modules/java/source/save/CasualDiff.java
##########
@@ -1900,7 +1900,14 @@ protected int diffSwitch(JCSwitch oldT, JCSwitch newT, int[] bounds) {
         PositionEstimator est = EstimatorFactory.cases(oldT.getCases(), newT.getCases(), diffContext);
         localPointer = diffList(oldT.cases, newT.cases, localPointer, est, Measure.MEMBER, printer);
 
-        copyTo(localPointer, bounds[1]);
+        List<JCCase> cases = newT.cases;
+        if (cases.size() != 0) {
+            String caseKind = String.valueOf(CasualDiff.getCaseKind(cases.get(0)));
+            if (caseKind.equals("RULE")) {

Review comment:
       Please add `// NOI18N` if it is not expect i18N




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

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] junichi11 commented on a change in pull request #2570: [NETBEANS:4447]:Fixed NullPointerException while computing switch exp…

Posted by GitBox <gi...@apache.org>.
junichi11 commented on a change in pull request #2570:
URL: https://github.com/apache/netbeans/pull/2570#discussion_r535107407



##########
File path: java/java.source.base/src/org/netbeans/modules/java/source/save/CasualDiff.java
##########
@@ -1900,7 +1900,14 @@ protected int diffSwitch(JCSwitch oldT, JCSwitch newT, int[] bounds) {
         PositionEstimator est = EstimatorFactory.cases(oldT.getCases(), newT.getCases(), diffContext);
         localPointer = diffList(oldT.cases, newT.cases, localPointer, est, Measure.MEMBER, printer);
 
-        copyTo(localPointer, bounds[1]);
+        List<JCCase> cases = newT.cases;
+        if (cases.size() != 0) {
+            String caseKind = String.valueOf(CasualDiff.getCaseKind(cases.get(0)));
+            if (caseKind.equals("RULE")) {
+		printer.newline();

Review comment:
       Please use not TABs but spaces.




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

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] arvindaprameya commented on pull request #2570: [NETBEANS:4447]:Fixed NullPointerException while computing switch exp…

Posted by GitBox <gi...@apache.org>.
arvindaprameya commented on pull request #2570:
URL: https://github.com/apache/netbeans/pull/2570#issuecomment-810923080


   Awaiting Jan's approval before going ahead and merging
   ________________________________
   From: Geertjan Wielenga ***@***.***>
   Sent: Wednesday, March 31, 2021 2:42 PM
   To: apache/netbeans ***@***.***>
   Cc: Arvind Aprameya ***@***.***>; Comment ***@***.***>
   Subject: [External] : Re: [apache/netbeans] [NETBEANS:4447]:Fixed NullPointerException while computing switch exp… (#2570)
   
   
   Is there any reason to not merge this?
   
   —
   You are receiving this because you commented.
   Reply to this email directly, view it on GitHub<https://urldefense.com/v3/__https://github.com/apache/netbeans/pull/2570*issuecomment-810909891__;Iw!!GqivPVa7Brio!L6ijm5Ssu7T_-XuorwyJRJc7jH3up9_PyOr3LUADqmEOvtZY21vH9ho17gEAVTMZMdQ5$>, or unsubscribe<https://urldefense.com/v3/__https://github.com/notifications/unsubscribe-auth/ALE5DIBTU2ATUAAWWQQIZZDTGLRPXANCNFSM4UHHOTMQ__;!!GqivPVa7Brio!L6ijm5Ssu7T_-XuorwyJRJc7jH3up9_PyOr3LUADqmEOvtZY21vH9ho17gEAVbufEJ1I$>.
   


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

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] Mohan-Sarilla commented on a change in pull request #2570: [NETBEANS:4447]:Fixed NullPointerException while computing switch exp…

Posted by GitBox <gi...@apache.org>.
Mohan-Sarilla commented on a change in pull request #2570:
URL: https://github.com/apache/netbeans/pull/2570#discussion_r538587653



##########
File path: java/java.source.base/src/org/netbeans/modules/java/source/save/CasualDiff.java
##########
@@ -1900,7 +1900,14 @@ protected int diffSwitch(JCSwitch oldT, JCSwitch newT, int[] bounds) {
         PositionEstimator est = EstimatorFactory.cases(oldT.getCases(), newT.getCases(), diffContext);
         localPointer = diffList(oldT.cases, newT.cases, localPointer, est, Measure.MEMBER, printer);
 
-        copyTo(localPointer, bounds[1]);
+        List<JCCase> cases = newT.cases;
+        if (cases.size() != 0) {
+            String caseKind = String.valueOf(CasualDiff.getCaseKind(cases.get(0)));
+            if (caseKind.equals("RULE")) {
+		printer.newline();

Review comment:
       @junichi11 , done with the changes requested

##########
File path: java/java.source.base/src/org/netbeans/modules/java/source/save/CasualDiff.java
##########
@@ -1900,7 +1900,14 @@ protected int diffSwitch(JCSwitch oldT, JCSwitch newT, int[] bounds) {
         PositionEstimator est = EstimatorFactory.cases(oldT.getCases(), newT.getCases(), diffContext);
         localPointer = diffList(oldT.cases, newT.cases, localPointer, est, Measure.MEMBER, printer);
 
-        copyTo(localPointer, bounds[1]);
+        List<JCCase> cases = newT.cases;
+        if (cases.size() != 0) {
+            String caseKind = String.valueOf(CasualDiff.getCaseKind(cases.get(0)));
+            if (caseKind.equals("RULE")) {
+		printer.newline();
+            }
+        }
+	copyTo(localPointer, bounds[1]);

Review comment:
       @junichi11 , done with the changes requested

##########
File path: java/java.hints/src/org/netbeans/modules/java/hints/errors/Utilities.java
##########
@@ -3137,7 +3137,8 @@ public static boolean isCompatibleWithSwitchExpression(SwitchTree st) {
                             }
                             break;
                         } else {
-                            if (leftTreeName != null && leftTreeName.contentEquals(getLeftTreeName(statements.get(0)))) {
+			    Name exprTree = getLeftTreeName(statements.get(0));

Review comment:
       @junichi11 , done with the changes requested

##########
File path: java/java.source.base/src/org/netbeans/modules/java/source/save/CasualDiff.java
##########
@@ -1900,7 +1900,14 @@ protected int diffSwitch(JCSwitch oldT, JCSwitch newT, int[] bounds) {
         PositionEstimator est = EstimatorFactory.cases(oldT.getCases(), newT.getCases(), diffContext);
         localPointer = diffList(oldT.cases, newT.cases, localPointer, est, Measure.MEMBER, printer);
 
-        copyTo(localPointer, bounds[1]);
+        List<JCCase> cases = newT.cases;
+        if (cases.size() != 0) {
+            String caseKind = String.valueOf(CasualDiff.getCaseKind(cases.get(0)));
+            if (caseKind.equals("RULE")) {

Review comment:
       @junichi11 , done with the changes requested




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

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] junichi11 commented on a change in pull request #2570: [NETBEANS:4447]:Fixed NullPointerException while computing switch exp…

Posted by GitBox <gi...@apache.org>.
junichi11 commented on a change in pull request #2570:
URL: https://github.com/apache/netbeans/pull/2570#discussion_r535107880



##########
File path: java/java.source.base/src/org/netbeans/modules/java/source/save/CasualDiff.java
##########
@@ -1900,7 +1900,14 @@ protected int diffSwitch(JCSwitch oldT, JCSwitch newT, int[] bounds) {
         PositionEstimator est = EstimatorFactory.cases(oldT.getCases(), newT.getCases(), diffContext);
         localPointer = diffList(oldT.cases, newT.cases, localPointer, est, Measure.MEMBER, printer);
 
-        copyTo(localPointer, bounds[1]);
+        List<JCCase> cases = newT.cases;
+        if (cases.size() != 0) {
+            String caseKind = String.valueOf(CasualDiff.getCaseKind(cases.get(0)));
+            if (caseKind.equals("RULE")) {
+		printer.newline();
+            }
+        }
+	copyTo(localPointer, bounds[1]);

Review comment:
       Please use not a TAB but spaces.




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

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] lahodaj commented on pull request #2570: [NETBEANS:4447]:Fixed NullPointerException while computing switch exp…

Posted by GitBox <gi...@apache.org>.
lahodaj commented on pull request #2570:
URL: https://github.com/apache/netbeans/pull/2570#issuecomment-758531130


   It would be good to have tests (I think I can see what the change in Utilities is doing, but what exactly is doing the change in CasualDiff is less clear - and both are very easy to regress given there are no tests).


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

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] geertjanw merged pull request #2570: [NETBEANS:4447]:Fixed NullPointerException while computing switch exp…

Posted by GitBox <gi...@apache.org>.
geertjanw merged pull request #2570:
URL: https://github.com/apache/netbeans/pull/2570


   


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

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] junichi11 commented on a change in pull request #2570: [NETBEANS:4447]:Fixed NullPointerException while computing switch exp…

Posted by GitBox <gi...@apache.org>.
junichi11 commented on a change in pull request #2570:
URL: https://github.com/apache/netbeans/pull/2570#discussion_r538883642



##########
File path: java/java.hints/src/org/netbeans/modules/java/hints/errors/Utilities.java
##########
@@ -3155,7 +3156,8 @@ public static boolean isCompatibleWithSwitchExpression(SwitchTree st) {
                             }
                             firstCase = false;
                         }
-                        if (leftTreeName != null && leftTreeName.contentEquals(getLeftTreeName(statements.get(0)))) {
+                        Name exprTree = getLeftTreeName(statements.get(0));
+                        if (leftTreeName != null && exprTree != null && leftTreeName.contentEquals(exprTree)) {

Review comment:
       I would introduce a method for checking conditions because it's the same as above.
   cc: @Akshay-Gupta-Oracle 




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

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] junichi11 commented on a change in pull request #2570: [NETBEANS:4447]:Fixed NullPointerException while computing switch exp…

Posted by GitBox <gi...@apache.org>.
junichi11 commented on a change in pull request #2570:
URL: https://github.com/apache/netbeans/pull/2570#discussion_r538879737



##########
File path: java/java.source.base/src/org/netbeans/modules/java/source/save/CasualDiff.java
##########
@@ -1900,7 +1900,14 @@ protected int diffSwitch(JCSwitch oldT, JCSwitch newT, int[] bounds) {
         PositionEstimator est = EstimatorFactory.cases(oldT.getCases(), newT.getCases(), diffContext);
         localPointer = diffList(oldT.cases, newT.cases, localPointer, est, Measure.MEMBER, printer);
 
-        copyTo(localPointer, bounds[1]);
+        List<JCCase> cases = newT.cases;
+        if (cases.size() != 0) {
+            String caseKind = String.valueOf(CasualDiff.getCaseKind(cases.get(0)));
+            if (caseKind.equals("RULE")) {
+		printer.newline();
+            }
+        }
+	copyTo(localPointer, bounds[1]);

Review comment:
       Thanks!




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

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] geertjanw commented on pull request #2570: [NETBEANS:4447]:Fixed NullPointerException while computing switch exp…

Posted by GitBox <gi...@apache.org>.
geertjanw commented on pull request #2570:
URL: https://github.com/apache/netbeans/pull/2570#issuecomment-810909891


   Is there any reason to not merge this?


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

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] geertjanw commented on pull request #2570: [NETBEANS:4447]:Fixed NullPointerException while computing switch exp…

Posted by GitBox <gi...@apache.org>.
geertjanw commented on pull request #2570:
URL: https://github.com/apache/netbeans/pull/2570#issuecomment-809732577


   @Mohan-Sarilla Can we have unit tests for this one?


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

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] junichi11 commented on pull request #2570: [NETBEANS:4447]:Fixed NullPointerException while computing switch exp…

Posted by GitBox <gi...@apache.org>.
junichi11 commented on pull request #2570:
URL: https://github.com/apache/netbeans/pull/2570#issuecomment-741216793


   @Mohan-Sarilla Thank you for fixing it. Could you please squash your changes yourself?


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

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] junichi11 commented on a change in pull request #2570: [NETBEANS:4447]:Fixed NullPointerException while computing switch exp…

Posted by GitBox <gi...@apache.org>.
junichi11 commented on a change in pull request #2570:
URL: https://github.com/apache/netbeans/pull/2570#discussion_r535109132



##########
File path: java/java.hints/src/org/netbeans/modules/java/hints/errors/Utilities.java
##########
@@ -3137,7 +3137,8 @@ public static boolean isCompatibleWithSwitchExpression(SwitchTree st) {
                             }
                             break;
                         } else {
-                            if (leftTreeName != null && leftTreeName.contentEquals(getLeftTreeName(statements.get(0)))) {
+			    Name exprTree = getLeftTreeName(statements.get(0));

Review comment:
       Please use not TABs but spaces.
   Other changes as well.




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

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] Mohan-Sarilla commented on pull request #2570: [NETBEANS:4447]:Fixed NullPointerException while computing switch exp…

Posted by GitBox <gi...@apache.org>.
Mohan-Sarilla commented on pull request #2570:
URL: https://github.com/apache/netbeans/pull/2570#issuecomment-737699280


   > Looks correct to me.
   > check the formatting, can be done automatically by Netbeans Formatter.
   
   @Akshay-Gupta-Oracle I could see Formatting appearing fine in Netbeans.
   
   


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

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] mishrasandeep commented on pull request #2570: [NETBEANS:4447]:Fixed NullPointerException while computing switch exp…

Posted by GitBox <gi...@apache.org>.
mishrasandeep commented on pull request #2570:
URL: https://github.com/apache/netbeans/pull/2570#issuecomment-809926332


   > 
   > 
   > @Mohan-Sarilla Can we have unit tests for this one?
   
   Have added the unit tests for the changes in the following PR: https://github.com/apache/netbeans/pull/2791


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

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