Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephan Herrmann2019-05-12 07:29:06 -0400
committerStephan Herrmann2019-05-12 07:29:06 -0400
commitd00d33a7e2d1a4906eb3cf4380c89d9abdb87603 (patch)
tree05eb31c943c11a49578404cd45876cb540463824
parentb150a823927c3586fa8e11a2cb098c3e2dbbc1e5 (diff)
downloadeclipse.jdt.core-I20190512-1800.tar.gz
eclipse.jdt.core-I20190512-1800.tar.xz
eclipse.jdt.core-I20190512-1800.zip
Bug 404648 - [1.8][compiler] investigate differences between ECJ & javacI20190512-1800
- improve cleanup between javac invocations Change-Id: Ib5cca78c085e68b97fd7dca9f19f03d5564dbd18 Signed-off-by: Stephan Herrmann <stephan.herrmann@berlin.de>
-rw-r--r--org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AbstractRegressionTest.java15
1 files changed, 15 insertions, 0 deletions
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AbstractRegressionTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AbstractRegressionTest.java
index c1f940b704..bf92df0f21 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AbstractRegressionTest.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AbstractRegressionTest.java
@@ -35,6 +35,7 @@ import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.net.URL;
+import java.nio.file.Files;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Collection;
@@ -93,6 +94,7 @@ import org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding;
import org.eclipse.jdt.internal.compiler.lookup.TypeConstants;
import org.eclipse.jdt.internal.compiler.problem.AbortCompilation;
import org.eclipse.jdt.internal.compiler.problem.DefaultProblemFactory;
+import org.eclipse.jdt.internal.compiler.util.SuffixConstants;
import org.eclipse.jdt.internal.core.search.JavaSearchParticipant;
import org.eclipse.jdt.internal.core.search.indexing.BinaryIndexer;
import org.eclipse.jdt.internal.core.util.Messages;
@@ -2228,6 +2230,8 @@ protected void runJavac(
File.separator + compiler.rawVersion); // need to change output directory per javac version
if (shouldFlushOutputDirectory) {
Util.delete(javacOutputDirectory);
+ } else {
+ deleteSourceFiles(javacOutputDirectory);
}
javacOutputDirectory.mkdirs();
// write test files
@@ -2348,6 +2352,17 @@ protected void runJavac(
}
}
}
+private void deleteSourceFiles(File directory) {
+ try {
+ Files.walk(directory.toPath())
+ .filter(f -> f.endsWith(SuffixConstants.SUFFIX_STRING_java))
+ .map(java.nio.file.Path::toFile)
+ .filter(File::isFile)
+ .forEach(File::delete);
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+}
private boolean errorStringMatch(String expectedErrorStringStart, String actualError) {
/*
* From TestVerifier.checkBuffers():

Back to the top