Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Kurtakov2019-05-17 11:52:48 -0400
committerAlexander Kurtakov2019-05-17 12:18:55 -0400
commit82ee759c46e993f9c425316f04046950851a5b34 (patch)
tree6bf00f8f29d2a681739c03d3ff0a8bafe4905521
parentc081ed2886990acffc27592cdb901f3950584c45 (diff)
downloadm2e-core-82ee759c46e993f9c425316f04046950851a5b34.tar.gz
m2e-core-82ee759c46e993f9c425316f04046950851a5b34.tar.xz
m2e-core-82ee759c46e993f9c425316f04046950851a5b34.zip
Fix various deprecation usages.HEADmaster
Change-Id: I2609f865d94a73e2410aa6c3c8e38e6d7766cf7c Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
-rw-r--r--org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/M2EUIPluginActivator.java2
-rw-r--r--org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/editing/ChangeCreator.java2
-rw-r--r--org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/util/ProposalUtil.java3
-rw-r--r--org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/builder/plexusbuildapi/AbstractEclipseBuildContext.java3
-rw-r--r--org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/index/nexus/AetherClientResourceFetcher.java1
-rw-r--r--org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/lifecyclemapping/AnnotationMappingMetadataSource.java2
-rw-r--r--org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/project/registry/ProjectRegistryReader.java5
-rw-r--r--org.eclipse.m2e.discovery/src/org/eclipse/m2e/internal/discovery/strategy/M2EConnectorDiscoveryExtensionReader.java2
-rw-r--r--org.eclipse.m2e.editor.xml/src/main/java/org/eclipse/m2e/editor/xml/internal/MarkerHoverControl.java2
-rw-r--r--org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/pom/MavenPomEditorPage.java20
-rw-r--r--org.eclipse.m2e.jdt/src/org/eclipse/m2e/jdt/internal/AbstractJavaProjectConfigurator.java3
-rw-r--r--org.eclipse.m2e.refactoring/src/org/eclipse/m2e/refactoring/ChangeCreator.java6
12 files changed, 29 insertions, 22 deletions
diff --git a/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/M2EUIPluginActivator.java b/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/M2EUIPluginActivator.java
index 4cb6d17a..6bbd3a72 100644
--- a/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/M2EUIPluginActivator.java
+++ b/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/M2EUIPluginActivator.java
@@ -60,7 +60,7 @@ public class M2EUIPluginActivator extends AbstractUIPlugin {
// Create the preference store lazily.
if(preferenceStore == null) {
// InstanceScope.INSTANCE added in 3.7
- preferenceStore = new ScopedPreferenceStore(new InstanceScope(), IMavenConstants.PLUGIN_ID);
+ preferenceStore = new ScopedPreferenceStore(InstanceScope.INSTANCE, IMavenConstants.PLUGIN_ID);
}
return preferenceStore;
diff --git a/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/editing/ChangeCreator.java b/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/editing/ChangeCreator.java
index 4b473879..f1e9f727 100644
--- a/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/editing/ChangeCreator.java
+++ b/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/editing/ChangeCreator.java
@@ -141,7 +141,7 @@ public class ChangeCreator {
IRegion lineRegion;
lineRegion = document.getLineInformation(line);
String lineContents = document.get(lineRegion.getOffset(), lineRegion.getLength());
- hash = new Integer(computeDJBHash(lineContents));
+ hash = Integer.valueOf(computeDJBHash(lineContents));
hashes.set(line, hash);
}
return hash;
diff --git a/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/util/ProposalUtil.java b/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/util/ProposalUtil.java
index e8d735c8..54fa901b 100644
--- a/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/util/ProposalUtil.java
+++ b/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/util/ProposalUtil.java
@@ -29,6 +29,7 @@ import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.IWorkbenchCommandConstants;
import org.eclipse.ui.fieldassist.ContentAssistCommandAdapter;
import org.apache.lucene.queryParser.QueryParser;
@@ -113,7 +114,7 @@ public class ProposalUtil {
ContentAssistCommandAdapter adapter = new ContentAssistCommandAdapter( //
control, contentAdapter, proposalProvider, //
- ContentAssistCommandAdapter.CONTENT_PROPOSAL_COMMAND, null);
+ IWorkbenchCommandConstants.EDIT_CONTENT_ASSIST, null);
// ContentProposalAdapter adapter = new ContentProposalAdapter(control, contentAdapter, //
// proposalProvider, KeyStroke.getInstance(SWT.MOD1, ' '), null);
adapter.setProposalAcceptanceStyle(ContentProposalAdapter.PROPOSAL_REPLACE);
diff --git a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/builder/plexusbuildapi/AbstractEclipseBuildContext.java b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/builder/plexusbuildapi/AbstractEclipseBuildContext.java
index 4e85712d..4053dd84 100644
--- a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/builder/plexusbuildapi/AbstractEclipseBuildContext.java
+++ b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/builder/plexusbuildapi/AbstractEclipseBuildContext.java
@@ -94,14 +94,17 @@ public abstract class AbstractEclipseBuildContext implements BuildContext, IIncr
/**
* @deprecated Use addMessage instead
*/
+ @Deprecated
@Override
public void addError(File file, int line, int column, String message, Throwable cause) {
addMessage(file, line, column, message, BuildContext.SEVERITY_ERROR, cause);
}
/**
+ * @deprecated
* @deprecated Use addMessage instead
*/
+ @Deprecated
@Override
public void addWarning(File file, int line, int column, String message, Throwable cause) {
addMessage(file, line, column, message, BuildContext.SEVERITY_WARNING, cause);
diff --git a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/index/nexus/AetherClientResourceFetcher.java b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/index/nexus/AetherClientResourceFetcher.java
index 16a5b901..614c7587 100644
--- a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/index/nexus/AetherClientResourceFetcher.java
+++ b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/index/nexus/AetherClientResourceFetcher.java
@@ -78,6 +78,7 @@ public class AetherClientResourceFetcher extends AbstractResourceFetcher {
aetherClient.close();
}
+ @Deprecated
public void retrieve(String name, File targetFile) throws IOException, FileNotFoundException {
String url = baseUrl + "/" + name;
try (Response response = aetherClient.get(url);
diff --git a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/lifecyclemapping/AnnotationMappingMetadataSource.java b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/lifecyclemapping/AnnotationMappingMetadataSource.java
index aaf1fd23..75642a73 100644
--- a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/lifecyclemapping/AnnotationMappingMetadataSource.java
+++ b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/lifecyclemapping/AnnotationMappingMetadataSource.java
@@ -220,7 +220,7 @@ public class AnnotationMappingMetadataSource implements MappingMetadataSource {
return pis;
}
- private static final Splitter PI_SPLITTER = Splitter.on(CharMatcher.WHITESPACE).omitEmptyStrings().limit(2);
+ private static final Splitter PI_SPLITTER = Splitter.on(CharMatcher.whitespace()).omitEmptyStrings().limit(2);
private static final Splitter EXECUTE_SPLITTER = Splitter.on(',').omitEmptyStrings();
diff --git a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/project/registry/ProjectRegistryReader.java b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/project/registry/ProjectRegistryReader.java
index 50c2ac00..d764ae4b 100644
--- a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/project/registry/ProjectRegistryReader.java
+++ b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/project/registry/ProjectRegistryReader.java
@@ -23,6 +23,7 @@ import java.io.Serializable;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
+import org.osgi.framework.FrameworkUtil;
import org.osgi.framework.ServiceReference;
import org.osgi.framework.Version;
import org.osgi.service.packageadmin.PackageAdmin;
@@ -120,8 +121,6 @@ public class ProjectRegistryReader {
public void writeWorkspaceState(ProjectRegistry state) {
final ClassLoader thisClassloader = getClass().getClassLoader();
- final PackageAdmin packageAdmin = getPackageAdmin();
-
ObjectOutputStream os = null;
try {
os = new ObjectOutputStream(new BufferedOutputStream(new FileOutputStream(stateFile))) {
@@ -157,7 +156,7 @@ public class ProjectRegistryReader {
}
// foreign class
- Bundle bundle = packageAdmin.getBundle(cl);
+ Bundle bundle = FrameworkUtil.getBundle(cl);
if(bundle != null) {
writeObject(bundle.getSymbolicName());
writeObject(bundle.getVersion().toString());
diff --git a/org.eclipse.m2e.discovery/src/org/eclipse/m2e/internal/discovery/strategy/M2EConnectorDiscoveryExtensionReader.java b/org.eclipse.m2e.discovery/src/org/eclipse/m2e/internal/discovery/strategy/M2EConnectorDiscoveryExtensionReader.java
index 2a6003e3..35c00e91 100644
--- a/org.eclipse.m2e.discovery/src/org/eclipse/m2e/internal/discovery/strategy/M2EConnectorDiscoveryExtensionReader.java
+++ b/org.eclipse.m2e.discovery/src/org/eclipse/m2e/internal/discovery/strategy/M2EConnectorDiscoveryExtensionReader.java
@@ -70,7 +70,7 @@ public class M2EConnectorDiscoveryExtensionReader extends ConnectorDiscoveryExte
throws ValidationException {
T connectorDescriptor;
try {
- connectorDescriptor = clazz.newInstance();
+ connectorDescriptor = clazz.getDeclaredConstructor().newInstance();
} catch(Exception e) {
throw new IllegalStateException(e);
}
diff --git a/org.eclipse.m2e.editor.xml/src/main/java/org/eclipse/m2e/editor/xml/internal/MarkerHoverControl.java b/org.eclipse.m2e.editor.xml/src/main/java/org/eclipse/m2e/editor/xml/internal/MarkerHoverControl.java
index 37c08c9c..5fffad5e 100644
--- a/org.eclipse.m2e.editor.xml/src/main/java/org/eclipse/m2e/editor/xml/internal/MarkerHoverControl.java
+++ b/org.eclipse.m2e.editor.xml/src/main/java/org/eclipse/m2e/editor/xml/internal/MarkerHoverControl.java
@@ -524,7 +524,7 @@ public class MarkerHoverControl extends AbstractInformationControl
GridData layoutData = new GridData(SWT.BEGINNING, SWT.TOP, false, false);
String linkText;
if(isMultiFix) {
- linkText = NLS.bind(Messages.PomTextHover_category_fix, new Integer(count));
+ linkText = NLS.bind(Messages.PomTextHover_category_fix, Integer.valueOf(count));
} else {
linkText = proposal.getLabel();
}
diff --git a/org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/pom/MavenPomEditorPage.java b/org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/pom/MavenPomEditorPage.java
index e2ca6757..796e1f8a 100644
--- a/org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/pom/MavenPomEditorPage.java
+++ b/org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/pom/MavenPomEditorPage.java
@@ -302,10 +302,11 @@ public abstract class MavenPomEditorPage extends FormPage {
//if we have multiple errors
text = NLS.bind(Messages.MavenPomEditorPage_add_desc, maxText, text);
if(markers != null) {
- String number = new Integer(markers.length - 1).toString();
+ String number = Integer.toString(markers.length - 1);
head = NLS.bind(Messages.FormUtils_click_for_details2,
maxText.length() > FormUtils.MAX_MSG_LENGTH ? maxText.substring(0, FormUtils.MAX_MSG_LENGTH)
- : maxText, number);
+ : maxText,
+ number);
} else {
head = maxText;
if(head.length() > FormUtils.MAX_MSG_LENGTH) {
@@ -351,13 +352,14 @@ public abstract class MavenPomEditorPage extends FormPage {
}
- private void setErrorMessageForMarkers(final String msg, final String tip, final int severity, final IMarker[] markers) {
+ private void setErrorMessageForMarkers(final String msg, final String tip, final int severity,
+ final IMarker[] markers) {
if(getPartControl() != null && !getPartControl().isDisposed()) {
getPartControl().getDisplay().asyncExec(new Runnable() {
public void run() {
if(!getManagedForm().getForm().isDisposed()) {
- FormHoverProvider.Execute runnable = FormHoverProvider.createHoverRunnable(getManagedForm().getForm()
- .getShell(), markers, getPomEditor().getSourcePage().getTextViewer());
+ FormHoverProvider.Execute runnable = FormHoverProvider.createHoverRunnable(
+ getManagedForm().getForm().getShell(), markers, getPomEditor().getSourcePage().getTextViewer());
if(runnable != null) {
FormUtils.setMessageWithPerformer(getManagedForm().getForm(), msg, severity, runnable);
} else {
@@ -418,8 +420,8 @@ public abstract class MavenPomEditorPage extends FormPage {
if(!(control instanceof Text || control instanceof CCombo)) {
throw new IllegalArgumentException("Not a Text or CCombo");
}
- FieldDecoration fieldDecoration = FieldDecorationRegistry.getDefault().getFieldDecoration(
- FieldDecorationRegistry.DEC_INFORMATION);
+ FieldDecoration fieldDecoration = FieldDecorationRegistry.getDefault()
+ .getFieldDecoration(FieldDecorationRegistry.DEC_INFORMATION);
final ControlDecoration decoration = new ControlDecoration(control, SWT.RIGHT | SWT.TOP) {
/* (non-Javadoc)
@@ -429,8 +431,8 @@ public abstract class MavenPomEditorPage extends FormPage {
public String getDescriptionText() {
MavenProject mp = getPomEditor().getMavenProject();
if(mp != null) {
- return FormUtils.simpleInterpolate(mp, control instanceof Text ? ((Text) control).getText()
- : ((CCombo) control).getText());
+ return FormUtils.simpleInterpolate(mp,
+ control instanceof Text ? ((Text) control).getText() : ((CCombo) control).getText());
}
return "Cannot interpolate expressions, not resolvable file.";
}
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 ab0ef29d..e0a2c767 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
@@ -606,7 +606,8 @@ public abstract class AbstractJavaProjectConfigurator extends AbstractProjectCon
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);
+ 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);
diff --git a/org.eclipse.m2e.refactoring/src/org/eclipse/m2e/refactoring/ChangeCreator.java b/org.eclipse.m2e.refactoring/src/org/eclipse/m2e/refactoring/ChangeCreator.java
index 0c201555..61476c11 100644
--- a/org.eclipse.m2e.refactoring/src/org/eclipse/m2e/refactoring/ChangeCreator.java
+++ b/org.eclipse.m2e.refactoring/src/org/eclipse/m2e/refactoring/ChangeCreator.java
@@ -77,8 +77,8 @@ public class ChangeCreator {
for(int j = startLine; j <= endLine; j++ ) {
int newPos = curr.leftStart() - startLine + j;
String newText = newDocument.get(newDocument.getLineOffset(newPos), newDocument.getLineLength(newPos));
- addEdit(change, startLine, new ReplaceEdit(oldDocument.getLineOffset(j), oldDocument.getLineLength(j),
- newText));
+ addEdit(change, startLine,
+ new ReplaceEdit(oldDocument.getLineOffset(j), oldDocument.getLineLength(j), newText));
}
} else if(curr.rightLength() > 0 && curr.leftLength() == 0) {
// insert
@@ -169,7 +169,7 @@ public class ChangeCreator {
IRegion lineRegion;
lineRegion = document.getLineInformation(line);
String lineContents = document.get(lineRegion.getOffset(), lineRegion.getLength());
- hash = new Integer(computeDJBHash(lineContents));
+ hash = Integer.valueOf(computeDJBHash(lineContents));
hashes.set(line, hash);
}
return hash;

Back to the top