Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephan Herrmann2018-12-06 17:41:04 +0000
committerStephan Herrmann2018-12-06 17:41:04 +0000
commitc0faff45d8b6c888ef80754ca448068c9fc871d6 (patch)
tree2c20ba9ba87fcfe5fe9bc72641890e0c5b36a245 /org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AbstractRegressionTest.java
parentb37e97ed48bf43f330d19fc487d0c186b747581c (diff)
downloadorg.eclipse.objectteams-c0faff45d8b6c888ef80754ca448068c9fc871d6.tar.gz
org.eclipse.objectteams-c0faff45d8b6c888ef80754ca448068c9fc871d6.tar.xz
org.eclipse.objectteams-c0faff45d8b6c888ef80754ca448068c9fc871d6.zip
Releng: update jdt.core to I20181206-0815 (candidate 4.10 RC2)
Diffstat (limited to 'org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AbstractRegressionTest.java')
-rw-r--r--org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AbstractRegressionTest.java27
1 files changed, 22 insertions, 5 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 ab71b712c..b2121e110 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
@@ -246,6 +246,10 @@ static class JavacCompiler {
StringBuffer classpathBuffer = new StringBuffer(" -classpath ");
this.classpath = classpathBuffer.toString();
}
+ /** Call this if " -classpath " should be replaced by some other option token. */
+ protected void usePathOption(String option) {
+ this.classpath = option;
+ }
static String getVersion(String javacPathName) throws IOException, InterruptedException {
Process fetchVersionProcess = null;
try {
@@ -1013,7 +1017,7 @@ protected static class JavacTestOptions {
// list of available javac compilers, as defined by the jdk.roots
// variable, which should hold a File.pathSeparatorChar separated
// list of paths for to-be-tested JDK root directories
- protected static List javacCompilers = null;
+ protected static List<JavacCompiler> javacCompilers = null;
public static final String OUTPUT_DIR = Util.getOutputDirectory() + File.separator + "regression";
public static final String LIB_DIR = Util.getOutputDirectory() + File.separator + "lib";
@@ -1869,7 +1873,15 @@ protected static class JavacTestOptions {
expectedSuccessOutputString,
null,
javacTestOptions);
+ }
+
+ protected static void javacUsePathOption(String option) {
+ if (AbstractRegressionTest.javacCompilers != null) {
+ for (JavacCompiler compiler : AbstractRegressionTest.javacCompilers) {
+ compiler.usePathOption(option);
+ }
}
+ }
/*
* Run Sun compilation using javac.
@@ -2184,9 +2196,9 @@ protected void runJavac(
}
}
String testName = testName();
- Iterator compilers = javacCompilers.iterator();
+ Iterator<JavacCompiler> compilers = javacCompilers.iterator();
while (compilers.hasNext()) {
- JavacCompiler compiler = (JavacCompiler) compilers.next();
+ JavacCompiler compiler = compilers.next();
if (!options.skip(compiler) && compiler.compliance == this.complianceLevel) {
// WORK this may exclude some compilers under some conditions (when
// complianceLevel is not set); consider accepting the compiler
@@ -2208,6 +2220,7 @@ protected void runJavac(
for (int i = 0, length = testFiles.length; i < length; ) {
String fileName = testFiles[i++];
String contents = testFiles[i++];
+ fileName = expandFileNameForJavac(fileName);
File file = new File(javacOutputDirectory, fileName);
if (fileName.lastIndexOf('/') >= 0) {
File dir = file.getParentFile();
@@ -2221,7 +2234,7 @@ protected void runJavac(
int testFilesLength = testFiles.length;
sourceFileNames = new String[testFilesLength / 2];
for (int i = 0, j = 0; i < testFilesLength; i += 2, j++) {
- sourceFileNames[j] = testFiles[i];
+ sourceFileNames[j] = expandFileNameForJavac(testFiles[i]);
}
// compile
@@ -2324,6 +2337,10 @@ protected void runJavac(
}
}
}
+/** Hook for AbstractRegressionTest9 */
+protected String expandFileNameForJavac(String fileName) {
+ return fileName;
+}
void handleMismatch(JavacCompiler compiler, String testName, String[] testFiles, String expectedCompilerLog,
String expectedOutputString, String expectedErrorString, StringBuffer compilerLog, String output, String err,
JavacTestOptions.Excuse excuse, int mismatch) {
@@ -3606,7 +3623,7 @@ protected void runNegativeTest(
System.out.println("* Sun Javac compiler output archived into file:");
System.out.println("* " + javacFullLogFileName);
System.out.println("***************************************************************************");
- javacCompilers = new ArrayList();
+ javacCompilers = new ArrayList<>();
String jdkRoots = System.getProperty("jdk.roots");
if (jdkRoots == null) {
javacCompilers.add(new JavacCompiler(jdkRootDirPath.toString()));

Back to the top