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 2021/03/04 10:24:06 UTC

[GitHub] [netbeans] mishrasandeep opened a new pull request #2791: [NETBEANS:4447]:Fixed NullPointerException while computing switch expression

mishrasandeep opened a new pull request #2791:
URL: https://github.com/apache/netbeans/pull/2791


   Fixed Formatting issues for SwitchToSwitchExpression Hint


----------------------------------------------------------------
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] sdedic commented on a change in pull request #2791: [NETBEANS:4447]:Fixed NullPointerException while computing switch expression

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



##########
File path: java/java.source.base/src/org/netbeans/modules/java/source/save/CasualDiff.java
##########
@@ -4151,7 +4164,7 @@ private int diffList(
                         match = wasInFieldGroup;
                         for (Iterator<JCTree> it = deletedItems.iterator(); !match && it.hasNext(); ) {
                             ld = it.next();
-                            if (match == treesMatch(item.element, ld, false)) {
+                            if (match = treesMatch(item.element, ld, false)) {

Review comment:
       Since this expression seems confusing, I'd recomment to make a comment note that the assignment is really meant :)

##########
File path: java/java.source.base/src/org/netbeans/modules/java/source/save/CasualDiff.java
##########
@@ -4151,7 +4164,7 @@ private int diffList(
                         match = wasInFieldGroup;
                         for (Iterator<JCTree> it = deletedItems.iterator(); !match && it.hasNext(); ) {
                             ld = it.next();
-                            if (match == treesMatch(item.element, ld, false)) {
+                            if (match = treesMatch(item.element, ld, false)) {

Review comment:
       Since this expression seems confusing, I'd recommend to make a comment note that the assignment is really meant :)




----------------------------------------------------------------
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 a change in pull request #2791: [NETBEANS:4447]:Fixed NullPointerException while computing switch expression

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



##########
File path: java/java.hints/test/unit/src/org/netbeans/modules/java/hints/jdk/ConvertSwitchToRuleSwitchTest.java
##########
@@ -875,6 +875,73 @@ public void testSwitch2SwitchExpressionNestedInnerSwitchStatement() throws Excep
                               "     }\n" +
                               "}\n");
     }
+    
+    public void testSwitchToRuleSwitchFormattingMultiple() throws Exception {
+        if(!ConvertSwitchToRuleSwitchTest.isJDK14())
+            return;
+        String output = HintTest.create()
+                .input("package test;" +
+                        "public class Test {\n" +
+                        "     private void test(int p) {\n" +
+                        "         String result;\n" +
+                        "         switch (p) {\n" +
+                        "            case 0:\n" +
+                        "            case 1:\n" +
+                        "            case 2:\n" +
+                        "            case 3: result=\"a\"; break;\n" +
+                        "            default: System.err.println(\"No.\"); break;" +
+                        "         }\n" +
+                        "     }\n" +
+                        "}\n")
+                .sourceLevel(SourceVersion.latest().name())
+                .run(ConvertSwitchToRuleSwitch.class)
+                .findWarning("3:9-3:15:verifier:" + Bundle.ERR_ConvertSwitchToRuleSwitch())
+                .applyFix()
+                .assertCompilable().getOutput();
+        String expected="package test;" +
+                        "public class Test {\n" +
+                        "     private void test(int p) {\n" +
+                        "         String result;\n" +
+                        "         switch (p) {\n" +
+                        "            case 0, 1, 2, 3 -> result=\"a\";\n" +
+                        "            default -> System.err.println(\"No.\");\n" +
+                        "         }\n" +
+                        "     }\n" +
+                        "}\n";
+        assertEquals(expected, output);

Review comment:
       Thanks, have added the regression test in java/java.source.base/test/unit/src/org/netbeans/api/java/source/gen and made changes to java.hints test.




-- 
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 a change in pull request #2791: [NETBEANS:4447]:Fixed NullPointerException while computing switch expression

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



##########
File path: java/java.source.base/src/org/netbeans/modules/java/source/save/CasualDiff.java
##########
@@ -1954,6 +1961,14 @@ protected int diffCase(JCCase oldT, JCCase newT, int[] bounds) {
             endpos = endPos(oldPatterns.get(oldPatterns.size() - 1));
 
             if (newPatterns.isEmpty()) {
+                if(copyTo > localPointer){

Review comment:
       I guess you might need to use the lexer (there is a tokensequence in this class that can be used, IIRC) to find the end offset to copy. The code below will copy only spaces - but indent may be done using tabs, or even may contain comments. Finding the keyword using lexical tokens is probably easiest.




-- 
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 #2791: [NETBEANS:4447]:Fixed NullPointerException while computing switch expression

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


   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] mishrasandeep commented on a change in pull request #2791: [NETBEANS:4447]:Fixed NullPointerException while computing switch expression

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



##########
File path: java/java.source.base/src/org/netbeans/modules/java/source/save/CasualDiff.java
##########
@@ -4151,7 +4164,7 @@ private int diffList(
                         match = wasInFieldGroup;
                         for (Iterator<JCTree> it = deletedItems.iterator(); !match && it.hasNext(); ) {
                             ld = it.next();
-                            if (match == treesMatch(item.element, ld, false)) {
+                            if (match = treesMatch(item.element, ld, false)) {

Review comment:
       Thanks for the input. Have made the change.




----------------------------------------------------------------
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 closed pull request #2791: [NETBEANS:4447]:Fixed NullPointerException while computing switch expression

Posted by GitBox <gi...@apache.org>.
mishrasandeep closed pull request #2791:
URL: 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


[GitHub] [netbeans] matthiasblaesing commented on pull request #2791: [NETBEANS:4447]:Fixed NullPointerException while computing switch expression

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


   The author of this PR is not a committer, so two things are required:
   
   1. A committer, that actually does the commit and
   2. Ensures, that the author is aware, that he donates the change to the ASF (as the license headers of the files state) or if there is not enough content there to warant copyright.
   
   It would be good if one of the reviewers could take this task. Thank you!


-- 
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] Akshay-Gupta-Oracle merged pull request #2791: [NETBEANS:4447]:Fixed NullPointerException while computing switch expression

Posted by GitBox <gi...@apache.org>.
Akshay-Gupta-Oracle merged pull request #2791:
URL: 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


[GitHub] [netbeans] mishrasandeep commented on pull request #2791: [NETBEANS:4447]:Fixed NullPointerException while computing switch expression

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


   > 
   > 
   > The author of this PR is not a committer, so two things are required:
   > 
   >     1. A committer, that actually does the commit and
   > 
   >     2. Ensures, that the author is aware, that he donates the change to the ASF (as the license headers of the files state) or if there is not enough content there to warant copyright.
   > 
   > 
   > It would be good if one of the reviewers could take this task. Thank you!
   
   Thanks for the comment. I understand that I am donating to ASF. Akshay and Akhilesh from the team have reviewed the PR and will be doing the commit.


-- 
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 a change in pull request #2791: [NETBEANS:4447]:Fixed NullPointerException while computing switch expression

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



##########
File path: java/java.source.base/src/org/netbeans/modules/java/source/save/CasualDiff.java
##########
@@ -1954,6 +1961,14 @@ protected int diffCase(JCCase oldT, JCCase newT, int[] bounds) {
             endpos = endPos(oldPatterns.get(oldPatterns.size() - 1));
 
             if (newPatterns.isEmpty()) {
+                if(copyTo > localPointer){

Review comment:
       Thanks for the input. Have made the changes.




-- 
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 a change in pull request #2791: [NETBEANS:4447]:Fixed NullPointerException while computing switch expression

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



##########
File path: java/java.source.base/src/org/netbeans/modules/java/source/save/CasualDiff.java
##########
@@ -1954,6 +1961,14 @@ protected int diffCase(JCCase oldT, JCCase newT, int[] bounds) {
             endpos = endPos(oldPatterns.get(oldPatterns.size() - 1));
 
             if (newPatterns.isEmpty()) {
+                if(copyTo > localPointer){

Review comment:
       Here I am trying to print the spaces before the default keyword as the formatting was wrong on using the hint. `copyTo(localPointer, copyTo) ` will copy the entire thing which could either be the case or default keyword.




-- 
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] singh-akhilesh commented on a change in pull request #2791: [NETBEANS:4447]:Fixed NullPointerException while computing switch expression

Posted by GitBox <gi...@apache.org>.
singh-akhilesh commented on a change in pull request #2791:
URL: https://github.com/apache/netbeans/pull/2791#discussion_r607667165



##########
File path: java/java.source.base/test/unit/src/org/netbeans/api/java/source/gen/SwitchRuleFormattingTest.java
##########
@@ -0,0 +1,258 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.api.java.source.gen;
+
+import com.sun.source.tree.BlockTree;
+import com.sun.source.tree.CaseTree;
+import com.sun.source.tree.ClassTree;
+import com.sun.source.tree.CompilationUnitTree;
+import com.sun.source.tree.ExpressionTree;
+import com.sun.source.tree.MethodTree;
+import com.sun.source.tree.StatementTree;
+import com.sun.source.tree.SwitchTree;
+import com.sun.source.tree.Tree;
+import com.sun.tools.javac.tree.JCTree;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+import javax.lang.model.SourceVersion;
+import javax.lang.model.element.Element;
+import javax.swing.event.ChangeListener;
+import static junit.framework.TestCase.assertEquals;
+import static junit.framework.TestCase.assertNotNull;
+import org.netbeans.api.java.source.JavaSource;
+import org.netbeans.api.java.source.Task;
+import org.netbeans.api.java.source.TestUtilities;
+import org.netbeans.api.java.source.TreeMaker;
+import org.netbeans.api.java.source.WorkingCopy;
+import org.netbeans.junit.NbTestSuite;
+import org.netbeans.modules.java.source.TreeShims;
+import org.netbeans.modules.java.source.parsing.JavacParser;
+import org.netbeans.spi.java.queries.CompilerOptionsQueryImplementation;
+import org.openide.filesystems.FileObject;
+import org.openide.util.lookup.ServiceProvider;
+
+/**
+ * Test cases for SwitchExpression
+ *
+ */
+public class SwitchRuleFormattingTest extends TreeRewriteTestBase {
+
+    private static final List<String> EXTRA_OPTIONS = new ArrayList<>();
+
+    public SwitchRuleFormattingTest(String testName) {
+        super(testName);
+    }
+
+    public static NbTestSuite suite() {
+        NbTestSuite suite = new NbTestSuite();
+        suite.addTestSuite(SwitchRuleFormattingTest.class);
+        return suite;
+    }
+
+    @Override
+    protected void setUp() throws Exception {
+        super.setUp();
+        sourceLevel = "1.13";
+        JavacParser.DISABLE_SOURCE_LEVEL_DOWNGRADE = true;
+        EXTRA_OPTIONS.add("--enable-preview");
+    }
+
+    @Override
+    protected void tearDown() throws Exception {
+        super.tearDown();
+        JavacParser.DISABLE_SOURCE_LEVEL_DOWNGRADE = false;
+
+    }
+
+    @ServiceProvider(service = CompilerOptionsQueryImplementation.class, position = 100)
+    public static class TestCompilerOptionsQueryImplementation implements CompilerOptionsQueryImplementation {
+
+        @Override
+        public CompilerOptionsQueryImplementation.Result getOptions(FileObject file) {
+            return new CompilerOptionsQueryImplementation.Result() {
+                @Override
+                public List<? extends String> getArguments() {
+                    return EXTRA_OPTIONS;
+                }
+
+                @Override
+                public void addChangeListener(ChangeListener listener) {
+                }
+
+                @Override
+                public void removeChangeListener(ChangeListener listener) {
+                }
+            };
+        }
+
+    }
+
+public void testSwitchRuleFormatting1() throws Exception {
+        try {
+            SourceVersion.valueOf("RELEASE_13");
+        } catch (IllegalArgumentException ex) {
+            //OK, skip test
+            return ;
+        }
+
+        String code = "package test;" +
+                        "public class Test {\n" +
+                        "     private void test(int p) {\n" +
+                        "         switch (p) {\n" +
+                        "            case 0:\n" +
+                        "            case 1:\n" +
+                        "            case 2:\n" +
+                        "            case 3: result=\"a\"; break;\n" +
+                        "            default: System.err.println(\"No.\"); break;" +
+                        "         }\n" +
+                        "     }\n" +
+                        "}\n";
+        String golden = "package test;" +
+                        "public class Test {\n" +
+                        "     private void test(int p) {\n" +
+                        "         switch (p) {\n" +
+                        "            case 0, 1, 2, 3 -> result=\"a\";\n" +
+                        "            default -> System.err.println(\"No.\");\n" +
+                        "         }\n" +
+                        "     }\n" +
+                        "}\n";
+
+        prepareTest("Test", code);
+
+        rewriteSwitch();
+        String res = TestUtilities.copyFileToString(getTestFile());
+        //System.err.println(res);

Review comment:
       Remove all commented code //System.err.println(res) .




-- 
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] jlahoda commented on a change in pull request #2791: [NETBEANS:4447]:Fixed NullPointerException while computing switch expression

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



##########
File path: java/java.hints/test/unit/src/org/netbeans/modules/java/hints/jdk/ConvertSwitchToRuleSwitchTest.java
##########
@@ -875,6 +875,73 @@ public void testSwitch2SwitchExpressionNestedInnerSwitchStatement() throws Excep
                               "     }\n" +
                               "}\n");
     }
+    
+    public void testSwitchToRuleSwitchFormattingMultiple() throws Exception {
+        if(!ConvertSwitchToRuleSwitchTest.isJDK14())
+            return;
+        String output = HintTest.create()
+                .input("package test;" +
+                        "public class Test {\n" +
+                        "     private void test(int p) {\n" +
+                        "         String result;\n" +
+                        "         switch (p) {\n" +
+                        "            case 0:\n" +
+                        "            case 1:\n" +
+                        "            case 2:\n" +
+                        "            case 3: result=\"a\"; break;\n" +
+                        "            default: System.err.println(\"No.\"); break;" +
+                        "         }\n" +
+                        "     }\n" +
+                        "}\n")
+                .sourceLevel(SourceVersion.latest().name())
+                .run(ConvertSwitchToRuleSwitch.class)
+                .findWarning("3:9-3:15:verifier:" + Bundle.ERR_ConvertSwitchToRuleSwitch())
+                .applyFix()
+                .assertCompilable().getOutput();
+        String expected="package test;" +
+                        "public class Test {\n" +
+                        "     private void test(int p) {\n" +
+                        "         String result;\n" +
+                        "         switch (p) {\n" +
+                        "            case 0, 1, 2, 3 -> result=\"a\";\n" +
+                        "            default -> System.err.println(\"No.\");\n" +
+                        "         }\n" +
+                        "     }\n" +
+                        "}\n";
+        assertEquals(expected, output);

Review comment:
       A partly stylistic comment there: it is usually better to have testcases for the code generation under `java/java.source.base/test/unit/src/org/netbeans/api/java/source/gen`, so that regressions are found without running `java.hints` tests. The `java.hints` tests then can usually use `assertOutput`, which ignores formatting changes, but if formatting check is desired, `assertVerbatimOutput` can be used instead of calling `getOutput()` and `assertEquals`.

##########
File path: java/java.source.base/src/org/netbeans/modules/java/source/save/CasualDiff.java
##########
@@ -1954,6 +1961,14 @@ protected int diffCase(JCCase oldT, JCCase newT, int[] bounds) {
             endpos = endPos(oldPatterns.get(oldPatterns.size() - 1));
 
             if (newPatterns.isEmpty()) {
+                if(copyTo > localPointer){

Review comment:
       Should this be something like `copyTo(localPointer, copyTo);`?




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