neilcsmith-net commented on code in PR #9258:
URL: https://github.com/apache/netbeans/pull/9258#discussion_r2919837202


##########
java/java.source.base/test/unit/src/org/netbeans/modules/java/source/save/FormatingTest.java:
##########
@@ -6328,7 +6325,52 @@ public void testForVar2() throws Exception {
                 + "    }\n"
                 + "}\n";
         reformat(doc, content, golden);
-        JavaSourceTest.SourceLevelQueryImpl.sourceLevel = oldLevel;
+    }
+
+    public void testForVarUnnamed() throws Exception {
+        sourceLevel = "22";
+        testFile = new File(getWorkDir(), "Test.java");
+        TestUtilities.copyStringToFile(testFile, "");
+        FileObject testSourceFO = FileUtil.toFileObject(testFile);
+        DataObject testSourceDO = DataObject.find(testSourceFO);
+        EditorCookie ec = (EditorCookie) 
testSourceDO.getCookie(EditorCookie.class);
+        final Document doc = ec.openDocument();
+        doc.putProperty(Language.class, JavaTokenId.language());
+        String content
+                = """
+                  package hierbas.del.litoral;
+                  
+                  public class Test {
+                  
+                      public static void main(String[] args) {
+                          int[] orderIDs = {34, 45, 23, 27, 15};
+                          int total = 0;
+                          for (   var   _:orderIDs) {
+                            total++;
+                          }
+                      }
+                  }
+                  """;
+
+        String golden
+                = """
+                  package hierbas.del.litoral;
+                  
+                  public class Test {
+                  
+                      public static void main(String[] args) {
+                          int[] orderIDs = {34, 45, 23, 27, 15};
+                          int total = 0;
+                          for (var _ : orderIDs) {
+                              total++;
+                          }
+                      }
+                  }
+                  """;
+
+        //check no change then formatted
+        reformat(doc, golden, golden);
+        reformat(doc, content, golden);

Review Comment:
   Ah, yes, OK, that would make a lot of sense!



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


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