Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Kurtakov2017-08-17 12:12:48 -0400
committerAlexander Kurtakov2017-08-17 12:12:48 -0400
commit102c8038d5de2c3a0511eb13ebf947f18f046183 (patch)
tree7951ad1cd7a292bbb7edcba5c4a39a9deb814d8f
parent33378b82c8015f78d19cb349ffcc2f482daa0cd6 (diff)
downloadrt.equinox.p2-102c8038d5de2c3a0511eb13ebf947f18f046183.tar.gz
rt.equinox.p2-102c8038d5de2c3a0511eb13ebf947f18f046183.tar.xz
rt.equinox.p2-102c8038d5de2c3a0511eb13ebf947f18f046183.zip
Bug 521075 - Move o.e.equinox.p2.director.app to Java 8 I20170818-0100I20170818-0040I20170817-2140I20170817-2000
Bump minor, add missing Override annotations, remove duplicate type declarations, try-with-resources, Change-Id: I49d32d9227c84b3c2b3a5d82e0e9ebfe74f20ac7 Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
-rw-r--r--bundles/org.eclipse.equinox.p2.director.app/.classpath2
-rw-r--r--bundles/org.eclipse.equinox.p2.director.app/.settings/org.eclipse.jdt.core.prefs23
-rw-r--r--bundles/org.eclipse.equinox.p2.director.app/META-INF/MANIFEST.MF4
-rw-r--r--bundles/org.eclipse.equinox.p2.director.app/pom.xml2
-rw-r--r--bundles/org.eclipse.equinox.p2.director.app/src/org/eclipse/equinox/internal/p2/director/app/Activator.java4
-rw-r--r--bundles/org.eclipse.equinox.p2.director.app/src/org/eclipse/equinox/internal/p2/director/app/DirectorApplication.java62
-rw-r--r--bundles/org.eclipse.equinox.p2.director.app/src/org/eclipse/equinox/internal/p2/director/app/IUListFormatter.java4
-rw-r--r--bundles/org.eclipse.equinox.p2.director.app/src/org/eclipse/equinox/internal/p2/director/app/PrettyQuery.java5
-rw-r--r--bundles/org.eclipse.equinox.p2.director.app/src_ant/org/eclipse/equinox/p2/director/app/ant/DirectorTask.java23
9 files changed, 62 insertions, 67 deletions
diff --git a/bundles/org.eclipse.equinox.p2.director.app/.classpath b/bundles/org.eclipse.equinox.p2.director.app/.classpath
index 834ea833e..030607499 100644
--- a/bundles/org.eclipse.equinox.p2.director.app/.classpath
+++ b/bundles/org.eclipse.equinox.p2.director.app/.classpath
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" output="bin_ant" path="src_ant"/>
diff --git a/bundles/org.eclipse.equinox.p2.director.app/.settings/org.eclipse.jdt.core.prefs b/bundles/org.eclipse.equinox.p2.director.app/.settings/org.eclipse.jdt.core.prefs
index 9b504b4cd..edf2224c7 100644
--- a/bundles/org.eclipse.equinox.p2.director.app/.settings/org.eclipse.jdt.core.prefs
+++ b/bundles/org.eclipse.equinox.p2.director.app/.settings/org.eclipse.jdt.core.prefs
@@ -10,13 +10,16 @@ org.eclipse.jdt.core.classpath.multipleOutputLocations=enabled
org.eclipse.jdt.core.compiler.annotation.inheritNullAnnotations=disabled
org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore
org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull
+org.eclipse.jdt.core.compiler.annotation.nonnull.secondary=
org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault
+org.eclipse.jdt.core.compiler.annotation.nonnullbydefault.secondary=
org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable
+org.eclipse.jdt.core.compiler.annotation.nullable.secondary=
org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
-org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
@@ -33,7 +36,7 @@ org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=
org.eclipse.jdt.core.compiler.problem.discouragedReference=error
org.eclipse.jdt.core.compiler.problem.emptyStatement=warning
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
-org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=ignore
+org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=warning
org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled
org.eclipse.jdt.core.compiler.problem.fieldHiding=warning
@@ -50,7 +53,7 @@ org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=private
org.eclipse.jdt.core.compiler.problem.localVariableHiding=warning
org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
org.eclipse.jdt.core.compiler.problem.missingDefaultCase=ignore
-org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore
+org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=warning
org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=disabled
org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=warning
org.eclipse.jdt.core.compiler.problem.missingJavadocComments=ignore
@@ -59,7 +62,7 @@ org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=public
org.eclipse.jdt.core.compiler.problem.missingJavadocTags=ignore
org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=enabled
org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=public
-org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=warning
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled
org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore
@@ -67,19 +70,21 @@ org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=warning
org.eclipse.jdt.core.compiler.problem.nonnullParameterAnnotationDropped=warning
+org.eclipse.jdt.core.compiler.problem.nonnullTypeVariableFromLegacyInvocation=warning
org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error
org.eclipse.jdt.core.compiler.problem.nullReference=warning
org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error
org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning
org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
+org.eclipse.jdt.core.compiler.problem.pessimisticNullAnalysisForFreeTypeVariables=warning
org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning
org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore
org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore
org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning
org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning
org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore
-org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=ignore
+org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=warning
org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore
org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore
@@ -95,6 +100,9 @@ org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning
org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=warning
org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.unlikelyCollectionMethodArgumentType=warning
+org.eclipse.jdt.core.compiler.problem.unlikelyCollectionMethodArgumentTypeStrict=disabled
+org.eclipse.jdt.core.compiler.problem.unlikelyEqualsArgumentType=info
org.eclipse.jdt.core.compiler.problem.unnecessaryElse=warning
org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning
org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
@@ -102,6 +110,7 @@ org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=warning
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=enabled
+org.eclipse.jdt.core.compiler.problem.unusedExceptionParameter=ignore
org.eclipse.jdt.core.compiler.problem.unusedImport=error
org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
@@ -114,7 +123,7 @@ org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=error
org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore
org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
-org.eclipse.jdt.core.compiler.source=1.5
+org.eclipse.jdt.core.compiler.source=1.8
org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16
diff --git a/bundles/org.eclipse.equinox.p2.director.app/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.p2.director.app/META-INF/MANIFEST.MF
index e663b150a..ccb5b56e1 100644
--- a/bundles/org.eclipse.equinox.p2.director.app/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.equinox.p2.director.app/META-INF/MANIFEST.MF
@@ -2,13 +2,13 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.equinox.p2.director.app;singleton:=true
-Bundle-Version: 1.0.500.qualifier
+Bundle-Version: 1.1.0.qualifier
Bundle-Activator: org.eclipse.equinox.internal.p2.director.app.Activator
Bundle-Vendor: %providerName
Bundle-Localization: plugin
Export-Package: org.eclipse.equinox.internal.p2.director.app;x-internal:=true
Require-Bundle: org.eclipse.equinox.common;bundle-version="[3.5.0,4.0.0)"
-Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Bundle-ActivationPolicy: lazy
Import-Package: org.eclipse.equinox.app,
org.eclipse.equinox.internal.p2.core.helpers,
diff --git a/bundles/org.eclipse.equinox.p2.director.app/pom.xml b/bundles/org.eclipse.equinox.p2.director.app/pom.xml
index 3eeb223c5..d3ccfde3c 100644
--- a/bundles/org.eclipse.equinox.p2.director.app/pom.xml
+++ b/bundles/org.eclipse.equinox.p2.director.app/pom.xml
@@ -9,6 +9,6 @@
</parent>
<groupId>org.eclipse.equinox</groupId>
<artifactId>org.eclipse.equinox.p2.director.app</artifactId>
- <version>1.0.500-SNAPSHOT</version>
+ <version>1.1.0-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
</project>
diff --git a/bundles/org.eclipse.equinox.p2.director.app/src/org/eclipse/equinox/internal/p2/director/app/Activator.java b/bundles/org.eclipse.equinox.p2.director.app/src/org/eclipse/equinox/internal/p2/director/app/Activator.java
index de0403a9a..742aa2e81 100644
--- a/bundles/org.eclipse.equinox.p2.director.app/src/org/eclipse/equinox/internal/p2/director/app/Activator.java
+++ b/bundles/org.eclipse.equinox.p2.director.app/src/org/eclipse/equinox/internal/p2/director/app/Activator.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 IBM Corporation and others. All rights reserved. This
+ * Copyright (c) 2007, 2017 IBM Corporation and others. All rights reserved. This
* program and the accompanying materials are made available under the terms of
* the Eclipse Public License v1.0 which accompanies this distribution, and is
* available at http://www.eclipse.org/legal/epl-v10.html
@@ -19,10 +19,12 @@ public class Activator implements BundleActivator {
return bundleContext;
}
+ @Override
public void start(BundleContext context) throws Exception {
bundleContext = context;
}
+ @Override
public void stop(BundleContext context) throws Exception {
bundleContext = null;
}
diff --git a/bundles/org.eclipse.equinox.p2.director.app/src/org/eclipse/equinox/internal/p2/director/app/DirectorApplication.java b/bundles/org.eclipse.equinox.p2.director.app/src/org/eclipse/equinox/internal/p2/director/app/DirectorApplication.java
index c301cea55..03de3cbdf 100644
--- a/bundles/org.eclipse.equinox.p2.director.app/src/org/eclipse/equinox/internal/p2/director/app/DirectorApplication.java
+++ b/bundles/org.eclipse.equinox.p2.director.app/src/org/eclipse/equinox/internal/p2/director/app/DirectorApplication.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2016 IBM Corporation and others.
+ * Copyright (c) 2007, 2017 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -86,6 +86,7 @@ public class DirectorApplication implements IApplication, ProvisioningListener {
Assert.isNotNull(location);
}
+ @Override
public IQueryResult<IInstallableUnit> query(IQuery<IInstallableUnit> query, IProgressMonitor monitor) {
return getInstallableUnits(location, query, monitor);
}
@@ -210,17 +211,17 @@ public class DirectorApplication implements IApplication, ProvisioningListener {
String[] roots = StringHelper.getArrayFromString(arg, ',');
for (int i = 0; i < roots.length; ++i) {
if (roots[i].equalsIgnoreCase(LIST_GROUPS_SHORTCUT)) {
- vnames.add(new PrettyQuery<IInstallableUnit>(QueryUtil.createIUGroupQuery(), "All groups")); //$NON-NLS-1$
+ vnames.add(new PrettyQuery<>(QueryUtil.createIUGroupQuery(), "All groups")); //$NON-NLS-1$
continue;
}
if (roots[i].startsWith(QUERY_SEPARATOR) || roots[i].startsWith(QUERY_SEPARATOR_SMALL)) {
String queryString = roots[i].substring(2);
- vnames.add(new PrettyQuery<IInstallableUnit>(QueryUtil.createQuery(queryString, new Object[0]), queryString));
+ vnames.add(new PrettyQuery<>(QueryUtil.createQuery(queryString, new Object[0]), queryString));
continue;
}
IVersionedId vId = VersionedId.parse(roots[i]);
Version v = vId.getVersion();
- IQuery<IInstallableUnit> query = new PrettyQuery<IInstallableUnit>(QueryUtil.createIUQuery(vId.getId(), Version.emptyVersion.equals(v) ? VersionRange.emptyRange : new VersionRange(v, true, v, true)), roots[i]);
+ IQuery<IInstallableUnit> query = new PrettyQuery<>(QueryUtil.createIUQuery(vId.getId(), Version.emptyVersion.equals(v) ? VersionRange.emptyRange : new VersionRange(v, true, v, true)), roots[i]);
vnames.add(query);
}
}
@@ -239,11 +240,11 @@ public class DirectorApplication implements IApplication, ProvisioningListener {
private URI[] artifactReposForRemoval;
private URI[] metadataReposForRemoval;
- private final List<URI> artifactRepositoryLocations = new ArrayList<URI>();
- private final List<URI> metadataRepositoryLocations = new ArrayList<URI>();
- private final List<IQuery<IInstallableUnit>> rootsToInstall = new ArrayList<IQuery<IInstallableUnit>>();
- private final List<IQuery<IInstallableUnit>> rootsToUninstall = new ArrayList<IQuery<IInstallableUnit>>();
- private final List<IQuery<IInstallableUnit>> rootsToList = new ArrayList<IQuery<IInstallableUnit>>();
+ private final List<URI> artifactRepositoryLocations = new ArrayList<>();
+ private final List<URI> metadataRepositoryLocations = new ArrayList<>();
+ private final List<IQuery<IInstallableUnit>> rootsToInstall = new ArrayList<>();
+ private final List<IQuery<IInstallableUnit>> rootsToUninstall = new ArrayList<>();
+ private final List<IQuery<IInstallableUnit>> rootsToList = new ArrayList<>();
private File bundlePool = null;
private File destination;
@@ -302,20 +303,11 @@ public class DirectorApplication implements IApplication, ProvisioningListener {
return null;
}
Properties properties = new Properties();
- InputStream input = null;
- try {
- input = new BufferedInputStream(new FileInputStream(file));
+ try (InputStream input = new BufferedInputStream(new FileInputStream(file))){
properties.load(input);
} catch (IOException e) {
logFailure(new Status(IStatus.ERROR, Activator.ID, NLS.bind(Messages.Problem_loading_file, file.getAbsolutePath()), e));
return null;
- } finally {
- if (input != null)
- try {
- input.close();
- } catch (IOException e) {
- // ignore
- }
}
return properties;
}
@@ -337,7 +329,7 @@ public class DirectorApplication implements IApplication, ProvisioningListener {
// id is the IU id
// keyword is either "key" or "value"
// uniqueNumber is used to group keys and values together
- Set<String> alreadyProcessed = new HashSet<String>();
+ Set<String> alreadyProcessed = new HashSet<>();
for (Iterator<Object> iter = properties.keySet().iterator(); iter.hasNext();) {
String line = (String) iter.next();
int index = line.lastIndexOf('.');
@@ -420,14 +412,14 @@ public class DirectorApplication implements IApplication, ProvisioningListener {
if (top == 0)
return getInstallableUnits(null, query, nullMonitor);
- List<IQueryable<IInstallableUnit>> locationQueryables = new ArrayList<IQueryable<IInstallableUnit>>(top);
+ List<IQueryable<IInstallableUnit>> locationQueryables = new ArrayList<>(top);
for (int i = 0; i < top; i++)
locationQueryables.add(new LocationQueryable(metadataRepositoryLocations.get(i)));
return QueryUtil.compoundQueryable(locationQueryables).query(query, nullMonitor);
}
private Collection<IInstallableUnit> collectRoots(IProfile profile, List<IQuery<IInstallableUnit>> rootNames, boolean forInstall) throws CoreException {
- ArrayList<IInstallableUnit> allRoots = new ArrayList<IInstallableUnit>();
+ ArrayList<IInstallableUnit> allRoots = new ArrayList<>();
for (IQuery<IInstallableUnit> rootQuery : rootNames) {
IQueryResult<IInstallableUnit> roots = null;
if (forInstall)
@@ -463,7 +455,7 @@ public class DirectorApplication implements IApplication, ProvisioningListener {
}
private String getEnvironmentProperty() {
- HashMap<String, String> values = new HashMap<String, String>();
+ HashMap<String, String> values = new HashMap<>();
if (os != null)
values.put("osgi.os", os); //$NON-NLS-1$
if (nl != null)
@@ -492,7 +484,7 @@ public class DirectorApplication implements IApplication, ProvisioningListener {
if (flavor == null)
flavor = System.getProperty("eclipse.p2.configurationFlavor", FLAVOR_DEFAULT); //$NON-NLS-1$
- Map<String, String> props = new HashMap<String, String>();
+ Map<String, String> props = new HashMap<>();
props.put(IProfile.PROP_INSTALL_FOLDER, destination.toString());
if (bundlePool == null)
props.put(IProfile.PROP_CACHE, sharedLocation == null ? destination.getAbsolutePath() : sharedLocation.getAbsolutePath());
@@ -632,21 +624,12 @@ public class DirectorApplication implements IApplication, ProvisioningListener {
if (profileId == null) {
if (destination != null) {
File configIni = new File(destination, "configuration/config.ini"); //$NON-NLS-1$
- InputStream in = null;
- try {
- Properties ciProps = new Properties();
- in = new BufferedInputStream(new FileInputStream(configIni));
+ Properties ciProps = new Properties();
+ try (InputStream in = new BufferedInputStream(new FileInputStream(configIni));) {
ciProps.load(in);
profileId = ciProps.getProperty(PROP_P2_PROFILE);
} catch (IOException e) {
// Ignore
- } finally {
- if (in != null)
- try {
- in.close();
- } catch (IOException e) {
- // Ignore;
- }
}
if (profileId == null)
profileId = destination.toString();
@@ -685,6 +668,7 @@ public class DirectorApplication implements IApplication, ProvisioningListener {
* Using the event bus to detect whether or not a repository was added in a touchpoint action.
* If it was, then (if it exists) remove it from our list of repos to remove after we complete our install.
*/
+ @Override
public void notify(EventObject o) {
if (!(o instanceof RepositoryEvent))
return;
@@ -755,7 +739,7 @@ public class DirectorApplication implements IApplication, ProvisioningListener {
if (metadataRepositoryLocations.isEmpty())
missingArgument("metadataRepository"); //$NON-NLS-1$
- ArrayList<IInstallableUnit> allRoots = new ArrayList<IInstallableUnit>();
+ ArrayList<IInstallableUnit> allRoots = new ArrayList<>();
if (rootsToList.size() == 0) {
Iterator<IInstallableUnit> roots = collectRootIUs(QueryUtil.createIUAnyQuery()).iterator();
while (roots.hasNext())
@@ -1302,6 +1286,7 @@ public class DirectorApplication implements IApplication, ProvisioningListener {
return PlanExecutionHelper.executePlan(result, engine, context, new NullProgressMonitor());
}
+ @Override
public Object start(IApplicationContext context) throws Exception {
return run((String[]) context.getArguments().get("application.args")); //$NON-NLS-1$
}
@@ -1362,6 +1347,7 @@ public class DirectorApplication implements IApplication, ProvisioningListener {
throw new CoreException(new MultiStatus(org.eclipse.equinox.internal.p2.director.app.Activator.ID, IStatus.ERROR, new IStatus[] {status}, NLS.bind(Messages.Cant_change_roaming, profile.getProfileId()), null));
}
+ @Override
public void stop() {
IProvisioningEventBus eventBus = (IProvisioningEventBus) targetAgent.getService(IProvisioningEventBus.SERVICE_NAME);
if (eventBus != null)
@@ -1377,7 +1363,7 @@ public class DirectorApplication implements IApplication, ProvisioningListener {
private void performListInstalledRoots() throws CoreException {
IProfile profile = initializeProfile();
IQueryResult<IInstallableUnit> roots = profile.query(new UserVisibleRootQuery(), null);
- Set<IInstallableUnit> sorted = new TreeSet<IInstallableUnit>(roots.toUnmodifiableSet());
+ Set<IInstallableUnit> sorted = new TreeSet<>(roots.toUnmodifiableSet());
for (IInstallableUnit iu : sorted)
System.out.println(iu.getId() + '/' + iu.getVersion());
}
@@ -1387,7 +1373,7 @@ public class DirectorApplication implements IApplication, ProvisioningListener {
IProfileRegistry registry = (IProfileRegistry) targetAgent.getService(IProfileRegistry.SERVICE_NAME);
Map<String, String> tags = registry.getProfileStateProperties(profile.getProfileId(), IProfile.STATE_PROP_TAG);
//Sort the tags from the most recent to the oldest
- List<String> timeStamps = new ArrayList<String>(tags.keySet());
+ List<String> timeStamps = new ArrayList<>(tags.keySet());
Collections.sort(timeStamps, Collections.reverseOrder());
for (String timestamp : timeStamps) {
System.out.println(tags.get(timestamp));
diff --git a/bundles/org.eclipse.equinox.p2.director.app/src/org/eclipse/equinox/internal/p2/director/app/IUListFormatter.java b/bundles/org.eclipse.equinox.p2.director.app/src/org/eclipse/equinox/internal/p2/director/app/IUListFormatter.java
index 67988f4fa..387a32a5f 100644
--- a/bundles/org.eclipse.equinox.p2.director.app/src/org/eclipse/equinox/internal/p2/director/app/IUListFormatter.java
+++ b/bundles/org.eclipse.equinox.p2.director.app/src/org/eclipse/equinox/internal/p2/director/app/IUListFormatter.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2014 SAP AG and others.
+ * Copyright (c) 2014, 2017 SAP AG 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
@@ -77,7 +77,7 @@ public class IUListFormatter {
* Finds all IU properties in the format string
*/
private static Collection<String> parse(String string) {
- Set<String> properties = new HashSet<String>(5);
+ Set<String> properties = new HashSet<>(5);
int start = 0;
while (start < string.length() && (start = string.indexOf(PREFIX, start)) > -1) {
int end = string.indexOf('}', start + PREFIX.length());
diff --git a/bundles/org.eclipse.equinox.p2.director.app/src/org/eclipse/equinox/internal/p2/director/app/PrettyQuery.java b/bundles/org.eclipse.equinox.p2.director.app/src/org/eclipse/equinox/internal/p2/director/app/PrettyQuery.java
index 3dd931aa7..c688aa1e1 100644
--- a/bundles/org.eclipse.equinox.p2.director.app/src/org/eclipse/equinox/internal/p2/director/app/PrettyQuery.java
+++ b/bundles/org.eclipse.equinox.p2.director.app/src/org/eclipse/equinox/internal/p2/director/app/PrettyQuery.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2011 Sonatype, Inc. and others.
+ * Copyright (c) 2011, 2017 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
@@ -27,14 +27,17 @@ public class PrettyQuery<T> implements IQuery<T> {
userString = userReadable;
}
+ @Override
public IQueryResult<T> perform(Iterator<T> iterator) {
return decorated.perform(iterator);
}
+ @Override
public IExpression getExpression() {
return decorated.getExpression();
}
+ @Override
public String toString() {
if (userString != null)
return userString;
diff --git a/bundles/org.eclipse.equinox.p2.director.app/src_ant/org/eclipse/equinox/p2/director/app/ant/DirectorTask.java b/bundles/org.eclipse.equinox.p2.director.app/src_ant/org/eclipse/equinox/p2/director/app/ant/DirectorTask.java
index d2c5aeadd..32110226a 100644
--- a/bundles/org.eclipse.equinox.p2.director.app/src_ant/org/eclipse/equinox/p2/director/app/ant/DirectorTask.java
+++ b/bundles/org.eclipse.equinox.p2.director.app/src_ant/org/eclipse/equinox/p2/director/app/ant/DirectorTask.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2015 IBM Corporation and others.
+ * Copyright (c) 2007, 2017 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -40,7 +40,7 @@ public class DirectorTask extends Task implements ILog {
private String extraArguments;
private File destination, bundlePool, agentLocation;
private URI metadataRepository, artifactRepository;
- private List<IUDescription> ius = new ArrayList<IUDescription>();
+ private List<IUDescription> ius = new ArrayList<>();
private String outputProperty;
private StringBuffer outputBuffer = null;
private File logFile = null;
@@ -67,6 +67,7 @@ public class DirectorTask extends Task implements ILog {
* (non-Javadoc)
* @see org.apache.tools.ant.Task#execute()
*/
+ @Override
public void execute() throws BuildException {
Object result = null;
try {
@@ -94,7 +95,7 @@ public class DirectorTask extends Task implements ILog {
}
private String[] getArguments() {
- List<String> result = new ArrayList<String>();
+ List<String> result = new ArrayList<>();
if (roaming)
result.add("-roaming"); //$NON-NLS-1$
if (profile != null) {
@@ -249,6 +250,7 @@ public class DirectorTask extends Task implements ILog {
agentLocation = new File(value);
}
+ @Override
public void log(String msg) {
if (outputBuffer != null) {
outputBuffer.append(msg);
@@ -258,6 +260,7 @@ public class DirectorTask extends Task implements ILog {
super.log(msg, Project.MSG_INFO);
}
+ @Override
public void log(IStatus status) {
log(0, status);
if (status.isMultiStatus()) {
@@ -294,21 +297,12 @@ public class DirectorTask extends Task implements ILog {
if (parentFile != null && !parentFile.exists())
parentFile.mkdirs();
- FileWriter writer = null;
- try {
- writer = new FileWriter(logFile);
+ try (FileWriter writer = new FileWriter(logFile)) {
+
writer.write(logString);
} catch (IOException e) {
getProject().log(NLS.bind(Messages.unableToWriteLogFile, logFile.getAbsolutePath()), e, Project.MSG_WARN);
- } finally {
- if (writer != null) {
- try {
- writer.close();
- } catch (IOException e) {
- //ignore
- }
- }
}
}
}
@@ -326,6 +320,7 @@ public class DirectorTask extends Task implements ILog {
}
}
+ @Override
public void close() {
// ILog#close(), nothing to do here
}

Back to the top