rtaneja1 commented on a change in pull request #1237: [NETBEANS-2349] Convert 
switch typecast case to switch expression
URL: https://github.com/apache/netbeans/pull/1237#discussion_r283216738
 
 

 ##########
 File path: 
java/java.hints/src/org/netbeans/modules/java/hints/errors/Utilities.java
 ##########
 @@ -3247,10 +3249,20 @@ public Void visitIdentifier(IdentifierTree node, Void 
p) {
             if (isExpression) {
                 if (statements.get(0).getKind() == Tree.Kind.RETURN) {
                     body = ((JCTree.JCReturn) 
statements.get(0)).getExpression();
-                    isReturnExpression = true;
+                    switchType = SWITCH_TYPE.SIMPLIFIED_WITH_RETURN_CASE;
+                    if (body instanceof JCTree.JCTypeCast) {
+                        typeCast = ((JCTree.JCTypeCast)body).getType();
+                        body = ((JCTree.JCTypeCast)body).getExpression();
+                    }
                 } else {
+                    switchType = SWITCH_TYPE.SWITCH_EXPRESSION;
                     JCTree.JCExpressionStatement jceTree = 
(JCTree.JCExpressionStatement) statements.get(0);
                     body = ((JCTree.JCAssign) jceTree.expr).rhs;
+                    if (body instanceof JCTree.JCTypeCast) {
+                        switchType = SWITCH_TYPE.SIMPLIFIED_WITH_CAST_CASE;
 
 Review comment:
   same code as in if, move out? 

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