Update code style in index.* bundles.

* Try-with-resouces.
* Uselesss types.
* Some deprecations.
* Annotations.

Change-Id: I70bbb1f5a208fe0d90ae3d6fb6d03b6d0865c33f
Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
diff --git a/core/plugins/org.eclipse.dltk.core.index.lucene/.settings/org.eclipse.jdt.core.prefs b/core/plugins/org.eclipse.dltk.core.index.lucene/.settings/org.eclipse.jdt.core.prefs
index d7d05c6..6a77e8e 100644
--- a/core/plugins/org.eclipse.dltk.core.index.lucene/.settings/org.eclipse.jdt.core.prefs
+++ b/core/plugins/org.eclipse.dltk.core.index.lucene/.settings/org.eclipse.jdt.core.prefs
@@ -2,8 +2,11 @@
 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.methodParameters=do not generate
@@ -39,7 +42,7 @@
 org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore
 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=ignore
 org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=warning
@@ -50,12 +53,14 @@
 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=ignore
 org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore
 org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore
@@ -78,8 +83,11 @@
 org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning
 org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
 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=ignore
-org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=ignore
+org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning
 org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
 org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore
 org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled
diff --git a/core/plugins/org.eclipse.dltk.core.index.sql.h2/.settings/org.eclipse.jdt.core.prefs b/core/plugins/org.eclipse.dltk.core.index.sql.h2/.settings/org.eclipse.jdt.core.prefs
index f0498f7..94e947e 100644
--- a/core/plugins/org.eclipse.dltk.core.index.sql.h2/.settings/org.eclipse.jdt.core.prefs
+++ b/core/plugins/org.eclipse.dltk.core.index.sql.h2/.settings/org.eclipse.jdt.core.prefs
@@ -1,9 +1,111 @@
 eclipse.preferences.version=1
+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.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.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.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=disabled
+org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
+org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore
 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=ignore
+org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
+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=warning
+org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore
+org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore
+org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
+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.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=ignore
+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=ignore
+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=ignore
+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=ignore
+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=ignore
+org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning
+org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
+org.eclipse.jdt.core.compiler.problem.unusedExceptionParameter=ignore
+org.eclipse.jdt.core.compiler.problem.unusedImport=warning
+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=disabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
+org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
+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.8
 org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
diff --git a/core/plugins/org.eclipse.dltk.core.index.sql.h2/src/org/eclipse/dltk/internal/core/index/sql/h2/H2Cache.java b/core/plugins/org.eclipse.dltk.core.index.sql.h2/src/org/eclipse/dltk/internal/core/index/sql/h2/H2Cache.java
index e2fe3d6..3da23a4 100644
--- a/core/plugins/org.eclipse.dltk.core.index.sql.h2/src/org/eclipse/dltk/internal/core/index/sql/h2/H2Cache.java
+++ b/core/plugins/org.eclipse.dltk.core.index.sql.h2/src/org/eclipse/dltk/internal/core/index/sql/h2/H2Cache.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2009 IBM Corporation and others.
+ * Copyright (c) 2009, 2017 IBM Corporation and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -30,10 +30,10 @@
 public class H2Cache {
 
 	private static final ILock containerLock = Job.getJobManager().newLock();
-	private static final Map<Integer, Container> containerById = new HashMap<Integer, Container>();
+	private static final Map<Integer, Container> containerById = new HashMap<>();
 
 	private static final ILock fileLock = Job.getJobManager().newLock();
-	private static final Map<Integer, Map<Integer, File>> filesByContainer = new HashMap<Integer, Map<Integer, File>>();
+	private static final Map<Integer, Map<Integer, File>> filesByContainer = new HashMap<>();
 
 	public static void addContainer(Container container) {
 		containerLock.acquire();
@@ -51,7 +51,7 @@
 			int containerId = file.getContainerId();
 			Map<Integer, File> files = filesByContainer.get(containerId);
 			if (files == null) {
-				files = new HashMap<Integer, File>();
+				files = new HashMap<>();
 				filesByContainer.put(containerId, files);
 			}
 			files.put(file.getId(), file);
@@ -183,6 +183,7 @@
 	 * 
 	 * @deprecated Use {@link #selectFilesByContainerIdAsArray(int)}
 	 */
+	@Deprecated
 	public static Collection<File> selectFilesByContainerId(int id) {
 		fileLock.acquire();
 		try {
diff --git a/core/plugins/org.eclipse.dltk.core.index.sql.h2/src/org/eclipse/dltk/internal/core/index/sql/h2/H2ContainerDao.java b/core/plugins/org.eclipse.dltk.core.index.sql.h2/src/org/eclipse/dltk/internal/core/index/sql/h2/H2ContainerDao.java
index 57089c2..55df880 100644
--- a/core/plugins/org.eclipse.dltk.core.index.sql.h2/src/org/eclipse/dltk/internal/core/index/sql/h2/H2ContainerDao.java
+++ b/core/plugins/org.eclipse.dltk.core.index.sql.h2/src/org/eclipse/dltk/internal/core/index/sql/h2/H2ContainerDao.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2009 IBM Corporation and others.
+ * Copyright (c) 2009, 2017 IBM Corporation and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -34,6 +34,7 @@
 	private static final String Q_DELETE_BY_PATH = "DELETE FROM CONTAINERS WHERE PATH=?;"; //$NON-NLS-1$
 	private static final String Q_DELETE_BY_ID = "DELETE FROM CONTAINERS WHERE ID=?;"; //$NON-NLS-1$
 
+	@Override
 	public Container insert(Connection connection, String path)
 			throws SQLException {
 
@@ -42,27 +43,22 @@
 			return container;
 		}
 
-		PreparedStatement statement = connection.prepareStatement(Q_INSERT,
-				Statement.RETURN_GENERATED_KEYS);
-		try {
+		try (PreparedStatement statement = connection.prepareStatement(Q_INSERT,
+				Statement.RETURN_GENERATED_KEYS)) {
 			int param = 0;
 			statement.setString(++param, path);
 			statement.executeUpdate();
 
-			ResultSet result = statement.getGeneratedKeys();
-			try {
+			try (ResultSet result = statement.getGeneratedKeys()) {
 				result.next();
 				container = new Container(result.getInt(1), path);
 				H2Cache.addContainer(container);
-			} finally {
-				result.close();
 			}
-		} finally {
-			statement.close();
 		}
 		return container;
 	}
 
+	@Override
 	public Container selectByPath(Connection connection, String path)
 			throws SQLException {
 
@@ -71,28 +67,23 @@
 			return container;
 		}
 
-		PreparedStatement statement = connection
-				.prepareStatement(Q_SELECT_BY_PATH);
-		try {
+		try (PreparedStatement statement = connection
+				.prepareStatement(Q_SELECT_BY_PATH)) {
 			int param = 0;
 			statement.setString(++param, path);
-			ResultSet result = statement.executeQuery();
-			try {
+			try (ResultSet result = statement.executeQuery()) {
 				if (result.next()) {
 					container = new Container(result.getInt(1),
 							result.getString(2));
 
 					H2Cache.addContainer(container);
 				}
-			} finally {
-				result.close();
 			}
-		} finally {
-			statement.close();
 		}
 		return container;
 	}
 
+	@Override
 	public Container selectById(Connection connection, int id)
 			throws SQLException {
 
@@ -101,52 +92,44 @@
 			return container;
 		}
 
-		PreparedStatement statement = connection
-				.prepareStatement(Q_SELECT_BY_ID);
-		try {
+		try (PreparedStatement statement = connection
+				.prepareStatement(Q_SELECT_BY_ID)) {
 			int param = 0;
 			statement.setInt(++param, id);
-			ResultSet result = statement.executeQuery();
-			try {
+
+			try (ResultSet result = statement.executeQuery()) {
 				if (result.next()) {
 					container = new Container(result.getInt(1),
 							result.getString(2));
 
 					H2Cache.addContainer(container);
 				}
-			} finally {
-				result.close();
 			}
-		} finally {
-			statement.close();
 		}
 		return container;
 	}
 
+	@Override
 	public void deleteById(Connection connection, int id) throws SQLException {
-		PreparedStatement statement = connection
-				.prepareStatement(Q_DELETE_BY_ID);
-		try {
+
+		try (PreparedStatement statement = connection
+				.prepareStatement(Q_DELETE_BY_ID)) {
 			int param = 0;
 			statement.setInt(++param, id);
 			statement.executeUpdate();
-		} finally {
-			statement.close();
 		}
 
 		H2Cache.deleteContainerById(id);
 	}
 
+	@Override
 	public void deleteByPath(Connection connection, String path)
 			throws SQLException {
-		PreparedStatement statement = connection
-				.prepareStatement(Q_DELETE_BY_PATH);
-		try {
+		try (PreparedStatement statement = connection
+				.prepareStatement(Q_DELETE_BY_PATH)) {
 			int param = 0;
 			statement.setString(++param, path);
 			statement.executeUpdate();
-		} finally {
-			statement.close();
 		}
 
 		H2Cache.deleteContainerByPath(path);
diff --git a/core/plugins/org.eclipse.dltk.core.index.sql.h2/src/org/eclipse/dltk/internal/core/index/sql/h2/H2DbFactory.java b/core/plugins/org.eclipse.dltk.core.index.sql.h2/src/org/eclipse/dltk/internal/core/index/sql/h2/H2DbFactory.java
index e150490..b5c574a 100644
--- a/core/plugins/org.eclipse.dltk.core.index.sql.h2/src/org/eclipse/dltk/internal/core/index/sql/h2/H2DbFactory.java
+++ b/core/plugins/org.eclipse.dltk.core.index.sql.h2/src/org/eclipse/dltk/internal/core/index/sql/h2/H2DbFactory.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2009 IBM Corporation and others.
+ * Copyright (c) 2009, 2017 IBM Corporation and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -62,17 +62,14 @@
 			try {
 				connection = pool.getConnection();
 				try {
-					Statement statement = connection.createStatement();
-					try {
-						statement
-								.executeQuery("SELECT COUNT(*) FROM FILES WHERE 1=0;");
+					try (Statement statement = connection.createStatement()) {
+						statement.executeQuery(
+								"SELECT COUNT(*) FROM FILES WHERE 1=0;");
 						initializeSchema = !schema.isCompatible();
 
 					} catch (SQLException e) {
 						// Basic table doesn't exist
 						initializeSchema = true;
-					} finally {
-						statement.close();
 					}
 
 					if (initializeSchema) {
@@ -115,7 +112,8 @@
 				} catch (Exception e1) {
 					SqlIndex.error(
 							"An exception has occurred while removing corrupted DB: "
-									+ dbPath.toOSString(), e1);
+									+ dbPath.toOSString(),
+							e1);
 					throw e1;
 				}
 			}
@@ -134,40 +132,39 @@
 		IPreferencesService preferencesService = Platform
 				.getPreferencesService();
 
-		StringBuilder buf = new StringBuilder("jdbc:h2:").append(dbPath.append(
-				DB_NAME).toOSString());
+		StringBuilder buf = new StringBuilder("jdbc:h2:")
+				.append(dbPath.append(DB_NAME).toOSString());
 
 		buf.append(";UNDO_LOG=0");
-		buf.append(";LOCK_MODE=").append(
-				preferencesService.getInt(H2Index.PLUGIN_ID,
-						H2IndexPreferences.DB_LOCK_MODE, 0, null));
+		buf.append(";LOCK_MODE=").append(preferencesService.getInt(
+				H2Index.PLUGIN_ID, H2IndexPreferences.DB_LOCK_MODE, 0, null));
 
-		buf.append(";CACHE_TYPE=").append(
-				preferencesService.getString(H2Index.PLUGIN_ID,
+		buf.append(";CACHE_TYPE=")
+				.append(preferencesService.getString(H2Index.PLUGIN_ID,
 						H2IndexPreferences.DB_CACHE_TYPE, null, null));
 
-		buf.append(";CACHE_SIZE=").append(
-				preferencesService.getInt(H2Index.PLUGIN_ID,
-						H2IndexPreferences.DB_CACHE_SIZE, 0, null));
+		buf.append(";CACHE_SIZE=").append(preferencesService.getInt(
+				H2Index.PLUGIN_ID, H2IndexPreferences.DB_CACHE_SIZE, 0, null));
 
-		buf.append(";QUERY_CACHE_SIZE=").append(
-				preferencesService.getInt(H2Index.PLUGIN_ID,
+		buf.append(";QUERY_CACHE_SIZE=")
+				.append(preferencesService.getInt(H2Index.PLUGIN_ID,
 						H2IndexPreferences.DB_QUERY_CACHE_SIZE, 0, null));
 
-		buf.append(";LARGE_RESULT_BUFFER_SIZE=").append(
-				preferencesService
-						.getInt(H2Index.PLUGIN_ID,
-								H2IndexPreferences.DB_LARGE_RESULT_BUFFER_SIZE,
-								0, null));
+		buf.append(";LARGE_RESULT_BUFFER_SIZE=")
+				.append(preferencesService.getInt(H2Index.PLUGIN_ID,
+						H2IndexPreferences.DB_LARGE_RESULT_BUFFER_SIZE, 0,
+						null));
 		buf.append(";FILE_LOCK=NO");
 
 		return buf.toString();
 	}
 
+	@Override
 	public Connection createConnection() throws SQLException {
 		return pool == null ? null : pool.getConnection();
 	}
 
+	@Override
 	public void dispose() throws SQLException {
 		if (pool != null) {
 			pool.dispose();
@@ -175,14 +172,17 @@
 		}
 	}
 
+	@Override
 	public IContainerDao getContainerDao() {
 		return new H2ContainerDao();
 	}
 
+	@Override
 	public IElementDao getElementDao() {
 		return new H2ElementDao();
 	}
 
+	@Override
 	public IFileDao getFileDao() {
 		return new H2FileDao();
 	}
diff --git a/core/plugins/org.eclipse.dltk.core.index.sql.h2/src/org/eclipse/dltk/internal/core/index/sql/h2/H2ElementDao.java b/core/plugins/org.eclipse.dltk.core.index.sql.h2/src/org/eclipse/dltk/internal/core/index/sql/h2/H2ElementDao.java
index 0b89a41..cc71f16 100644
--- a/core/plugins/org.eclipse.dltk.core.index.sql.h2/src/org/eclipse/dltk/internal/core/index/sql/h2/H2ElementDao.java
+++ b/core/plugins/org.eclipse.dltk.core.index.sql.h2/src/org/eclipse/dltk/internal/core/index/sql/h2/H2ElementDao.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2009 IBM Corporation and others.
+ * Copyright (c) 2009, 2017 IBM Corporation and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -46,17 +46,17 @@
 			.readSqlFile("resources/insert_decl.sql"); //$NON-NLS-1$
 
 	/** Cache for insert element declaration queries */
-	private static final Map<String, String> R_INSERT_QUERY_CACHE = new HashMap<String, String>();
+	private static final Map<String, String> R_INSERT_QUERY_CACHE = new HashMap<>();
 
 	/** Cache for insert element reference queries */
-	private static final Map<String, String> D_INSERT_QUERY_CACHE = new HashMap<String, String>();
+	private static final Map<String, String> D_INSERT_QUERY_CACHE = new HashMap<>();
 
 	private final ModelManager modelManager;
 	private final Map<String, PreparedStatement> batchStatements;
 
 	public H2ElementDao() {
 		this.modelManager = ModelManager.getModelManager();
-		this.batchStatements = new HashMap<String, PreparedStatement>();
+		this.batchStatements = new HashMap<>();
 	}
 
 	private String getTableName(Connection connection, int elementType,
@@ -70,12 +70,11 @@
 		return tableName;
 	}
 
-	private void insertBatch(Connection connection,
-			PreparedStatement statement, int type, int flags, int offset,
-			int length, int nameOffset, int nameLength, String name,
-			String metadata, String doc, String qualifier, String parent,
-			int fileId, String natureId, boolean isReference)
-			throws SQLException {
+	private void insertBatch(Connection connection, PreparedStatement statement,
+			int type, int flags, int offset, int length, int nameOffset,
+			int nameLength, String name, String metadata, String doc,
+			String qualifier, String parent, int fileId, String natureId,
+			boolean isReference) throws SQLException {
 
 		int param = 0;
 		if (!isReference) {
@@ -100,8 +99,9 @@
 					break;
 				}
 			}
-			camelCaseName = camelCaseNameBuf.length() > 0 ? camelCaseNameBuf
-					.toString() : null;
+			camelCaseName = camelCaseNameBuf.length() > 0
+					? camelCaseNameBuf.toString()
+					: null;
 			statement.setString(++param, camelCaseName);
 		}
 		statement.setString(++param, metadata);
@@ -116,13 +116,15 @@
 		statement.addBatch();
 	}
 
+	@Override
 	public void insert(Connection connection, int type, int flags, int offset,
 			int length, int nameOffset, int nameLength, String name,
 			String metadata, String doc, String qualifier, String parent,
 			int fileId, String natureId, boolean isReference)
 			throws SQLException {
 
-		String tableName = getTableName(connection, type, natureId, isReference);
+		String tableName = getTableName(connection, type, natureId,
+				isReference);
 
 		String query;
 		if (isReference) {
@@ -150,6 +152,7 @@
 		}
 	}
 
+	@Override
 	public void commitInsertions() throws SQLException {
 		synchronized (batchStatements) {
 			try {
@@ -166,12 +169,13 @@
 		}
 	}
 
+	@Override
 	public void search(Connection connection, String pattern,
-			MatchRule matchRule, int elementType, int trueFlags,
-			int falseFlags, String qualifier, String parent, int[] filesId,
-			int containersId[], String natureId, int limit,
-			boolean isReference, IElementHandler handler,
-			IProgressMonitor monitor) throws SQLException {
+			MatchRule matchRule, int elementType, int trueFlags, int falseFlags,
+			String qualifier, String parent, int[] filesId, int containersId[],
+			String natureId, int limit, boolean isReference,
+			IElementHandler handler, IProgressMonitor monitor)
+			throws SQLException {
 
 		long timeStamp = System.currentTimeMillis();
 		int count = 0;
@@ -183,9 +187,10 @@
 				.append(tableName);
 
 		StringBuilder query = new StringBuilder();
-		final List<Object> parameters = new ArrayList<Object>();
+		final List<Object> parameters = new ArrayList<>();
 
-		if (filesId == null && containersId != null && containersId.length > 0) {
+		if (filesId == null && containersId != null
+				&& containersId.length > 0) {
 			begin.append("_TO_CONTAINER AS T");
 			query.append(" AND T.CONTAINER_ID IN(");
 			for (int i = 0; i < containersId.length; ++i) {
@@ -203,7 +208,8 @@
 		// Name patterns
 		if (pattern != null && pattern.length() > 0) {
 			if (isReference && matchRule == MatchRule.CAMEL_CASE) {
-				H2Index.warn("MatchRule.CAMEL_CASE is not supported by element references search."); //$NON-NLS-1$
+				H2Index.warn(
+						"MatchRule.CAMEL_CASE is not supported by element references search."); //$NON-NLS-1$
 				matchRule = MatchRule.EXACT;
 			}
 
@@ -294,9 +300,8 @@
 			System.out.println("Query: " + query.toString());
 		}
 
-		final PreparedStatement statement = connection.prepareStatement(query
-				.toString());
-		try {
+		try (final PreparedStatement statement = connection
+				.prepareStatement(query.toString())) {
 			for (int i = 0; i < parameters.size(); ++i) {
 				final Object param = parameters.get(i);
 				if (param instanceof Integer) {
@@ -306,8 +311,7 @@
 				}
 			}
 
-			final ResultSet result = statement.executeQuery();
-			try {
+			try (final ResultSet result = statement.executeQuery()) {
 				while (result.next()) {
 					++count;
 					if (monitor != null && monitor.isCanceled()) {
@@ -358,11 +362,7 @@
 
 					handler.handle(element);
 				}
-			} finally {
-				result.close();
 			}
-		} finally {
-			statement.close();
 		}
 
 		if (H2Index.DEBUG) {
diff --git a/core/plugins/org.eclipse.dltk.core.index.sql.h2/src/org/eclipse/dltk/internal/core/index/sql/h2/H2FileDao.java b/core/plugins/org.eclipse.dltk.core.index.sql.h2/src/org/eclipse/dltk/internal/core/index/sql/h2/H2FileDao.java
index 7e6c8ad..eb8b060 100644
--- a/core/plugins/org.eclipse.dltk.core.index.sql.h2/src/org/eclipse/dltk/internal/core/index/sql/h2/H2FileDao.java
+++ b/core/plugins/org.eclipse.dltk.core.index.sql.h2/src/org/eclipse/dltk/internal/core/index/sql/h2/H2FileDao.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2009 IBM Corporation and others.
+ * Copyright (c) 2009, 2017 IBM Corporation and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -37,75 +37,65 @@
 	private static final String Q_DELETE = "DELETE FROM FILES WHERE PATH=? AND CONTAINER_ID=?;"; //$NON-NLS-1$
 	private static final String Q_DELETE_BY_ID = "DELETE FROM FILES WHERE ID=?;"; //$NON-NLS-1$
 
+	@Override
 	public File insert(Connection connection, String path, long timestamp,
 			int containerId) throws SQLException {
 
-		PreparedStatement statement = connection.prepareStatement(Q_INSERT,
-				Statement.RETURN_GENERATED_KEYS);
-		try {
+		try (PreparedStatement statement = connection.prepareStatement(Q_INSERT,
+				Statement.RETURN_GENERATED_KEYS)) {
 			int param = 0;
 			statement.setString(++param, path);
 			statement.setLong(++param, timestamp);
 			statement.setInt(++param, containerId);
 			statement.executeUpdate();
 
-			ResultSet result = statement.getGeneratedKeys();
-			try {
+			try (ResultSet result = statement.getGeneratedKeys()) {
 				result.next();
 				File file = new File(result.getInt(1), path, timestamp,
 						containerId);
 				H2Cache.addFile(file);
 				return file;
-			} finally {
-				result.close();
 			}
-		} finally {
-			statement.close();
 		}
 	}
 
+	@Override
 	public File select(Connection connection, String path, int containerId)
 			throws SQLException {
 
 		File file = H2Cache.selectFileByContainerIdAndPath(containerId, path);
 		if (file == null) {
-			PreparedStatement statement = connection.prepareStatement(Q_SELECT);
-			try {
+			try (PreparedStatement statement = connection
+					.prepareStatement(Q_SELECT)) {
 				int param = 0;
 				statement.setString(++param, path);
 				statement.setInt(++param, containerId);
-				ResultSet result = statement.executeQuery();
-				try {
+				try (ResultSet result = statement.executeQuery()) {
 					if (result.next()) {
 						file = new File(result.getInt(1), result.getString(2),
 								result.getLong(3), result.getInt(4));
 
 						H2Cache.addFile(file);
 					}
-				} finally {
-					result.close();
 				}
-			} finally {
-				statement.close();
 			}
 		}
 		return file;
 	}
 
+	@Override
 	public File[] selectByContainerId(Connection connection, int containerId)
 			throws SQLException {
 
 		File[] files = H2Cache.selectFilesByContainerIdAsArray(containerId);
 		if (files == null) {
-			List<File> containerFiles = new LinkedList<File>();
+			List<File> containerFiles = new LinkedList<>();
 
-			PreparedStatement statement = connection
-					.prepareStatement(Q_SELECT_BY_CONTAINER_ID);
-			try {
+			try (PreparedStatement statement = connection
+					.prepareStatement(Q_SELECT_BY_CONTAINER_ID)) {
 				int param = 0;
 				statement.setInt(++param, containerId);
-				ResultSet result = statement.executeQuery();
-				try {
+				try (ResultSet result = statement.executeQuery()) {
 					while (result.next()) {
 						File file = new File(result.getInt(1),
 								result.getString(2), result.getLong(3),
@@ -114,69 +104,57 @@
 						containerFiles.add(file);
 						H2Cache.addFile(file);
 					}
-				} finally {
-					result.close();
 				}
-			} finally {
-				statement.close();
 			}
 			files = containerFiles.toArray(new File[containerFiles.size()]);
 		}
 		return files;
 	}
 
+	@Override
 	public File selectById(Connection connection, int id) throws SQLException {
 
 		File file = H2Cache.selectFileById(id);
 		if (file == null) {
-			PreparedStatement statement = connection
-					.prepareStatement(Q_SELECT_BY_ID);
-			try {
+			try (PreparedStatement statement = connection
+					.prepareStatement(Q_SELECT_BY_ID)) {
 				int param = 0;
 				statement.setInt(++param, id);
-				ResultSet result = statement.executeQuery();
-				try {
+				try (ResultSet result = statement.executeQuery()) {
 					if (result.next()) {
 						file = new File(result.getInt(1), result.getString(2),
 								result.getLong(3), result.getInt(4));
 
 						H2Cache.addFile(file);
 					}
-				} finally {
-					result.close();
 				}
-			} finally {
-				statement.close();
 			}
 		}
 		return file;
 	}
 
+	@Override
 	public void delete(Connection connection, String path, int containerId)
 			throws SQLException {
 
-		PreparedStatement statement = connection.prepareStatement(Q_DELETE);
-		try {
+		try (PreparedStatement statement = connection
+				.prepareStatement(Q_DELETE)) {
 			int param = 0;
 			statement.setString(++param, path);
 			statement.setInt(++param, containerId);
 			statement.executeUpdate();
-		} finally {
-			statement.close();
 		}
 
 		H2Cache.deleteFileByContainerIdAndPath(containerId, path);
 	}
 
+	@Override
 	public void deleteById(Connection connection, int id) throws SQLException {
-		PreparedStatement statement = connection
-				.prepareStatement(Q_DELETE_BY_ID);
-		try {
+		try (PreparedStatement statement = connection
+				.prepareStatement(Q_DELETE_BY_ID)) {
 			int param = 0;
 			statement.setInt(++param, id);
 			statement.executeUpdate();
-		} finally {
-			statement.close();
 		}
 
 		H2Cache.deleteFileById(id);
diff --git a/core/plugins/org.eclipse.dltk.core.index.sql.h2/src/org/eclipse/dltk/internal/core/index/sql/h2/Schema.java b/core/plugins/org.eclipse.dltk.core.index.sql.h2/src/org/eclipse/dltk/internal/core/index/sql/h2/Schema.java
index ccaf67e..849bd54 100644
--- a/core/plugins/org.eclipse.dltk.core.index.sql.h2/src/org/eclipse/dltk/internal/core/index/sql/h2/Schema.java
+++ b/core/plugins/org.eclipse.dltk.core.index.sql.h2/src/org/eclipse/dltk/internal/core/index/sql/h2/Schema.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2009 IBM Corporation and others.
+ * Copyright (c) 2009, 2017 IBM Corporation and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -42,7 +42,7 @@
 	public static final String VERSION = "0.8.1"; //$NON-NLS-1$
 
 	/** Contains already created tables names */
-	private static final Set<String> TABLES_CACHE = new HashSet<String>();
+	private static final Set<String> TABLES_CACHE = new HashSet<>();
 
 	/**
 	 * Creates the database schema using given connection.
@@ -53,19 +53,16 @@
 	 */
 	public void initialize(Connection connection) throws SQLException {
 		try {
-			Statement statement = connection.createStatement();
-			try {
+			try (Statement statement = connection.createStatement()) {
 				statement.executeUpdate(readSqlFile("resources/basic.sql")); //$NON-NLS-1$
-			} finally {
-				statement.close();
 			}
 
 			// Store new schema version:
 			storeSchemaVersion(VERSION);
 
 		} catch (SQLException e) {
-			H2Index.error(
-					"An exception was thrown while initializing schema", e); //$NON-NLS-1$
+			H2Index.error("An exception was thrown while initializing schema", //$NON-NLS-1$
+					e);
 			throw e;
 		}
 	}
@@ -112,16 +109,14 @@
 		synchronized (TABLES_CACHE) {
 			if (TABLES_CACHE.add(tableName)) {
 
-				String query = isReference ? readSqlFile("resources/element_ref.sql") //$NON-NLS-1$
+				String query = isReference
+						? readSqlFile("resources/element_ref.sql") //$NON-NLS-1$
 						: readSqlFile("resources/element_decl.sql"); //$NON-NLS-1$
 				query = NLS.bind(query, tableName);
 
 				try {
-					Statement statement = connection.createStatement();
-					try {
+					try (Statement statement = connection.createStatement()) {
 						statement.executeUpdate(query);
-					} finally {
-						statement.close();
 					}
 				} catch (SQLException e) {
 					H2Index.error(
@@ -166,15 +161,12 @@
 			URL resolved = FileLocator.resolve(url);
 
 			StringBuilder buf = new StringBuilder();
-			BufferedReader r = new BufferedReader(new InputStreamReader(
-					resolved.openStream()));
-			try {
+			try (BufferedReader r = new BufferedReader(
+					new InputStreamReader(resolved.openStream()))) {
 				String line;
 				while ((line = r.readLine()) != null) {
 					buf.append(line).append('\n');
 				}
-			} finally {
-				r.close();
 			}
 			return buf.toString();
 		} catch (IOException e) {
diff --git a/core/plugins/org.eclipse.dltk.core.index.sql/.settings/org.eclipse.jdt.core.prefs b/core/plugins/org.eclipse.dltk.core.index.sql/.settings/org.eclipse.jdt.core.prefs
index f0498f7..4fd52f1 100644
--- a/core/plugins/org.eclipse.dltk.core.index.sql/.settings/org.eclipse.jdt.core.prefs
+++ b/core/plugins/org.eclipse.dltk.core.index.sql/.settings/org.eclipse.jdt.core.prefs
@@ -1,9 +1,106 @@
 eclipse.preferences.version=1
+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.8
 org.eclipse.jdt.core.compiler.compliance=1.8
+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=disabled
+org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
+org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore
 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=ignore
+org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
+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=warning
+org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore
+org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore
+org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
+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.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=ignore
+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=ignore
+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=ignore
+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=ignore
+org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
+org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=disabled
+org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
+org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning
+org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
+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=ignore
+org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning
+org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
+org.eclipse.jdt.core.compiler.problem.unusedExceptionParameter=ignore
+org.eclipse.jdt.core.compiler.problem.unusedImport=warning
+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=disabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
+org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
+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.8
 org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
diff --git a/core/plugins/org.eclipse.dltk.core.index.sql/src/org/eclipse/dltk/core/index/sql/Container.java b/core/plugins/org.eclipse.dltk.core.index.sql/src/org/eclipse/dltk/core/index/sql/Container.java
index 3f9bfbe..40c7574 100644
--- a/core/plugins/org.eclipse.dltk.core.index.sql/src/org/eclipse/dltk/core/index/sql/Container.java
+++ b/core/plugins/org.eclipse.dltk.core.index.sql/src/org/eclipse/dltk/core/index/sql/Container.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2009 IBM Corporation and others.
+ * Copyright (c) 2009, 2017 IBM Corporation and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -48,6 +48,7 @@
 		return id;
 	}
 
+	@Override
 	public int hashCode() {
 		final int prime = 31;
 		int result = 1;
@@ -55,6 +56,7 @@
 		return result;
 	}
 
+	@Override
 	public boolean equals(Object obj) {
 		if (this == obj)
 			return true;
@@ -68,6 +70,7 @@
 		return true;
 	}
 
+	@Override
 	public String toString() {
 		return "Container [path=" + path + "]";
 	}
diff --git a/core/plugins/org.eclipse.dltk.core.index.sql/src/org/eclipse/dltk/core/index/sql/DbFactory.java b/core/plugins/org.eclipse.dltk.core.index.sql/src/org/eclipse/dltk/core/index/sql/DbFactory.java
index d22529c..96acb8f 100644
--- a/core/plugins/org.eclipse.dltk.core.index.sql/src/org/eclipse/dltk/core/index/sql/DbFactory.java
+++ b/core/plugins/org.eclipse.dltk.core.index.sql/src/org/eclipse/dltk/core/index/sql/DbFactory.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2009 IBM Corporation and others.
+ * Copyright (c) 2009, 2017 IBM Corporation and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -18,7 +18,6 @@
 import org.eclipse.core.runtime.Platform;
 import org.eclipse.core.runtime.jobs.ILock;
 import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.dltk.core.IShutdownListener;
 
 /**
  * Abstract database access factory
@@ -59,29 +58,24 @@
 								 * We don't want static initialization code to
 								 * be executed during framework shutdown.
 								 */
-								SqlIndex
-										.addShutdownListener(new IShutdownListener() {
-											public void shutdown() {
-												if (instance != null) {
-													try {
-														instance.dispose();
-													} catch (SQLException e) {
-														SqlIndex
-																.error(
-																		"DbFactory.dispose() error",
-																		e);
-													}
-													instance = null;
-												}
-											}
-										});
+								SqlIndex.addShutdownListener(() -> {
+									if (instance != null) {
+										try {
+											instance.dispose();
+										} catch (SQLException e) {
+											SqlIndex.error(
+													"DbFactory.dispose() error",
+													e);
+										}
+										instance = null;
+									}
+								});
 							}
 						}
 					} catch (Exception e) {
-						SqlIndex
-								.error(
-										"An exception has occurred while creating database factory",
-										e);
+						SqlIndex.error(
+								"An exception has occurred while creating database factory",
+								e);
 					}
 				}
 			} finally {
diff --git a/core/plugins/org.eclipse.dltk.core.index.sql/src/org/eclipse/dltk/core/index/sql/Element.java b/core/plugins/org.eclipse.dltk.core.index.sql/src/org/eclipse/dltk/core/index/sql/Element.java
index 402836d..51a60be 100644
--- a/core/plugins/org.eclipse.dltk.core.index.sql/src/org/eclipse/dltk/core/index/sql/Element.java
+++ b/core/plugins/org.eclipse.dltk.core.index.sql/src/org/eclipse/dltk/core/index/sql/Element.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2009 IBM Corporation and others.
+ * Copyright (c) 2009, 2017 IBM Corporation and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -113,6 +113,7 @@
 		return isReference;
 	}
 
+	@Override
 	public String toString() {
 		return "Element [type=" + type + ", isReference=" + isReference
 				+ ", name=" + name + "]";
diff --git a/core/plugins/org.eclipse.dltk.core.index.sql/src/org/eclipse/dltk/core/index/sql/File.java b/core/plugins/org.eclipse.dltk.core.index.sql/src/org/eclipse/dltk/core/index/sql/File.java
index 533fb8b..3a83daa 100644
--- a/core/plugins/org.eclipse.dltk.core.index.sql/src/org/eclipse/dltk/core/index/sql/File.java
+++ b/core/plugins/org.eclipse.dltk.core.index.sql/src/org/eclipse/dltk/core/index/sql/File.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2009 IBM Corporation and others.
+ * Copyright (c) 2009, 2017 IBM Corporation and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -65,6 +65,7 @@
 		return containerId;
 	}
 
+	@Override
 	public int hashCode() {
 		final int prime = 31;
 		int result = 1;
@@ -72,6 +73,7 @@
 		return result;
 	}
 
+	@Override
 	public boolean equals(Object obj) {
 		if (this == obj)
 			return true;
@@ -85,6 +87,7 @@
 		return true;
 	}
 
+	@Override
 	public String toString() {
 		return "File [containerId=" + containerId + ", path=" + path + "]";
 	}
diff --git a/core/plugins/org.eclipse.dltk.core.index.sql/src/org/eclipse/dltk/core/index/sql/SqlIndex.java b/core/plugins/org.eclipse.dltk.core.index.sql/src/org/eclipse/dltk/core/index/sql/SqlIndex.java
index bbe82e8..36561e8 100644
--- a/core/plugins/org.eclipse.dltk.core.index.sql/src/org/eclipse/dltk/core/index/sql/SqlIndex.java
+++ b/core/plugins/org.eclipse.dltk.core.index.sql/src/org/eclipse/dltk/core/index/sql/SqlIndex.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2009 IBM Corporation and others.
+ * Copyright (c) 2009, 2017 IBM Corporation and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -26,8 +26,9 @@
 
 	public static final String PLUGIN_ID = "org.eclipse.dltk.core.index.sql"; //$NON-NLS-1$
 
-	public static final boolean DEBUG = Boolean.valueOf(
-			Platform.getDebugOption(PLUGIN_ID + "/debug")).booleanValue(); //$NON-NLS-1$
+	public static final boolean DEBUG = Boolean
+			.valueOf(Platform.getDebugOption(PLUGIN_ID + "/debug")) //$NON-NLS-1$
+			.booleanValue();
 
 	private static SqlIndex plugin;
 
@@ -37,7 +38,7 @@
 		plugin = this;
 	}
 
-	private static final ListenerList shutdownListeners = new ListenerList();
+	private static final ListenerList<IShutdownListener> shutdownListeners = new ListenerList<>();
 
 	public static void addShutdownListener(IShutdownListener listener) {
 		shutdownListeners.add(listener);
@@ -45,9 +46,8 @@
 
 	@Override
 	public void stop(BundleContext context) throws Exception {
-		Object[] listeners = shutdownListeners.getListeners();
-		for (int i = 0; i < listeners.length; ++i) {
-			((IShutdownListener) listeners[i]).shutdown();
+		for (IShutdownListener listener : shutdownListeners) {
+			listener.shutdown();
 		}
 		shutdownListeners.clear();
 		plugin = null;
@@ -64,10 +64,8 @@
 	}
 
 	public static void error(String message) {
-		plugin.getLog()
-				.log(
-						new Status(IStatus.ERROR, PLUGIN_ID, IStatus.OK,
-								message, null));
+		plugin.getLog().log(new Status(IStatus.ERROR, PLUGIN_ID, IStatus.OK,
+				message, null));
 	}
 
 	public static void error(String message, Throwable t) {
diff --git a/core/plugins/org.eclipse.dltk.core.index.sql/src/org/eclipse/dltk/internal/core/index/sql/SqlIndexer.java b/core/plugins/org.eclipse.dltk.core.index.sql/src/org/eclipse/dltk/internal/core/index/sql/SqlIndexer.java
index d9ef82a..c02eae4 100644
--- a/core/plugins/org.eclipse.dltk.core.index.sql/src/org/eclipse/dltk/internal/core/index/sql/SqlIndexer.java
+++ b/core/plugins/org.eclipse.dltk.core.index.sql/src/org/eclipse/dltk/internal/core/index/sql/SqlIndexer.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2009 IBM Corporation and others.
+ * Copyright (c) 2009, 2017 IBM Corporation and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -57,6 +57,7 @@
 		elementDao = db.getElementDao();
 	}
 
+	@Override
 	public void addDeclaration(DeclarationInfo info) {
 
 		try {
@@ -72,6 +73,7 @@
 		}
 	}
 
+	@Override
 	public void addReference(ReferenceInfo info) {
 
 		try {
@@ -86,6 +88,7 @@
 		}
 	}
 
+	@Override
 	public void indexDocument(ISourceModule sourceModule) {
 
 		final IFileHandle fileHandle = EnvironmentPathUtils
@@ -109,17 +112,18 @@
 				if (sourceModule instanceof SourceModule) {
 					containerPath = sourceModule.getScriptProject().getPath();
 				} else {
-					containerPath = sourceModule.getAncestor(
-							IModelElement.PROJECT_FRAGMENT).getPath();
+					containerPath = sourceModule
+							.getAncestor(IModelElement.PROJECT_FRAGMENT)
+							.getPath();
 				}
-				Container container = dbFactory.getContainerDao().insert(
-						connection, containerPath.toString());
+				Container container = dbFactory.getContainerDao()
+						.insert(connection, containerPath.toString());
 
 				String relativePath;
 				if (toolkit instanceof IDLTKLanguageToolkitExtension
 						&& ((IDLTKLanguageToolkitExtension) toolkit)
-								.isArchiveFileName(sourceModule.getPath()
-										.toString())) {
+								.isArchiveFileName(
+										sourceModule.getPath().toString())) {
 					relativePath = ((ExternalSourceModule) sourceModule)
 							.getFullPath().toString();
 				} else {
@@ -127,8 +131,8 @@
 							containerPath.segmentCount());
 				}
 
-				long lastModified = fileHandle == null ? 0 : fileHandle
-						.lastModified();
+				long lastModified = fileHandle == null ? 0
+						: fileHandle.lastModified();
 
 				File existing = dbFactory.getFileDao().select(connection,
 						relativePath, container.getId());
@@ -152,29 +156,29 @@
 				connection.close();
 			}
 		} catch (Exception e) {
-			SqlIndex.error("An exception was thrown while indexing document", e);
+			SqlIndex.error("An exception was thrown while indexing document",
+					e);
 		}
 	}
 
+	@Override
 	public Map<String, Long> getDocuments(IPath containerPath) {
 		try {
 			DbFactory dbFactory = DbFactory.getInstance();
-			Connection connection = dbFactory.createConnection();
-			try {
+
+			try (Connection connection = dbFactory.createConnection()) {
 				Container containerDao = dbFactory.getContainerDao()
 						.selectByPath(connection, containerPath.toString());
 				if (containerDao != null) {
 
 					File[] files = dbFactory.getFileDao().selectByContainerId(
 							connection, containerDao.getId());
-					Map<String, Long> paths = new HashMap<String, Long>();
+					Map<String, Long> paths = new HashMap<>();
 					for (File fileDao : files) {
 						paths.put(fileDao.getPath(), fileDao.getTimestamp());
 					}
 					return paths;
 				}
-			} finally {
-				connection.close();
 			}
 		} catch (SQLException e) {
 			SqlIndex.error(
@@ -184,46 +188,41 @@
 		return null;
 	}
 
+	@Override
 	public void removeContainer(IPath containerPath) {
 		try {
 			DbFactory dbFactory = DbFactory.getInstance();
-			Connection connection = dbFactory.createConnection();
-			try {
+			try (Connection connection = dbFactory.createConnection()) {
 				dbFactory.getContainerDao().deleteByPath(connection,
 						containerPath.toString());
-			} finally {
-				connection.close();
 			}
 		} catch (SQLException e) {
-			SqlIndex.error(
-					NLS.bind(
-							"An exception thrown while removing container ''{0}'' from index",
-							containerPath.toString()), e);
+			SqlIndex.error(NLS.bind(
+					"An exception thrown while removing container ''{0}'' from index",
+					containerPath.toString()), e);
 		}
 	}
 
+	@Override
 	public void removeDocument(IPath containerPath, String relativePath) {
 		try {
 			DbFactory dbFactory = DbFactory.getInstance();
-			Connection connection = dbFactory.createConnection();
-			try {
+			try (Connection connection = dbFactory.createConnection()) {
 				Container containerDao = dbFactory.getContainerDao()
 						.selectByPath(connection, containerPath.toString());
 				if (containerDao != null) {
 					dbFactory.getFileDao().delete(connection, relativePath,
 							containerDao.getId());
 				}
-			} finally {
-				connection.close();
 			}
 		} catch (SQLException e) {
-			SqlIndex.error(
-					NLS.bind(
-							"An exception thrown while removing file ''{0}'' from index",
-							containerPath.append(relativePath).toString()), e);
+			SqlIndex.error(NLS.bind(
+					"An exception thrown while removing file ''{0}'' from index",
+					containerPath.append(relativePath).toString()), e);
 		}
 	}
 
+	@Override
 	public ISearchEngine createSearchEngine() {
 		return new SqlSearchEngine();
 	}
diff --git a/core/plugins/org.eclipse.dltk.core.index.sql/src/org/eclipse/dltk/internal/core/index/sql/SqlSearchEngine.java b/core/plugins/org.eclipse.dltk.core.index.sql/src/org/eclipse/dltk/internal/core/index/sql/SqlSearchEngine.java
index b0b168e..a3fca1b 100644
--- a/core/plugins/org.eclipse.dltk.core.index.sql/src/org/eclipse/dltk/internal/core/index/sql/SqlSearchEngine.java
+++ b/core/plugins/org.eclipse.dltk.core.index.sql/src/org/eclipse/dltk/internal/core/index/sql/SqlSearchEngine.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2009 IBM Corporation and others.
+ * Copyright (c) 2009, 2017 IBM Corporation and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -53,15 +53,16 @@
  */
 public class SqlSearchEngine implements ISearchEngineExtension {
 
+	@Override
 	public void search(int elementType, String qualifier, String elementName,
 			int trueFlags, int falseFlags, int limit, SearchFor searchFor,
 			MatchRule matchRule, IDLTKSearchScope scope,
 			ISearchRequestor requestor, IProgressMonitor monitor) {
-		search(elementType, qualifier, elementName, null, trueFlags,
-				falseFlags, limit, searchFor, matchRule, scope, requestor,
-				monitor);
+		search(elementType, qualifier, elementName, null, trueFlags, falseFlags,
+				limit, searchFor, matchRule, scope, requestor, monitor);
 	}
 
+	@Override
 	public void search(int elementType, String qualifier, String elementName,
 			String parent, int trueFlags, int falseFlags, int limit,
 			SearchFor searchFor, MatchRule matchRule, IDLTKSearchScope scope,
@@ -87,7 +88,7 @@
 				if (!(scope instanceof DLTKWorkspaceScope)) {
 					// Calculate container IDs:
 					IPath[] containerPaths = scope.enclosingProjectsAndZips();
-					List<Integer> containerIdsList = new LinkedList<Integer>();
+					List<Integer> containerIdsList = new LinkedList<>();
 					for (IPath containerPath : containerPaths) {
 						Container container = dbFactory.getContainerDao()
 								.selectByPath(connection,
@@ -105,7 +106,7 @@
 
 					// Calculate file IDs:
 					if (scope instanceof DLTKSearchScope) {
-						List<Integer> fileIdsList = new LinkedList<Integer>();
+						List<Integer> fileIdsList = new LinkedList<>();
 						String[] relativePaths = ((DLTKSearchScope) scope)
 								.getRelativePaths();
 						String[] fileExtensions = ScriptModelUtil
@@ -147,9 +148,9 @@
 				}
 
 				boolean searchForDecls = searchFor == SearchFor.DECLARATIONS
-						|| searchFor == SearchFor.ALL_OCCURENCES;
+						|| searchFor == SearchFor.ALL_OCCURRENCES;
 				boolean searchForRefs = searchFor == SearchFor.REFERENCES
-						|| searchFor == SearchFor.ALL_OCCURENCES;
+						|| searchFor == SearchFor.ALL_OCCURRENCES;
 
 				if (searchForDecls) {
 					dbFactory.getElementDao().search(connection, elementName,
@@ -195,10 +196,10 @@
 
 	class ElementHandler implements IElementHandler, ISearchRequestor {
 
-		private Map<Integer, File> fileCache = new HashMap<Integer, File>();
-		private Map<Integer, Container> containerCache = new HashMap<Integer, Container>();
-		private Map<String, IProjectFragment> projectFragmentCache = new HashMap<String, IProjectFragment>();
-		private Map<String, ISourceModule> sourceModuleCache = new HashMap<String, ISourceModule>();
+		private Map<Integer, File> fileCache = new HashMap<>();
+		private Map<Integer, Container> containerCache = new HashMap<>();
+		private Map<String, IProjectFragment> projectFragmentCache = new HashMap<>();
+		private Map<String, ISourceModule> sourceModuleCache = new HashMap<>();
 		private Connection connection;
 		private ISearchRequestor searchRequestor;
 		private IDLTKSearchScope scope;
@@ -211,6 +212,7 @@
 			this.searchRequestor = searchRequestor;
 		}
 
+		@Override
 		public void handle(Element element) {
 			try {
 				DbFactory dbFactory = DbFactory.getInstance();
@@ -218,8 +220,8 @@
 				int fileId = element.getFileId();
 				File file = fileCache.get(fileId);
 				if (file == null) {
-					file = dbFactory.getFileDao()
-							.selectById(connection, fileId);
+					file = dbFactory.getFileDao().selectById(connection,
+							fileId);
 					if (file == null) {
 						return;
 					}
@@ -229,8 +231,8 @@
 				int containerId = file.getContainerId();
 				Container container = containerCache.get(containerId);
 				if (container == null) {
-					container = dbFactory.getContainerDao().selectById(
-							connection, containerId);
+					container = dbFactory.getContainerDao()
+							.selectById(connection, containerId);
 					if (container == null) {
 						return;
 					}
@@ -246,8 +248,8 @@
 					containerPath = containerPath
 							+ IDLTKSearchScope.FILE_ENTRY_SEPARATOR;
 				}
-				if (containerPath.length() != 0
-						&& containerPath.charAt(containerPath.length() - 1) != IPath.SEPARATOR) {
+				if (containerPath.length() != 0 && containerPath.charAt(
+						containerPath.length() - 1) != IPath.SEPARATOR) {
 					containerPath = containerPath + IPath.SEPARATOR;
 				}
 
@@ -324,6 +326,7 @@
 			}
 		}
 
+		@Override
 		public void match(int elementType, int flags, int offset, int length,
 				int nameOffset, int nameLength, String elementName,
 				String metadata, String doc, String qualifier, String parent,