Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorManoj Palat2021-04-26 07:06:48 +0000
committerManoj Palat2021-04-26 09:44:52 +0000
commitd2c5473e050dbc8239109bec60e42bcce593c7c3 (patch)
treee558a893a2659546006ee0ed70b9e80aa1c7b158
parentf19d20e6a917016c9405829df3732ebb1d810478 (diff)
downloadeclipse.jdt.core-d2c5473e050dbc8239109bec60e42bcce593c7c3.tar.gz
eclipse.jdt.core-d2c5473e050dbc8239109bec60e42bcce593c7c3.tar.xz
eclipse.jdt.core-d2c5473e050dbc8239109bec60e42bcce593c7c3.zip
Bug 573158 - [16] BatchCompilerTest_16 is not part of any suite yet
Change-Id: If251c66df651b65fb99b9b3e7233aa0a24146831 Signed-off-by: Manoj Palat <manpalat@in.ibm.com> Reviewed-on: https://git.eclipse.org/r/c/jdt/eclipse.jdt.core/+/179814 Tested-by: JDT Bot <jdt-bot@eclipse.org>
-rw-r--r--org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AbstractBatchCompilerTest.java11
-rw-r--r--org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/BatchCompilerTest_15.java5
-rw-r--r--org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/BatchCompilerTest_16.java6
-rw-r--r--org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/TestAll.java2
4 files changed, 23 insertions, 1 deletions
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AbstractBatchCompilerTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AbstractBatchCompilerTest.java
index cad3c2fb7e..94bcd69e40 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AbstractBatchCompilerTest.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AbstractBatchCompilerTest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2017 GK Software AG and others.
+ * Copyright (c) 2017, 2021 GK Software AG and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -38,6 +38,15 @@ public abstract class AbstractBatchCompilerTest extends AbstractRegressionTest {
}
/**
+ * Used for preview features especially.
+ * @param compilerVersion - CompilerOptions.version string
+ * @return true if spec version is same as compiler version
+ */
+ public static boolean isJREVersionEqualTo(String compilerVersion) {
+ String specVersion = System.getProperty("java.specification.version");
+ return specVersion != null && Integer.valueOf(specVersion) == Integer.valueOf(compilerVersion);
+ }
+ /**
* Abstract normalizer for output comparison. This class merely embodies a
* chain of responsibility, plus the signature of the method of interest
* here, that is {@link #normalized(String) normalized}.
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/BatchCompilerTest_15.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/BatchCompilerTest_15.java
index de0b950662..b67fc11d63 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/BatchCompilerTest_15.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/BatchCompilerTest_15.java
@@ -18,6 +18,8 @@ import java.io.IOException;
import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jdt.core.tests.util.Util;
+import org.eclipse.jdt.internal.compiler.impl.CompilerOptions;
+
import junit.framework.Test;
@SuppressWarnings({ "rawtypes" })
@@ -45,6 +47,9 @@ public class BatchCompilerTest_15 extends AbstractBatchCompilerTest {
super(name);
}
public void testBug564047_001(){
+ if (!AbstractBatchCompilerTest.isJREVersionEqualTo(CompilerOptions.VERSION_15))
+ return; // preview test - relevant only at level 15
+
String currentWorkingDirectoryPath = System.getProperty("user.dir");
if (currentWorkingDirectoryPath == null) {
System.err.println("BatchCompilerTest#testBug564047_001 could not access the current working directory " + currentWorkingDirectoryPath);
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/BatchCompilerTest_16.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/BatchCompilerTest_16.java
index 40b81442d7..30d3fb786d 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/BatchCompilerTest_16.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/BatchCompilerTest_16.java
@@ -13,6 +13,8 @@
package org.eclipse.jdt.core.tests.compiler.regression;
import java.io.File;
+import org.eclipse.jdt.internal.compiler.impl.CompilerOptions;
+
import junit.framework.Test;
@SuppressWarnings({ "rawtypes" })
public class BatchCompilerTest_16 extends AbstractBatchCompilerTest {
@@ -37,6 +39,8 @@ public class BatchCompilerTest_16 extends AbstractBatchCompilerTest {
super(name);
}
public void testBug571454_001(){
+ if (AbstractBatchCompilerTest.isJREVersionEqualTo(CompilerOptions.VERSION_16))
+ return;
String currentWorkingDirectoryPath = System.getProperty("user.dir");
if (currentWorkingDirectoryPath == null) {
System.err.println("BatchCompilerTest#testBug564047_001 could not access the current working directory " + currentWorkingDirectoryPath);
@@ -82,6 +86,8 @@ public class BatchCompilerTest_16 extends AbstractBatchCompilerTest {
}
}
public void testBug570399(){
+ if (AbstractBatchCompilerTest.isJREVersionEqualTo(CompilerOptions.VERSION_16))
+ return;
this.runConformTest(
new String[] {
"src/X.java",
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/TestAll.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/TestAll.java
index 0f62c6079b..8cf9177e3e 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/TestAll.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/TestAll.java
@@ -202,6 +202,7 @@ public static Test suite() {
since_15.add(ClassFileReaderTest_15.class);
since_15.add(JavadocTest_15.class);
since_15.add(Unicode13Test.class);
+ since_15.add(BatchCompilerTest_15.class);
// add 16 specific test here (check duplicates)
ArrayList since_16 = new ArrayList();
@@ -210,6 +211,7 @@ public static Test suite() {
since_16.add(LocalStaticsTest.class);
since_16.add(PreviewFeatureTest.class);
since_16.add(ValueBasedAnnotationTests.class);
+ since_16.add(BatchCompilerTest_16.class);
// Build final test suite
TestSuite all = new TestSuite(TestAll.class.getName());

Back to the top