Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Kurtakov2019-07-16 13:24:29 +0000
committerAlexander Kurtakov2019-07-17 12:33:03 +0000
commitc5e0391344eaa7dfe5446f92cdbdd4259c781386 (patch)
tree32a76214e63d61449af6abb012f329c4c14e1257
parent7af4f8562a6d8c8577b761e4031f635443c10f51 (diff)
downloadm2e-core-c5e0391344eaa7dfe5446f92cdbdd4259c781386.tar.gz
m2e-core-c5e0391344eaa7dfe5446f92cdbdd4259c781386.tar.xz
m2e-core-c5e0391344eaa7dfe5446f92cdbdd4259c781386.zip
Depend on o.e.jdt.core 3.18.
And use "--preview" features constants directly instead of mirroring them. Change-Id: I1d6f2da32b410d9760f7e1c94ab99ac8689ec62b Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
-rw-r--r--org.eclipse.m2e.jdt/META-INF/MANIFEST.MF2
-rw-r--r--org.eclipse.m2e.jdt/src/org/eclipse/m2e/jdt/internal/AbstractJavaProjectConfigurator.java17
-rw-r--r--org.eclipse.m2e.jdt/src/org/eclipse/m2e/jdt/internal/JavaSettingsUtils.java32
3 files changed, 8 insertions, 43 deletions
diff --git a/org.eclipse.m2e.jdt/META-INF/MANIFEST.MF b/org.eclipse.m2e.jdt/META-INF/MANIFEST.MF
index 0eb62647..76aa2829 100644
--- a/org.eclipse.m2e.jdt/META-INF/MANIFEST.MF
+++ b/org.eclipse.m2e.jdt/META-INF/MANIFEST.MF
@@ -9,7 +9,7 @@ Export-Package: org.eclipse.m2e.jdt,
org.eclipse.m2e.jdt.internal.launch;x-internal:=true
Require-Bundle: org.eclipse.core.runtime,
org.eclipse.debug.core,
- org.eclipse.jdt.core,
+ org.eclipse.jdt.core;bundle-version="3.18.0",
org.eclipse.jdt.launching,
org.eclipse.core.resources,
org.eclipse.m2e.maven.runtime;bundle-version="[1.13.0,1.14.0)",
diff --git a/org.eclipse.m2e.jdt/src/org/eclipse/m2e/jdt/internal/AbstractJavaProjectConfigurator.java b/org.eclipse.m2e.jdt/src/org/eclipse/m2e/jdt/internal/AbstractJavaProjectConfigurator.java
index 28410a30..7d7d09ea 100644
--- a/org.eclipse.m2e.jdt/src/org/eclipse/m2e/jdt/internal/AbstractJavaProjectConfigurator.java
+++ b/org.eclipse.m2e.jdt/src/org/eclipse/m2e/jdt/internal/AbstractJavaProjectConfigurator.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008-2018 Sonatype, Inc.
+ * Copyright (c) 2008, 2019 Sonatype, Inc. and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -605,13 +605,11 @@ public abstract class AbstractJavaProjectConfigurator extends AbstractProjectCon
if(jp != null && jp.getOption(JavaCore.COMPILER_PB_FORBIDDEN_REFERENCE, false) == null) {
options.put(JavaCore.COMPILER_PB_FORBIDDEN_REFERENCE, JavaCore.WARNING);
}
- if(JavaSettingsUtils.isPreviewFeatureAvailable) {
- options.put(JavaSettingsUtils.COMPILER_PB_ENABLE_PREVIEW_FEATURES,
- enablePreviewFeatures ? JavaCore.ENABLED : JavaCore.DISABLED);
- //preview features are enabled on purpose, so keep JDT quiet about it, unless specifically overridden by the user
- if(jp != null && jp.getOption(JavaSettingsUtils.COMPILER_PB_REPORT_PREVIEW_FEATURES, false) == null) {
- options.put(JavaSettingsUtils.COMPILER_PB_REPORT_PREVIEW_FEATURES, JavaCore.IGNORE);
- }
+ options.put(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES,
+ enablePreviewFeatures ? JavaCore.ENABLED : JavaCore.DISABLED);
+ //preview features are enabled on purpose, so keep JDT quiet about it, unless specifically overridden by the user
+ if(jp != null && jp.getOption(JavaCore.COMPILER_PB_REPORT_PREVIEW_FEATURES, false) == null) {
+ options.put(JavaCore.COMPILER_PB_REPORT_PREVIEW_FEATURES, JavaCore.IGNORE);
}
}
@@ -654,9 +652,6 @@ public abstract class AbstractJavaProjectConfigurator extends AbstractProjectCon
private boolean isEnablePreviewFeatures(MavenProject mavenProject, MojoExecution execution,
IProgressMonitor monitor) {
- if(!JavaSettingsUtils.isPreviewFeatureAvailable) {
- return false;
- }
//1st, check the --enable-preview flag in the compilerArgs list
try {
List<?> args = maven.getMojoParameterValue(mavenProject, execution, "compilerArgs", List.class, monitor);//$NON-NLS-1$
diff --git a/org.eclipse.m2e.jdt/src/org/eclipse/m2e/jdt/internal/JavaSettingsUtils.java b/org.eclipse.m2e.jdt/src/org/eclipse/m2e/jdt/internal/JavaSettingsUtils.java
index 9acf696a..87da3f0d 100644
--- a/org.eclipse.m2e.jdt/src/org/eclipse/m2e/jdt/internal/JavaSettingsUtils.java
+++ b/org.eclipse.m2e.jdt/src/org/eclipse/m2e/jdt/internal/JavaSettingsUtils.java
@@ -22,40 +22,10 @@ import org.eclipse.jdt.core.JavaCore;
*/
public class JavaSettingsUtils {
- /**
- * @deprecated use JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES when it's available
- */
- @Deprecated
- public static final String COMPILER_PB_ENABLE_PREVIEW_FEATURES = "org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures";
-
- /**
- * @deprecated use JavaCore.COMPILER_PB_REPORT_PREVIEW_FEATURES when it's available
- */
- @Deprecated
- public static final String COMPILER_PB_REPORT_PREVIEW_FEATURES = "org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures";
-
public static final String ENABLE_PREVIEW_JVM_FLAG = "--enable-preview";
public static final String PARAMETERS_JVM_FLAG = "-parameters";
- /**
- * Does this version of JDT support JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES? Will be removed once the minimum JDT
- * requirement guarantees COMPILER_PB_ENABLE_PREVIEW_FEATURES is available.
- */
- @Deprecated
- public static final boolean isPreviewFeatureAvailable;
-
- static {
- //TODO remove that once we depend on Eclipse 4.12
- boolean hasField = false;
- try {
- JavaCore.class.getField("COMPILER_PB_ENABLE_PREVIEW_FEATURES");
- hasField = true;
- } catch(Exception ignore) {
- }
- isPreviewFeatureAvailable = hasField;
- }
-
private JavaSettingsUtils() {
//No public instanciation
}
@@ -71,6 +41,6 @@ public class JavaSettingsUtils {
if(project == null) {
return false;
}
- return JavaCore.ENABLED.equals(project.getOption(COMPILER_PB_ENABLE_PREVIEW_FEATURES, true));
+ return JavaCore.ENABLED.equals(project.getOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, true));
}
}

Back to the top