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>
diff --git a/bundles/org.eclipse.equinox.p2.reconciler.dropins/.classpath b/bundles/org.eclipse.equinox.p2.reconciler.dropins/.classpath
index 64c5e31..eca7bdb 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 d50f6a2..ac7c5cd 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.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.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 94174b9..be78489 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 @@
 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 @@
 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 60856fd..d734ada 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 271b61b..5276e90 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 @@
 	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 @@
 		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 @@
 		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 @@
 		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 @@
 			// 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 @@
 		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 @@
 		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 @@
 	 * 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 @@
 		// 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 @@
 			}
 		} 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 @@
 	 * 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 @@
 			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 @@
 		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 @@
 	 * 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 @@
 	 * 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 ea5da90..fdf2ca6 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 @@
 
 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 @@
 		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 45aad29..d0a9556 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 @@
 	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 @@
 		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 @@
 		return true;
 	}
 
+	@Override
 	public boolean changed(File file) {
 		if (super.changed(file)) {
 			if (Tracing.DEBUG_RECONCILER)
@@ -111,7 +114,7 @@
 		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 @@
 	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 @@
 		}
 	}
 
+	@Override
 	public void stopPoll() {
 		synchronizeDropinMetadataRepositories();
 		synchronizeDropinArtifactRepositories();
@@ -272,7 +273,7 @@
 	}
 
 	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 @@
 	}
 
 	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 @@
 	}
 
 	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 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 802ee1b..3f2a26c 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 @@
 		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 @@
 	 */
 	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 @@
 					// 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 af00174..f8885db 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 @@
 	 * 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 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 @@
 			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 @@
 		// 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 @@
 			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 @@
 		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 @@
 						Activator.trace(key + '=' + value);
 					}
 				}
-			} finally {
-				if (os != null)
-					os.close();
 			}
 		} catch (FileNotFoundException e) {
 			//Ignore
@@ -399,35 +395,31 @@
 	 */
 	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 @@
 	}
 
 	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 @@
 			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 @@
 		}
 		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 @@
 	 */
 	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 @@
 	 */
 	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 @@
 		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 @@
 			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 @@
 	 */
 	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));
 		}