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 2022/08/04 12:24:41 UTC

[GitHub] [netbeans] dbalek opened a new pull request, #4467: Updade nb-javac to 19+33.

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

   Updating nb-javac to version 19+33.
   


-- 
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] dbalek merged pull request #4467: Update nb-javac to 19+33.

Posted by GitBox <gi...@apache.org>.
dbalek merged PR #4467:
URL: https://github.com/apache/netbeans/pull/4467


-- 
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] neilcsmith-net commented on pull request #4467: Updade nb-javac to 19+33.

Posted by GitBox <gi...@apache.org>.
neilcsmith-net commented on PR #4467:
URL: https://github.com/apache/netbeans/pull/4467#issuecomment-1205351609

   I assumed so - thanks for the updated description.  You can use URLs in `binaries-list` files now too, which might be better for testing.  This may or may not get properly tested now - at least discussion in #4431 might lead to this failing before it gets to any 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.

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] dbalek commented on a diff in pull request #4467: Update nb-javac to 19+33.

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


##########
java/java.source.base/src/org/netbeans/api/java/source/TreeMaker.java:
##########
@@ -276,7 +276,18 @@ public CaseTree Case(List<? extends ExpressionTree> patterns, Tree body) {
      * @since 2.39
      */
     public CaseTree CasePatterns(List<? extends Tree> patterns, Tree body) {
-        return delegate.CaseMultiplePatterns(patterns.stream().map(p -> (CaseLabelTree) p).collect(Collectors.toList()), body);
+        return delegate.CaseMultiplePatterns(patterns.stream().map(p -> {
+            if (p instanceof CaseLabelTree) {
+                return (CaseLabelTree) p;
+            }
+            if (p instanceof ExpressionTree) {
+                return delegate.ConstantCaseLabel((ExpressionTree) p);
+            }
+            if (p instanceof PatternTree) {
+                return delegate.PatternCaseLabel((PatternTree) p, null);
+            }
+            throw new IllegalArgumentException("Invalid pattern kind: " + p.getKind()); //NOI18N
+        }).collect(Collectors.toList()), body);

Review Comment:
   Fixed.



##########
java/java.source.base/src/org/netbeans/api/java/source/TreeMaker.java:
##########
@@ -288,7 +299,18 @@ public CaseTree CasePatterns(List<? extends Tree> patterns, Tree body) {
      * @since 2.39
      */
     public CaseTree CasePatterns(List<? extends Tree> patterns, List<? extends StatementTree> statements) {
-        return delegate.CaseMultiplePatterns(patterns.stream().map(p -> (CaseLabelTree) p).collect(Collectors.toList()), statements);
+        return delegate.CaseMultiplePatterns(patterns.stream().map(p -> {
+            if (p instanceof CaseLabelTree) {
+                return (CaseLabelTree) p;
+            }
+            if (p instanceof ExpressionTree) {
+                return delegate.ConstantCaseLabel((ExpressionTree) p);
+            }
+            if (p instanceof PatternTree) {
+                return delegate.PatternCaseLabel((PatternTree) p, null);
+            }
+            throw new IllegalArgumentException("Invalid pattern kind: " + p.getKind()); //NOI18N
+        }).collect(Collectors.toList()), statements);

Review Comment:
   Fixed.



-- 
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 #4467: Updade nb-javac to 19+33.

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


##########
java/java.source.base/src/org/netbeans/modules/java/source/transform/ImmutableTreeTranslator.java:
##########
@@ -1429,18 +1502,43 @@ private DefaultCaseLabelTree rewriteChildren(DefaultCaseLabelTree tree) {
         return tree;
     }
 
-    private GuardedPatternTree rewriteChildren(GuardedPatternTree tree) {
-        PatternTree newPattern = (PatternTree) translate(tree.getPattern());
-        ExpressionTree newGuard = (ExpressionTree) translate(tree.getExpression());
-        if (newPattern != tree.getPattern() ||
-            newGuard != tree.getExpression()) {
-            GuardedPatternTree n = make.GuardedPattern(newPattern, newGuard);
+    private ConstantCaseLabelTree rewriteChildren(ConstantCaseLabelTree tree) {
+	ExpressionTree newExpression = (ExpressionTree)translate(tree.getConstantExpression());
+	if (newExpression != tree.getConstantExpression()) {
+	    ConstantCaseLabelTree n = make.ConstantCaseLabel(newExpression);
             model.setType(n, model.getType(tree));
-            copyCommentTo(tree,n);
+	    copyCommentTo(tree,n);
             copyPosTo(tree,n);
-            tree = n;
-        }
-        return tree;
+	    tree = n;
+	}
+	return tree;
+    }
+
+    private PatternCaseLabelTree rewriteChildren(PatternCaseLabelTree tree) {
+	ExpressionTree newGuard = (ExpressionTree)translate(tree.getGuard());
+	PatternTree newPattern = (PatternTree)translate(tree.getPattern());
+	if (newGuard != tree.getGuard() || newPattern != tree.getPattern()) {
+	    PatternCaseLabelTree n = make.PatternCaseLabel(newPattern, newGuard);
+            model.setType(n, model.getType(tree));
+	    copyCommentTo(tree,n);
+            copyPosTo(tree,n);
+	    tree = n;
+	}
+	return tree;
+    }
+
+    private DeconstructionPatternTree rewriteChildren(DeconstructionPatternTree tree) {
+	ExpressionTree newDeconstructor = (ExpressionTree)translate(tree.getDeconstructor());
+        List<? extends PatternTree> newNestedPatterns = translate(tree.getNestedPatterns());
+	VariableTree newVariable = (VariableTree)translate(tree.getVariable());
+	if (newDeconstructor != tree.getDeconstructor() || newVariable != tree.getVariable() || !Objects.equals(newNestedPatterns, tree.getNestedPatterns())) {
+	    DeconstructionPatternTree n = make.DeconstructionPattern(newDeconstructor, newNestedPatterns, newVariable);
+            model.setType(n, model.getType(tree));
+	    copyCommentTo(tree,n);
+            copyPosTo(tree,n);
+	    tree = n;
+	}
+	return tree;
     }

Review Comment:
   broken formatting in this section



-- 
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] dbalek commented on a diff in pull request #4467: Updade nb-javac to 19+33.

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


##########
java/java.source.base/src/org/netbeans/modules/java/source/transform/ImmutableTreeTranslator.java:
##########
@@ -1429,18 +1502,43 @@ private DefaultCaseLabelTree rewriteChildren(DefaultCaseLabelTree tree) {
         return tree;
     }
 
-    private GuardedPatternTree rewriteChildren(GuardedPatternTree tree) {
-        PatternTree newPattern = (PatternTree) translate(tree.getPattern());
-        ExpressionTree newGuard = (ExpressionTree) translate(tree.getExpression());
-        if (newPattern != tree.getPattern() ||
-            newGuard != tree.getExpression()) {
-            GuardedPatternTree n = make.GuardedPattern(newPattern, newGuard);
+    private ConstantCaseLabelTree rewriteChildren(ConstantCaseLabelTree tree) {
+	ExpressionTree newExpression = (ExpressionTree)translate(tree.getConstantExpression());
+	if (newExpression != tree.getConstantExpression()) {
+	    ConstantCaseLabelTree n = make.ConstantCaseLabel(newExpression);
             model.setType(n, model.getType(tree));
-            copyCommentTo(tree,n);
+	    copyCommentTo(tree,n);
             copyPosTo(tree,n);
-            tree = n;
-        }
-        return tree;
+	    tree = n;
+	}
+	return tree;
+    }
+
+    private PatternCaseLabelTree rewriteChildren(PatternCaseLabelTree tree) {
+	ExpressionTree newGuard = (ExpressionTree)translate(tree.getGuard());
+	PatternTree newPattern = (PatternTree)translate(tree.getPattern());
+	if (newGuard != tree.getGuard() || newPattern != tree.getPattern()) {
+	    PatternCaseLabelTree n = make.PatternCaseLabel(newPattern, newGuard);
+            model.setType(n, model.getType(tree));
+	    copyCommentTo(tree,n);
+            copyPosTo(tree,n);
+	    tree = n;
+	}
+	return tree;
+    }
+
+    private DeconstructionPatternTree rewriteChildren(DeconstructionPatternTree tree) {
+	ExpressionTree newDeconstructor = (ExpressionTree)translate(tree.getDeconstructor());
+        List<? extends PatternTree> newNestedPatterns = translate(tree.getNestedPatterns());
+	VariableTree newVariable = (VariableTree)translate(tree.getVariable());
+	if (newDeconstructor != tree.getDeconstructor() || newVariable != tree.getVariable() || !Objects.equals(newNestedPatterns, tree.getNestedPatterns())) {
+	    DeconstructionPatternTree n = make.DeconstructionPattern(newDeconstructor, newNestedPatterns, newVariable);
+            model.setType(n, model.getType(tree));
+	    copyCommentTo(tree,n);
+            copyPosTo(tree,n);
+	    tree = n;
+	}
+	return tree;
     }

Review Comment:
   Fixed.



-- 
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 #4467: Update nb-javac to 19+33.

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


##########
java/java.source.base/src/org/netbeans/api/java/source/TreeMaker.java:
##########
@@ -276,7 +276,18 @@ public CaseTree Case(List<? extends ExpressionTree> patterns, Tree body) {
      * @since 2.39
      */
     public CaseTree CasePatterns(List<? extends Tree> patterns, Tree body) {
-        return delegate.CaseMultiplePatterns(patterns.stream().map(p -> (CaseLabelTree) p).collect(Collectors.toList()), body);
+        return delegate.CaseMultiplePatterns(patterns.stream().map(p -> {
+            if (p instanceof CaseLabelTree) {
+                return (CaseLabelTree) p;
+            }
+            if (p instanceof ExpressionTree) {
+                return delegate.ConstantCaseLabel((ExpressionTree) p);
+            }
+            if (p instanceof PatternTree) {
+                return delegate.PatternCaseLabel((PatternTree) p, null);
+            }
+            throw new IllegalArgumentException("Invalid pattern kind: " + p.getKind()); //NOI18N
+        }).collect(Collectors.toList()), body);

Review Comment:
   this part is used twice and looks like it could grow with future javac updates -> could be extracted to a private utility method to make it "DRY".
   
   ```diff
   diff --git a/java/java.source.base/src/org/netbeans/api/java/source/TreeMaker.java b/java/java.source.base/src/org/netbeans/api/java/source/TreeMaker.java
   index 0c3fab6..cb830c6 100644
   --- a/java/java.source.base/src/org/netbeans/api/java/source/TreeMaker.java
   +++ b/java/java.source.base/src/org/netbeans/api/java/source/TreeMaker.java
   @@ -276,18 +276,7 @@
         * @since 2.39
         */
        public CaseTree CasePatterns(List<? extends Tree> patterns, Tree body) {
   -        return delegate.CaseMultiplePatterns(patterns.stream().map(p -> {
   -            if (p instanceof CaseLabelTree) {
   -                return (CaseLabelTree) p;
   -            }
   -            if (p instanceof ExpressionTree) {
   -                return delegate.ConstantCaseLabel((ExpressionTree) p);
   -            }
   -            if (p instanceof PatternTree) {
   -                return delegate.PatternCaseLabel((PatternTree) p, null);
   -            }
   -            throw new IllegalArgumentException("Invalid pattern kind: " + p.getKind()); //NOI18N
   -        }).collect(Collectors.toList()), body);
   +        return delegate.CaseMultiplePatterns(toCaseLabelTreeDelegates(patterns), body);
        }
        
        /**
   @@ -299,7 +288,11 @@
         * @since 2.39
         */
        public CaseTree CasePatterns(List<? extends Tree> patterns, List<? extends StatementTree> statements) {
   -        return delegate.CaseMultiplePatterns(patterns.stream().map(p -> {
   +        return delegate.CaseMultiplePatterns(toCaseLabelTreeDelegates(patterns), statements);
   +    }
   +
   +    private List<? extends CaseLabelTree> toCaseLabelTreeDelegates(List<? extends Tree> patterns) {
   +        return patterns.stream().map(p -> {
                if (p instanceof CaseLabelTree) {
                    return (CaseLabelTree) p;
                }
   @@ -310,7 +303,7 @@
                    return delegate.PatternCaseLabel((PatternTree) p, null);
                }
                throw new IllegalArgumentException("Invalid pattern kind: " + p.getKind()); //NOI18N
   -        }).collect(Collectors.toList()), statements);
   +        }).collect(Collectors.toList());
        }
   ```



##########
java/java.source.base/src/org/netbeans/api/java/source/TreeMaker.java:
##########
@@ -288,7 +299,18 @@ public CaseTree CasePatterns(List<? extends Tree> patterns, Tree body) {
      * @since 2.39
      */
     public CaseTree CasePatterns(List<? extends Tree> patterns, List<? extends StatementTree> statements) {
-        return delegate.CaseMultiplePatterns(patterns.stream().map(p -> (CaseLabelTree) p).collect(Collectors.toList()), statements);
+        return delegate.CaseMultiplePatterns(patterns.stream().map(p -> {
+            if (p instanceof CaseLabelTree) {
+                return (CaseLabelTree) p;
+            }
+            if (p instanceof ExpressionTree) {
+                return delegate.ConstantCaseLabel((ExpressionTree) p);
+            }
+            if (p instanceof PatternTree) {
+                return delegate.PatternCaseLabel((PatternTree) p, null);
+            }
+            throw new IllegalArgumentException("Invalid pattern kind: " + p.getKind()); //NOI18N
+        }).collect(Collectors.toList()), statements);

Review Comment:
   second usage / already handled by the diff above



-- 
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 #4467: Update nb-javac to 19+33.

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


##########
java/java.source.base/src/org/netbeans/modules/java/source/save/Reformatter.java:
##########
@@ -2933,36 +2959,24 @@ private boolean handleSwitch(Tree node, Void p) {
 
         @Override
         public Boolean visitCase(CaseTree node, Void p) {
-            List<? extends Tree> labels = node.getLabels();
-            if (labels != null && labels.size() > 0) {
+            List<? extends CaseLabelTree> labels = node.getLabels();
+            if (labels != null && !labels.isEmpty()) {
                 if (tokens.token().id() == JavaTokenId.DEFAULT && labels.get(0).getKind() == Kind.DEFAULT_CASE_LABEL) {
                     accept(DEFAULT);
                 } else {
                     accept(CASE);
                     space();
-                    for (Tree label : labels) {
-                        switch (label.getKind()) {
-                            case DEFAULT_CASE_LABEL:
-                                removeWhiteSpace(JavaTokenId.DEFAULT);
-                                accept(DEFAULT);
-                                break;
-                            case BINDING_PATTERN:
-                            case PARENTHESIZED_PATTERN:
-                            case GUARDED_PATTERN:
-                                removeWhiteSpace(JavaTokenId.IDENTIFIER);
-                                scan(label, p);
-                                break;
-                            case NULL_LITERAL:
-                                removeWhiteSpace(JavaTokenId.NULL);
-                                scan(label, p);
-                                break;
-                            default:
-                                scan(label, p);
-                                break;
+                    for (Iterator<? extends CaseLabelTree> it = labels.iterator(); it.hasNext();) {
+                        CaseLabelTree label = it.next();
+                        scan(label, p);
+                        if (it.hasNext()) {
+                            spaces(0);
+                            accept(COMMA);
+                            space();
                         }
                     }

Review Comment:
   since it doesn't have the `removeWhiteSpace` calls anymore, this basically means it will format switch-cases less aggressively now?



-- 
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] dbalek commented on a diff in pull request #4467: Update nb-javac to 19+33.

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


##########
java/java.source.base/src/org/netbeans/modules/java/source/save/Reformatter.java:
##########
@@ -2933,36 +2959,24 @@ private boolean handleSwitch(Tree node, Void p) {
 
         @Override
         public Boolean visitCase(CaseTree node, Void p) {
-            List<? extends Tree> labels = node.getLabels();
-            if (labels != null && labels.size() > 0) {
+            List<? extends CaseLabelTree> labels = node.getLabels();
+            if (labels != null && !labels.isEmpty()) {
                 if (tokens.token().id() == JavaTokenId.DEFAULT && labels.get(0).getKind() == Kind.DEFAULT_CASE_LABEL) {
                     accept(DEFAULT);
                 } else {
                     accept(CASE);
                     space();
-                    for (Tree label : labels) {
-                        switch (label.getKind()) {
-                            case DEFAULT_CASE_LABEL:
-                                removeWhiteSpace(JavaTokenId.DEFAULT);
-                                accept(DEFAULT);
-                                break;
-                            case BINDING_PATTERN:
-                            case PARENTHESIZED_PATTERN:
-                            case GUARDED_PATTERN:
-                                removeWhiteSpace(JavaTokenId.IDENTIFIER);
-                                scan(label, p);
-                                break;
-                            case NULL_LITERAL:
-                                removeWhiteSpace(JavaTokenId.NULL);
-                                scan(label, p);
-                                break;
-                            default:
-                                scan(label, p);
-                                break;
+                    for (Iterator<? extends CaseLabelTree> it = labels.iterator(); it.hasNext();) {
+                        CaseLabelTree label = it.next();
+                        scan(label, p);
+                        if (it.hasNext()) {
+                            spaces(0);
+                            accept(COMMA);
+                            space();
                         }
                     }

Review Comment:
   Surely not. Redundant whitespace is removed as a part of `spaces(0)` and `space()` calls.



-- 
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] dbalek commented on pull request #4467: Update nb-javac to 19+33.

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

   @neilcsmith-net: Changes requested are IMHO done, do you want to update your review before merge ?


-- 
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 #4467: Updade nb-javac to 19+33.

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


##########
java/java.source.base/src/org/netbeans/modules/java/source/transform/ImmutableTreeTranslator.java:
##########
@@ -1429,18 +1502,43 @@ private DefaultCaseLabelTree rewriteChildren(DefaultCaseLabelTree tree) {
         return tree;
     }
 
-    private GuardedPatternTree rewriteChildren(GuardedPatternTree tree) {
-        PatternTree newPattern = (PatternTree) translate(tree.getPattern());
-        ExpressionTree newGuard = (ExpressionTree) translate(tree.getExpression());
-        if (newPattern != tree.getPattern() ||
-            newGuard != tree.getExpression()) {
-            GuardedPatternTree n = make.GuardedPattern(newPattern, newGuard);
+    private ConstantCaseLabelTree rewriteChildren(ConstantCaseLabelTree tree) {
+	ExpressionTree newExpression = (ExpressionTree)translate(tree.getConstantExpression());
+	if (newExpression != tree.getConstantExpression()) {
+	    ConstantCaseLabelTree n = make.ConstantCaseLabel(newExpression);
             model.setType(n, model.getType(tree));
-            copyCommentTo(tree,n);
+	    copyCommentTo(tree,n);
             copyPosTo(tree,n);
-            tree = n;
-        }
-        return tree;
+	    tree = n;
+	}
+	return tree;
+    }
+
+    private PatternCaseLabelTree rewriteChildren(PatternCaseLabelTree tree) {
+	ExpressionTree newGuard = (ExpressionTree)translate(tree.getGuard());
+	PatternTree newPattern = (PatternTree)translate(tree.getPattern());
+	if (newGuard != tree.getGuard() || newPattern != tree.getPattern()) {
+	    PatternCaseLabelTree n = make.PatternCaseLabel(newPattern, newGuard);
+            model.setType(n, model.getType(tree));
+	    copyCommentTo(tree,n);
+            copyPosTo(tree,n);
+	    tree = n;
+	}
+	return tree;
+    }
+
+    private DeconstructionPatternTree rewriteChildren(DeconstructionPatternTree tree) {
+	ExpressionTree newDeconstructor = (ExpressionTree)translate(tree.getDeconstructor());
+        List<? extends PatternTree> newNestedPatterns = translate(tree.getNestedPatterns());
+	VariableTree newVariable = (VariableTree)translate(tree.getVariable());
+	if (newDeconstructor != tree.getDeconstructor() || newVariable != tree.getVariable() || !Objects.equals(newNestedPatterns, tree.getNestedPatterns())) {
+	    DeconstructionPatternTree n = make.DeconstructionPattern(newDeconstructor, newNestedPatterns, newVariable);
+            model.setType(n, model.getType(tree));
+	    copyCommentTo(tree,n);
+            copyPosTo(tree,n);
+	    tree = n;
+	}
+	return tree;
     }

Review Comment:
   broken formatting in this method



-- 
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] dbalek commented on pull request #4467: Updade nb-javac to 19+33.

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

   > Obviously the binaries need distributing via Maven and the binaries-list files updating rather than deleting before this can be merged.
   > 
   > Is there a reason for the PR in current state? Be good to get the binaries sorted before using Travis and GitHub CI overhead for this.
   
   This is just a temporary state (see do-not-merge badge) to check NB build and tests with the new nb-javac binary before pushing it to Maven. Will be changed to updating binaries-list later.
   


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