diff options
60 files changed, 387 insertions, 210 deletions
diff --git a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/RawMirrorRequest.java b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/RawMirrorRequest.java index cfe61e2dc..e8424d875 100644 --- a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/RawMirrorRequest.java +++ b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/RawMirrorRequest.java @@ -84,7 +84,7 @@ public class RawMirrorRequest extends MirrorRequest { protected IStatus getArtifact(IArtifactDescriptor artifactDescriptor, OutputStream destination, IProgressMonitor monitor) { if (SimpleArtifactRepository.CHECKSUMS_ENABLED) { - Collection<ProcessingStep> steps = ChecksumUtilities.getChecksumVerifiers(artifactDescriptor, IArtifactDescriptor.DOWNLOAD_CHECKSUM, Collections.<String> emptySet()); + Collection<ProcessingStep> steps = ChecksumUtilities.getChecksumVerifiers(artifactDescriptor, IArtifactDescriptor.DOWNLOAD_CHECKSUM, Collections.emptySet()); ProcessingStep[] stepArray = steps.toArray(new ProcessingStep[steps.size()]); // TODO should probably be using createAndLink here ProcessingStepHandler handler = new ProcessingStepHandler(); diff --git a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/simple/KeyIndex.java b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/simple/KeyIndex.java index c04fed648..6f6add9b2 100644 --- a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/simple/KeyIndex.java +++ b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/simple/KeyIndex.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010, 2017 Cloudsmith Inc. and others. + * Copyright (c) 2010, 2018 Cloudsmith 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 @@ -70,11 +70,11 @@ public class KeyIndex extends Index<IArtifactKey> { } } if (collector == null) - collector = Collections.<IArtifactKey> emptySet(); + collector = Collections.emptySet(); } else { Object v = artifactMap.get(queriedKeys); if (v == null) - collector = Collections.<IArtifactKey> emptySet(); + collector = Collections.emptySet(); else if (v instanceof IArtifactKey) collector = Collections.singleton((IArtifactKey) v); else diff --git a/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/internal/p2/core/helpers/CollectionUtils.java b/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/internal/p2/core/helpers/CollectionUtils.java index 017d4d5de..bfb44ef4f 100644 --- a/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/internal/p2/core/helpers/CollectionUtils.java +++ b/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/internal/p2/core/helpers/CollectionUtils.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009, 2017 Cloudsmith Inc. and others. + * Copyright (c) 2009, 2018 Cloudsmith 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 @@ -191,7 +191,7 @@ public class CollectionUtils { * @return The unmodifiable list */ public static <T> List<T> unmodifiableList(T[] array) { - return array == null || array.length == 0 ? Collections.<T> emptyList() : new UnmodifiableArrayList<>(array); + return array == null || array.length == 0 ? Collections.emptyList() : new UnmodifiableArrayList<>(array); } /** @@ -214,7 +214,7 @@ public class CollectionUtils { */ public static Map<String, String> toMap(Properties properties) { if (properties == null || properties.isEmpty()) - return Collections.<String, String> emptyMap(); + return Collections.emptyMap(); Map<String, String> props = new HashMap<>(properties.size()); putAll(properties, props); diff --git a/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/internal/p2/core/helpers/OrderedProperties.java b/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/internal/p2/core/helpers/OrderedProperties.java index 6f5a020e2..f41cc5ce5 100644 --- a/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/internal/p2/core/helpers/OrderedProperties.java +++ b/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/internal/p2/core/helpers/OrderedProperties.java @@ -106,7 +106,7 @@ public class OrderedProperties extends Dictionary<String, String> implements Map @Override public Set<Map.Entry<String, String>> entrySet() { - return propertyMap != null ? propertyMap.entrySet() : Collections.<Map.Entry<String, String>> emptySet(); + return propertyMap != null ? propertyMap.entrySet() : Collections.emptySet(); } @Override @@ -116,7 +116,7 @@ public class OrderedProperties extends Dictionary<String, String> implements Map @Override public Set<String> keySet() { - return propertyMap != null ? propertyMap.keySet() : Collections.<String> emptySet(); + return propertyMap != null ? propertyMap.keySet() : Collections.emptySet(); } @Override @@ -132,7 +132,7 @@ public class OrderedProperties extends Dictionary<String, String> implements Map @Override public Collection<String> values() { - return propertyMap != null ? propertyMap.values() : Collections.<String> emptyList(); + return propertyMap != null ? propertyMap.values() : Collections.emptyList(); } @Override diff --git a/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/OptimizationFunction.java b/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/OptimizationFunction.java index 7a425bce8..a439c0d8d 100644 --- a/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/OptimizationFunction.java +++ b/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/OptimizationFunction.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2013, 2017 Rapicorp Inc. and others. + * Copyright (c) 2013, 2018 Rapicorp 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 @@ -43,11 +43,11 @@ public class OptimizationFunction { Set<IInstallableUnit> transitiveClosure; //The transitive closure of the IUs we are adding (this also means updating) if (newRoots.isEmpty()) { - transitiveClosure = Collections.<IInstallableUnit> emptySet(); + transitiveClosure = Collections.emptySet(); } else { IQueryable<IInstallableUnit> queryable = new Slicer(picker, selectionContext, false).slice(newRoots.toArray(new IInstallableUnit[newRoots.size()]), new NullProgressMonitor()); if (queryable == null) { - transitiveClosure = Collections.<IInstallableUnit> emptySet(); + transitiveClosure = Collections.emptySet(); } else { transitiveClosure = queryable.query(QueryUtil.ALL_UNITS, new NullProgressMonitor()).toSet(); } diff --git a/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/ProfileChangeRequest.java b/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/ProfileChangeRequest.java index 31e62a98e..5fb9b4a4b 100644 --- a/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/ProfileChangeRequest.java +++ b/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/ProfileChangeRequest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008, 2017 IBM Corporation and others. + * Copyright (c) 2008, 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 @@ -153,14 +153,14 @@ public class ProfileChangeRequest implements Cloneable, IProfileChangeRequest { @Override public Collection<IInstallableUnit> getRemovals() { if (iusToRemove == null) - return Collections.<IInstallableUnit> emptyList(); + return Collections.emptyList(); return Collections.unmodifiableList(iusToRemove); } @Override public Collection<IInstallableUnit> getAdditions() { if (iusToAdd == null) - return Collections.<IInstallableUnit> emptyList(); + return Collections.emptyList(); return Collections.unmodifiableList(iusToAdd); } @@ -174,14 +174,14 @@ public class ProfileChangeRequest implements Cloneable, IProfileChangeRequest { // map of key value pairs public Map<String, String> getPropertiesToAdd() { if (propertiesToAdd == null) - return Collections.<String, String> emptyMap(); + return Collections.emptyMap(); return propertiesToAdd; } // map of iu->list of property keys to be removed for an iu public Map<IInstallableUnit, List<String>> getInstallableUnitProfilePropertiesToRemove() { if (iuPropertiesToRemove == null) - return Collections.<IInstallableUnit, List<String>> emptyMap(); + return Collections.emptyMap(); return iuPropertiesToRemove; } @@ -189,7 +189,7 @@ public class ProfileChangeRequest implements Cloneable, IProfileChangeRequest { // map iu->map of key->value pairs for properties to be added for an iu public Map<IInstallableUnit, Map<String, String>> getInstallableUnitProfilePropertiesToAdd() { if (iuPropertiesToAdd == null) - return Collections.<IInstallableUnit, Map<String, String>> emptyMap(); + return Collections.emptyMap(); return iuPropertiesToAdd; } diff --git a/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/Projector.java b/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/Projector.java index 914c06d0a..937a1d615 100644 --- a/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/Projector.java +++ b/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/Projector.java @@ -1,5 +1,6 @@ /******************************************************************************* - * Copyright (c) 2007, 2017 IBM Corporation and others. All rights reserved. This + * 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 http://www.eclipse.org/legal/epl-v10.html @@ -150,7 +151,7 @@ public class Projector { } finally { //must never have a null result, because caller is waiting on result to be non-null if (explanation == null) - explanation = Collections.<Explanation> emptySet(); + explanation = Collections.emptySet(); } synchronized (this) { ExplanationJob.this.notify(); @@ -815,7 +816,7 @@ public class Projector { IRequirement req = patch.getLifeCycle(); if (req == null) return; - expandRequirement(req, iu, Collections.<AbstractVariable> emptyList(), isRootIu); + expandRequirement(req, iu, Collections.emptyList(), isRootIu); } private void missingRequirement(IInstallableUnit iu, IRequirement req) throws ContradictionException { diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/InstallableUnitPhase.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/InstallableUnitPhase.java index da6846d26..0c80ca454 100644 --- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/InstallableUnitPhase.java +++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/InstallableUnitPhase.java @@ -113,7 +113,7 @@ public abstract class InstallableUnitPhase extends Phase { Collection<ITouchpointData> data = unit.getTouchpointData(); int dataSize = data.size(); if (dataSize == 0) - return Collections.<ITouchpointInstruction> emptyList(); + return Collections.emptyList(); ArrayList<ITouchpointInstruction> matches = new ArrayList<>(dataSize); for (ITouchpointData td : data) { diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/InstructionParser.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/InstructionParser.java index 5aae66b40..33c62d22f 100644 --- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/InstructionParser.java +++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/InstructionParser.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2005, 2017 IBM Corporation and others. + * Copyright (c) 2005, 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 @@ -49,7 +49,7 @@ public class InstructionParser { private Map<String, ActionEntry> parseImportAttribute(String importAttribute) { if (importAttribute == null) - return Collections.<String, ActionEntry> emptyMap(); + return Collections.emptyMap(); Map<String, ActionEntry> result = new HashMap<>(); StringTokenizer tokenizer = new StringTokenizer(importAttribute, ","); //$NON-NLS-1$ @@ -82,7 +82,7 @@ public class InstructionParser { String nameValuePairs = statement.substring(openBracket + 1, closeBracket); if (nameValuePairs.length() == 0) - return new ParameterizedProvisioningAction(action, Collections.<String, String> emptyMap(), statement); + return new ParameterizedProvisioningAction(action, Collections.emptyMap(), statement); StringTokenizer tokenizer = new StringTokenizer(nameValuePairs, ","); //$NON-NLS-1$ Map<String, String> parameters = new HashMap<>(); diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/Profile.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/Profile.java index c477a8493..1220578ad 100644 --- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/Profile.java +++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/Profile.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2017 IBM Corporation and others. All rights reserved. This + * 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 http://www.eclipse.org/legal/epl-v10.html @@ -135,7 +135,7 @@ public class Profile extends IndexProvider<IInstallableUnit> implements IProfile public List<String> getSubProfileIds() { if (subProfileIds == null) - return Collections.<String> emptyList(); + return Collections.emptyList(); return Collections.unmodifiableList(subProfileIds); } diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/SurrogateProfileHandler.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/SurrogateProfileHandler.java index 85708904f..f0ce7d0c0 100644 --- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/SurrogateProfileHandler.java +++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/SurrogateProfileHandler.java @@ -85,7 +85,7 @@ public class SurrogateProfileHandler implements ISurrogateProfileHandler { IQueryResult<IInstallableUnit> allIUs = sharedProfile.query(QueryUtil.createIUAnyQuery(), null); for (Iterator<IInstallableUnit> iterator = allIUs.iterator(); iterator.hasNext();) { IInstallableUnit iu = iterator.next(); - IMatchExpression<IInstallableUnit> iuMatcher = ExpressionUtil.getFactory().<IInstallableUnit> matchExpression(ExpressionUtil.parse("id == $0 && version == $1"), iu.getId(), iu.getVersion()); //$NON-NLS-1$ + IMatchExpression<IInstallableUnit> iuMatcher = ExpressionUtil.getFactory().matchExpression(ExpressionUtil.parse("id == $0 && version == $1"), iu.getId(), iu.getVersion()); //$NON-NLS-1$ iuRequirements.add(MetadataFactory.createRequirement(iuMatcher, null, 0, 1, true)); } iuDescription.addRequirements(iuRequirements); diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/Property.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/Property.java index 2fb4d8d7b..a49f52b81 100644 --- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/Property.java +++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/Property.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008, 2017 IBM Corporation and others. + * Copyright (c) 2008, 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 @@ -147,15 +147,15 @@ public class Property extends Phase { @Override protected List<ProvisioningAction> getActions(Operand operand) { if (operand instanceof PropertyOperand) - return Collections.<ProvisioningAction> singletonList(new ProfilePropertyAction()); + return Collections.singletonList(new ProfilePropertyAction()); if (operand instanceof InstallableUnitOperand) { InstallableUnitOperand iuOperand = (InstallableUnitOperand) operand; if (iuOperand.first() != null) { if (iuOperand.second() != null) { - return Collections.<ProvisioningAction> singletonList(new UpdateInstallableUnitProfilePropertiesAction()); + return Collections.singletonList(new UpdateInstallableUnitProfilePropertiesAction()); } - return Collections.<ProvisioningAction> singletonList(new RemoveInstallableUnitProfilePropertiesAction()); + return Collections.singletonList(new RemoveInstallableUnitProfilePropertiesAction()); } } return null; diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/p2/engine/query/IUProfilePropertyQuery.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/p2/engine/query/IUProfilePropertyQuery.java index 2dac78352..ffd372115 100644 --- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/p2/engine/query/IUProfilePropertyQuery.java +++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/p2/engine/query/IUProfilePropertyQuery.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2010 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 @@ -32,7 +32,7 @@ public class IUProfilePropertyQuery extends ExpressionMatchQuery<IInstallableUni private static IMatchExpression<IInstallableUnit> createMatch(String propertyName, String propertyValue) { IExpressionFactory factory = ExpressionUtil.getFactory(); - return ANY.equals(propertyValue) ? factory.<IInstallableUnit> matchExpression(matchAny, propertyName) : factory.<IInstallableUnit> matchExpression(matchValue, propertyName, propertyValue); + return ANY.equals(propertyValue) ? factory.matchExpression(matchAny, propertyName) : factory.<IInstallableUnit> matchExpression(matchValue, propertyName, propertyValue); } /** diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/p2/engine/spi/Memento.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/p2/engine/spi/Memento.java index cb57866f9..110296986 100644 --- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/p2/engine/spi/Memento.java +++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/p2/engine/spi/Memento.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 @@ -16,9 +16,9 @@ import java.util.*; * @since 2.0 */ public final class Memento { - private static final Collection<Class<?>> simples = Arrays.<Class<?>> asList(String.class, Integer.class, Long.class, Float.class, Double.class, Byte.class, Short.class, Character.class, Boolean.class); - private static final Collection<Class<?>> simpleArrays = Arrays.<Class<?>> asList(String[].class, Integer[].class, Long[].class, Float[].class, Double[].class, Byte[].class, Short[].class, Character[].class, Boolean[].class); - private static final Collection<Class<?>> primitiveArrays = Arrays.<Class<?>> asList(long[].class, int[].class, short[].class, char[].class, byte[].class, double[].class, float[].class, boolean[].class); + private static final Collection<Class<?>> simples = Arrays.asList(String.class, Integer.class, Long.class, Float.class, Double.class, Byte.class, Short.class, Character.class, Boolean.class); + private static final Collection<Class<?>> simpleArrays = Arrays.asList(String[].class, Integer[].class, Long[].class, Float[].class, Double[].class, Byte[].class, Short[].class, Character[].class, Boolean[].class); + private static final Collection<Class<?>> primitiveArrays = Arrays.asList(long[].class, int[].class, short[].class, char[].class, byte[].class, double[].class, float[].class, boolean[].class); Map<String, Object> mementoMap = new HashMap<>(); diff --git a/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/LocalMetadataRepository.java b/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/LocalMetadataRepository.java index 22a4dab6a..d859c764f 100644 --- a/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/LocalMetadataRepository.java +++ b/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/LocalMetadataRepository.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 @@ -187,7 +187,7 @@ public class LocalMetadataRepository extends AbstractMetadataRepository implemen private synchronized List<IRepositoryReference> createRepositoriesSnapshot() { if (repositories.isEmpty()) - return Collections.<IRepositoryReference> emptyList(); + return Collections.emptyList(); return new ArrayList<>(repositories); } diff --git a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/IUMap.java b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/IUMap.java index f3971163f..201061fae 100644 --- a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/IUMap.java +++ b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/IUMap.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009, 2017 IBM Corporation and others. + * Copyright (c) 2009, 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,13 +11,22 @@ *******************************************************************************/ package org.eclipse.equinox.internal.p2.metadata; -import java.util.*; +import java.util.Collection; +import java.util.Collections; +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; import java.util.Map.Entry; +import java.util.NoSuchElementException; import org.eclipse.equinox.internal.p2.core.helpers.CollectionUtils; import org.eclipse.equinox.p2.core.IPool; import org.eclipse.equinox.p2.metadata.IInstallableUnit; import org.eclipse.equinox.p2.metadata.Version; -import org.eclipse.equinox.p2.query.*; +import org.eclipse.equinox.p2.query.CollectionResult; +import org.eclipse.equinox.p2.query.Collector; +import org.eclipse.equinox.p2.query.IQuery; +import org.eclipse.equinox.p2.query.IQueryResult; +import org.eclipse.equinox.p2.query.QueryUtil; /** * A map that stores {@link IInstallableUnit} instances in a way that is efficient to query @@ -165,8 +174,8 @@ public class IUMap implements Cloneable { public Collection<IInstallableUnit> getUnits(String id) { Object bucket = units.get(id); if (bucket == null) - return Collections.<IInstallableUnit> emptyList(); - return bucket.getClass().isArray() ? CollectionUtils.unmodifiableList((IInstallableUnit[]) bucket) : Collections.<IInstallableUnit> singletonList((IInstallableUnit) bucket); + return Collections.emptyList(); + return bucket.getClass().isArray() ? CollectionUtils.unmodifiableList((IInstallableUnit[]) bucket) : Collections.singletonList((IInstallableUnit) bucket); } public IQueryResult<IInstallableUnit> get(String id) { diff --git a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/InstallableUnit.java b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/InstallableUnit.java index 1c8c43483..5f0587ccc 100644 --- a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/InstallableUnit.java +++ b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/InstallableUnit.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 @@ -11,11 +11,30 @@ *******************************************************************************/ package org.eclipse.equinox.internal.p2.metadata; -import java.util.*; +import java.util.Collection; +import java.util.Collections; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; import org.eclipse.equinox.internal.p2.core.helpers.CollectionUtils; import org.eclipse.equinox.internal.p2.core.helpers.OrderedProperties; -import org.eclipse.equinox.p2.metadata.*; -import org.eclipse.equinox.p2.metadata.expression.*; +import org.eclipse.equinox.p2.metadata.IArtifactKey; +import org.eclipse.equinox.p2.metadata.ICopyright; +import org.eclipse.equinox.p2.metadata.IInstallableUnit; +import org.eclipse.equinox.p2.metadata.IInstallableUnitFragment; +import org.eclipse.equinox.p2.metadata.ILicense; +import org.eclipse.equinox.p2.metadata.IProvidedCapability; +import org.eclipse.equinox.p2.metadata.IRequirement; +import org.eclipse.equinox.p2.metadata.ITouchpointData; +import org.eclipse.equinox.p2.metadata.ITouchpointType; +import org.eclipse.equinox.p2.metadata.IUpdateDescriptor; +import org.eclipse.equinox.p2.metadata.Version; +import org.eclipse.equinox.p2.metadata.expression.ExpressionUtil; +import org.eclipse.equinox.p2.metadata.expression.IExpression; +import org.eclipse.equinox.p2.metadata.expression.IExpressionFactory; +import org.eclipse.equinox.p2.metadata.expression.IFilterExpression; +import org.eclipse.equinox.p2.metadata.expression.IMatchExpression; +import org.eclipse.equinox.p2.metadata.expression.IMemberProvider; public class InstallableUnit implements IInstallableUnit, IMemberProvider { @SuppressWarnings("serial") @@ -137,7 +156,7 @@ public class InstallableUnit implements IInstallableUnit, IMemberProvider { @Override public Collection<IInstallableUnitFragment> getFragments() { - return Collections.<IInstallableUnitFragment> emptyList(); + return Collections.emptyList(); } @Override @@ -261,7 +280,7 @@ public class InstallableUnit implements IInstallableUnit, IMemberProvider { if (matchExpr != null) return matchExpr; - matchExpr = ExpressionUtil.getFactory().<IInstallableUnit> matchExpression(filterWrap, filter); + matchExpr = ExpressionUtil.getFactory().matchExpression(filterWrap, filter); filterCache.put(filter, matchExpr); return matchExpr; } diff --git a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/OmniVersion.java b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/OmniVersion.java index 410fdb3de..04990effe 100644 --- a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/OmniVersion.java +++ b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/OmniVersion.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009, 2017 Cloudsmith Inc. and others. + * Copyright (c) 2009, 2018 Cloudsmith 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 @@ -70,13 +70,13 @@ public class OmniVersion extends BasicVersion { public static Version createMinVersion() { if (minimumVersion == null) - minimumVersion = new OmniVersion(Collections.<Comparable<?>> singletonList(null), null, null); + minimumVersion = new OmniVersion(Collections.singletonList(null), null, null); return minimumVersion; } public static Version createMaxVersion() { if (maximumVersion == null) - maximumVersion = new OmniVersion(Collections.<Comparable<?>> singletonList(VersionVector.MAX_VALUE), null, null); + maximumVersion = new OmniVersion(Collections.singletonList(VersionVector.MAX_VALUE), null, null); return maximumVersion; } diff --git a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/ResolvedInstallableUnit.java b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/ResolvedInstallableUnit.java index f641546b7..59feaba7c 100644 --- a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/ResolvedInstallableUnit.java +++ b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/ResolvedInstallableUnit.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 @@ -11,8 +11,22 @@ *******************************************************************************/ package org.eclipse.equinox.internal.p2.metadata; -import java.util.*; -import org.eclipse.equinox.p2.metadata.*; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.Collections; +import java.util.Map; +import org.eclipse.equinox.p2.metadata.IArtifactKey; +import org.eclipse.equinox.p2.metadata.ICopyright; +import org.eclipse.equinox.p2.metadata.IInstallableUnit; +import org.eclipse.equinox.p2.metadata.IInstallableUnitFragment; +import org.eclipse.equinox.p2.metadata.ILicense; +import org.eclipse.equinox.p2.metadata.IProvidedCapability; +import org.eclipse.equinox.p2.metadata.IRequirement; +import org.eclipse.equinox.p2.metadata.ITouchpointData; +import org.eclipse.equinox.p2.metadata.ITouchpointType; +import org.eclipse.equinox.p2.metadata.IUpdateDescriptor; +import org.eclipse.equinox.p2.metadata.Version; import org.eclipse.equinox.p2.metadata.expression.IMatchExpression; import org.eclipse.equinox.p2.metadata.expression.IMemberProvider; @@ -38,7 +52,7 @@ public class ResolvedInstallableUnit implements IInstallableUnit, IMemberProvide public Collection<IInstallableUnitFragment> getFragments() { int fcount = fragments.length; if (fcount == 0) - return Collections.<IInstallableUnitFragment> emptyList(); + return Collections.emptyList(); ArrayList<IInstallableUnitFragment> result = new ArrayList<>(fcount); result.addAll(Arrays.asList(fragments)); diff --git a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/TranslationSupport.java b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/TranslationSupport.java index ad7c16790..ee8315123 100644 --- a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/TranslationSupport.java +++ b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/TranslationSupport.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008, 2017 IBM Corporation and others. + * Copyright (c) 2008, 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 @@ -13,13 +13,31 @@ package org.eclipse.equinox.internal.p2.metadata; import java.lang.ref.SoftReference; -import java.util.*; +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Locale; +import java.util.Map; import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.Status; import org.eclipse.equinox.internal.p2.core.helpers.LogHelper; -import org.eclipse.equinox.p2.metadata.*; -import org.eclipse.equinox.p2.metadata.expression.*; -import org.eclipse.equinox.p2.query.*; +import org.eclipse.equinox.p2.metadata.ICopyright; +import org.eclipse.equinox.p2.metadata.IInstallableUnit; +import org.eclipse.equinox.p2.metadata.IInstallableUnitFragment; +import org.eclipse.equinox.p2.metadata.ILicense; +import org.eclipse.equinox.p2.metadata.IUpdateDescriptor; +import org.eclipse.equinox.p2.metadata.KeyWithLocale; +import org.eclipse.equinox.p2.metadata.MetadataFactory; +import org.eclipse.equinox.p2.metadata.expression.ExpressionUtil; +import org.eclipse.equinox.p2.metadata.expression.IExpression; +import org.eclipse.equinox.p2.metadata.expression.IExpressionFactory; +import org.eclipse.equinox.p2.query.Collector; +import org.eclipse.equinox.p2.query.IQuery; +import org.eclipse.equinox.p2.query.IQueryResult; +import org.eclipse.equinox.p2.query.IQueryable; +import org.eclipse.equinox.p2.query.QueryUtil; import org.eclipse.osgi.service.localization.LocaleProvider; /** @@ -242,7 +260,7 @@ public class TranslationSupport { return cached; } - IQuery<IInstallableUnit> iuQuery = QueryUtil.<IInstallableUnit> createMatchQuery(IInstallableUnitFragment.class, capabilityMatch, NAMESPACE_IU_LOCALIZATION, localeVariants); + IQuery<IInstallableUnit> iuQuery = QueryUtil.createMatchQuery(IInstallableUnitFragment.class, capabilityMatch, NAMESPACE_IU_LOCALIZATION, localeVariants); IQueryResult<IInstallableUnit> collected = fragmentSource.query(iuQuery, null); localeCollectorCache.put(locale, new SoftReference<>(collected)); return collected; @@ -267,7 +285,7 @@ public class TranslationSupport { IQueryResult<IInstallableUnit> localizationFragments = getLocalizationFragments(locales, locale); IExpressionFactory factory = ExpressionUtil.getFactory(); - IQuery<IInstallableUnit> iuQuery = QueryUtil.<IInstallableUnit> createMatchQuery(IInstallableUnitFragment.class, factory.matchExpression(haveHostMatch, theUnit)); + IQuery<IInstallableUnit> iuQuery = QueryUtil.createMatchQuery(IInstallableUnitFragment.class, factory.matchExpression(haveHostMatch, theUnit)); IQueryResult<IInstallableUnit> collected = iuQuery.perform(localizationFragments.iterator()); if (!collected.isEmpty()) { String translation = null; diff --git a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/expression/CompoundIterator.java b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/expression/CompoundIterator.java index bf3ab6ebe..0aa906e4e 100644 --- a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/expression/CompoundIterator.java +++ b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/expression/CompoundIterator.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009, 2017 Cloudsmith Inc. and others. + * Copyright (c) 2009, 2018 Cloudsmith 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 @@ -74,7 +74,7 @@ public class CompoundIterator<T> implements Iterator<T> { return false; Object nextItor = iteratorIterator.next(); - currentIterator = (nextItor instanceof Iterator<?>) ? (Iterator<T>) nextItor : RepeatableIterator.<T> create(nextItor); + currentIterator = (nextItor instanceof Iterator<?>) ? (Iterator<T>) nextItor : RepeatableIterator.create(nextItor); } nextObject = currentIterator.next(); return true; diff --git a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/expression/Everything.java b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/expression/Everything.java index e77d49738..839aa38c4 100644 --- a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/expression/Everything.java +++ b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/expression/Everything.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009, 2017 Cloudsmith Inc. and others. + * Copyright (c) 2009, 2018 Cloudsmith 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 @@ -10,7 +10,9 @@ *******************************************************************************/ package org.eclipse.equinox.internal.p2.metadata.expression; -import java.util.*; +import java.util.Collection; +import java.util.Collections; +import java.util.Iterator; import org.eclipse.equinox.p2.metadata.index.IIndexProvider; /** @@ -22,7 +24,7 @@ public final class Everything<T> extends MatchIteratorFilter<T> implements IRepe private final Class<? extends T> elementClass; public Everything(Class<? extends T> elementClass, Collection<T> collection) { - super(RepeatableIterator.<T> create(collection == null ? Collections.<T> emptyList() : collection)); + super(RepeatableIterator.create(collection == null ? Collections.emptyList() : collection)); this.elementClass = elementClass; } @@ -31,7 +33,7 @@ public final class Everything<T> extends MatchIteratorFilter<T> implements IRepe } public Everything(Class<? extends T> elementClass, IIndexProvider<? extends T> indexProvider) { - super(RepeatableIterator.<T> create(indexProvider)); + super(RepeatableIterator.create(indexProvider)); this.elementClass = elementClass; } diff --git a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/expression/Expression.java b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/expression/Expression.java index bd004d409..3eb60c516 100644 --- a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/expression/Expression.java +++ b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/expression/Expression.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009, 2017 Cloudsmith Inc. and others. + * Copyright (c) 2009, 2018 Cloudsmith 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 @@ -10,10 +10,18 @@ *******************************************************************************/ package org.eclipse.equinox.internal.p2.metadata.expression; -import java.util.*; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; +import java.util.Set; import org.eclipse.equinox.internal.p2.metadata.InstallableUnit; import org.eclipse.equinox.p2.metadata.IInstallableUnit; -import org.eclipse.equinox.p2.metadata.expression.*; +import org.eclipse.equinox.p2.metadata.expression.IEvaluationContext; +import org.eclipse.equinox.p2.metadata.expression.IExpression; +import org.eclipse.equinox.p2.metadata.expression.IExpressionVisitor; import org.eclipse.equinox.p2.query.IQueryResult; /** @@ -350,7 +358,7 @@ public abstract class Expression implements IExpression, Comparable<Expression>, } List<String> getMembers() { - return members == null ? Collections.<String> emptyList() : members; + return members == null ? Collections.emptyList() : members; } } diff --git a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/expression/parser/LDAPFilterParser.java b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/expression/parser/LDAPFilterParser.java index a3b5efe07..27988d6be 100644 --- a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/expression/parser/LDAPFilterParser.java +++ b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/expression/parser/LDAPFilterParser.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010, 2017 Cloudsmith Inc. and others. + * Copyright (c) 2010, 2018 Cloudsmith 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 @@ -10,11 +10,18 @@ *******************************************************************************/ package org.eclipse.equinox.internal.p2.metadata.expression.parser; -import java.util.*; +import java.util.ArrayList; +import java.util.Collections; +import java.util.LinkedHashMap; +import java.util.Map; import org.eclipse.equinox.internal.p2.metadata.Messages; import org.eclipse.equinox.internal.p2.metadata.expression.IExpressionConstants; import org.eclipse.equinox.internal.p2.metadata.expression.LDAPApproximation; -import org.eclipse.equinox.p2.metadata.expression.*; +import org.eclipse.equinox.p2.metadata.expression.ExpressionParseException; +import org.eclipse.equinox.p2.metadata.expression.IExpression; +import org.eclipse.equinox.p2.metadata.expression.IExpressionFactory; +import org.eclipse.equinox.p2.metadata.expression.IFilterExpression; +import org.eclipse.equinox.p2.metadata.expression.SimplePattern; import org.eclipse.osgi.util.NLS; /** @@ -23,7 +30,7 @@ import org.eclipse.osgi.util.NLS; */ public class LDAPFilterParser { @SuppressWarnings("serial") - private static final Map<String, IFilterExpression> filterCache = Collections.<String, IFilterExpression> synchronizedMap(new LinkedHashMap<String, IFilterExpression>() { + private static final Map<String, IFilterExpression> filterCache = Collections.synchronizedMap(new LinkedHashMap<String, IFilterExpression>() { @Override public boolean removeEldestEntry(Map.Entry<String, IFilterExpression> expr) { return size() > 64; diff --git a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/index/CapabilityIndex.java b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/index/CapabilityIndex.java index 8d89b2d13..a0c4900f0 100644 --- a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/index/CapabilityIndex.java +++ b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/index/CapabilityIndex.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010, 2017 Cloudsmith Inc. and others. + * Copyright (c) 2010, 2018 Cloudsmith 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 @@ -10,11 +10,32 @@ *******************************************************************************/ package org.eclipse.equinox.internal.p2.metadata.index; -import java.util.*; -import org.eclipse.equinox.internal.p2.metadata.*; -import org.eclipse.equinox.internal.p2.metadata.expression.*; -import org.eclipse.equinox.p2.metadata.*; -import org.eclipse.equinox.p2.metadata.expression.*; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; +import java.util.Map; +import org.eclipse.equinox.internal.p2.metadata.IRequiredCapability; +import org.eclipse.equinox.internal.p2.metadata.InstallableUnit; +import org.eclipse.equinox.internal.p2.metadata.ProvidedCapability; +import org.eclipse.equinox.internal.p2.metadata.RequiredCapability; +import org.eclipse.equinox.internal.p2.metadata.expression.CollectionFilter; +import org.eclipse.equinox.internal.p2.metadata.expression.Expression; +import org.eclipse.equinox.internal.p2.metadata.expression.ExpressionFactory; +import org.eclipse.equinox.internal.p2.metadata.expression.LambdaExpression; +import org.eclipse.equinox.internal.p2.metadata.expression.Matches; +import org.eclipse.equinox.internal.p2.metadata.expression.Member; +import org.eclipse.equinox.internal.p2.metadata.expression.Parameter; +import org.eclipse.equinox.internal.p2.metadata.expression.Unary; +import org.eclipse.equinox.p2.metadata.IInstallableUnit; +import org.eclipse.equinox.p2.metadata.IProvidedCapability; +import org.eclipse.equinox.p2.metadata.IRequirement; +import org.eclipse.equinox.p2.metadata.expression.ExpressionUtil; +import org.eclipse.equinox.p2.metadata.expression.IEvaluationContext; +import org.eclipse.equinox.p2.metadata.expression.IExpression; +import org.eclipse.equinox.p2.metadata.expression.IMatchExpression; /** * An in-memory implementation of a CapabilityIndex based on a Map. @@ -200,7 +221,7 @@ public class CapabilityIndex extends Index<IInstallableUnit> { if (queriedKeys == Boolean.FALSE) { // It has been determined that the expression has no chance // to succeed regardless of input - matchingIUs = Collections.<IInstallableUnit> emptySet(); + matchingIUs = Collections.emptySet(); } else if (queriedKeys instanceof Collection<?>) { matchingIUs = new HashSet<>(); for (Object key : (Collection<Object>) queriedKeys) @@ -208,7 +229,7 @@ public class CapabilityIndex extends Index<IInstallableUnit> { } else { Object v = capabilityMap.get(queriedKeys); if (v == null) - matchingIUs = Collections.<IInstallableUnit> emptySet(); + matchingIUs = Collections.emptySet(); else if (v instanceof IInstallableUnit) matchingIUs = Collections.singleton((IInstallableUnit) v); else diff --git a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/p2/metadata/MetadataFactory.java b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/p2/metadata/MetadataFactory.java index 6c9d91a77..e956ebc31 100644 --- a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/p2/metadata/MetadataFactory.java +++ b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/p2/metadata/MetadataFactory.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 @@ -404,7 +404,7 @@ public final class MetadataFactory { /** * Singleton touchpoint data for a touchpoint with no instructions. */ - private static final ITouchpointData EMPTY_TOUCHPOINT_DATA = new TouchpointData(Collections.<String, ITouchpointInstruction> emptyMap()); + private static final ITouchpointData EMPTY_TOUCHPOINT_DATA = new TouchpointData(Collections.emptyMap()); private static ITouchpointType[] typeCache = new ITouchpointType[5]; diff --git a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/p2/query/CollectionResult.java b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/p2/query/CollectionResult.java index 9e6ce5816..485f0efa3 100644 --- a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/p2/query/CollectionResult.java +++ b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/p2/query/CollectionResult.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010, 2017 Cloudsmith Inc. and others. + * Copyright (c) 2010, 2018 Cloudsmith 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 @@ -11,7 +11,11 @@ package org.eclipse.equinox.p2.query; import java.lang.reflect.Array; -import java.util.*; +import java.util.Collection; +import java.util.Collections; +import java.util.HashSet; +import java.util.Iterator; +import java.util.Set; import org.eclipse.core.runtime.IProgressMonitor; /** @@ -22,7 +26,7 @@ public class CollectionResult<T> implements IQueryResult<T> { private final Collection<T> collection; public CollectionResult(Collection<T> collection) { - this.collection = collection == null ? Collections.<T> emptySet() : collection; + this.collection = collection == null ? Collections.emptySet() : collection; } @Override @@ -57,7 +61,7 @@ public class CollectionResult<T> implements IQueryResult<T> { @Override public Set<T> toUnmodifiableSet() { - return collection instanceof Set<?> ? Collections.<T> unmodifiableSet((Set<T>) collection) : toSet(); + return collection instanceof Set<?> ? Collections.unmodifiableSet((Set<T>) collection) : toSet(); } @Override diff --git a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/p2/query/Collector.java b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/p2/query/Collector.java index c196951d3..13ffda2a6 100644 --- a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/p2/query/Collector.java +++ b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/p2/query/Collector.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 @@ -12,7 +12,11 @@ package org.eclipse.equinox.p2.query; import java.lang.reflect.Array; -import java.util.*; +import java.util.Collection; +import java.util.Collections; +import java.util.HashSet; +import java.util.Iterator; +import java.util.Set; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.NullProgressMonitor; import org.eclipse.equinox.internal.p2.metadata.Messages; diff --git a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/p2/query/CompoundQueryable.java b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/p2/query/CompoundQueryable.java index 727d48fa1..2b60e258f 100644 --- a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/p2/query/CompoundQueryable.java +++ b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/p2/query/CompoundQueryable.java @@ -1,5 +1,5 @@ /******************************************************************************* -* Copyright (c) 2009, 2017 EclipseSource and others. +* Copyright (c) 2009, 2018 EclipseSource 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 @@ -10,7 +10,10 @@ ******************************************************************************/ package org.eclipse.equinox.p2.query; -import java.util.*; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.Iterator; import org.eclipse.core.runtime.NullProgressMonitor; import org.eclipse.equinox.internal.p2.metadata.InstallableUnit; import org.eclipse.equinox.internal.p2.metadata.expression.CompoundIterator; diff --git a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/p2/query/ExpressionMatchQuery.java b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/p2/query/ExpressionMatchQuery.java index bbe61ae22..4249d31d2 100644 --- a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/p2/query/ExpressionMatchQuery.java +++ b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/p2/query/ExpressionMatchQuery.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009, 2010 Cloudsmith Inc. and others. + * Copyright (c) 2009, 2018 Cloudsmith 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 @@ -10,10 +10,21 @@ *******************************************************************************/ package org.eclipse.equinox.p2.query; -import java.util.*; -import org.eclipse.equinox.internal.p2.metadata.expression.*; -import org.eclipse.equinox.p2.metadata.expression.*; -import org.eclipse.equinox.p2.metadata.index.*; +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; +import org.eclipse.equinox.internal.p2.metadata.expression.Expression; +import org.eclipse.equinox.internal.p2.metadata.expression.ExpressionFactory; +import org.eclipse.equinox.internal.p2.metadata.expression.MatchExpression; +import org.eclipse.equinox.internal.p2.metadata.expression.QueryResult; +import org.eclipse.equinox.internal.p2.metadata.expression.RepeatableIterator; +import org.eclipse.equinox.p2.metadata.expression.ExpressionUtil; +import org.eclipse.equinox.p2.metadata.expression.IEvaluationContext; +import org.eclipse.equinox.p2.metadata.expression.IExpression; +import org.eclipse.equinox.p2.metadata.expression.IMatchExpression; +import org.eclipse.equinox.p2.metadata.index.IIndex; +import org.eclipse.equinox.p2.metadata.index.IIndexProvider; +import org.eclipse.equinox.p2.metadata.index.IQueryWithIndex; /** * A query that matches candidates against an expression. @@ -27,7 +38,7 @@ public class ExpressionMatchQuery<T> implements IMatchQuery<T>, IQueryWithIndex< public ExpressionMatchQuery(Class<? extends T> matchingClass, IExpression expression, Object... parameters) { this.matchingClass = matchingClass; - this.expression = ExpressionUtil.getFactory().<T> matchExpression(expression, parameters); + this.expression = ExpressionUtil.getFactory().matchExpression(expression, parameters); this.context = this.expression.createContext(); this.indexedMembers = Expression.getIndexCandidateMembers(matchingClass, ExpressionFactory.THIS, (Expression) expression); } @@ -78,7 +89,7 @@ public class ExpressionMatchQuery<T> implements IMatchQuery<T>, IQueryWithIndex< result.add(value); } } - return result == null ? Collector.<T> emptyCollector() : new CollectionResult<>(result); + return result == null ? Collector.emptyCollector() : new CollectionResult<>(result); } @Override diff --git a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/p2/query/ExpressionQuery.java b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/p2/query/ExpressionQuery.java index 3921029b0..77f1a3376 100644 --- a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/p2/query/ExpressionQuery.java +++ b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/p2/query/ExpressionQuery.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009, 2017 Cloudsmith Inc. and others. + * Copyright (c) 2009, 2018 Cloudsmith 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 @@ -11,8 +11,14 @@ package org.eclipse.equinox.p2.query; import java.util.Iterator; -import org.eclipse.equinox.internal.p2.metadata.expression.*; -import org.eclipse.equinox.p2.metadata.expression.*; +import org.eclipse.equinox.internal.p2.metadata.expression.ContextExpression; +import org.eclipse.equinox.internal.p2.metadata.expression.ExpressionFactory; +import org.eclipse.equinox.internal.p2.metadata.expression.MatchExpression; +import org.eclipse.equinox.internal.p2.metadata.expression.QueryResult; +import org.eclipse.equinox.p2.metadata.expression.ExpressionUtil; +import org.eclipse.equinox.p2.metadata.expression.IContextExpression; +import org.eclipse.equinox.p2.metadata.expression.IExpression; +import org.eclipse.equinox.p2.metadata.expression.IExpressionFactory; import org.eclipse.equinox.p2.metadata.index.IIndexProvider; import org.eclipse.equinox.p2.metadata.index.IQueryWithIndex; @@ -26,7 +32,7 @@ public class ExpressionQuery<T> implements IQueryWithIndex<T> { public ExpressionQuery(Class<? extends T> elementClass, IExpression expression, Object... parameters) { this.elementClass = elementClass; - this.expression = ExpressionUtil.getFactory().<T> contextExpression(expression, parameters); + this.expression = ExpressionUtil.getFactory().contextExpression(expression, parameters); } public ExpressionQuery(Class<? extends T> matchingClass, String expression, Object... parameters) { diff --git a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/p2/query/QueryUtil.java b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/p2/query/QueryUtil.java index 1e0365207..95a77a969 100644 --- a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/p2/query/QueryUtil.java +++ b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/p2/query/QueryUtil.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010, 2017 Cloudsmith Inc. and others. + * Copyright (c) 2010, 2018 Cloudsmith 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 @@ -17,8 +17,16 @@ import org.eclipse.equinox.internal.p2.metadata.InstallableUnit; import org.eclipse.equinox.internal.p2.metadata.expression.ContextExpression; import org.eclipse.equinox.internal.p2.metadata.expression.Expression.VariableFinder; import org.eclipse.equinox.internal.p2.metadata.expression.ExpressionFactory; -import org.eclipse.equinox.p2.metadata.*; -import org.eclipse.equinox.p2.metadata.expression.*; +import org.eclipse.equinox.p2.metadata.IInstallableUnit; +import org.eclipse.equinox.p2.metadata.IInstallableUnitFragment; +import org.eclipse.equinox.p2.metadata.IVersionedId; +import org.eclipse.equinox.p2.metadata.MetadataFactory; +import org.eclipse.equinox.p2.metadata.Version; +import org.eclipse.equinox.p2.metadata.VersionRange; +import org.eclipse.equinox.p2.metadata.expression.ExpressionUtil; +import org.eclipse.equinox.p2.metadata.expression.IContextExpression; +import org.eclipse.equinox.p2.metadata.expression.IExpression; +import org.eclipse.equinox.p2.metadata.expression.IExpressionFactory; /** * Helper class for query related tasks. @@ -94,7 +102,7 @@ public class QueryUtil { Class<? extends T> elementClass = (Class<T>) Object.class; if (top == 0) - return QueryUtil.<T> createMatchQuery(elementClass, ExpressionUtil.TRUE_EXPRESSION); + return QueryUtil.createMatchQuery(elementClass, ExpressionUtil.TRUE_EXPRESSION); IExpression[] expressions = new IExpression[top]; boolean justBooleans = true; @@ -129,7 +137,7 @@ public class QueryUtil { if (justBooleans) { IExpression compound = and ? factory.and(expressions) : factory.or(expressions); - return QueryUtil.<T> createMatchQuery(elementClass, compound); + return QueryUtil.createMatchQuery(elementClass, compound); } if (!justContexts) { @@ -141,7 +149,7 @@ public class QueryUtil { IExpression compound = expressions[0]; for (idx = 1; idx < expressions.length; ++idx) compound = and ? factory.intersect(compound, expressions[idx]) : factory.union(compound, expressions[idx]); - return QueryUtil.<T> createQuery(elementClass, compound); + return QueryUtil.createQuery(elementClass, compound); } /** @@ -408,7 +416,7 @@ public class QueryUtil { IExpression pipe = factory.pipe(expressions); VariableFinder finder = new VariableFinder(ExpressionFactory.EVERYTHING); pipe.accept(finder); - return finder.isFound() ? QueryUtil.<T> createQuery((Class<T>) Object.class, pipe) : QueryUtil.<T> createMatchQuery((Class<T>) Object.class, pipe); + return finder.isFound() ? QueryUtil.createQuery((Class<T>) Object.class, pipe) : QueryUtil.createMatchQuery((Class<T>) Object.class, pipe); } /** 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 e071acc21..f4007def3 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, 2017 Red Hat, Inc. and others + * Copyright (c) 2013, 2018 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 @@ -338,7 +338,7 @@ public class RequestFlexer { expressionParameters[count * 2 + 1] = iu.getVersion(); count++; } - IMatchExpression<IInstallableUnit> iuMatcher = ExpressionUtil.getFactory().<IInstallableUnit> matchExpression(ExpressionUtil.parse(expression.toString()), expressionParameters); + IMatchExpression<IInstallableUnit> iuMatcher = ExpressionUtil.getFactory().matchExpression(ExpressionUtil.parse(expression.toString()), expressionParameters); return MetadataFactory.createRequirement(iuMatcher, null, optional ? 0 : 1, 1, true); } diff --git a/bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/p2/operations/UpdateOperation.java b/bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/p2/operations/UpdateOperation.java index 8706c7a1e..28ce01459 100644 --- a/bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/p2/operations/UpdateOperation.java +++ b/bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/p2/operations/UpdateOperation.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009, 2017 IBM Corporation and others. + * Copyright (c) 2009, 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 @@ -283,7 +283,7 @@ public class UpdateOperation extends ProfileChangeOperation { private Collection<IInstallableUnit> getInstalledIUs() { IProfile profile = session.getProfileRegistry().getProfile(profileId); if (profile == null) - return Collections.<IInstallableUnit> emptyList(); + return Collections.emptyList(); IQuery<IInstallableUnit> query = new UserVisibleRootQuery(); IQueryResult<IInstallableUnit> queryResult = profile.query(query, null); return queryResult.toUnmodifiableSet(); diff --git a/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/internal/p2/publisher/eclipse/ProductFile.java b/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/internal/p2/publisher/eclipse/ProductFile.java index 99292cf2e..d97744be8 100644 --- a/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/internal/p2/publisher/eclipse/ProductFile.java +++ b/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/internal/p2/publisher/eclipse/ProductFile.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2005, 2017 IBM Corporation and others. + * Copyright (c) 2005, 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 @@ -382,7 +382,7 @@ public class ProductFile extends DefaultHandler implements IProductDescriptor { */ @Override public List<BundleInfo> getBundleInfos() { - return bundleInfos != null ? bundleInfos : Collections.<BundleInfo> emptyList(); + return bundleInfos != null ? bundleInfos : Collections.emptyList(); } /** diff --git a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/AdviceFileAdvice.java b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/AdviceFileAdvice.java index 9a22bf362..f5b0400da 100644 --- a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/AdviceFileAdvice.java +++ b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/AdviceFileAdvice.java @@ -1,10 +1,10 @@ /******************************************************************************* - * Copyright (c) 2008, 2017 IBM Corporation and others. + * Copyright (c) 2008, 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 * http://www.eclipse.org/legal/epl-v10.html - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ @@ -52,7 +52,7 @@ public class AdviceFileAdvice extends AbstractAdvice implements ITouchpointAdvic * Creates advice for an advice file at the given location. If <tt>basePath</tt> * is a directory, then <tt>adviceFilePath</tt> is appended to this location to * obtain the location of the advice file. If <tt>basePath</tt> is a file, then - * <tt>adviceFilePath</tt> is used to + * <tt>adviceFilePath</tt> is used to * @param id The symbolic id of the installable unit this advice applies to * @param version The version of the installable unit this advice applies to * @param basePath The root location of the the advice file. This is either the location of @@ -102,7 +102,7 @@ public class AdviceFileAdvice extends AbstractAdvice implements ITouchpointAdvic private static Map<String, String> loadAdviceMap(IPath basePath, IPath adviceFilePath) { File location = basePath.toFile(); if (location == null || !location.exists()) - return Collections.<String, String> emptyMap(); + return Collections.emptyMap(); ZipFile jar = null; InputStream stream = null; @@ -110,13 +110,13 @@ public class AdviceFileAdvice extends AbstractAdvice implements ITouchpointAdvic if (location.isDirectory()) { File adviceFile = new File(location, adviceFilePath.toString()); if (!adviceFile.isFile()) - return Collections.<String, String> emptyMap(); + return Collections.emptyMap(); stream = new BufferedInputStream(new FileInputStream(adviceFile)); } else if (location.isFile()) { jar = new ZipFile(location); ZipEntry entry = jar.getEntry(adviceFilePath.toString()); if (entry == null) - return Collections.<String, String> emptyMap(); + return Collections.emptyMap(); stream = new BufferedInputStream(jar.getInputStream(entry)); } @@ -125,7 +125,7 @@ public class AdviceFileAdvice extends AbstractAdvice implements ITouchpointAdvic String message = "An error occured while reading advice file: basePath=" + basePath + ", adviceFilePath=" + adviceFilePath + "."; //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$ IStatus status = new Status(IStatus.ERROR, Activator.ID, message, e); LogHelper.log(status); - return Collections.<String, String> emptyMap(); + return Collections.emptyMap(); } finally { if (stream != null) try { diff --git a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/spi/p2/publisher/LocalizationHelper.java b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/spi/p2/publisher/LocalizationHelper.java index 2546e1d30..ecce30426 100644 --- a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/spi/p2/publisher/LocalizationHelper.java +++ b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/spi/p2/publisher/LocalizationHelper.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008, 2017 IBM Corporation and others. + * Copyright (c) 2008, 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 @@ -31,7 +31,7 @@ public final class LocalizationHelper { // Extract the locale string from the properties file with the given filename // where the locale string follows the given prefix. For example, return "zh_HK" - // from filename == "plugin_zh_HK.properties" and prefix == "plugin". + // from filename == "plugin_zh_HK.properties" and prefix == "plugin". static public String getLocaleString(String filename, String prefix) { String localeString = null; if (filename.startsWith(prefix) && filename.endsWith(PROPERTIES_FILE_EXTENSION)) { @@ -132,7 +132,7 @@ public final class LocalizationHelper { } } catch (FileNotFoundException e) { // if there is no messages file then just return; - return Collections.<String, String> emptyMap(); + return Collections.emptyMap(); } return CollectionUtils.loadProperties(propertyStream); } finally { @@ -142,7 +142,7 @@ public final class LocalizationHelper { } // Given a list of keys and the corresponding localized property set, - // return a new property set with those keys and the localized values. + // return a new property set with those keys and the localized values. static public Map<String, String> getLocalizedProperties(String[] propertyKeys, Map<String, String> properties) { Map<String, String> localizedProperties = new HashMap<>(); for (int i = 0; i < propertyKeys.length; i++) { diff --git a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/spi/p2/publisher/PublisherHelper.java b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/spi/p2/publisher/PublisherHelper.java index 5c9186ea8..5fa4cadb7 100644 --- a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/spi/p2/publisher/PublisherHelper.java +++ b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/spi/p2/publisher/PublisherHelper.java @@ -137,7 +137,7 @@ public class PublisherHelper { private static void calculateChecksums(File pathOnDisk, ArtifactDescriptor descriptor) { // TODO disable specific algorithms - List<String> checksumsToSkip = Collections.<String> emptyList(); + List<String> checksumsToSkip = Collections.emptyList(); Map<String, String> checksums = new HashMap<>(); IStatus status = ChecksumUtilities.calculateChecksums(pathOnDisk, checksums, checksumsToSkip); if (!status.isOK()) { diff --git a/bundles/org.eclipse.equinox.p2.reconciler.dropins/src/org/eclipse/equinox/internal/p2/reconciler/dropins/PlatformXmlListener.java b/bundles/org.eclipse.equinox.p2.reconciler.dropins/src/org/eclipse/equinox/internal/p2/reconciler/dropins/PlatformXmlListener.java index 3f2a26c02..d9d981f7e 100644 --- a/bundles/org.eclipse.equinox.p2.reconciler.dropins/src/org/eclipse/equinox/internal/p2/reconciler/dropins/PlatformXmlListener.java +++ b/bundles/org.eclipse.equinox.p2.reconciler.dropins/src/org/eclipse/equinox/internal/p2/reconciler/dropins/PlatformXmlListener.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 @@ -125,7 +125,7 @@ public class PlatformXmlListener extends DirectoryChangeListener { public Collection<IMetadataRepository> getMetadataRepositories() { if (configRepositories == null) - return Collections.<IMetadataRepository> emptySet(); + return Collections.emptySet(); return configRepositories; } diff --git a/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/mirroring/Mirroring.java b/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/mirroring/Mirroring.java index 21127075e..b3a1ad9f3 100644 --- a/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/mirroring/Mirroring.java +++ b/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/mirroring/Mirroring.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 @@ -41,7 +41,7 @@ public class Mirroring { private boolean validate = false; private IArtifactComparator comparator; private IQuery<IArtifactDescriptor> compareExclusionQuery = null; - private Set<IArtifactDescriptor> compareExclusions = Collections.<IArtifactDescriptor> emptySet(); + private Set<IArtifactDescriptor> compareExclusions = Collections.emptySet(); private String comparatorID; private List<IArtifactKey> keysToMirror; private IArtifactMirrorLog comparatorLog; diff --git a/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/Repo2Runnable.java b/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/Repo2Runnable.java index 4571096b5..269662843 100644 --- a/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/Repo2Runnable.java +++ b/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/Repo2Runnable.java @@ -93,7 +93,7 @@ public class Repo2Runnable extends AbstractApplication implements IApplication { protected List<ProvisioningAction> getActions(InstallableUnitOperand operand) { IInstallableUnit unit = operand.second(); if (unit.getTouchpointType().getId().equals(NATIVE_TYPE)) { - return Collections.<ProvisioningAction> singletonList(new CollectNativesAction()); + return Collections.singletonList(new CollectNativesAction()); } return null; } diff --git a/bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/IUDescription.java b/bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/IUDescription.java index 73513433a..ba33b45a9 100644 --- a/bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/IUDescription.java +++ b/bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/IUDescription.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009, 2017 IBM Corporation and others. + * Copyright (c) 2009, 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 @@ -150,7 +150,7 @@ public class IUDescription extends DataType { private Map<String, String> processQueryAttributes(String attributes) { if (attributes == null || attributes.length() == 0) - return Collections.<String, String> emptyMap(); + return Collections.emptyMap(); Map<String, String> result = new HashMap<>(); int start = 0; diff --git a/bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/MirrorTask.java b/bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/MirrorTask.java index 2e067a149..80f4fe13e 100644 --- a/bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/MirrorTask.java +++ b/bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/MirrorTask.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009, 2017 IBM Corporation and others. + * Copyright (c) 2009, 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 @@ -83,7 +83,7 @@ public class MirrorTask extends AbstractRepositoryTask { if (queries.size() == 1) return queries.get(0); - return QueryUtil.<IArtifactDescriptor> createCompoundQuery(queries, false); + return QueryUtil.createCompoundQuery(queries, false); } public SlicingOption createSlicingOptions() { diff --git a/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/p2/repository/artifact/ArtifactDescriptorQuery.java b/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/p2/repository/artifact/ArtifactDescriptorQuery.java index e704b1763..6cba4ea89 100644 --- a/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/p2/repository/artifact/ArtifactDescriptorQuery.java +++ b/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/p2/repository/artifact/ArtifactDescriptorQuery.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009, 2010 IBM Corporation and others. + * Copyright (c) 2009, 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 @@ -40,10 +40,10 @@ public final class ArtifactDescriptorQuery extends ExpressionMatchQuery<IArtifac properties.put(IArtifactDescriptor.FORMAT, format); } } else if (properties == null) - properties = Collections.<String, String> emptyMap(); + properties = Collections.emptyMap(); IExpressionFactory factory = ExpressionUtil.getFactory(); - return factory.<IArtifactDescriptor> matchExpression(descriptorMatch, id, range, properties); + return factory.matchExpression(descriptorMatch, id, range, properties); } /** diff --git a/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/p2/repository/artifact/ArtifactKeyQuery.java b/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/p2/repository/artifact/ArtifactKeyQuery.java index 1e8f0ade9..3ba1df3b1 100644 --- a/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/p2/repository/artifact/ArtifactKeyQuery.java +++ b/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/p2/repository/artifact/ArtifactKeyQuery.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009, 2010 IBM Corporation and others. + * Copyright (c) 2009, 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 @@ -33,7 +33,7 @@ public final class ArtifactKeyQuery extends ExpressionMatchQuery<IArtifactKey> { private static IExpression createMatchExpression(IArtifactKey key) { if (key == null) return ExpressionUtil.TRUE_EXPRESSION; - return ExpressionUtil.getFactory().<IArtifactKey> matchExpression(matchKey, key); + return ExpressionUtil.getFactory().matchExpression(matchKey, key); } private static IExpression createMatchExpression(String classifier, String id, VersionRange range) { @@ -41,11 +41,11 @@ public final class ArtifactKeyQuery extends ExpressionMatchQuery<IArtifactKey> { if (classifier == null) { if (id == null) return ExpressionUtil.TRUE_EXPRESSION; - return ExpressionUtil.getFactory().<IArtifactKey> matchExpression(matchID, id); + return ExpressionUtil.getFactory().matchExpression(matchID, id); } range = VersionRange.emptyRange; } - return ExpressionUtil.getFactory().<IArtifactKey> matchExpression(matchIDClassifierRange, id, classifier, range); + return ExpressionUtil.getFactory().matchExpression(matchIDClassifierRange, id, classifier, range); } /** diff --git a/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/operations/OperationFactoryTest.java b/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/operations/OperationFactoryTest.java index c8c9925b7..f335da9e4 100644 --- a/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/operations/OperationFactoryTest.java +++ b/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/operations/OperationFactoryTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011, 2017 Sonatype, Inc. and others. + * Copyright (c) 2011, 2018 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 @@ -63,7 +63,7 @@ public class OperationFactoryTest extends AbstractProvisioningTest { versions.add(new VersionedId("aBundle", "1.0.0")); Exception exceptionMet = null; try { - of.createInstallOperation(versions, Collections.<URI> emptyList(), new NullProgressMonitor()); + of.createInstallOperation(versions, Collections.emptyList(), new NullProgressMonitor()); } catch (ProvisionException e) { exceptionMet = e; } @@ -124,7 +124,7 @@ public class OperationFactoryTest extends AbstractProvisioningTest { toRemove.add(vid); Exception expectedException = null; try { - of.createUninstallOperation(toRemove, Collections.<URI> emptyList(), new NullProgressMonitor()); + of.createUninstallOperation(toRemove, Collections.emptyList(), new NullProgressMonitor()); } catch (ProvisionException e) { expectedException = e; } diff --git a/bundles/org.eclipse.equinox.p2.tests.verifier/src/org/eclipse/equinox/internal/p2/tests/verifier/VerifierApplication.java b/bundles/org.eclipse.equinox.p2.tests.verifier/src/org/eclipse/equinox/internal/p2/tests/verifier/VerifierApplication.java index c575520c6..83e0dad34 100644 --- a/bundles/org.eclipse.equinox.p2.tests.verifier/src/org/eclipse/equinox/internal/p2/tests/verifier/VerifierApplication.java +++ b/bundles/org.eclipse.equinox.p2.tests.verifier/src/org/eclipse/equinox/internal/p2/tests/verifier/VerifierApplication.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009, 2017 IBM Corporation and others. + * Copyright (c) 2009, 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 @@ -344,7 +344,7 @@ public class VerifierApplication implements IApplication { IProfileRegistry reg = (IProfileRegistry) agent.getService(IProfileRegistry.SERVICE_NAME); IProfile profile = reg.getProfile(IProfileRegistry.SELF); - MigrationWizard wizardPage = new MigrationWizard(profile, Collections.<IInstallableUnit> emptyList(), new URI[0], false); + MigrationWizard wizardPage = new MigrationWizard(profile, Collections.emptyList(), new URI[0], false); int cancelAnswer = Integer.parseInt(properties.getProperty("checkMigration.cancelAnswer")); wizardPage.rememberCancellationDecision(cancelAnswer); } diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/ant/MirrorTaskTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/ant/MirrorTaskTest.java index 9037b2195..dbe22ae67 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/ant/MirrorTaskTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/ant/MirrorTaskTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009, 2017 IBM Corporation and others. + * Copyright (c) 2009, 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 @@ -12,22 +12,39 @@ package org.eclipse.equinox.p2.tests.ant; import static org.junit.Assert.assertNotEquals; -import java.io.*; +import java.io.File; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.PrintStream; import java.net.URI; import java.net.URISyntaxException; -import java.util.*; +import java.util.Arrays; +import java.util.Collections; +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; +import java.util.Properties; import java.util.zip.ZipEntry; import java.util.zip.ZipOutputStream; -import org.eclipse.core.runtime.*; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.NullProgressMonitor; +import org.eclipse.core.runtime.URIUtil; import org.eclipse.equinox.internal.p2.director.PermissiveSlicer; import org.eclipse.equinox.internal.p2.metadata.ArtifactKey; import org.eclipse.equinox.internal.p2.metadata.InstallableUnit; import org.eclipse.equinox.p2.core.ProvisionException; import org.eclipse.equinox.p2.internal.repository.comparator.MD5ArtifactComparator; import org.eclipse.equinox.p2.internal.repository.tools.Messages; -import org.eclipse.equinox.p2.metadata.*; -import org.eclipse.equinox.p2.query.*; -import org.eclipse.equinox.p2.repository.artifact.*; +import org.eclipse.equinox.p2.metadata.IArtifactKey; +import org.eclipse.equinox.p2.metadata.IInstallableUnit; +import org.eclipse.equinox.p2.metadata.Version; +import org.eclipse.equinox.p2.query.Collector; +import org.eclipse.equinox.p2.query.IQueryResult; +import org.eclipse.equinox.p2.query.IQueryable; +import org.eclipse.equinox.p2.query.QueryUtil; +import org.eclipse.equinox.p2.repository.artifact.IArtifactDescriptor; +import org.eclipse.equinox.p2.repository.artifact.IArtifactRepository; +import org.eclipse.equinox.p2.repository.artifact.IArtifactRepositoryManager; import org.eclipse.equinox.p2.repository.metadata.IMetadataRepository; import org.eclipse.equinox.p2.repository.metadata.IMetadataRepositoryManager; import org.eclipse.equinox.p2.tests.AbstractAntProvisioningTest; @@ -364,7 +381,7 @@ public class MirrorTaskTest extends AbstractAntProvisioningTest { runAntTask(); - PermissiveSlicer slicer = new PermissiveSlicer(repo, Collections.<String, String> emptyMap(), true, false, true, false, false); + PermissiveSlicer slicer = new PermissiveSlicer(repo, Collections.emptyMap(), true, false, true, false, false); IQueryable<IInstallableUnit> result = slicer.slice(new IInstallableUnit[] {iu}, new NullProgressMonitor()); assertEquals("Different number of IUs", queryResultSize(result.query(QueryUtil.createIUAnyQuery(), new NullProgressMonitor())), getIUCount(destinationRepo)); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/core/AggregateQueryTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/core/AggregateQueryTest.java index edcb33f85..31e80013f 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/core/AggregateQueryTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/core/AggregateQueryTest.java @@ -1,5 +1,5 @@ /******************************************************************************* -* Copyright (c) 2009, 2017 EclipseSource and others. All rights reserved. This +* Copyright (c) 2009, 2018 EclipseSource 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 http://www.eclipse.org/legal/epl-v10.html @@ -9,9 +9,17 @@ ******************************************************************************/ package org.eclipse.equinox.p2.tests.core; -import java.util.*; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.Iterator; +import java.util.List; import junit.framework.TestCase; -import org.eclipse.equinox.p2.query.*; +import org.eclipse.equinox.p2.query.Collector; +import org.eclipse.equinox.p2.query.IQuery; +import org.eclipse.equinox.p2.query.IQueryResult; +import org.eclipse.equinox.p2.query.MatchQuery; +import org.eclipse.equinox.p2.query.QueryUtil; import org.eclipse.equinox.p2.tests.AbstractProvisioningTest; /** @@ -29,7 +37,7 @@ public class AggregateQueryTest extends TestCase { } public void testEmptyCompositeQuery() { - IQuery<String> query = QueryUtil.createPipeQuery(Collections.<IQuery<String>> emptySet()); + IQuery<String> query = QueryUtil.createPipeQuery(Collections.emptySet()); query.perform(getABCDE().iterator()); // We should not throw an exception. No guarantee on what perform // will return in this case diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/RequirementToString.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/RequirementToString.java index 476d0daed..c2b1be510 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/RequirementToString.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/RequirementToString.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2013 Ericsson AB and others. All rights reserved. This + * Copyright (c) 2013, 2018 Ericsson AB 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 http://www.eclipse.org/legal/epl-v10.html @@ -38,7 +38,7 @@ public class RequirementToString extends TestCase { public void testFancyRequirement() { Object[] expressionParameters = new Object[] {"expectedId1", "expectedVersion1", "expectedId2", "expectedVersion2"}; - IMatchExpression<IInstallableUnit> iuMatcher = ExpressionUtil.getFactory().<IInstallableUnit> matchExpression(ExpressionUtil.parse("(id == $0 && version == $1) || (id == $2 && version == $3)"), expressionParameters); + IMatchExpression<IInstallableUnit> iuMatcher = ExpressionUtil.getFactory().matchExpression(ExpressionUtil.parse("(id == $0 && version == $1) || (id == $2 && version == $3)"), expressionParameters); IRequirement req = MetadataFactory.createRequirement(iuMatcher, null, 1, 1, true); assertEquals("id == $0 && version == $1 || id == $2 && version == $3 (expectedId1, expectedVersion1, expectedId2, expectedVersion2)", req.toString().trim()); } diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/SPIMetadataRepositoryTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/SPIMetadataRepositoryTest.java index 605143491..f120c9779 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/SPIMetadataRepositoryTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/SPIMetadataRepositoryTest.java @@ -1,5 +1,5 @@ /******************************************************************************* -* Copyright (c) 2008, 2017 EclipseSource and others. All rights reserved. This +* Copyright (c) 2008, 2018 EclipseSource 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 http://www.eclipse.org/legal/epl-v10.html @@ -364,7 +364,7 @@ public class SPIMetadataRepositoryTest extends AbstractProvisioningTest { @Override public List<IRequirement> getMetaRequirements() { - return Collections.<IRequirement> emptyList(); + return Collections.emptyList(); } @Override diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/AdditionalConstraints.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/AdditionalConstraints.java index 86f419aec..0033d2b6d 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/AdditionalConstraints.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/AdditionalConstraints.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009, 2017 IBM Corporation and others. + * Copyright (c) 2009, 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 @@ -13,8 +13,12 @@ package org.eclipse.equinox.p2.tests.planner; import java.util.Arrays; import org.eclipse.core.runtime.IStatus; import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; -import org.eclipse.equinox.p2.engine.*; -import org.eclipse.equinox.p2.metadata.*; +import org.eclipse.equinox.p2.engine.IProfile; +import org.eclipse.equinox.p2.engine.IProvisioningPlan; +import org.eclipse.equinox.p2.engine.ProvisioningContext; +import org.eclipse.equinox.p2.metadata.IInstallableUnit; +import org.eclipse.equinox.p2.metadata.Version; +import org.eclipse.equinox.p2.metadata.VersionRange; import org.eclipse.equinox.p2.planner.IPlanner; import org.eclipse.equinox.p2.tests.AbstractProvisioningTest; @@ -52,7 +56,7 @@ public class AdditionalConstraints extends AbstractProvisioningTest { ProfileChangeRequest req = new ProfileChangeRequest(profile); req.addInstallableUnits(new IInstallableUnit[] {a1}); ProvisioningContext ctx = new ProvisioningContext(getAgent()); - req.addExtraRequirements(Arrays.<IRequirement> asList(createRequiredCapabilities(IInstallableUnit.NAMESPACE_IU_ID, "B", new VersionRange("[2.0.0, 2.0.0]"))[0])); + req.addExtraRequirements(Arrays.asList(createRequiredCapabilities(IInstallableUnit.NAMESPACE_IU_ID, "B", new VersionRange("[2.0.0, 2.0.0]"))[0])); IProvisioningPlan plan = planner.getProvisioningPlan(req, ctx, null); assertEquals(IStatus.OK, plan.getStatus().getSeverity()); assertInstallOperand(plan, a1); @@ -63,7 +67,7 @@ public class AdditionalConstraints extends AbstractProvisioningTest { public void testExtraRequirement() { ProfileChangeRequest req = new ProfileChangeRequest(profile); ProvisioningContext ctx = new ProvisioningContext(getAgent()); - req.addExtraRequirements(Arrays.<IRequirement> asList(createRequiredCapabilities(IInstallableUnit.NAMESPACE_IU_ID, "B", new VersionRange("[1.0.0, 4.0.0]"))[0])); + req.addExtraRequirements(Arrays.asList(createRequiredCapabilities(IInstallableUnit.NAMESPACE_IU_ID, "B", new VersionRange("[1.0.0, 4.0.0]"))[0])); IProvisioningPlan plan = planner.getProvisioningPlan(req, ctx, null); assertEquals(IStatus.OK, plan.getStatus().getSeverity()); assertInstallOperand(plan, b3); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/FindRootsAfterUpdate.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/FindRootsAfterUpdate.java index 7a0cecdcc..5b0611c1f 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/FindRootsAfterUpdate.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/FindRootsAfterUpdate.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011, 2017 Sonatype, Inc. and others. All rights reserved. This + * Copyright (c) 2011, 2018 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 http://www.eclipse.org/legal/epl-v10.html @@ -12,8 +12,13 @@ package org.eclipse.equinox.p2.tests.planner; import java.util.Arrays; import org.eclipse.core.runtime.IStatus; import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; -import org.eclipse.equinox.p2.engine.*; -import org.eclipse.equinox.p2.metadata.*; +import org.eclipse.equinox.p2.engine.IProfile; +import org.eclipse.equinox.p2.engine.IProvisioningPlan; +import org.eclipse.equinox.p2.engine.ProvisioningContext; +import org.eclipse.equinox.p2.metadata.IInstallableUnit; +import org.eclipse.equinox.p2.metadata.IRequirement; +import org.eclipse.equinox.p2.metadata.Version; +import org.eclipse.equinox.p2.metadata.VersionRange; import org.eclipse.equinox.p2.planner.IPlanner; import org.eclipse.equinox.p2.query.QueryUtil; import org.eclipse.equinox.p2.tests.AbstractProvisioningTest; @@ -52,7 +57,7 @@ public class FindRootsAfterUpdate extends AbstractProvisioningTest { ProfileChangeRequest req = new ProfileChangeRequest(profile); ProvisioningContext ctx = new ProvisioningContext(getAgent()); IRequirement[] reqs = createRequiredCapabilities(IInstallableUnit.NAMESPACE_IU_ID, "B", new VersionRange("[2.0.0, 4.0.0]")); - req.addExtraRequirements(Arrays.<IRequirement> asList(reqs[0])); + req.addExtraRequirements(Arrays.asList(reqs[0])); IProvisioningPlan plan = planner.getProvisioningPlan(req, ctx, null); assertEquals(IStatus.OK, plan.getStatus().getSeverity()); assertInstallOperand(plan, b3); @@ -65,7 +70,7 @@ public class FindRootsAfterUpdate extends AbstractProvisioningTest { IRequirement reqOnB = createRequiredCapabilities(IInstallableUnit.NAMESPACE_IU_ID, "B", new VersionRange("[3.0.0, 4.0.0]"))[0]; IRequirement reqOnX = createRequiredCapabilities(IInstallableUnit.NAMESPACE_IU_ID, "X", new VersionRange("[2.0.0, 2.0.0]"))[0]; IRequirement[] extraReqs = new IRequirement[] {reqOnB, reqOnX}; - req.addExtraRequirements(Arrays.<IRequirement> asList(extraReqs)); + req.addExtraRequirements(Arrays.asList(extraReqs)); IProvisioningPlan plan = planner.getProvisioningPlan(req, ctx, null); assertNotOK(plan.getStatus()); } diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/NegationTesting.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/NegationTesting.java index 6862f1216..c25a4f136 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/NegationTesting.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/NegationTesting.java @@ -94,7 +94,7 @@ public class NegationTesting extends AbstractProvisioningTest { IMetadataRepository repo = createTestMetdataRepository(new IInstallableUnit[] {iu1, iu2, iu3}); // Verify that the slice includes iu3 because the requirement from iu1 is a range including the provided capability of iu3. - Slicer slicer = new Slicer(repo, Collections.<String, String> emptyMap(), false); + Slicer slicer = new Slicer(repo, Collections.emptyMap(), false); IQueryable<IInstallableUnit> slice = slicer.slice(new IInstallableUnit[] {iu1}, new NullProgressMonitor()); assertEquals(3, queryResultSize(slice.query(QueryUtil.createIUAnyQuery(), new NullProgressMonitor()))); @@ -152,7 +152,7 @@ public class NegationTesting extends AbstractProvisioningTest { IMetadataRepository repo = createTestMetdataRepository(new IInstallableUnit[] {iu1, iu2, iu3}); //Test the slicer. The slice will not contain iu3 because none of the range of iu1 cause it to be brought in. - Slicer slicer = new Slicer(repo, Collections.<String, String> emptyMap(), false); + Slicer slicer = new Slicer(repo, Collections.emptyMap(), false); IQueryable<IInstallableUnit> slice = slicer.slice(new IInstallableUnit[] {iu1}, new NullProgressMonitor()); assertEquals(0, queryResultSize(slice.query(QueryUtil.createIUQuery("ProviderOf1_1_1"), new NullProgressMonitor()))); assertEquals(2, queryResultSize(slice.query(QueryUtil.createIUAnyQuery(), new NullProgressMonitor()))); @@ -184,7 +184,7 @@ public class NegationTesting extends AbstractProvisioningTest { IMetadataRepository repo = createTestMetdataRepository(new IInstallableUnit[] {iu1, iu2}); //Test the slicer. The slice will not contain iu3 because none of the range of iu1 cause it to be brought in. - Slicer slicer = new Slicer(repo, Collections.<String, String> emptyMap(), false); + Slicer slicer = new Slicer(repo, Collections.emptyMap(), false); IQueryable<IInstallableUnit> slice = slicer.slice(new IInstallableUnit[] {iu1}, new NullProgressMonitor()); assertEquals(0, queryResultSize(slice.query(QueryUtil.createIUQuery("ProviderOf1_1_1"), new NullProgressMonitor()))); assertEquals(2, queryResultSize(slice.query(QueryUtil.createIUAnyQuery(), new NullProgressMonitor()))); @@ -238,7 +238,7 @@ public class NegationTesting extends AbstractProvisioningTest { IMetadataRepository repo = createTestMetdataRepository(new IInstallableUnit[] {iu1, iu2, iu3}); // Verify that the slice includes iu3 because the requirement from iu1 is a range including the provided capability of iu3. - Slicer slicer = new Slicer(repo, Collections.<String, String> emptyMap(), false); + Slicer slicer = new Slicer(repo, Collections.emptyMap(), false); IQueryable<IInstallableUnit> slice = slicer.slice(new IInstallableUnit[] {iu1}, new NullProgressMonitor()); assertEquals(3, queryResultSize(slice.query(QueryUtil.createIUAnyQuery(), new NullProgressMonitor()))); @@ -307,12 +307,12 @@ public class NegationTesting extends AbstractProvisioningTest { IMetadataRepository repo = createTestMetdataRepository(new IInstallableUnit[] {iu1, iu2, iu3, iu4}); // Verify that the slice includes iu3 - Slicer slicer = new Slicer(repo, Collections.<String, String> emptyMap(), false); + Slicer slicer = new Slicer(repo, Collections.emptyMap(), false); IQueryable<IInstallableUnit> slice = slicer.slice(new IInstallableUnit[] {iu1, iu4}, new NullProgressMonitor()); assertEquals(4, queryResultSize(slice.query(QueryUtil.createIUAnyQuery(), new NullProgressMonitor()))); // Verify that the slice includes iu3 - Slicer slicer2 = new Slicer(repo, Collections.<String, String> emptyMap(), false); + Slicer slicer2 = new Slicer(repo, Collections.emptyMap(), false); IQueryable<IInstallableUnit> slice2 = slicer2.slice(new IInstallableUnit[] {iu4}, new NullProgressMonitor()); assertEquals(2, queryResultSize(slice2.query(QueryUtil.createIUAnyQuery(), new NullProgressMonitor()))); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/PermissiveSlicerTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/PermissiveSlicerTest.java index 9026954d8..9a8d40af8 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/PermissiveSlicerTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/PermissiveSlicerTest.java @@ -11,11 +11,19 @@ package org.eclipse.equinox.p2.tests.planner; import java.io.File; -import java.util.*; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; import org.eclipse.core.runtime.NullProgressMonitor; import org.eclipse.equinox.internal.p2.director.PermissiveSlicer; -import org.eclipse.equinox.p2.metadata.*; -import org.eclipse.equinox.p2.query.*; +import org.eclipse.equinox.p2.metadata.IInstallableUnit; +import org.eclipse.equinox.p2.metadata.IProvidedCapability; +import org.eclipse.equinox.p2.metadata.IRequirement; +import org.eclipse.equinox.p2.metadata.MetadataFactory; +import org.eclipse.equinox.p2.metadata.VersionRange; +import org.eclipse.equinox.p2.query.IQueryResult; +import org.eclipse.equinox.p2.query.IQueryable; +import org.eclipse.equinox.p2.query.QueryUtil; import org.eclipse.equinox.p2.repository.metadata.IMetadataRepository; import org.eclipse.equinox.p2.tests.AbstractProvisioningTest; @@ -30,7 +38,7 @@ public class PermissiveSlicerTest extends AbstractProvisioningTest { } public void testSliceRCPOut() { - PermissiveSlicer slicer = new PermissiveSlicer(repo, Collections.<String, String> emptyMap(), true, false, true, false, false); + PermissiveSlicer slicer = new PermissiveSlicer(repo, Collections.emptyMap(), true, false, true, false, false); IQueryResult<IInstallableUnit> c = repo.query(QueryUtil.createIUQuery("org.eclipse.rcp.feature.group"), new NullProgressMonitor()); IInstallableUnit iu = c.iterator().next(); IQueryable<IInstallableUnit> result = slicer.slice(new IInstallableUnit[] {iu}, new NullProgressMonitor()); @@ -43,7 +51,7 @@ public class PermissiveSlicerTest extends AbstractProvisioningTest { //Test with and without optional pieces public void testSliceRCPWithOptionalPieces() { - PermissiveSlicer slicer = new PermissiveSlicer(repo, Collections.<String, String> emptyMap(), false, false, true, false, false); + PermissiveSlicer slicer = new PermissiveSlicer(repo, Collections.emptyMap(), false, false, true, false, false); IQueryResult<IInstallableUnit> c = repo.query(QueryUtil.createIUQuery("org.eclipse.rcp.feature.group"), new NullProgressMonitor()); IInstallableUnit iu = c.iterator().next(); IQueryable<IInstallableUnit> result = slicer.slice(new IInstallableUnit[] {iu}, new NullProgressMonitor()); @@ -54,7 +62,7 @@ public class PermissiveSlicerTest extends AbstractProvisioningTest { } public void testSliceRCPWithIgnoringGreed() { - PermissiveSlicer slicer = new PermissiveSlicer(repo, Collections.<String, String> emptyMap(), false, true, true, false, false); + PermissiveSlicer slicer = new PermissiveSlicer(repo, Collections.emptyMap(), false, true, true, false, false); IQueryResult<IInstallableUnit> c = repo.query(QueryUtil.createIUQuery("org.eclipse.rcp.feature.group"), new NullProgressMonitor()); IInstallableUnit iu = c.iterator().next(); IQueryable<IInstallableUnit> result = slicer.slice(new IInstallableUnit[] {iu}, new NullProgressMonitor()); @@ -97,7 +105,7 @@ public class PermissiveSlicerTest extends AbstractProvisioningTest { } public void testExtractPlatformIndependentPieces() { - PermissiveSlicer slicer = new PermissiveSlicer(repo, Collections.<String, String> emptyMap(), true, false, false, false, false); + PermissiveSlicer slicer = new PermissiveSlicer(repo, Collections.emptyMap(), true, false, false, false, false); IQueryResult<IInstallableUnit> c = repo.query(QueryUtil.createIUQuery("org.eclipse.rcp.feature.group"), new NullProgressMonitor()); IInstallableUnit iu = c.iterator().next(); IQueryable<IInstallableUnit> result = slicer.slice(new IInstallableUnit[] {iu}, new NullProgressMonitor()); @@ -115,7 +123,7 @@ public class PermissiveSlicerTest extends AbstractProvisioningTest { IRequirement[] metaReq = createRequiredCapabilities("p2.action", "action1", new VersionRange("[0.0.0, 1.0.0]")); IInstallableUnit a = createIUWithMetaRequirement("A", DEFAULT_VERSION, true, NO_REQUIRES, metaReq); - PermissiveSlicer slicer = new PermissiveSlicer(createTestMetdataRepository(new IInstallableUnit[] {a, act1}), Collections.<String, String> emptyMap(), true, false, false, false, false); + PermissiveSlicer slicer = new PermissiveSlicer(createTestMetdataRepository(new IInstallableUnit[] {a, act1}), Collections.emptyMap(), true, false, false, false, false); IQueryable<IInstallableUnit> result = slicer.slice(new IInstallableUnit[] {a}, new NullProgressMonitor()); assertEquals(1, queryResultSize(result.query(QueryUtil.createIUQuery("Action1"), null))); } @@ -135,7 +143,7 @@ public class PermissiveSlicerTest extends AbstractProvisioningTest { public void testMissingNecessaryPiece() { IRequirement[] req = createRequiredCapabilities("B", "B", new VersionRange("[0.0.0, 1.0.0]")); IInstallableUnit iuA = createIU("A", DEFAULT_VERSION, null, req, NO_PROVIDES, NO_PROPERTIES, null, NO_TP_DATA, true); - PermissiveSlicer slicer = new PermissiveSlicer(createTestMetdataRepository(new IInstallableUnit[] {iuA}), Collections.<String, String> emptyMap(), true, false, false, false, false); + PermissiveSlicer slicer = new PermissiveSlicer(createTestMetdataRepository(new IInstallableUnit[] {iuA}), Collections.emptyMap(), true, false, false, false, false); IQueryable<IInstallableUnit> result = slicer.slice(new IInstallableUnit[] {iuA}, new NullProgressMonitor()); assertNotNull(result); assertNotOK(slicer.getStatus()); @@ -154,7 +162,7 @@ public class PermissiveSlicerTest extends AbstractProvisioningTest { } public void testExtractOnlyPlatformSpecific() { - PermissiveSlicer slicer = new PermissiveSlicer(repo, Collections.<String, String> emptyMap(), true, false, true, false, true); + PermissiveSlicer slicer = new PermissiveSlicer(repo, Collections.emptyMap(), true, false, true, false, true); IQueryResult<IInstallableUnit> c = repo.query(QueryUtil.createIUQuery("org.eclipse.rcp.feature.group"), new NullProgressMonitor()); IInstallableUnit iu = c.iterator().next(); IQueryResult<IInstallableUnit> resultCollector = slicer.slice(new IInstallableUnit[] {iu}, new NullProgressMonitor()).query(QueryUtil.createIUAnyQuery(), new NullProgressMonitor()); diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/EclipseMarkSetProvider.java b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/EclipseMarkSetProvider.java index c64a11ecc..dfac801a1 100644 --- a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/EclipseMarkSetProvider.java +++ b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/EclipseMarkSetProvider.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2010 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 @@ -64,7 +64,7 @@ public class EclipseMarkSetProvider extends MarkSetProvider { private List<Feature> getAllFeatures(Configuration cfg) { if (cfg == null) - return Collections.<Feature> emptyList(); + return Collections.emptyList(); List<Site> sites = cfg.getSites(); ArrayList<Feature> result = new ArrayList<Feature>(); for (Site object : sites) { diff --git a/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/src/org/eclipse/equinox/internal/p2/ui/sdk/scheduler/AutomaticUpdater.java b/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/src/org/eclipse/equinox/internal/p2/ui/sdk/scheduler/AutomaticUpdater.java index 9dcce0422..f43e9b2df 100644 --- a/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/src/org/eclipse/equinox/internal/p2/ui/sdk/scheduler/AutomaticUpdater.java +++ b/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/src/org/eclipse/equinox/internal/p2/ui/sdk/scheduler/AutomaticUpdater.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008, 2017 IBM Corporation and others. + * Copyright (c) 2008, 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 @@ -356,7 +356,7 @@ public class AutomaticUpdater implements IUpdateListener { public Collection<IInstallableUnit> getInstalledIUs() { IProfile profile = getProfileRegistry().getProfile(profileId); if (profile == null) - return Collections.<IInstallableUnit> emptyList(); + return Collections.emptyList(); IQuery<IInstallableUnit> query = new UserVisibleRootQuery(); IQueryResult<IInstallableUnit> queryResult = profile.query(query, null); return queryResult.toUnmodifiableSet(); diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/CategoryElement.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/CategoryElement.java index f3e58cebe..f3030d13f 100644 --- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/CategoryElement.java +++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/CategoryElement.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2015 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 @@ -114,7 +114,7 @@ public class CategoryElement extends RemoteQueriedElement implements IIUElement @Override public Collection<IRequirement> getRequirements() { if (ius == null || ius.isEmpty()) - return Collections.<IRequirement> emptyList(); + return Collections.emptyList(); if (requirements == null) { if (ius.size() == 1) requirements = getIU().getRequirements(); diff --git a/bundles/org.eclipse.equinox.p2.updatechecker/src/org/eclipse/equinox/internal/p2/updatechecker/UpdateChecker.java b/bundles/org.eclipse.equinox.p2.updatechecker/src/org/eclipse/equinox/internal/p2/updatechecker/UpdateChecker.java index 8fe527d5f..3f0590012 100644 --- a/bundles/org.eclipse.equinox.p2.updatechecker/src/org/eclipse/equinox/internal/p2/updatechecker/UpdateChecker.java +++ b/bundles/org.eclipse.equinox.p2.updatechecker/src/org/eclipse/equinox/internal/p2/updatechecker/UpdateChecker.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 @@ -122,7 +122,7 @@ public class UpdateChecker implements IUpdateChecker { IProfile profile = getProfileRegistry().getProfile(profileId); ArrayList<IInstallableUnit> iusWithUpdates = new ArrayList<>(); if (profile == null) - return Collections.<IInstallableUnit> emptyList(); + return Collections.emptyList(); ProvisioningContext context = new ProvisioningContext(agent); context.setMetadataRepositories(getAvailableRepositories()); if (query == null) diff --git a/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/SiteXMLAction.java b/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/SiteXMLAction.java index 7f5329c45..43c87de35 100644 --- a/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/SiteXMLAction.java +++ b/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/SiteXMLAction.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008, 2017 Code 9 and others. All rights reserved. This + * Copyright (c) 2008, 2018 Code 9 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 http://www.eclipse.org/legal/epl-v10.html @@ -270,7 +270,7 @@ public class SiteXMLAction extends AbstractPublisherAction { String expression = siteIU.getQueryExpression(); Object[] params = siteIU.getQueryParams(); if (id == null && (type == null || expression == null)) - return Collections.<IInstallableUnit> emptyList(); + return Collections.emptyList(); IQuery<IInstallableUnit> query = null; if (id != null) { VersionRange vRange = VersionRange.create(range); @@ -280,7 +280,7 @@ public class SiteXMLAction extends AbstractPublisherAction { } else if (type.equals("match")) //$NON-NLS-1$ query = QueryUtil.createMatchQuery(expression, params); if (query == null) - return Collections.<IInstallableUnit> emptyList(); + return Collections.emptyList(); IQueryResult<IInstallableUnit> queryResult = results.query(query, null); if (queryResult.isEmpty()) queryResult = publisherInfo.getMetadataRepository().query(query, null); @@ -629,13 +629,13 @@ public class SiteXMLAction extends AbstractPublisherAction { String categoryId = buildCategoryId(category.getName()); cat.setId(categoryId); if (categoryVersion == null) - cat.setVersion(Version.createOSGi(1, 0, 0, versionSuffixGenerator.generateSuffix(childrenIUs, Collections.<IVersionedId> emptyList()))); + cat.setVersion(Version.createOSGi(1, 0, 0, versionSuffixGenerator.generateSuffix(childrenIUs, Collections.emptyList()))); else { if (categoryVersion.isOSGiCompatible()) { org.osgi.framework.Version osgiVersion = PublisherHelper.toOSGiVersion(categoryVersion); String qualifier = osgiVersion.getQualifier(); if (qualifier.endsWith(QUALIFIER)) { - String suffix = versionSuffixGenerator.generateSuffix(childrenIUs, Collections.<IVersionedId> emptyList()); + String suffix = versionSuffixGenerator.generateSuffix(childrenIUs, Collections.emptyList()); qualifier = qualifier.substring(0, qualifier.length() - 9) + suffix; categoryVersion = Version.createOSGi(osgiVersion.getMajor(), osgiVersion.getMinor(), osgiVersion.getMicro(), qualifier); } |