This is an automated email from the ASF dual-hosted git repository.
neilcsmith pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/netbeans.git
The following commit(s) were added to refs/heads/master by this push:
new 7a53e68a93 [NETBEANS-5260] Binding patterns are valid even in absence
of MatchException.
new 2d5ae33ac1 Merge pull request #5682 from jlahoda/NETBEANS-5260
7a53e68a93 is described below
commit 7a53e68a93171c4d4b0a427239d801f9cb7f6ef5
Author: Jan Lahoda <[email protected]>
AuthorDate: Sun Mar 19 16:48:32 2023 +0100
[NETBEANS-5260] Binding patterns are valid even in absence of
MatchException.
---
.../java/source/indexing/VanillaCompileWorker.java | 1 -
.../source/indexing/VanillaCompileWorkerTest.java | 52 ++++++++++++++++++++++
2 files changed, 52 insertions(+), 1 deletion(-)
diff --git
a/java/java.source.base/src/org/netbeans/modules/java/source/indexing/VanillaCompileWorker.java
b/java/java.source.base/src/org/netbeans/modules/java/source/indexing/VanillaCompileWorker.java
index e10e905b29..dcc3999f7c 100644
---
a/java/java.source.base/src/org/netbeans/modules/java/source/indexing/VanillaCompileWorker.java
+++
b/java/java.source.base/src/org/netbeans/modules/java/source/indexing/VanillaCompileWorker.java
@@ -914,7 +914,6 @@ final class VanillaCompileWorker extends CompileWorker {
@Override
public Void visitBindingPattern(BindingPatternTree node, Void p) {
- errorFound |= !hasMatchException;
return super.visitBindingPattern(node, p);
}
diff --git
a/java/java.source.base/test/unit/src/org/netbeans/modules/java/source/indexing/VanillaCompileWorkerTest.java
b/java/java.source.base/test/unit/src/org/netbeans/modules/java/source/indexing/VanillaCompileWorkerTest.java
index 276fa04b97..40ca64d159 100644
---
a/java/java.source.base/test/unit/src/org/netbeans/modules/java/source/indexing/VanillaCompileWorkerTest.java
+++
b/java/java.source.base/test/unit/src/org/netbeans/modules/java/source/indexing/VanillaCompileWorkerTest.java
@@ -2245,6 +2245,58 @@ public class VanillaCompileWorkerTest extends
CompileWorkerTestBase {
assertEquals(expected, file2Fixed);
}
+ public void testTypeTest() throws Exception {
+ setSourceLevel("17");
+
+ Map<String, String> file2Fixed = new HashMap<>();
+ VanillaCompileWorker.fixedListener = (file, cut) -> {
+ try {
+ FileObject source =
URLMapper.findFileObject(file.toUri().toURL());
+ file2Fixed.put(FileUtil.getRelativePath(getRoot(), source),
cut.toString());
+ } catch (MalformedURLException ex) {
+ throw new IllegalStateException(ex);
+ }
+ };
+ ParsingOutput result =
runIndexing(Arrays.asList(compileTuple("test/Test.java",
+ "package
test;\n" +
+ "public
class Test {\n" +
+ "
public void test1(Object o) {\n" +
+ "
if (o instanceof String s) {\n" +
+ "
System.err.println();\n" +
+ "
}\n" +
+ "
}\n" +
+ "}\n")),
+ Arrays.asList());
+
+ assertFalse(result.lowMemory);
+ assertTrue(result.success);
+
+ Set<String> createdFiles = new HashSet<String>();
+
+ for (File created : result.createdFiles) {
+
createdFiles.add(getWorkDir().toURI().relativize(created.toURI()).getPath());
+ }
+
+ assertEquals(new
HashSet<String>(Arrays.asList("cache/s1/java/15/classes/test/Test.sig")),
+ createdFiles);
+ Map<String, String> expected =
Collections.singletonMap("test/Test.java",
+ "package test;\n" +
+ "\n" +
+ "public class Test {\n" +
+ " \n" +
+ " public Test() {\n" +
+ " super();\n" +
+ " }\n" +
+ " \n" +
+ " public void test1(Object o) {\n" +
+ " if (o instanceof String s) {\n" +
+ " System.err.println();\n" +
+ " }\n" +
+ " }\n" +
+ "}");
+ assertEquals(expected, file2Fixed);
+ }
+
public static void noop() {}
@Override
---------------------------------------------------------------------
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