From 7177693a6a63388fef87a2790246e0c285dbed95 Mon Sep 17 00:00:00 2001 From: Manoj N Palat Date: Fri, 13 Dec 2024 14:59:34 +0530 Subject: [PATCH] test showing the problem decribed in issue #3445 --- .../regression/BatchCompilerTest.java | 45 ++++++++++++++++++- 1 file changed, 44 insertions(+), 1 deletion(-) diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/BatchCompilerTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/BatchCompilerTest.java index e09a12222ad..e32ac751369 100644 --- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/BatchCompilerTest.java +++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/BatchCompilerTest.java @@ -68,7 +68,7 @@ public class BatchCompilerTest extends AbstractBatchCompilerTest { static { -// TESTS_NAMES = new String[] { "test440477" }; +// TESTS_NAMES = new String[] { "test3445" }; // TESTS_NUMBERS = new int[] { 306 }; // TESTS_RANGE = new int[] { 298, -1 }; } @@ -13161,4 +13161,47 @@ public void testGH2434(){ "", true); } +public void test3445() { + final String testScratchArea = "fileSystemTestScratchArea"; + + File testScratchAreaFile = new File(Util.getOutputDirectory(), testScratchArea); + File packsFile = null; + try { + if(!testScratchAreaFile.exists()) { + testScratchAreaFile.mkdirs(); + } + + + assertTrue(testScratchAreaFile.exists()); + + String packComponent = "AAAA"; + final String packs = packComponent + File.separator + packComponent + File.separator + packComponent; + packsFile = new File(testScratchAreaFile, packs); + + try { + if(!packsFile.exists()) { + packsFile.mkdirs(); + } + } finally { + // do nothing + } + + Classpath classpath = FileSystem.getClasspath(testScratchAreaFile.getPath(), null, null); + assertNotNull(classpath); + assertTrue(classpath instanceof ClasspathDirectory); + + ClasspathDirectory classpathDirectory = (ClasspathDirectory)classpath; + classpathDirectory.getModulesDeclaringPackage(packs, ""); // //Just testing the concurrenthashmap implementation. + + } finally { + if(packsFile.exists()) { + Util.delete(packsFile); + } + + if(testScratchAreaFile.exists()) { + Util.delete(testScratchAreaFile); + } + } +} + } \ No newline at end of file