Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSarika Sinha2019-07-11 05:48:26 -0400
committerSarika Sinha2019-07-11 05:48:26 -0400
commit98197a6e247571eb5aaa4483ec70e8deece6d6e8 (patch)
treef7668a52b112f0a4a5c9ad87534f771d959220d3
parent3122a06e3a023df004c6d9fca731a8e0da4ab108 (diff)
downloadeclipse.jdt.core-98197a6e247571eb5aaa4483ec70e8deece6d6e8.tar.gz
eclipse.jdt.core-98197a6e247571eb5aaa4483ec70e8deece6d6e8.tar.xz
eclipse.jdt.core-98197a6e247571eb5aaa4483ec70e8deece6d6e8.zip
Bug 548956 - Rewrite should work based on previewEnabled flag of ASTI20190713-0230I20190712-1800I20190712-0625
Change-Id: If1e02d077f2af60de859a68d0c02e25766bc93e8 Signed-off-by: Sarika Sinha <sarika.sinha@in.ibm.com>
-rw-r--r--org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/rewrite/describing/ASTRewritingStatementsTest.java9
-rw-r--r--org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/rewrite/describing/ASTRewritingSwitchExpressionsTest.java10
2 files changed, 19 insertions, 0 deletions
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/rewrite/describing/ASTRewritingStatementsTest.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/rewrite/describing/ASTRewritingStatementsTest.java
index bd6a6e6a0f..83eac08688 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/rewrite/describing/ASTRewritingStatementsTest.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/rewrite/describing/ASTRewritingStatementsTest.java
@@ -104,6 +104,15 @@ public class ASTRewritingStatementsTest extends ASTRewritingTest {
return createSuite(ASTRewritingStatementsTest.class);
}
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ if (this.apiLevel >= AST.JLS12 ) {
+ this.project1.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, JavaCore.ENABLED);
+ this.project1.setOption(JavaCore.COMPILER_PB_REPORT_PREVIEW_FEATURES, JavaCore.IGNORE);
+ }
+ }
+
/** @deprecated using deprecated code */
private void internalSetExtraDimensions(VariableDeclarationFragment node, int dimensions) {
if (this.apiLevel < AST.JLS8) {
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/rewrite/describing/ASTRewritingSwitchExpressionsTest.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/rewrite/describing/ASTRewritingSwitchExpressionsTest.java
index f10badf274..e018cddfb6 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/rewrite/describing/ASTRewritingSwitchExpressionsTest.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/rewrite/describing/ASTRewritingSwitchExpressionsTest.java
@@ -17,6 +17,7 @@ import java.util.List;
import org.eclipse.jdt.core.ICompilationUnit;
import org.eclipse.jdt.core.IPackageFragment;
+import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jdt.core.dom.AST;
import org.eclipse.jdt.core.dom.ASTNode;
import org.eclipse.jdt.core.dom.Block;
@@ -53,6 +54,15 @@ public class ASTRewritingSwitchExpressionsTest extends ASTRewritingTest {
return createSuite(ASTRewritingSwitchExpressionsTest.class);
}
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ if (this.apiLevel >= AST.JLS12 ) {
+ this.project1.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, JavaCore.ENABLED);
+ this.project1.setOption(JavaCore.COMPILER_PB_REPORT_PREVIEW_FEATURES, JavaCore.IGNORE);
+ }
+ }
+
@SuppressWarnings("rawtypes")
public void testSwitchExpressions_since_12() throws Exception {
IPackageFragment pack1= this.sourceFolder.createPackageFragment("test1", false, null);

Back to the top