Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Kurtakov2017-10-09 02:51:29 -0400
committerAlexander Kurtakov2017-10-09 02:51:29 -0400
commitf6a067057b657e611b25a467de21e6a625a02c32 (patch)
treee2d3abf163e3acf2fefe4623dd9a97a651b13809
parenta64ad46b0c7bd1d48664b01abc05fe16156a0a85 (diff)
downloadrt.equinox.p2-f6a067057b657e611b25a467de21e6a625a02c32.tar.gz
rt.equinox.p2-f6a067057b657e611b25a467de21e6a625a02c32.tar.xz
rt.equinox.p2-f6a067057b657e611b25a467de21e6a625a02c32.zip
Bug 525734 - Move reconciler.dropins bundle to Java 8
* Bump BREE. * Bump minor version. * Remove redundant type arguments. * Try-with-resources. * Lambda conversion. * Add missing Override annotations. Change-Id: I67445ed3433f2034d1b21059c0dea2c699612ab6 Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
-rw-r--r--bundles/org.eclipse.equinox.p2.reconciler.dropins/.classpath2
-rw-r--r--bundles/org.eclipse.equinox.p2.reconciler.dropins/.settings/org.eclipse.jdt.core.prefs65
-rw-r--r--bundles/org.eclipse.equinox.p2.reconciler.dropins/META-INF/MANIFEST.MF4
-rw-r--r--bundles/org.eclipse.equinox.p2.reconciler.dropins/pom.xml2
-rw-r--r--bundles/org.eclipse.equinox.p2.reconciler.dropins/src/org/eclipse/equinox/internal/p2/reconciler/dropins/Activator.java59
-rw-r--r--bundles/org.eclipse.equinox.p2.reconciler.dropins/src/org/eclipse/equinox/internal/p2/reconciler/dropins/Application.java4
-rw-r--r--bundles/org.eclipse.equinox.p2.reconciler.dropins/src/org/eclipse/equinox/internal/p2/reconciler/dropins/DropinsRepositoryListener.java25
-rw-r--r--bundles/org.eclipse.equinox.p2.reconciler.dropins/src/org/eclipse/equinox/internal/p2/reconciler/dropins/PlatformXmlListener.java36
-rw-r--r--bundles/org.eclipse.equinox.p2.reconciler.dropins/src/org/eclipse/equinox/internal/p2/reconciler/dropins/ProfileSynchronizer.java68
9 files changed, 136 insertions, 129 deletions
diff --git a/bundles/org.eclipse.equinox.p2.reconciler.dropins/.classpath b/bundles/org.eclipse.equinox.p2.reconciler.dropins/.classpath
index 64c5e31b7..eca7bdba8 100644
--- a/bundles/org.eclipse.equinox.p2.reconciler.dropins/.classpath
+++ b/bundles/org.eclipse.equinox.p2.reconciler.dropins/.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="output" path="bin"/>
diff --git a/bundles/org.eclipse.equinox.p2.reconciler.dropins/.settings/org.eclipse.jdt.core.prefs b/bundles/org.eclipse.equinox.p2.reconciler.dropins/.settings/org.eclipse.jdt.core.prefs
index d50f6a296..ac7c5cd89 100644
--- a/bundles/org.eclipse.equinox.p2.reconciler.dropins/.settings/org.eclipse.jdt.core.prefs
+++ b/bundles/org.eclipse.equinox.p2.reconciler.dropins/.settings/org.eclipse.jdt.core.prefs
@@ -7,29 +7,46 @@ org.eclipse.jdt.core.builder.resourceCopyExclusionFilter=*.launch
org.eclipse.jdt.core.circularClasspath=error
org.eclipse.jdt.core.classpath.exclusionPatterns=enabled
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.methodParameters=do not generate
+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
org.eclipse.jdt.core.compiler.doc.comment.support=enabled
org.eclipse.jdt.core.compiler.maxProblemPerUnit=1000
+org.eclipse.jdt.core.compiler.problem.APILeak=warning
org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
+org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning
+org.eclipse.jdt.core.compiler.problem.deadCode=warning
org.eclipse.jdt.core.compiler.problem.deprecation=warning
org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=enabled
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=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
org.eclipse.jdt.core.compiler.problem.finalParameterBound=ignore
org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
+org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled
org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=ignore
org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=warning
@@ -37,41 +54,79 @@ org.eclipse.jdt.core.compiler.problem.invalidJavadoc=error
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.missingDeprecatedAnnotation=ignore
+org.eclipse.jdt.core.compiler.problem.missingDefaultCase=ignore
+org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=warning
+org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=disabled
+org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore
org.eclipse.jdt.core.compiler.problem.missingJavadocComments=ignore
org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=enabled
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
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=warning
+org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=warning
+org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
+org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore
org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
+org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled
org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
+org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=disabled
org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=warning
+org.eclipse.jdt.core.compiler.problem.terminalDeprecation=warning
org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
+org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=enabled
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
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
+org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore
org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
+org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=enabled
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=enabled
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.reconciler.dropins/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.p2.reconciler.dropins/META-INF/MANIFEST.MF
index 94174b94b..be78489e5 100644
--- a/bundles/org.eclipse.equinox.p2.reconciler.dropins/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.equinox.p2.reconciler.dropins/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.equinox.p2.reconciler.dropins;singleton:=true
-Bundle-Version: 1.1.400.qualifier
+Bundle-Version: 1.2.0.qualifier
Bundle-Activator: org.eclipse.equinox.internal.p2.reconciler.dropins.Activator
Bundle-Vendor: %providerName
Bundle-Localization: plugin
@@ -10,7 +10,7 @@ Export-Package: org.eclipse.equinox.internal.p2.reconciler.dropins;x-internal:=t
Require-Bundle: org.eclipse.equinox.common;bundle-version="[3.5.0,4.0.0)",
org.eclipse.equinox.p2.touchpoint.eclipse;bundle-version="1.0.0",
org.eclipse.equinox.p2.metadata
-Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Import-Package: org.eclipse.equinox.app;version="1.0.0",
org.eclipse.equinox.internal.p2.artifact.repository,
org.eclipse.equinox.internal.p2.core.helpers,
diff --git a/bundles/org.eclipse.equinox.p2.reconciler.dropins/pom.xml b/bundles/org.eclipse.equinox.p2.reconciler.dropins/pom.xml
index 60856fd16..d734adaa4 100644
--- a/bundles/org.eclipse.equinox.p2.reconciler.dropins/pom.xml
+++ b/bundles/org.eclipse.equinox.p2.reconciler.dropins/pom.xml
@@ -9,6 +9,6 @@
</parent>
<groupId>org.eclipse.equinox</groupId>
<artifactId>org.eclipse.equinox.p2.reconciler.dropins</artifactId>
- <version>1.1.400-SNAPSHOT</version>
+ <version>1.2.0-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
</project>
diff --git a/bundles/org.eclipse.equinox.p2.reconciler.dropins/src/org/eclipse/equinox/internal/p2/reconciler/dropins/Activator.java b/bundles/org.eclipse.equinox.p2.reconciler.dropins/src/org/eclipse/equinox/internal/p2/reconciler/dropins/Activator.java
index 271b61bc0..5276e9069 100644
--- a/bundles/org.eclipse.equinox.p2.reconciler.dropins/src/org/eclipse/equinox/internal/p2/reconciler/dropins/Activator.java
+++ b/bundles/org.eclipse.equinox.p2.reconciler.dropins/src/org/eclipse/equinox/internal/p2/reconciler/dropins/Activator.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2015 IBM Corporation and others. All rights reserved.
+ * 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
@@ -52,7 +52,7 @@ public class Activator implements BundleActivator {
private static final String EXT_LINK = ".link"; //$NON-NLS-1$
public static final String TRACING_PREFIX = "[reconciler] "; //$NON-NLS-1$
private static BundleContext bundleContext;
- private final static Set<IMetadataRepository> repositories = new HashSet<IMetadataRepository>();
+ private final static Set<IMetadataRepository> repositories = new HashSet<>();
private Collection<File> filesToCheck = null;
/**
@@ -72,7 +72,7 @@ public class Activator implements BundleActivator {
ExtensionLocationMetadataRepositoryFactory factory = new ExtensionLocationMetadataRepositoryFactory();
factory.setAgent(agent);
// always compress repositories that we are creating.
- Map<String, String> repositoryProperties = new HashMap<String, String>();
+ Map<String, String> repositoryProperties = new HashMap<>();
repositoryProperties.put(IRepository.PROP_COMPRESSED, Boolean.TRUE.toString());
if (properties != null)
repositoryProperties.putAll(properties);
@@ -119,7 +119,7 @@ public class Activator implements BundleActivator {
ExtensionLocationArtifactRepositoryFactory factory = new ExtensionLocationArtifactRepositoryFactory();
factory.setAgent(agent);
// always compress repositories that we are creating.
- Map<String, String> repositoryProperties = new HashMap<String, String>();
+ Map<String, String> repositoryProperties = new HashMap<>();
repositoryProperties.put(IRepository.PROP_COMPRESSED, Boolean.TRUE.toString());
if (properties != null)
repositoryProperties.putAll(properties);
@@ -153,9 +153,7 @@ public class Activator implements BundleActivator {
return repositories;
}
- /* (non-Javadoc)
- * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
- */
+ @Override
public void start(BundleContext context) throws Exception {
bundleContext = context;
@@ -201,15 +199,10 @@ public class Activator implements BundleActivator {
// write shared configuration
Properties props = new Properties();
try {
- OutputStream os = null;
- try {
- os = new BufferedOutputStream(new FileOutputStream(configIni));
+ try (OutputStream os = new BufferedOutputStream(new FileOutputStream(configIni))) {
String externalForm = PathUtil.makeRelative(parentConfiguration.toURL().toExternalForm(), getOSGiInstallArea()).replace('\\', '/');
props.put("osgi.sharedConfiguration.area", externalForm); //$NON-NLS-1$
props.store(os, "Linked configuration"); //$NON-NLS-1$
- } finally {
- if (os != null)
- os.close();
}
} catch (IOException e) {
LogHelper.log(new Status(IStatus.ERROR, ID, "Unable to create linked configuration location.", e)); //$NON-NLS-1$
@@ -289,19 +282,10 @@ public class Activator implements BundleActivator {
if (!file.exists())
return result;
trace("Reading timestamps from file: " + file.getAbsolutePath()); //$NON-NLS-1$
- InputStream input = null;
- try {
- input = new BufferedInputStream(new FileInputStream(file));
+ try (InputStream input = new BufferedInputStream(new FileInputStream(file))) {
result.load(input);
} catch (IOException e) {
LogHelper.log(new Status(IStatus.ERROR, Activator.ID, "Error occurred while reading cached timestamps for reconciliation.", e)); //$NON-NLS-1$
- } finally {
- try {
- if (input != null)
- input.close();
- } catch (IOException e) {
- // ignore
- }
}
if (Tracing.DEBUG_RECONCILER) {
for (Iterator<Object> iter = result.keySet().iterator(); iter.hasNext();) {
@@ -321,7 +305,7 @@ public class Activator implements BundleActivator {
if (filesToCheck != null)
return filesToCheck;
- Set<File> result = new HashSet<File>();
+ Set<File> result = new HashSet<>();
// configuration/org.eclipse.update/platform.xml, configuration/../plugins, configuration/../features
File configuration = getConfigurationLocation();
@@ -366,7 +350,7 @@ public class Activator implements BundleActivator {
* return a collection of files that might be interesting to check the timestamps of.
*/
private Collection<File> getDropinsToCheck(File[] files) {
- Collection<File> result = new HashSet<File>();
+ Collection<File> result = new HashSet<>();
for (int outer = 0; outer < files.length; outer++) {
// add top-level file/folder
result.add(files[outer]);
@@ -433,10 +417,8 @@ public class Activator implements BundleActivator {
// write out the file
File file = Activator.getContext().getDataFile(CACHE_FILENAME);
trace("Writing out timestamps to file : " + file.getAbsolutePath()); //$NON-NLS-1$
- OutputStream output = null;
- try {
- file.delete();
- output = new BufferedOutputStream(new FileOutputStream(file));
+ file.delete();
+ try (OutputStream output = new BufferedOutputStream(new FileOutputStream(file))) {
timestamps.store(output, null);
if (Tracing.DEBUG_RECONCILER) {
for (Iterator<Object> iter = timestamps.keySet().iterator(); iter.hasNext();) {
@@ -447,13 +429,6 @@ public class Activator implements BundleActivator {
}
} catch (IOException e) {
LogHelper.log(new Status(IStatus.ERROR, ID, "Error occurred while writing cache timestamps for reconciliation.", e)); //$NON-NLS-1$
- } finally {
- if (output != null)
- try {
- output.close();
- } catch (IOException e) {
- // ignore
- }
}
}
@@ -524,7 +499,7 @@ public class Activator implements BundleActivator {
* Create a new directory watcher with a repository listener on the drop-ins folder.
*/
private void watchDropins() {
- List<File> directories = new ArrayList<File>();
+ List<File> directories = new ArrayList<>();
File[] dropinsDirectories = getDropinsDirectories();
directories.addAll(Arrays.asList(dropinsDirectories));
File[] linksDirectories = getLinksDirectories();
@@ -533,7 +508,7 @@ public class Activator implements BundleActivator {
return;
// we will compress the repositories and mark them hidden as "system" repos.
- Map<String, String> properties = new HashMap<String, String>();
+ Map<String, String> properties = new HashMap<>();
properties.put(IRepository.PROP_COMPRESSED, Boolean.TRUE.toString());
properties.put(IRepository.PROP_SYSTEM, Boolean.TRUE.toString());
@@ -544,9 +519,7 @@ public class Activator implements BundleActivator {
repositories.addAll(listener.getMetadataRepositories());
}
- /* (non-Javadoc)
- * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
- */
+ @Override
public void stop(BundleContext context) throws Exception {
bundleContext = null;
}
@@ -648,7 +621,7 @@ public class Activator implements BundleActivator {
* more than one to be returned here if we are running in shared mode.
*/
private static File[] getLinksDirectories() {
- List<File> linksDirectories = new ArrayList<File>();
+ List<File> linksDirectories = new ArrayList<>();
File root = getEclipseHome();
if (root != null)
linksDirectories.add(new File(root, LINKS));
@@ -671,7 +644,7 @@ public class Activator implements BundleActivator {
* local dropins directory.
*/
private static File[] getDropinsDirectories() {
- List<File> dropinsDirectories = new ArrayList<File>();
+ List<File> dropinsDirectories = new ArrayList<>();
// did the user specify one via System properties?
String watchedDirectoryProperty = bundleContext.getProperty(DROPINS_DIRECTORY);
if (watchedDirectoryProperty != null) {
diff --git a/bundles/org.eclipse.equinox.p2.reconciler.dropins/src/org/eclipse/equinox/internal/p2/reconciler/dropins/Application.java b/bundles/org.eclipse.equinox.p2.reconciler.dropins/src/org/eclipse/equinox/internal/p2/reconciler/dropins/Application.java
index ea5da9041..fdf2ca6b1 100644
--- a/bundles/org.eclipse.equinox.p2.reconciler.dropins/src/org/eclipse/equinox/internal/p2/reconciler/dropins/Application.java
+++ b/bundles/org.eclipse.equinox.p2.reconciler.dropins/src/org/eclipse/equinox/internal/p2/reconciler/dropins/Application.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2016 IBM Corporation and others. All rights reserved.
+ * Copyright (c) 2008, 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
@@ -15,6 +15,7 @@ import org.eclipse.equinox.app.IApplicationContext;
public class Application implements IApplication {
+ @Override
public Object start(IApplicationContext context) throws Exception {
Object obj = System.getProperties().get(Activator.PROP_APPLICATION_STATUS);
// if we have a non-OK status return "unlucky" 13, otherwise return the OK return code
@@ -23,6 +24,7 @@ public class Application implements IApplication {
return IApplication.EXIT_OK;
}
+ @Override
public void stop() {
//Nothing to do
}
diff --git a/bundles/org.eclipse.equinox.p2.reconciler.dropins/src/org/eclipse/equinox/internal/p2/reconciler/dropins/DropinsRepositoryListener.java b/bundles/org.eclipse.equinox.p2.reconciler.dropins/src/org/eclipse/equinox/internal/p2/reconciler/dropins/DropinsRepositoryListener.java
index 45aad29f1..d0a955650 100644
--- a/bundles/org.eclipse.equinox.p2.reconciler.dropins/src/org/eclipse/equinox/internal/p2/reconciler/dropins/DropinsRepositoryListener.java
+++ b/bundles/org.eclipse.equinox.p2.reconciler.dropins/src/org/eclipse/equinox/internal/p2/reconciler/dropins/DropinsRepositoryListener.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2015 IBM Corporation and others.
+ * Copyright (c) 2008, 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
@@ -47,8 +47,8 @@ public class DropinsRepositoryListener extends RepositoryListener {
private static final String DROPIN_METADATA_REPOSITORIES = "dropin.metadataRepositories"; //$NON-NLS-1$
private static final String PIPE = "|"; //$NON-NLS-1$
private final IProvisioningAgent agent;
- private List<IMetadataRepository> metadataRepositories = new ArrayList<IMetadataRepository>();
- private List<IArtifactRepository> artifactRepositories = new ArrayList<IArtifactRepository>();
+ private List<IMetadataRepository> metadataRepositories = new ArrayList<>();
+ private List<IArtifactRepository> artifactRepositories = new ArrayList<>();
static class LinkedRepository {
LinkedRepository(File location) {
@@ -83,10 +83,12 @@ public class DropinsRepositoryListener extends RepositoryListener {
this.agent = agent;
}
+ @Override
public boolean isInterested(File file) {
return true;
}
+ @Override
public boolean added(File file) {
if (super.added(file)) {
if (Tracing.DEBUG_RECONCILER)
@@ -97,6 +99,7 @@ public class DropinsRepositoryListener extends RepositoryListener {
return true;
}
+ @Override
public boolean changed(File file) {
if (super.changed(file)) {
if (Tracing.DEBUG_RECONCILER)
@@ -111,7 +114,7 @@ public class DropinsRepositoryListener extends RepositoryListener {
URI repoLocation = createRepositoryLocation(file);
if (repoLocation == null)
return;
- Map<String, String> properties = new HashMap<String, String>();
+ Map<String, String> properties = new HashMap<>();
// if the file pointed to a link file, keep track of the attribute
// so we can add it to the repo later
if (file.isFile() && file.getName().endsWith(LINK)) {
@@ -130,11 +133,8 @@ public class DropinsRepositoryListener extends RepositoryListener {
static LinkedRepository getLinkedRepository(File file) {
Properties links = new Properties();
try {
- InputStream input = new BufferedInputStream(new FileInputStream(file));
- try {
+ try (InputStream input = new BufferedInputStream(new FileInputStream(file))) {
links.load(input);
- } finally {
- input.close();
}
} catch (IOException e) {
LogHelper.log(new Status(IStatus.ERROR, Activator.ID, NLS.bind(Messages.error_reading_link, file.getAbsolutePath()), e));
@@ -265,6 +265,7 @@ public class DropinsRepositoryListener extends RepositoryListener {
}
}
+ @Override
public void stopPoll() {
synchronizeDropinMetadataRepositories();
synchronizeDropinArtifactRepositories();
@@ -272,7 +273,7 @@ public class DropinsRepositoryListener extends RepositoryListener {
}
private void synchronizeDropinMetadataRepositories() {
- List<String> currentRepositories = new ArrayList<String>();
+ List<String> currentRepositories = new ArrayList<>();
for (Iterator<IMetadataRepository> it = metadataRepositories.iterator(); it.hasNext();) {
IMetadataRepository repository = it.next();
currentRepositories.add(repository.getLocation().toString());
@@ -298,7 +299,7 @@ public class DropinsRepositoryListener extends RepositoryListener {
}
private void synchronizeDropinArtifactRepositories() {
- List<String> currentRepositories = new ArrayList<String>();
+ List<String> currentRepositories = new ArrayList<>();
for (Iterator<IArtifactRepository> it = artifactRepositories.iterator(); it.hasNext();) {
IArtifactRepository repository = it.next();
currentRepositories.add(repository.getLocation().toString());
@@ -324,7 +325,7 @@ public class DropinsRepositoryListener extends RepositoryListener {
}
private List<String> getListRepositoryProperty(IRepository<?> repository, String key) {
- List<String> listProperty = new ArrayList<String>();
+ List<String> listProperty = new ArrayList<>();
String dropinRepositories = repository.getProperties().get(key);
if (dropinRepositories != null) {
StringTokenizer tokenizer = new StringTokenizer(dropinRepositories, PIPE);
@@ -348,7 +349,7 @@ public class DropinsRepositoryListener extends RepositoryListener {
}
public Collection<IMetadataRepository> getMetadataRepositories() {
- List<IMetadataRepository> result = new ArrayList<IMetadataRepository>(metadataRepositories);
+ List<IMetadataRepository> result = new ArrayList<>(metadataRepositories);
result.add(getMetadataRepository());
return result;
}
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 802ee1bb9..3f2a26c02 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, 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
@@ -76,54 +76,40 @@ public class PlatformXmlListener extends DirectoryChangeListener {
this.root = file;
}
- /* (non-Javadoc)
- * @see org.eclipse.equinox.internal.provisional.p2.directorywatcher.IDirectoryChangeListener#added(java.io.File)
- */
+ @Override
public boolean added(File file) {
changed = changed || PLATFORM_XML.equals(file.getName());
return false;
}
- /* (non-Javadoc)
- * @see org.eclipse.equinox.internal.provisional.p2.directorywatcher.IDirectoryChangeListener#changed(java.io.File)
- */
+ @Override
public boolean changed(File file) {
changed = changed || PLATFORM_XML.equals(file.getName());
return false;
}
- /* (non-Javadoc)
- * @see org.eclipse.equinox.internal.provisional.p2.directorywatcher.IDirectoryChangeListener#getSeenFile(java.io.File)
- */
+ @Override
public Long getSeenFile(File file) {
return Long.valueOf(0);
}
- /* (non-Javadoc)
- * @see org.eclipse.equinox.internal.provisional.p2.directorywatcher.DirectoryChangeListener#isInterested(java.io.File)
- */
+ @Override
public boolean isInterested(File file) {
return file.getName().equals(PLATFORM_XML) && lastModified != file.lastModified();
}
- /* (non-Javadoc)
- * @see org.eclipse.equinox.internal.provisional.p2.directorywatcher.IDirectoryChangeListener#removed(java.io.File)
- */
+ @Override
public boolean removed(File file) {
changed = changed || PLATFORM_XML.equals(file.getName());
return false;
}
- /* (non-Javadoc)
- * @see org.eclipse.equinox.internal.provisional.p2.directorywatcher.IDirectoryChangeListener#startPoll()
- */
+ @Override
public void startPoll() {
changed = false;
}
- /* (non-Javadoc)
- * @see org.eclipse.equinox.internal.provisional.p2.directorywatcher.IDirectoryChangeListener#stopPoll()
- */
+ @Override
public void stopPoll() {
if (changed) {
lastModified = root.lastModified();
@@ -183,8 +169,8 @@ public class PlatformXmlListener extends DirectoryChangeListener {
*/
protected void synchronizeConfiguration(Configuration config) {
List<Site> sites = config.getSites();
- Set<IMetadataRepository> newRepos = new LinkedHashSet<IMetadataRepository>();
- Set<Site> toBeRemoved = new HashSet<Site>();
+ Set<IMetadataRepository> newRepos = new LinkedHashSet<>();
+ Set<Site> toBeRemoved = new HashSet<>();
for (Site site : sites) {
String siteURL = site.getUrl();
IMetadataRepository match = getMatchingRepo(Activator.getRepositories(), siteURL);
@@ -206,7 +192,7 @@ public class PlatformXmlListener extends DirectoryChangeListener {
// use the URI constructor here and not URIUtil#fromString because
// our string is already encoded
URI location = new URI(eclipseExtensionURL);
- Map<String, String> properties = new HashMap<String, String>();
+ Map<String, String> properties = new HashMap<>();
properties.put(SiteListener.SITE_POLICY, site.getPolicy());
// In a "USER-INCLUDE" we add the site's features to the list
diff --git a/bundles/org.eclipse.equinox.p2.reconciler.dropins/src/org/eclipse/equinox/internal/p2/reconciler/dropins/ProfileSynchronizer.java b/bundles/org.eclipse.equinox.p2.reconciler.dropins/src/org/eclipse/equinox/internal/p2/reconciler/dropins/ProfileSynchronizer.java
index af0017437..f8885db4a 100644
--- a/bundles/org.eclipse.equinox.p2.reconciler.dropins/src/org/eclipse/equinox/internal/p2/reconciler/dropins/ProfileSynchronizer.java
+++ b/bundles/org.eclipse.equinox.p2.reconciler.dropins/src/org/eclipse/equinox/internal/p2/reconciler/dropins/ProfileSynchronizer.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2015 IBM Corporation and others. All rights reserved.
+ * 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
@@ -69,7 +69,7 @@ public class ProfileSynchronizer {
* locations on disk.
*/
static class ReconcilerProfileChangeRequest extends ProfileChangeRequest {
- List<IInstallableUnit> toMove = new ArrayList<IInstallableUnit>();
+ List<IInstallableUnit> toMove = new ArrayList<>();
public ReconcilerProfileChangeRequest(IProfile profile) {
super(profile);
@@ -90,7 +90,7 @@ public class ProfileSynchronizer {
public ProfileSynchronizer(IProvisioningAgent agent, IProfile profile, Collection<IMetadataRepository> repositories) {
this.agent = agent;
this.profile = profile;
- this.repositoryMap = new HashMap<String, IMetadataRepository>();
+ this.repositoryMap = new HashMap<>();
for (IMetadataRepository repository : repositories) {
repositoryMap.put(repository.getLocation().toString(), repository);
}
@@ -129,7 +129,7 @@ public class ProfileSynchronizer {
return moveResult;
if (!request.getRemovals().isEmpty()) {
- Collection<IRequirement> requirements = new ArrayList<IRequirement>();
+ Collection<IRequirement> requirements = new ArrayList<>();
for (IInstallableUnit unit : request.getRemovals()) {
RequiredCapability req = new RequiredCapability(IInstallableUnit.NAMESPACE_IU_ID, unit.getId(), new VersionRange(unit.getVersion(), true, unit.getVersion(), true), null, 0, 0, false, null);
requirements.add(req);
@@ -220,7 +220,7 @@ public class ProfileSynchronizer {
// otherwise collect the roots, pretend they are optional, and see
// if the resulting plan affects them
Set<IInstallableUnit> strictRoots = getStrictRoots().toUnmodifiableSet();
- Collection<IRequirement> forceNegation = new ArrayList<IRequirement>(removals.size());
+ Collection<IRequirement> forceNegation = new ArrayList<>(removals.size());
for (IInstallableUnit iu : removals)
forceNegation.add(createNegation(iu));
request.addExtraRequirements(forceNegation);
@@ -246,7 +246,7 @@ public class ProfileSynchronizer {
finalRequest.remove(initialRoot);
finalRequest.setInstallableUnitProfileProperty(initialRoot, INCLUSION_RULES, INCLUSION_OPTIONAL);
IRequirement negation = createNegation(initialRoot);
- Collection<IRequirement> extra = new ArrayList<IRequirement>();
+ Collection<IRequirement> extra = new ArrayList<>();
extra.add(negation);
request.addExtraRequirements(extra);
LogHelper.log(new Status(IStatus.INFO, Activator.ID, NLS.bind(Messages.remove_root, initialRoot.getId(), initialRoot.getVersion())));
@@ -306,8 +306,7 @@ public class ProfileSynchronizer {
try {
File file = Activator.getContext().getDataFile(TIMESTAMPS_FILE_PREFIX + profile.getProfileId().hashCode());
Activator.trace("Writing timestamp file to : " + file.getAbsolutePath()); //$NON-NLS-1$
- OutputStream os = new BufferedOutputStream(new FileOutputStream(file));
- try {
+ try (OutputStream os = new BufferedOutputStream(new FileOutputStream(file))) {
CollectionUtils.storeProperties(timestamps, os, "Timestamps for " + profile.getProfileId()); //$NON-NLS-1$
if (Tracing.DEBUG_RECONCILER) {
for (Iterator<String> iter = timestamps.keySet().iterator(); iter.hasNext();) {
@@ -316,9 +315,6 @@ public class ProfileSynchronizer {
Activator.trace(key + '=' + value);
}
}
- } finally {
- if (os != null)
- os.close();
}
} catch (FileNotFoundException e) {
//Ignore
@@ -399,35 +395,31 @@ public class ProfileSynchronizer {
*/
private void readTimestamps() {
if (Boolean.TRUE.toString().equalsIgnoreCase(System.getProperty(PROP_IGNORE_USER_CONFIGURATION))) {
- timestamps = new HashMap<String, String>();
+ timestamps = new HashMap<>();
Activator.trace("Master profile changed."); //$NON-NLS-1$
Activator.trace("Performing reconciliation."); //$NON-NLS-1$
return;
}
File file = Activator.getContext().getDataFile(TIMESTAMPS_FILE_PREFIX + profile.getProfileId().hashCode());
try {
- InputStream is = new BufferedInputStream(new FileInputStream(file));
- try {
+ try (InputStream is = new BufferedInputStream(new FileInputStream(file))) {
timestamps = CollectionUtils.loadProperties(is);
- } finally {
- if (is != null)
- is.close();
}
} catch (FileNotFoundException e) {
//Ignore
- timestamps = new HashMap<String, String>();
+ timestamps = new HashMap<>();
Activator.trace("Timestamp file does not exist."); //$NON-NLS-1$
Activator.trace("Performing reconciliation."); //$NON-NLS-1$
} catch (IOException e) {
//Ignore
- timestamps = new HashMap<String, String>();
+ timestamps = new HashMap<>();
Activator.trace("Exception loading timestamp file: " + e.getMessage()); //$NON-NLS-1$
Activator.trace("Performing reconciliation."); //$NON-NLS-1$
}
}
private ProvisioningContext getContext() {
- ArrayList<URI> repoURLs = new ArrayList<URI>();
+ ArrayList<URI> repoURLs = new ArrayList<>();
for (Iterator<String> iterator = repositoryMap.keySet().iterator(); iterator.hasNext();) {
try {
repoURLs.add(new URI(iterator.next()));
@@ -442,10 +434,10 @@ public class ProfileSynchronizer {
}
private String synchronizeCacheExtensions() {
- List<String> currentExtensions = new ArrayList<String>();
+ List<String> currentExtensions = new ArrayList<>();
StringBuffer buffer = new StringBuffer();
- List<String> repositories = new ArrayList<String>(repositoryMap.keySet());
+ List<String> repositories = new ArrayList<>(repositoryMap.keySet());
URL installArea = Activator.getOSGiInstallArea();
final String OSGiInstallArea;
try {
@@ -455,14 +447,12 @@ public class ProfileSynchronizer {
OSGiInstallArea = URIUtil.toURI(installArea).toString() + Constants.EXTENSION_LOCATION;
// Sort the repositories so the extension location at the OSGi install folder is first.
// See https://bugs.eclipse.org/246310.
- Collections.sort(repositories, new Comparator<String>() {
- public int compare(String left, String right) {
- if (OSGiInstallArea.equals(left))
- return -1;
- if (OSGiInstallArea.equals(right))
- return 1;
- return left.compareTo(right);
- }
+ Collections.sort(repositories, (left, right) -> {
+ if (OSGiInstallArea.equals(left))
+ return -1;
+ if (OSGiInstallArea.equals(right))
+ return 1;
+ return left.compareTo(right);
});
} catch (URISyntaxException e) {
// This shouldn't happen but if it does we will log the error and continue
@@ -488,7 +478,7 @@ public class ProfileSynchronizer {
}
String currentExtensionsProperty = (buffer.length() == 0) ? null : buffer.toString();
- List<String> previousExtensions = new ArrayList<String>();
+ List<String> previousExtensions = new ArrayList<>();
String previousExtensionsProperty = profile.getProperty(CACHE_EXTENSIONS);
if (previousExtensionsProperty != null) {
StringTokenizer tokenizer = new StringTokenizer(previousExtensionsProperty, PIPE);
@@ -522,7 +512,7 @@ public class ProfileSynchronizer {
*/
private Map<IInstallableUnit, IInstallableUnit> getProfileIUs() {
IQueryResult<IInstallableUnit> profileQueryResult = profile.query(QueryUtil.createIUAnyQuery(), null);
- Map<IInstallableUnit, IInstallableUnit> result = new HashMap<IInstallableUnit, IInstallableUnit>();
+ Map<IInstallableUnit, IInstallableUnit> result = new HashMap<>();
for (Iterator<IInstallableUnit> it = profileQueryResult.iterator(); it.hasNext();) {
IInstallableUnit iu = it.next();
result.put(iu, iu);
@@ -536,7 +526,7 @@ public class ProfileSynchronizer {
*/
private Map<IInstallableUnit, IInstallableUnit> getAvailableProfileIUs() {
IQueryResult<IInstallableUnit> profileQueryResult = profile.available(QueryUtil.createIUAnyQuery(), null);
- Map<IInstallableUnit, IInstallableUnit> result = new HashMap<IInstallableUnit, IInstallableUnit>();
+ Map<IInstallableUnit, IInstallableUnit> result = new HashMap<>();
for (Iterator<IInstallableUnit> it = profileQueryResult.iterator(); it.hasNext();) {
IInstallableUnit iu = it.next();
result.put(iu, iu);
@@ -559,8 +549,8 @@ public class ProfileSynchronizer {
if (resolve)
request.removeProfileProperty("org.eclipse.equinox.p2.resolve"); //$NON-NLS-1$
- List<IInstallableUnit> toRemove = new ArrayList<IInstallableUnit>();
- List<IInstallableUnit> toMove = new ArrayList<IInstallableUnit>();
+ List<IInstallableUnit> toRemove = new ArrayList<>();
+ List<IInstallableUnit> toMove = new ArrayList<>();
boolean foundIUsToAdd = false;
Map<IInstallableUnit, IInstallableUnit> profileIUs = getProfileIUs();
@@ -661,9 +651,9 @@ public class ProfileSynchronizer {
return;
final String PREFIX = "[reconciler] [plan] "; //$NON-NLS-1$
// get the request
- List<IInstallableUnit> toAdd = new ArrayList<IInstallableUnit>(request.getAdditions());
- List<IInstallableUnit> toRemove = new ArrayList<IInstallableUnit>(request.getRemovals());
- List<IInstallableUnit> toMove = new ArrayList<IInstallableUnit>(request.getMoves());
+ List<IInstallableUnit> toAdd = new ArrayList<>(request.getAdditions());
+ List<IInstallableUnit> toRemove = new ArrayList<>(request.getRemovals());
+ List<IInstallableUnit> toMove = new ArrayList<>(request.getMoves());
// remove from the request everything that is in the plan
for (Iterator<IInstallableUnit> iterator = plan.getRemovals().query(QueryUtil.createIUAnyQuery(), null).iterator(); iterator.hasNext();) {
@@ -762,7 +752,7 @@ public class ProfileSynchronizer {
*/
private IQueryResult<IInstallableUnit> getAllIUsFromRepos() {
// TODO: Should consider using a sequenced iterator here instead of collecting
- Collector<IInstallableUnit> allRepos = new Collector<IInstallableUnit>();
+ Collector<IInstallableUnit> allRepos = new Collector<>();
for (IMetadataRepository repository : repositoryMap.values()) {
allRepos.addAll(repository.query(QueryUtil.createIUAnyQuery(), null));
}

Back to the top