Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Kurtakov2017-10-09 06:34:38 +0000
committerAlexander Kurtakov2017-10-09 06:34:38 +0000
commita64ad46b0c7bd1d48664b01abc05fe16156a0a85 (patch)
tree8c7c7902e03e7043289948ffec2a6281b2ad540e /bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/internal
parentc57f0da20d8de7f1e8d1cbb211ce476a516b3b71 (diff)
downloadrt.equinox.p2-a64ad46b0c7bd1d48664b01abc05fe16156a0a85.tar.gz
rt.equinox.p2-a64ad46b0c7bd1d48664b01abc05fe16156a0a85.tar.xz
rt.equinox.p2-a64ad46b0c7bd1d48664b01abc05fe16156a0a85.zip
Bug 525733 - Move operations bundle to Java 8
* Bump BREE. * Bump minor version. * Enable warnings for newer versions. * Lambda conversion. * Rename parameters to not collide with parent variables. * Remove redundant type arguments Change-Id: I5d022021db56baa19b5b7185bd679170159f6de9 Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
Diffstat (limited to 'bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/internal')
-rw-r--r--bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/internal/p2/operations/Activator.java4
-rw-r--r--bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/internal/p2/operations/PlannerResolutionJob.java4
-rw-r--r--bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/internal/p2/operations/RemediationResolutionJob.java3
-rw-r--r--bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/internal/p2/operations/RequestFlexer.java32
-rw-r--r--bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/internal/p2/operations/ResolutionResult.java4
-rw-r--r--bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/internal/p2/operations/SearchForUpdatesResolutionJob.java4
6 files changed, 29 insertions, 22 deletions
diff --git a/bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/internal/p2/operations/Activator.java b/bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/internal/p2/operations/Activator.java
index 8d5a2fc02..ff230a21f 100644
--- a/bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/internal/p2/operations/Activator.java
+++ b/bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/internal/p2/operations/Activator.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 IBM Corporation and others.
+ * Copyright (c) 2007, 2017 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
@@ -24,10 +24,12 @@ public class Activator implements BundleActivator {
return context;
}
+ @Override
public void start(BundleContext bundleContext) throws Exception {
Activator.context = bundleContext;
}
+ @Override
public void stop(BundleContext bundleContext) throws Exception {
Activator.context = null;
}
diff --git a/bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/internal/p2/operations/PlannerResolutionJob.java b/bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/internal/p2/operations/PlannerResolutionJob.java
index 78264ab90..f8931b17e 100644
--- a/bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/internal/p2/operations/PlannerResolutionJob.java
+++ b/bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/internal/p2/operations/PlannerResolutionJob.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 IBM Corporation and others.
+ * Copyright (c) 2007, 2017 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
@@ -65,6 +65,7 @@ public class PlannerResolutionJob extends ProvisioningJob implements IProfileCha
this.firstPass = firstPass;
}
+ @Override
public IStatus runModal(IProgressMonitor monitor) {
SubMonitor sub;
if (evaluator != null) {
@@ -117,6 +118,7 @@ public class PlannerResolutionJob extends ProvisioningJob implements IProfileCha
return report;
}
+ @Override
public String getProfileId() {
return profileId;
}
diff --git a/bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/internal/p2/operations/RemediationResolutionJob.java b/bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/internal/p2/operations/RemediationResolutionJob.java
index 1c10d322f..528591415 100644
--- a/bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/internal/p2/operations/RemediationResolutionJob.java
+++ b/bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/internal/p2/operations/RemediationResolutionJob.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010 IBM Corporation and others.
+ * Copyright (c) 2010, 2017 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
@@ -31,6 +31,7 @@ public class RemediationResolutionJob extends PlannerResolutionJob {
this.requestHolder = requestFromOperation;
}
+ @Override
public IStatus runModal(IProgressMonitor monitor) {
SubMonitor sub = SubMonitor.convert(monitor, 2);
try {
diff --git a/bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/internal/p2/operations/RequestFlexer.java b/bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/internal/p2/operations/RequestFlexer.java
index cb1a3ca70..e071acc21 100644
--- a/bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/internal/p2/operations/RequestFlexer.java
+++ b/bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/internal/p2/operations/RequestFlexer.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2013 Red Hat, Inc. and others
+ * Copyright (c) 2013, 2017 Red Hat, 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
@@ -41,10 +41,10 @@ public class RequestFlexer {
private ProvisioningContext provisioningContext;
- Set<IRequirement> requirementsForElementsBeingInstalled = new HashSet<IRequirement>();
- Set<IRequirement> requirementsForElementsAlreadyInstalled = new HashSet<IRequirement>();
- Map<IRequirement, Map<String, String>> propertiesPerRequirement = new HashMap<IRequirement, Map<String, String>>();
- Map<IRequirement, List<String>> removedPropertiesPerRequirement = new HashMap<IRequirement, List<String>>();
+ Set<IRequirement> requirementsForElementsBeingInstalled = new HashSet<>();
+ Set<IRequirement> requirementsForElementsAlreadyInstalled = new HashSet<>();
+ Map<IRequirement, Map<String, String>> propertiesPerRequirement = new HashMap<>();
+ Map<IRequirement, List<String>> removedPropertiesPerRequirement = new HashMap<>();
IProfile profile;
@@ -137,8 +137,8 @@ public class RequestFlexer {
private IProfileChangeRequest computeEffectiveChangeRequest(IProvisioningPlan intermediaryPlan, IProfileChangeRequest loosenedRequest, IProfileChangeRequest originalRequest) {
IProfileChangeRequest finalChangeRequest = planner.createChangeRequest(profile);
// We have the following two variables because a IPCRequest can not be muted
- Set<IInstallableUnit> iusToAdd = new HashSet<IInstallableUnit>();
- Set<IInstallableUnit> iusToRemove = new HashSet<IInstallableUnit>();
+ Set<IInstallableUnit> iusToAdd = new HashSet<>();
+ Set<IInstallableUnit> iusToRemove = new HashSet<>();
for (IRequirement beingInstalled : requirementsForElementsBeingInstalled) {
IQuery<IInstallableUnit> query = QueryUtil.createMatchQuery(beingInstalled.getMatches());
@@ -176,7 +176,7 @@ public class RequestFlexer {
iusToRemove.addAll(originalRequest.getRemovals());
//Remove entries that are both in the additions and removals (since this is a no-op)
- HashSet<IInstallableUnit> commons = new HashSet<IInstallableUnit>(iusToAdd);
+ HashSet<IInstallableUnit> commons = new HashSet<>(iusToAdd);
if (commons.retainAll(iusToRemove)) {
iusToAdd.removeAll(commons);
iusToRemove.removeAll(commons);
@@ -248,11 +248,11 @@ public class RequestFlexer {
SubMonitor subMonitor = SubMonitor.convert(monitor, requestedAdditions.size());
for (IInstallableUnit addedIU : requestedAdditions) {
SubMonitor iterationMonitor = subMonitor.split(1);
- Collection<IInstallableUnit> potentialUpdates = allowDifferentVersion ? findAllVersionsAvailable(addedIU, iterationMonitor) : new ArrayList<IInstallableUnit>();
+ Collection<IInstallableUnit> potentialUpdates = allowDifferentVersion ? findAllVersionsAvailable(addedIU, iterationMonitor) : new ArrayList<>();
foundDifferentVersionsForElementsToInstall = (foundDifferentVersionsForElementsToInstall || (potentialUpdates.size() == 0 ? false : true));
potentialUpdates.add(addedIU); //Make sure that we include the IU that we were initially trying to install
- Collection<IRequirement> newRequirement = new ArrayList<IRequirement>(1);
+ Collection<IRequirement> newRequirement = new ArrayList<>(1);
IRequirement req = createORRequirement(potentialUpdates, allowPartialInstall || isRequestedInstallationOptional(addedIU, originalRequest));
newRequirement.add(req);
newRequest.addExtraRequirements(newRequirement);
@@ -271,9 +271,9 @@ public class RequestFlexer {
//This keeps track for each requirement created (those created to loosen the constraint), of the original IU and the properties associated with it in the profile
//This is used for more easily construct the final profile change request
private void rememberIUProfileProperties(IInstallableUnit iu, IRequirement req, IProfileChangeRequest originalRequest, boolean includeProfile) {
- Map<String, String> allProperties = new HashMap<String, String>();
+ Map<String, String> allProperties = new HashMap<>();
if (includeProfile) {
- Map<String, String> tmp = new HashMap<String, String>(profile.getInstallableUnitProperties(iu));
+ Map<String, String> tmp = new HashMap<>(profile.getInstallableUnitProperties(iu));
List<String> propertiesToRemove = ((ProfileChangeRequest) originalRequest).getInstallableUnitProfilePropertiesToRemove().get(iu);
if (propertiesToRemove != null) {
for (String toRemove : propertiesToRemove) {
@@ -302,7 +302,7 @@ public class RequestFlexer {
}
private Collection<IInstallableUnit> findAllVersionsAvailable(IInstallableUnit iu, IProgressMonitor monitor) {
- Collection<IInstallableUnit> allVersions = new HashSet<IInstallableUnit>();
+ Collection<IInstallableUnit> allVersions = new HashSet<>();
SubMonitor sub = SubMonitor.convert(monitor, 2);
allVersions.addAll(findIUsWithSameId(iu, sub.newChild(1)));
allVersions.addAll(findUpdates(iu, sub.newChild(1)));
@@ -317,7 +317,7 @@ public class RequestFlexer {
private Collection<IInstallableUnit> findUpdates(IInstallableUnit iu, IProgressMonitor monitor) {
SubMonitor subMonitor = SubMonitor.convert(monitor, 1);
- Collection<IInstallableUnit> availableUpdates = new HashSet<IInstallableUnit>();
+ Collection<IInstallableUnit> availableUpdates = new HashSet<>();
IQueryResult<IInstallableUnit> updatesAvailable = planner.updatesFor(iu, provisioningContext, subMonitor.split(1));
for (Iterator<IInstallableUnit> iterator = updatesAvailable.iterator(); iterator.hasNext();) {
availableUpdates.add(iterator.next());
@@ -350,10 +350,10 @@ public class RequestFlexer {
Set<IInstallableUnit> allRoots = getRoots();
for (IInstallableUnit existingIU : allRoots) {
- Collection<IInstallableUnit> potentialUpdates = allowInstalledUpdate ? findUpdates(existingIU, monitor) : new HashSet<IInstallableUnit>();
+ Collection<IInstallableUnit> potentialUpdates = allowInstalledUpdate ? findUpdates(existingIU, monitor) : new HashSet<>();
foundDifferentVersionsForElementsInstalled = (foundDifferentVersionsForElementsInstalled || (potentialUpdates.size() == 0 ? false : true));
potentialUpdates.add(existingIU);
- Collection<IRequirement> newRequirement = new ArrayList<IRequirement>(1);
+ Collection<IRequirement> newRequirement = new ArrayList<>(1);
//when the element is requested for removal or is installed optionally we make sure to mark it optional, otherwise the removal woudl fail
IRequirement req = createORRequirement(potentialUpdates, allowInstalledRemoval || removalRequested(existingIU, originalRequest) || isOptionallyInstalled(existingIU, originalRequest));
newRequirement.add(req);
diff --git a/bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/internal/p2/operations/ResolutionResult.java b/bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/internal/p2/operations/ResolutionResult.java
index 16d360cf2..5254edc6c 100644
--- a/bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/internal/p2/operations/ResolutionResult.java
+++ b/bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/internal/p2/operations/ResolutionResult.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2010 IBM Corporation and others.
+ * Copyright (c) 2009, 2017 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
@@ -24,7 +24,7 @@ import org.eclipse.equinox.p2.metadata.IInstallableUnit;
public class ResolutionResult {
private static final String NESTING_INDENT = " "; //$NON-NLS-1$
- private final HashMap<IInstallableUnit, MultiStatus> iuToStatusMap = new HashMap<IInstallableUnit, MultiStatus>();
+ private final HashMap<IInstallableUnit, MultiStatus> iuToStatusMap = new HashMap<>();
private MultiStatus summaryStatus;
public IStatus getSummaryStatus() {
diff --git a/bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/internal/p2/operations/SearchForUpdatesResolutionJob.java b/bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/internal/p2/operations/SearchForUpdatesResolutionJob.java
index 5fcd8f152..fe359bd20 100644
--- a/bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/internal/p2/operations/SearchForUpdatesResolutionJob.java
+++ b/bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/internal/p2/operations/SearchForUpdatesResolutionJob.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010 IBM Corporation and others.
+ * Copyright (c) 2010, 2017 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
@@ -31,6 +31,7 @@ public class SearchForUpdatesResolutionJob extends PlannerResolutionJob {
this.operation = operation;
}
+ @Override
public IStatus runModal(IProgressMonitor monitor) {
SubMonitor sub = SubMonitor.convert(monitor);
try {
@@ -48,6 +49,7 @@ public class SearchForUpdatesResolutionJob extends PlannerResolutionJob {
}
// This is made public for the automated tests
+ @Override
public ProfileChangeRequest getProfileChangeRequest() {
return request;
}

Back to the top