Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Kurtakov2018-02-07 16:42:21 +0000
committerAlexander Kurtakov2018-02-07 17:11:44 +0000
commit9f2a9d2fb6a39c9e7b82eac18746ec17de6d8148 (patch)
tree240b2d9b4857d1d8bcf87c02735b01846eb340d5 /bundles
parentd32b6ea3ad024730acd4d7d47735e773558f5e30 (diff)
downloadeclipse.platform.team-9f2a9d2fb6a39c9e7b82eac18746ec17de6d8148.tar.gz
eclipse.platform.team-9f2a9d2fb6a39c9e7b82eac18746ec17de6d8148.tar.xz
eclipse.platform.team-9f2a9d2fb6a39c9e7b82eac18746ec17de6d8148.zip
Bug 530854 - Move away of methods deprecated in Java 9
Number constructors and Class.newInstance. Some small cleanups (generification, lambdas) in surrounding code. Change-Id: I62bab4119a98a7b5df560b8c9247f79fdfa8da03 Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
Diffstat (limited to 'bundles')
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/DocLineComparator.java4
-rw-r--r--bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/ProxyManager.java4
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSHistoryPage.java4
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSPreferencesPage.java18
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/SelectionPropertyTester.java12
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/IgnoreLeadingPathSegmentsAction.java30
6 files changed, 29 insertions, 43 deletions
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/DocLineComparator.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/DocLineComparator.java
index 5b417a4ba..9bb2fadce 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/DocLineComparator.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/DocLineComparator.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2013 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 IBM Corporation 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
@@ -207,7 +207,7 @@ public class DocLineComparator implements ITokenComparator {
if (fCompareFilters != null && fCompareFilters.length > 0) {
if (fCompareFilterCache != null
&& other.fCompareFilterCache != null) {
- extracts[0] = (String) fCompareFilterCache.get(new Integer(
+ extracts[0] = (String) fCompareFilterCache.get(Integer.valueOf(
thisIndex));
if (extracts[0] == null) {
extracts[0] = Utilities.applyCompareFilters(
diff --git a/bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/ProxyManager.java b/bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/ProxyManager.java
index 234a32907..f8fd8deb5 100644
--- a/bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/ProxyManager.java
+++ b/bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/ProxyManager.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2017 IBM Corporation and others.
+ * Copyright (c) 2007, 2018 IBM Corporation 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
@@ -60,7 +60,7 @@ public class ProxyManager implements IProxyService, IPreferenceChangeListener {
private ProxyManager() {
try {
nativeProxyProvider = (AbstractProxyProvider) Class.forName(
- "org.eclipse.core.net.ProxyProvider").newInstance(); //$NON-NLS-1$
+ "org.eclipse.core.net.ProxyProvider").getDeclaredConstructor().newInstance(); //$NON-NLS-1$
} catch (ClassNotFoundException e) {
// no class found
} catch (Exception e) {
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSHistoryPage.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSHistoryPage.java
index b28aa9c58..7808d2645 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSHistoryPage.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSHistoryPage.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2012 IBM Corporation and others.
+ * Copyright (c) 2006, 2018 IBM Corporation 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
@@ -2133,7 +2133,7 @@ public class CVSHistoryPage extends HistoryPage implements IAdaptable, IHistoryC
if (historyPageSite instanceof WorkbenchHistoryPageSite){
IWorkbenchPart part = ((WorkbenchHistoryPageSite) historyPageSite).getPart();
if (part instanceof GenericHistoryView){
- String revisions = NLS.bind(CVSUIMessages.CVSHistoryPage_FilterOnMessage, new Object[]{Integer.valueOf(historyFilter.getMatchCount()),new Integer(before)});
+ String revisions = NLS.bind(CVSUIMessages.CVSHistoryPage_FilterOnMessage, new Object[]{Integer.valueOf(historyFilter.getMatchCount()),Integer.valueOf(before)});
String old = getName();
description = NLS.bind(CVSUIMessages.CVSHistoryPage_FilterDescription, new Object[]{file.getName(), revisions});
CVSHistoryPage.this.firePropertyChange(CVSHistoryPage.this, P_NAME, old, getName());
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSPreferencesPage.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSPreferencesPage.java
index 15a095d22..c428985d1 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSPreferencesPage.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSPreferencesPage.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 IBM Corporation 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
@@ -292,19 +292,17 @@ public class CVSPreferencesPage extends PreferencePage implements IWorkbenchPref
fFields= new ArrayList();
final KSubstOption[] options = KSubstOption.getAllKSubstOptions();
- final ArrayList KSUBST_MODES= new ArrayList();
+ final ArrayList<KSubstOption> KSUBST_MODES= new ArrayList<>();
for (int i = 0; i < options.length; i++) {
final KSubstOption option = options[i];
if (!option.isBinary()) {
KSUBST_MODES.add(option);
}
}
- Collections.sort(KSUBST_MODES, new Comparator() {
- public int compare(Object a, Object b) {
- final String aKey = ((KSubstOption) a).getLongDisplayText();
- final String bKey = ((KSubstOption) b).getLongDisplayText();
- return aKey.compareTo(bKey);
- }
+ Collections.sort(KSUBST_MODES, (a, b) -> {
+ final String aKey = a.getLongDisplayText();
+ final String bKey = b.getLongDisplayText();
+ return aKey.compareTo(bKey);
});
KSUBST_LABELS= new String[KSUBST_MODES.size()];
@@ -462,7 +460,7 @@ public class CVSPreferencesPage extends PreferencePage implements IWorkbenchPref
CVSUIMessages.CVSPreferencesPage_26,
IHelpContextIds.PREF_QUIET,
new String [] { CVSUIMessages.CVSPreferencesPage_27, CVSUIMessages.CVSPreferencesPage_28, CVSUIMessages.CVSPreferencesPage_29 }, //
- new Integer [] { Integer.valueOf(0), new Integer(1), new Integer(2)});
+ new Integer [] { Integer.valueOf(0), Integer.valueOf(1), Integer.valueOf(2)});
quietnessCombo.getCombo().addSelectionListener(new SelectionListener() {
public void widgetSelected(SelectionEvent e) {
@@ -531,7 +529,7 @@ public class CVSPreferencesPage extends PreferencePage implements IWorkbenchPref
CVSUIMessages.CVSPreferencesPage_41,
IHelpContextIds.PREF_SAVE_DIRTY_EDITORS,
YES_NO_PROMPT,
- new Integer [] { Integer.valueOf(ICVSUIConstants.OPTION_AUTOMATIC), new Integer(ICVSUIConstants.OPTION_NEVER), new Integer(ICVSUIConstants.OPTION_PROMPT)});
+ new Integer [] { Integer.valueOf(ICVSUIConstants.OPTION_AUTOMATIC), Integer.valueOf(ICVSUIConstants.OPTION_NEVER), Integer.valueOf(ICVSUIConstants.OPTION_PROMPT)});
new StringRadioButtons(
composite,
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/SelectionPropertyTester.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/SelectionPropertyTester.java
index 2b97b5f52..e85c9e011 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/SelectionPropertyTester.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/SelectionPropertyTester.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 IBM Corporation 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
@@ -29,12 +29,6 @@ public class SelectionPropertyTester extends PropertyTester {
// TODO Auto-generated constructor stub
}
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.core.expressions.IPropertyTester#test(java.lang.Object,
- * java.lang.String, java.lang.Object[], java.lang.Object)
- */
public boolean test(Object receiver, String property, Object[] args,
Object expectedValue) {
@@ -62,8 +56,8 @@ public class SelectionPropertyTester extends PropertyTester {
Object invoke;
try {
- Class clazz = Class.forName((String) args[0]);
- Object instance = clazz.newInstance();
+ Class<?> clazz = Class.forName((String) args[0]);
+ Object instance = clazz.getDeclaredConstructor().newInstance();
// Field fld = clazz.getDeclaredField(SELECTION_FIELDNAME);
// fld.set(instance, (ISelection) receiver);
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/IgnoreLeadingPathSegmentsAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/IgnoreLeadingPathSegmentsAction.java
index f1865ad4e..56e749652 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/IgnoreLeadingPathSegmentsAction.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/IgnoreLeadingPathSegmentsAction.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010 IBM Corporation and others.
+ * Copyright (c) 2010, 2018 IBM Corporation 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
@@ -11,7 +11,6 @@
package org.eclipse.team.internal.ui.mapping;
import org.eclipse.jface.action.Action;
-import org.eclipse.jface.dialogs.IInputValidator;
import org.eclipse.jface.dialogs.InputDialog;
import org.eclipse.jface.window.Window;
import org.eclipse.osgi.util.NLS;
@@ -49,23 +48,18 @@ public class IgnoreLeadingPathSegmentsAction extends Action {
int oldValue = subscriber.getPatcher().getStripPrefixSegments();
maxValue = subscriber.getPatcher().calculatePrefixSegmentCount() - 1;
- InputDialog dlg = new InputDialog(
- Display.getCurrent().getActiveShell(),
- TeamUIMessages.IgnoreLeadingPathSegmentsDialog_title, NLS.bind(
- TeamUIMessages.IgnoreLeadingPathSegmentsDialog_message,
- Integer.valueOf(maxValue)), new Integer(oldValue)
- .toString(), new IInputValidator() {
- @Override
- public String isValid(String input) {
- try {
- int i = Integer.parseInt(input);
- if (i < 0 || i > maxValue)
- return TeamUIMessages.IgnoreLeadingPathSegmentsDialog_numberOutOfRange;
- } catch (NumberFormatException x) {
- return TeamUIMessages.IgnoreLeadingPathSegmentsDialog_notANumber;
- }
- return null;
+ InputDialog dlg = new InputDialog(Display.getCurrent().getActiveShell(),
+ TeamUIMessages.IgnoreLeadingPathSegmentsDialog_title,
+ NLS.bind(TeamUIMessages.IgnoreLeadingPathSegmentsDialog_message, Integer.valueOf(maxValue)),
+ Integer.valueOf(oldValue).toString(), input -> {
+ try {
+ int i = Integer.parseInt(input);
+ if (i < 0 || i > maxValue)
+ return TeamUIMessages.IgnoreLeadingPathSegmentsDialog_numberOutOfRange;
+ } catch (NumberFormatException x) {
+ return TeamUIMessages.IgnoreLeadingPathSegmentsDialog_notANumber;
}
+ return null;
});
if (dlg.open() == Window.OK) {

Back to the top