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 2019/04/30 06:45:58 UTC

[GitHub] [netbeans] rtaneja1 commented on a change in pull request #1193: [NETBEANS-2349] Convert switch to switch expression

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

 ##########
 File path: java/java.hints/src/org/netbeans/modules/java/hints/errors/Utilities.java
 ##########
 @@ -3111,14 +3111,57 @@ public Void visitClass(ClassTree node, Void p) {
         return scanner.completesNormally;
     }
 
-    public static void performRewriteRuleSwitch(JavaFix.TransformationContext ctx, TreePath tp, Tree st) {
+    public static boolean isCompatibleWithSwitchExpression(SwitchTree st) {
+        boolean firstCase = true;
+        Name leftTreeName = null;
+        for (CaseTree ct : st.getCases()) {
+            List<StatementTree> statements = new ArrayList<>(ct.getStatements());
+            switch (statements.size()) {
 
 Review comment:
   In case of more statements, we can create block with break value. This can be considered in separate enhancement.

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


With regards,
Apache Git Services

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