From 9ed23584ad26f5c8d54b3a83b172c78443709306 Mon Sep 17 00:00:00 2001 From: Michael Bien Date: Fri, 6 Dec 2024 14:24:47 +0100 Subject: [PATCH 1/4] Try to stabilize sealed class completion tests --- .../modules/java/completion/CompletionTestBaseBase.java | 3 +++ .../java/completion/JavaCompletionTask121FeaturesTest.java | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/java/java.completion/test/unit/src/org/netbeans/modules/java/completion/CompletionTestBaseBase.java b/java/java.completion/test/unit/src/org/netbeans/modules/java/completion/CompletionTestBaseBase.java index a25e9cf0b5a5..589b00dd5ff8 100644 --- a/java/java.completion/test/unit/src/org/netbeans/modules/java/completion/CompletionTestBaseBase.java +++ b/java/java.completion/test/unit/src/org/netbeans/modules/java/completion/CompletionTestBaseBase.java @@ -67,6 +67,9 @@ public class CompletionTestBaseBase extends NbTestCase { JavaCompletionTaskBasicTest.class.getClassLoader().setDefaultAssertionStatus(true); SourceUtilsTestUtil2.disableArtificalParameterNames(); System.setProperty("org.netbeans.modules.java.source.parsing.JavacParser.no_parameter_names", "true"); + // bump tresholds to avoid context dumps from "excessive indexing" warnings + System.setProperty("org.netbeans.modules.parsing.impl.indexing.LogContext$EventType.PATH.treshold", "100"); + System.setProperty("org.netbeans.modules.parsing.impl.indexing.LogContext$EventType.MANAGER.treshold", "100"); } static final int FINISH_OUTTIME = 5 * 60 * 1000; diff --git a/java/java.completion/test/unit/src/org/netbeans/modules/java/completion/JavaCompletionTask121FeaturesTest.java b/java/java.completion/test/unit/src/org/netbeans/modules/java/completion/JavaCompletionTask121FeaturesTest.java index 5237ac4e88f7..2d36c6ac975d 100644 --- a/java/java.completion/test/unit/src/org/netbeans/modules/java/completion/JavaCompletionTask121FeaturesTest.java +++ b/java/java.completion/test/unit/src/org/netbeans/modules/java/completion/JavaCompletionTask121FeaturesTest.java @@ -179,9 +179,10 @@ protected void afterTestSetup() throws Exception { @Override protected void tearDown() throws Exception { - if (classPathRegistered != null) { + if (getName().startsWith("testSealed") && classPathRegistered != null) { GlobalPathRegistry.getDefault().unregister(ClassPath.SOURCE, new ClassPath[] {classPathRegistered}); SourceUtils.waitScanFinished(); + classPathRegistered = null; } super.tearDown(); } From 39e89191cf5c15e6c68bb9e882c0ceb0280999bc Mon Sep 17 00:00:00 2001 From: Michael Bien Date: Fri, 6 Dec 2024 14:56:41 +0100 Subject: [PATCH 2/4] debug print --- harness/nbjunit/nbproject/project.properties | 2 +- harness/nbjunit/src/org/netbeans/junit/NbTestCase.java | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/harness/nbjunit/nbproject/project.properties b/harness/nbjunit/nbproject/project.properties index cbe11c7123f6..a4eb0fc9ba35 100644 --- a/harness/nbjunit/nbproject/project.properties +++ b/harness/nbjunit/nbproject/project.properties @@ -16,7 +16,7 @@ # under the License. javac.compilerargs=-Xlint:unchecked -javac.source=1.8 +javac.release=11 javadoc.arch=${basedir}/arch.xml javadoc.apichanges=${basedir}/apichanges.xml diff --git a/harness/nbjunit/src/org/netbeans/junit/NbTestCase.java b/harness/nbjunit/src/org/netbeans/junit/NbTestCase.java index 2d9f96007c80..b70f164df48a 100644 --- a/harness/nbjunit/src/org/netbeans/junit/NbTestCase.java +++ b/harness/nbjunit/src/org/netbeans/junit/NbTestCase.java @@ -752,6 +752,8 @@ public static void assertFile(String message, File test, File pass, File diff, D } else { try { if (diffImpl.diff(test, pass, diffFile)) { + System.out.println("test: "+test+"\n"+Files.readString(test.toPath())); + System.out.println("pass: "+pass+"\n"+Files.readString(pass.toPath())); throw new AssertionFileFailedError(message+"\n diff: "+diffFile, null == diffFile ? "" : diffFile.getAbsolutePath()); } } catch (IOException e) { From 98784f3816d798910e6c665e48ff59150c8c04ed Mon Sep 17 00:00:00 2001 From: Michael Bien Date: Sun, 8 Dec 2024 12:09:48 +0100 Subject: [PATCH 3/4] check potential side effect --- .../java/completion/JavaCompletionTask121FeaturesTest.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/java/java.completion/test/unit/src/org/netbeans/modules/java/completion/JavaCompletionTask121FeaturesTest.java b/java/java.completion/test/unit/src/org/netbeans/modules/java/completion/JavaCompletionTask121FeaturesTest.java index 2d36c6ac975d..b4f627748a56 100644 --- a/java/java.completion/test/unit/src/org/netbeans/modules/java/completion/JavaCompletionTask121FeaturesTest.java +++ b/java/java.completion/test/unit/src/org/netbeans/modules/java/completion/JavaCompletionTask121FeaturesTest.java @@ -38,7 +38,7 @@ public class JavaCompletionTask121FeaturesTest extends CompletionTestBase { public JavaCompletionTask121FeaturesTest(String testName) { super(testName); } - +/* public void testRecordPatternCompletion_1() throws Exception { performTest("RecordPattern", 930, null, "AutoCompletion_RecordPattern_1.pass", SOURCE_LEVEL); } @@ -122,7 +122,7 @@ public void testCaseBodyCompletion_GuardedPattern() throws Exception { public void TODOtestNoCrash() throws Exception { performTest("SwitchPatternMatching", 1275, "case R(var s,", "AutoCompletion_Guard_PatternMatchingSwitch.pass", SOURCE_LEVEL); } - +*/ public void testSealedTypeSwitch1() throws Exception { performTest("SwitchWithSealedType", 1084, null, "sealedTypeSwitch.pass", SOURCE_LEVEL); } From f7026d4b248c6725839331911a92eb8cbd8a9958 Mon Sep 17 00:00:00 2001 From: Michael Bien Date: Sun, 8 Dec 2024 12:32:36 +0100 Subject: [PATCH 4/4] remove input duplicate --- .../java/completion/JavaCompletionTask121FeaturesTest.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/java/java.completion/test/unit/src/org/netbeans/modules/java/completion/JavaCompletionTask121FeaturesTest.java b/java/java.completion/test/unit/src/org/netbeans/modules/java/completion/JavaCompletionTask121FeaturesTest.java index b4f627748a56..0f2a1b43abb0 100644 --- a/java/java.completion/test/unit/src/org/netbeans/modules/java/completion/JavaCompletionTask121FeaturesTest.java +++ b/java/java.completion/test/unit/src/org/netbeans/modules/java/completion/JavaCompletionTask121FeaturesTest.java @@ -139,9 +139,9 @@ public void testSealedTypeSwitchTypeFiltering() throws Exception { performTest("SwitchWithSealedType", 1084, "J j -> {} case ", "sealedTypeSwitchJFiltered.pass", SOURCE_LEVEL); } - public void testSealedTypeSwitchTypeFilteringGuard() throws Exception { - performTest("SwitchWithSealedType", 1084, "J j when j == null -> {} case ", "sealedTypeSwitch.pass", SOURCE_LEVEL); - } +// public void testSealedTypeSwitchTypeFilteringGuard() throws Exception { +// performTest("SwitchWithSealedType", 1084, "J j when j == null -> {} case ", "sealedTypeSwitch.pass", SOURCE_LEVEL); +// } public void testSealedTypeSwitchTypeFilteringQualified() throws Exception { performTest("SwitchWithSealedType", 1084, "J j -> {} case test.Test.", "sealedTypeSwitchJFilteredQualified.pass", SOURCE_LEVEL);