Fix warnings in dltk.core.tests.

Change-Id: Id32bd6f6eb2aa8834876c8530decc01661cc61c9
Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
diff --git a/core/tests/org.eclipse.dltk.core.tests/.settings/org.eclipse.jdt.core.prefs b/core/tests/org.eclipse.dltk.core.tests/.settings/org.eclipse.jdt.core.prefs
index 2adb63f..66f63ac 100644
--- a/core/tests/org.eclipse.dltk.core.tests/.settings/org.eclipse.jdt.core.prefs
+++ b/core/tests/org.eclipse.dltk.core.tests/.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
@@ -22,9 +25,9 @@
 org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
 org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled
 org.eclipse.jdt.core.compiler.problem.discouragedReference=ignore
-org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore
+org.eclipse.jdt.core.compiler.problem.emptyStatement=warning
 org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
-org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=ignore
+org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=warning
 org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
 org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled
 org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore
@@ -35,7 +38,7 @@
 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.indirectStaticAccess=warning
 org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore
 org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
 org.eclipse.jdt.core.compiler.problem.missingDefaultCase=ignore
@@ -50,20 +53,22 @@
 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=ignore
-org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=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
@@ -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/tests/org.eclipse.dltk.core.tests/.settings/org.eclipse.jdt.ui.prefs b/core/tests/org.eclipse.dltk.core.tests/.settings/org.eclipse.jdt.ui.prefs
index 8a26bb5..2be769c 100644
--- a/core/tests/org.eclipse.dltk.core.tests/.settings/org.eclipse.jdt.ui.prefs
+++ b/core/tests/org.eclipse.dltk.core.tests/.settings/org.eclipse.jdt.ui.prefs
@@ -15,10 +15,10 @@
 sp_cleanup.always_use_parentheses_in_expressions=false
 sp_cleanup.always_use_this_for_non_static_field_access=false
 sp_cleanup.always_use_this_for_non_static_method_access=false
-sp_cleanup.convert_functional_interfaces=false
+sp_cleanup.convert_functional_interfaces=true
 sp_cleanup.convert_to_enhanced_for_loop=false
 sp_cleanup.correct_indentation=false
-sp_cleanup.format_source_code=false
+sp_cleanup.format_source_code=true
 sp_cleanup.format_source_code_changes_only=false
 sp_cleanup.insert_inferred_type_arguments=false
 sp_cleanup.make_local_variable_final=true
@@ -36,13 +36,13 @@
 sp_cleanup.qualify_static_member_accesses_with_declaring_class=false
 sp_cleanup.qualify_static_method_accesses_with_declaring_class=false
 sp_cleanup.remove_private_constructors=true
-sp_cleanup.remove_redundant_type_arguments=false
-sp_cleanup.remove_trailing_whitespaces=false
+sp_cleanup.remove_redundant_type_arguments=true
+sp_cleanup.remove_trailing_whitespaces=true
 sp_cleanup.remove_trailing_whitespaces_all=true
 sp_cleanup.remove_trailing_whitespaces_ignore_empty=false
 sp_cleanup.remove_unnecessary_casts=true
 sp_cleanup.remove_unnecessary_nls_tags=false
-sp_cleanup.remove_unused_imports=false
+sp_cleanup.remove_unused_imports=true
 sp_cleanup.remove_unused_local_variables=false
 sp_cleanup.remove_unused_private_fields=true
 sp_cleanup.remove_unused_private_members=false
diff --git a/core/tests/org.eclipse.dltk.core.tests/src/org/eclipse/dltk/core/tests/BundledProjectSetup.java b/core/tests/org.eclipse.dltk.core.tests/src/org/eclipse/dltk/core/tests/BundledProjectSetup.java
index 7aee954..47b3fd1 100644
--- a/core/tests/org.eclipse.dltk.core.tests/src/org/eclipse/dltk/core/tests/BundledProjectSetup.java
+++ b/core/tests/org.eclipse.dltk.core.tests/src/org/eclipse/dltk/core/tests/BundledProjectSetup.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2011, 2016 NumberFour AG
+ * Copyright (c) 2011, 2017 NumberFour AG and others.
  *
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
@@ -18,25 +18,25 @@
 import java.util.Collections;
 import java.util.List;
 
-import junit.extensions.TestSetup;
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
 import org.eclipse.core.resources.IncrementalProjectBuilder;
 import org.eclipse.dltk.core.tests.model.AbstractModelTests;
 import org.eclipse.dltk.core.tests.model.SuiteOfTestCases;
 import org.eclipse.dltk.core.tests.model.SuiteOfTestCases.Suite;
 import org.eclipse.dltk.internal.core.ModelManager;
 
+import junit.extensions.TestSetup;
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
 /**
  * A decorator for tests to initialize workspace project before executing the
  * tests. Use as follows:
- * 
+ *
  * <pre>
- * suite.addTest(new BundledProjectSetup(MyPluginActivator.PLUGIN_ID, &quot;myProject&quot;,
- * 		new TestSuite(MyTests.class)));
+ * suite.addTest(new BundledProjectSetup(MyPluginActivator.PLUGIN_ID,
+ * 		&quot;myProject&quot;, new TestSuite(MyTests.class)));
  * </pre>
- * 
+ *
  * where <code>myProject</code> is the folder with the preconfigured project
  * located at <code>bundleRoot/workspace/myProject</code>
  */
@@ -45,7 +45,7 @@
 	public static class Builder {
 
 		private String bundleName;
-		private List<String> projectNames = new ArrayList<String>();
+		private List<String> projectNames = new ArrayList<>();
 		private boolean build;
 		private boolean disableIndexer;
 
@@ -70,14 +70,14 @@
 				return createSuite(testClasses[0]);
 			} else {
 				final TestSuite result = new TestSuite();
-				final List<String> names = new ArrayList<String>();
+				final List<String> names = new ArrayList<>();
 				for (Class<?> clazz : testClasses) {
 					final Test suite = createSuite(clazz);
 					result.addTest(suite);
 					names.add(clazz.getName());
 				}
-				result.setName(findLongestCommonPrefix(names
-						.toArray(new String[names.size()])) + "*.tests");
+				result.setName(findLongestCommonPrefix(
+						names.toArray(new String[names.size()])) + "*.tests");
 				return result;
 			}
 		}
@@ -135,12 +135,13 @@
 	private final boolean build;
 	private final boolean disableIndexer;
 
-	public BundledProjectSetup(String bundleName, String projectName, Test test) {
+	public BundledProjectSetup(String bundleName, String projectName,
+			Test test) {
 		this(bundleName, projectName, test, false);
 	}
 
-	public BundledProjectSetup(String bundleName, String projectName,
-			Test test, boolean build) {
+	public BundledProjectSetup(String bundleName, String projectName, Test test,
+			boolean build) {
 		this(bundleName, new String[] { projectName }, test, build);
 	}
 
@@ -171,12 +172,12 @@
 		if (build) {
 			final long start = System.currentTimeMillis();
 			for (String projectName : projectNames) {
-				getProject(projectName).build(
-						IncrementalProjectBuilder.FULL_BUILD, null);
+				getProject(projectName)
+						.build(IncrementalProjectBuilder.FULL_BUILD, null);
 			}
-			System.out.println((System.currentTimeMillis() - start)
-					+ " ms to build " + Arrays.asList(projectNames)
-					+ " project(s)");
+			System.out.println(
+					(System.currentTimeMillis() - start) + " ms to build "
+							+ Arrays.asList(projectNames) + " project(s)");
 		}
 	}
 
diff --git a/core/tests/org.eclipse.dltk.core.tests/src/org/eclipse/dltk/core/tests/CodeAssistUtil.java b/core/tests/org.eclipse.dltk.core.tests/src/org/eclipse/dltk/core/tests/CodeAssistUtil.java
index 203801d..b1888d4 100644
--- a/core/tests/org.eclipse.dltk.core.tests/src/org/eclipse/dltk/core/tests/CodeAssistUtil.java
+++ b/core/tests/org.eclipse.dltk.core.tests/src/org/eclipse/dltk/core/tests/CodeAssistUtil.java
@@ -152,11 +152,10 @@
 	private CodeAssistUtil calculateOffset(String marker, boolean last,
 			boolean after) {
 		final String text = module.getSource();
-		final int offset = last ? text.lastIndexOf(marker) : text
-				.indexOf(marker);
-		Assert.assertTrue(
-				NLS.bind("Pattern \"{0}\" not found in {1}", marker,
-						module.getName()), offset != -1);
+		final int offset = last ? text.lastIndexOf(marker)
+				: text.indexOf(marker);
+		Assert.assertTrue(NLS.bind("Pattern \"{0}\" not found in {1}", marker,
+				module.getName()), offset != -1);
 		this.offset = offset + (after ? marker.length() : 0);
 		return this;
 	}
@@ -213,7 +212,8 @@
 			}
 			final CompletionProposal[] sorted = proposals
 					.toArray(new CompletionProposal[proposals.size()]);
-			Arrays.sort(sorted, (pr, pr1) -> pr.getName().compareTo(pr1.getName()));
+			Arrays.sort(sorted,
+					(pr, pr1) -> pr.getName().compareTo(pr1.getName()));
 			final String[] sortedNames = new String[names.length];
 			System.arraycopy(names, 0, sortedNames, 0, names.length);
 			Arrays.sort(sortedNames);
@@ -230,8 +230,8 @@
 			for (int i = 0, size = proposals.size(); i < size; ++i) {
 				final CompletionProposal proposal = proposals.get(i);
 				String name = proposal.getName();
-				if (withKinds
-						&& proposal.getKind() == CompletionProposal.METHOD_REF) {
+				if (withKinds && proposal
+						.getKind() == CompletionProposal.METHOD_REF) {
 					name += "()";
 				}
 				list.add(name);
@@ -241,9 +241,9 @@
 
 		public void assertEquals(String... expectedProposalNames) {
 			if (!compareProposalNames(expectedProposalNames)) {
-				Assert.assertEquals(new StringList(expectedProposalNames)
-						.sort().toString(), exractProposalNames(false).sort()
-						.toString());
+				Assert.assertEquals(
+						new StringList(expectedProposalNames).sort().toString(),
+						exractProposalNames(false).sort().toString());
 			}
 		}
 
@@ -258,8 +258,8 @@
 					return proposal;
 				}
 			}
-			throw new IllegalArgumentException(NLS.bind(
-					"\"{0}\" completion proposal not found", name));
+			throw new IllegalArgumentException(
+					NLS.bind("\"{0}\" completion proposal not found", name));
 		}
 
 		/**
@@ -280,7 +280,7 @@
 	}
 
 	public CodeCompletionResult codeComplete(ICompletionEngine engine) {
-		final List<CompletionProposal> proposals = new ArrayList<CompletionProposal>();
+		final List<CompletionProposal> proposals = new ArrayList<>();
 		engine.setRequestor(new TestCompletionRequestor(proposals));
 		engine.complete(getModuleSource(), offset(), 0);
 		return new CodeCompletionResult(proposals);
@@ -290,13 +290,13 @@
 	 * Performs code completion in this source module.
 	 */
 	public CodeCompletionResult codeComplete() throws ModelException {
-		final List<CompletionProposal> proposals = new ArrayList<CompletionProposal>();
+		final List<CompletionProposal> proposals = new ArrayList<>();
 		module.codeComplete(offset(), new TestCompletionRequestor(proposals));
 		return new CodeCompletionResult(proposals);
 	}
 
 	public Object[] codeSelectAll(ISelectionEngine engine) {
-		final List<Object> elements = new ArrayList<Object>();
+		final List<Object> elements = new ArrayList<>();
 		engine.setRequestor(new ISelectionRequestor() {
 			@Override
 			public void acceptModelElement(IModelElement element) {
@@ -322,7 +322,7 @@
 	}
 
 	public IModelElement[] codeSelect(ISelectionEngine engine) {
-		final List<IModelElement> elements = new ArrayList<IModelElement>();
+		final List<IModelElement> elements = new ArrayList<>();
 		engine.setRequestor(new ISelectionRequestor() {
 
 			@Override
diff --git a/core/tests/org.eclipse.dltk.core.tests/src/org/eclipse/dltk/core/tests/FileUtil.java b/core/tests/org.eclipse.dltk.core.tests/src/org/eclipse/dltk/core/tests/FileUtil.java
index 0c786e7..d6c88c3 100644
--- a/core/tests/org.eclipse.dltk.core.tests/src/org/eclipse/dltk/core/tests/FileUtil.java
+++ b/core/tests/org.eclipse.dltk.core.tests/src/org/eclipse/dltk/core/tests/FileUtil.java
@@ -1,11 +1,10 @@
 /*******************************************************************************
- * Copyright (c) 2005, 2007 IBM Corporation and others.
+ * Copyright (c) 2005, 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
  *
- 
  *******************************************************************************/
 package org.eclipse.dltk.core.tests;
 
@@ -32,8 +31,8 @@
 		}
 		final File[] files = source.listFiles();
 		if (files == null) {
-			throw new IllegalStateException("Source directory " + source
-					+ " doesn't exist");
+			throw new IllegalStateException(
+					"Source directory " + source + " doesn't exist");
 		}
 		for (int i = 0; i < files.length; i++) {
 			final File sourceChild = files[i];
@@ -59,28 +58,13 @@
 	 * destination file).
 	 */
 	public static void copyFile(File src, File dest) throws IOException {
-		InputStream in = null;
-		OutputStream out = null;
 		byte[] buffer = new byte[12 * 1024];
 		int read;
 
-		try {
-			in = new FileInputStream(src);
-
-			try {
-				out = new FileOutputStream(dest);
-
-				while ((read = in.read(buffer)) != -1) {
-					out.write(buffer, 0, read);
-				}
-			} finally {
-				if (out != null) {
-					out.close();
-				}
-			}
-		} finally {
-			if (in != null) {
-				in.close();
+		try (InputStream in = new FileInputStream(src);
+				OutputStream out = new FileOutputStream(dest)) {
+			while ((read = in.read(buffer)) != -1) {
+				out.write(buffer, 0, read);
 			}
 		}
 	}
diff --git a/core/tests/org.eclipse.dltk.core.tests/src/org/eclipse/dltk/core/tests/ProblemTestUtil.java b/core/tests/org.eclipse.dltk.core.tests/src/org/eclipse/dltk/core/tests/ProblemTestUtil.java
index c0137a2..828eade 100644
--- a/core/tests/org.eclipse.dltk.core.tests/src/org/eclipse/dltk/core/tests/ProblemTestUtil.java
+++ b/core/tests/org.eclipse.dltk.core.tests/src/org/eclipse/dltk/core/tests/ProblemTestUtil.java
@@ -54,8 +54,8 @@
 	 * Returns problem identifier from the specified problem marker.
 	 */
 	public static IProblemIdentifier getProblemId(final IMarker problem) {
-		return DefaultProblemIdentifier.decode(problem.getAttribute(
-				IScriptModelMarker.ID, null));
+		return DefaultProblemIdentifier
+				.decode(problem.getAttribute(IScriptModelMarker.ID, null));
 	}
 
 	/**
@@ -78,7 +78,8 @@
 	/**
 	 * Asserts the expected number of problems in the specified array.
 	 */
-	public static void assertProblemCount(int expectedCount, IMarker[] problems) {
+	public static void assertProblemCount(int expectedCount,
+			IMarker[] problems) {
 		assertEquals(toString(problems), expectedCount, problems.length);
 	}
 
@@ -107,7 +108,7 @@
 	 *         "message1,message2,message3"
 	 */
 	public static String toString(IMarker[] markers) {
-		final List<String> text = new ArrayList<String>();
+		final List<String> text = new ArrayList<>();
 		for (IMarker marker : markers) {
 			text.add(toString(marker));
 		}
@@ -121,8 +122,8 @@
 		final IFile file = (IFile) marker.getResource();
 		final int lineNumber = marker.getAttribute(IMarker.LINE_NUMBER, 0) - 1;
 		assertTrue("Marker doesn't have line number", lineNumber >= 0);
-		final String[] lines = TextUtils.splitLines(new CharArraySequence(Util
-				.getResourceContentsAsCharArray(file)));
+		final String[] lines = TextUtils.splitLines(new CharArraySequence(
+				Util.getResourceContentsAsCharArray(file)));
 		return lines[lineNumber];
 	}
 
diff --git a/core/tests/org.eclipse.dltk.core.tests/src/org/eclipse/dltk/core/tests/ProjectSetup.java b/core/tests/org.eclipse.dltk.core.tests/src/org/eclipse/dltk/core/tests/ProjectSetup.java
index 5dbaec1..ca25b4e 100644
--- a/core/tests/org.eclipse.dltk.core.tests/src/org/eclipse/dltk/core/tests/ProjectSetup.java
+++ b/core/tests/org.eclipse.dltk.core.tests/src/org/eclipse/dltk/core/tests/ProjectSetup.java
@@ -40,12 +40,12 @@
 /**
  * The ProjectSetup Rule provides convenient way of creating workspace project
  * based on prepared template in JUnit4 tests:
- * 
+ *
  * <pre>
  * &#064;ClassRule
  * public static final ProjectSetup PROJECT = new ProjectSetup(....);
  * </pre>
- * 
+ *
  * In JUnit versions before 4.9 &#064;ClassRule was not available, so instead of
  * it, {@link #create(ProjectSetup...)} and {@link #delete(ProjectSetup...)}
  * methods should be called manually from the methods annotated with
@@ -87,7 +87,7 @@
 		/**
 		 * Specifies the exclusion path, those files will be excluded during
 		 * initial project creation, but can be created individually later.
-		 * 
+		 *
 		 * @see #createFile(String, Option)
 		 */
 		public static Option exclude(String path) {
@@ -153,7 +153,7 @@
 			Option option, Option... restOptions) {
 		this.workspaceSetup = workspaceSetup;
 		this.projectName = projectName;
-		this.options = new HashSet<Option>();
+		this.options = new HashSet<>();
 		this.options.add(option);
 		Collections.addAll(this.options, restOptions);
 		if (hasOption(Option.INDEXER_DISABLED)
@@ -198,10 +198,10 @@
 			throws IOException, CoreException {
 		final File source = getSourceDirectory();
 		if (!source.isDirectory()) {
-			throw new IllegalStateException(NLS.bind(
-					"Source directory \"{0}\" doesn't exist", source));
+			throw new IllegalStateException(
+					NLS.bind("Source directory \"{0}\" doesn't exist", source));
 		}
-		final Set<File> excludes = new HashSet<File>();
+		final Set<File> excludes = new HashSet<>();
 		for (Option option : options) {
 			if (option instanceof ExcludeOption) {
 				final File exclude = new File(source,
@@ -216,8 +216,8 @@
 		final File target = getWorkspaceRoot().getLocation()
 				.append(workspaceProjectName).toFile();
 		FileUtil.copyDirectory(source, target, excludes);
-		final IProject project = getWorkspaceRoot().getProject(
-				workspaceProjectName);
+		final IProject project = getWorkspaceRoot()
+				.getProject(workspaceProjectName);
 		ResourcesPlugin.getWorkspace().run(monitor -> {
 			project.create(null);
 			if (!hasOption(Option.CLOSED)) {
@@ -287,15 +287,16 @@
 	 */
 	@Override
 	public IProject get() {
-		Assert.assertNotNull("ProjectSetup " + getProjectName()
-				+ " not initialized", project);
+		Assert.assertNotNull(
+				"ProjectSetup " + getProjectName() + " not initialized",
+				project);
 		return project;
 	}
 
 	/**
 	 * Creates the specified file from the source project. Typical use case is
 	 * creation of the files which were excluded initially.
-	 * 
+	 *
 	 * @param filename
 	 *            project related filename
 	 * @param option
@@ -306,8 +307,8 @@
 			throws CoreException {
 		final File sourceFile = new File(getSourceDirectory(), filename);
 		if (!sourceFile.isFile()) {
-			throw new IllegalArgumentException(NLS.bind(
-					"Source file {0} doesn't exist", sourceFile));
+			throw new IllegalArgumentException(
+					NLS.bind("Source file {0} doesn't exist", sourceFile));
 		}
 		final IFile file = getFile(filename);
 		final FileInputStream input;
diff --git a/core/tests/org.eclipse.dltk.core.tests/src/org/eclipse/dltk/core/tests/TestSupport.java b/core/tests/org.eclipse.dltk.core.tests/src/org/eclipse/dltk/core/tests/TestSupport.java
index c859e97..5cf84f6 100644
--- a/core/tests/org.eclipse.dltk.core.tests/src/org/eclipse/dltk/core/tests/TestSupport.java
+++ b/core/tests/org.eclipse.dltk.core.tests/src/org/eclipse/dltk/core/tests/TestSupport.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2008 xored software, Inc.
+ * Copyright (c) 2008, 2017 xored software, Inc. and others.
  *
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
@@ -23,20 +23,21 @@
 public class TestSupport {
 
 	/**
-	 * Runs the calling JUnit test again and fails only if it unexpectedly runs.<br>
-	 * 
+	 * Runs the calling JUnit test again and fails only if it unexpectedly
+	 * runs.<br>
+	 *
 	 * This is helpful for tests that don't currently work but should work one
 	 * day, when the tested functionality has been implemented.<br>
-	 * 
+	 *
 	 * The right way to use it is:
-	 * 
+	 *
 	 * <pre>
 	 * public void testXXX() {
 	 *   if (TestSupport.notYetImplemented(this)) return;
 	 *   ... the real (now failing) unit test
 	 * }
 	 * </pre>
-	 * 
+	 *
 	 * @return <false> when not itself already in the call stack
 	 */
 	public static boolean notYetImplemented(Object caller) {
@@ -73,7 +74,7 @@
 
 	/**
 	 * Finds from the call stack the active running JUnit test case
-	 * 
+	 *
 	 * @return the test case method
 	 * @throws RuntimeException
 	 *             if no method could be found.
@@ -103,7 +104,7 @@
 
 	/**
 	 * Test if the method is a junit test.
-	 * 
+	 *
 	 * @param method
 	 *            the method
 	 * @return <code>true</code> if this is a junit test.
@@ -112,16 +113,16 @@
 		return method.getReturnType().equals(Void.TYPE)
 				&& Modifier.isPublic(method.getModifiers())
 				&& (method.getParameterTypes().length == 0
-						&& method.getName().startsWith("test") || method
-						.getAnnotation(Test.class) != null);
+						&& method.getName().startsWith("test")
+						|| method.getAnnotation(Test.class) != null);
 	}
 
-	private static final ThreadLocal<Boolean> notYetImplementedFlag = new ThreadLocal<Boolean>();
+	private static final ThreadLocal<Boolean> notYetImplementedFlag = new ThreadLocal<>();
 
 	public static boolean ignored(TestCase testCase) {
 		try {
-			final Method runMethod = testCase.getClass().getMethod(
-					testCase.getName(), NO_PARAMS);
+			final Method runMethod = testCase.getClass()
+					.getMethod(testCase.getName(), NO_PARAMS);
 			if (runMethod.getAnnotation(Ignore.class) != null) {
 				return true;
 			}
diff --git a/core/tests/org.eclipse.dltk.core.tests/src/org/eclipse/dltk/core/tests/UserLibraryTests.java b/core/tests/org.eclipse.dltk.core.tests/src/org/eclipse/dltk/core/tests/UserLibraryTests.java
index e479404..f051ba2 100644
--- a/core/tests/org.eclipse.dltk.core.tests/src/org/eclipse/dltk/core/tests/UserLibraryTests.java
+++ b/core/tests/org.eclipse.dltk.core.tests/src/org/eclipse/dltk/core/tests/UserLibraryTests.java
@@ -35,33 +35,39 @@
 		TEMPLATE += "	<archive path=\"org.eclipse.dltk.core.environment.localEnvironment/:{0}\"/>\n";
 		TEMPLATE += "</userlibrary>\n";
 	}
+
 	@Test
 	public void testSerializationSystemLibrary() throws IOException {
 		String path = "/segment01";
 
-		IBuildpathEntry[] entries = new IBuildpathEntry[] { createBuildpathEntry(path) };
+		IBuildpathEntry[] entries = new IBuildpathEntry[] {
+				createBuildpathEntry(path) };
 
 		String output = UserLibrary.serialize(entries, true);
 
 		assertEquals(output, createXML(path, true));
 	}
+
 	@Test
 	public void testSerializationNotSystemLibrary() throws IOException {
 		String path = "/segment01/segment02";
 
-		IBuildpathEntry[] entries = new IBuildpathEntry[] { createBuildpathEntry(path) };
+		IBuildpathEntry[] entries = new IBuildpathEntry[] {
+				createBuildpathEntry(path) };
 
 		String output = UserLibrary.serialize(entries, false);
 
 		assertEquals(output, createXML(path, false));
 	}
+
 	@Test
 	public void testSerializationAttributes() throws IOException {
 		String path = "/segment01/segment02";
 
-		IBuildpathEntry[] entries = new IBuildpathEntry[] { createBuildpathEntry(path) };
+		IBuildpathEntry[] entries = new IBuildpathEntry[] {
+				createBuildpathEntry(path) };
 
-		Map<String, String> attributes = new HashMap<String, String>();
+		Map<String, String> attributes = new HashMap<>();
 		attributes.put("libraryVersion", "1.0.0");
 		attributes.put("builtin", "true");
 		String output = UserLibrary.serialize(entries, false, attributes);
@@ -70,6 +76,7 @@
 		attributesOutput += "__attribute__libraryVersion=\"1.0.0\" ";
 		assertEquals(output, createXML(path, false, attributesOutput));
 	}
+
 	@Test
 	public void testDeserializationSystemLibrary() throws IOException {
 		String path = "/library/path";
@@ -83,6 +90,7 @@
 		assertEquals(userLibrary.isSystemLibrary(), true);
 		assertEquals(userLibrary.getAttributes().size(), 0);
 	}
+
 	@Test
 	public void testDeserializationNotSystemLibrary() throws IOException {
 		String path = "/library/path";
@@ -96,6 +104,7 @@
 		assertEquals(userLibrary.isSystemLibrary(), false);
 		assertEquals(userLibrary.getAttributes().size(), 0);
 	}
+
 	@Test
 	public void testDeserializationAttributes() throws IOException {
 		String path = "/library/path";
@@ -107,7 +116,7 @@
 		StringReader reader = new StringReader(xml);
 		UserLibrary userLibrary = UserLibrary.createFromString(reader);
 
-		Map<String, String> attributes = new HashMap<String, String>();
+		Map<String, String> attributes = new HashMap<>();
 		attributes.put("libraryVersion", "1.0.0");
 		attributes.put("builtin", "true");
 
@@ -129,8 +138,8 @@
 
 	private String createXML(String path, boolean isSystemLibrary,
 			String attributes) {
-		return MessageFormat
-				.format(TEMPLATE, path, isSystemLibrary, attributes);
+		return MessageFormat.format(TEMPLATE, path, isSystemLibrary,
+				attributes);
 	}
 
 }
diff --git a/core/tests/org.eclipse.dltk.core.tests/src/org/eclipse/dltk/core/tests/buildpath/BuildpathTests.java b/core/tests/org.eclipse.dltk.core.tests/src/org/eclipse/dltk/core/tests/buildpath/BuildpathTests.java
index 2290a85..c3042e7 100644
--- a/core/tests/org.eclipse.dltk.core.tests/src/org/eclipse/dltk/core/tests/buildpath/BuildpathTests.java
+++ b/core/tests/org.eclipse.dltk.core.tests/src/org/eclipse/dltk/core/tests/buildpath/BuildpathTests.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2016 IBM Corporation and others.
+ * Copyright (c) 2000, 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
@@ -15,8 +15,6 @@
 import java.util.Hashtable;
 import java.util.Map;
 
-import junit.framework.Test;
-
 import org.eclipse.core.resources.IFile;
 import org.eclipse.core.resources.IMarker;
 import org.eclipse.core.resources.IResource;
@@ -51,9 +49,12 @@
 import org.eclipse.dltk.internal.core.ScriptProject;
 import org.eclipse.dltk.utils.CorePrinter;
 
+import junit.framework.Test;
+
 public class BuildpathTests extends ModifyingResourceTests {
 
-	private static final String[] TEST_NATURE = new String[] { "org.eclipse.dltk.core.tests.testnature" };
+	private static final String[] TEST_NATURE = new String[] {
+			"org.eclipse.dltk.core.tests.testnature" };
 
 	private static final String BUILDPATH_PRJ_0 = "Buildpath0";
 
@@ -118,7 +119,8 @@
 			String expectedEncoded, IBuildpathEntry entry) {
 		IScriptProject project = getScriptProject(projectName);
 		String encoded = project.encodeBuildpathEntry(entry);
-		assertSourceEquals("Unexpected encoded entry", expectedEncoded, encoded);
+		assertSourceEquals("Unexpected encoded entry", expectedEncoded,
+				encoded);
 		IBuildpathEntry decoded = project.decodeBuildpathEntry(encoded);
 		assertEquals("Unexpected decoded entry", entry, decoded);
 	}
@@ -132,7 +134,8 @@
 		assertEquals(expected, actual);
 	}
 
-	protected void assertStatus(String message, String expected, IStatus status) {
+	protected void assertStatus(String message, String expected,
+			IStatus status) {
 		String actual = status.getMessage();
 		if (!expected.equals(actual)) {
 			// System.out.print(Util.displayString(actual, 2));
@@ -144,9 +147,9 @@
 	protected File createFile(File parent, String name, String content)
 			throws IOException {
 		File file = new File(parent, name);
-		FileOutputStream out = new FileOutputStream(file);
-		out.write(content.getBytes());
-		out.close();
+		try (FileOutputStream out = new FileOutputStream(file)) {
+			out.write(content.getBytes());
+		}
 		/*
 		 * Need to change the time stamp to realize that the file has been
 		 * modified
@@ -197,7 +200,8 @@
 	}
 
 	public void test001() throws ModelException {
-		ScriptProject project = (ScriptProject) getScriptProject(BUILDPATH_PRJ_0);
+		ScriptProject project = (ScriptProject) getScriptProject(
+				BUILDPATH_PRJ_0);
 		assertNotNull(project);
 		IBuildpathEntry entrys[] = project.getRawBuildpath();
 		assertEquals(3, entrys.length);
@@ -219,10 +223,10 @@
 				.getChildren();
 		assertEquals(2, folderChildren.length);
 		assertTrue(folderChildren[0] instanceof ISourceModule);
-		assertEquals("X.txt", ((ISourceModule) (folderChildren[0]))
-				.getElementName());
-		assertEquals("X2.txt", ((ISourceModule) (folderChildren[1]))
-				.getElementName());
+		assertEquals("X.txt",
+				((ISourceModule) (folderChildren[0])).getElementName());
+		assertEquals("X2.txt",
+				((ISourceModule) (folderChildren[1])).getElementName());
 		assertTrue(folderChildren[1] instanceof ISourceModule);
 
 		children = fr1.getChildren();
@@ -231,13 +235,15 @@
 		folderChildren = ((IScriptFolder) children[0]).getChildren();
 		assertEquals(1, folderChildren.length);
 		assertTrue(folderChildren[0] instanceof ISourceModule);
-		assertEquals("X3.txt", ((ISourceModule) (folderChildren[0]))
-				.getElementName());
+		assertEquals("X3.txt",
+				((ISourceModule) (folderChildren[0])).getElementName());
 	}
 
 	public void test002() throws ModelException {
-		ScriptProject project = (ScriptProject) getScriptProject(BUILDPATH_PRJ_0);
-		ScriptProject project2 = (ScriptProject) getScriptProject(BUILDPATH_PRJ_1);
+		ScriptProject project = (ScriptProject) getScriptProject(
+				BUILDPATH_PRJ_0);
+		ScriptProject project2 = (ScriptProject) getScriptProject(
+				BUILDPATH_PRJ_1);
 		assertNotNull(project);
 		IProjectFragment fragments[] = project.getProjectFragments();
 		IBuildpathEntry entrys[] = project.getResolvedBuildpath();
@@ -253,12 +259,14 @@
 
 	/**
 	 * Testie container test
-	 * 
+	 *
 	 * @throws ModelException
 	 */
 	public void test003() throws ModelException {
-		ScriptProject project = (ScriptProject) getScriptProject(BUILDPATH_PRJ_0);
-		ScriptProject project2 = (ScriptProject) getScriptProject(BUILDPATH_PRJ_1);
+		ScriptProject project = (ScriptProject) getScriptProject(
+				BUILDPATH_PRJ_0);
+		ScriptProject project2 = (ScriptProject) getScriptProject(
+				BUILDPATH_PRJ_1);
 		assertNotNull(project);
 		IProjectFragment fragments[] = project.getProjectFragments();
 		IBuildpathEntry entrys[] = project.getResolvedBuildpath();
@@ -274,7 +282,7 @@
 
 	/**
 	 * Library BuildpathEntry test
-	 * 
+	 *
 	 * @throws Exception
 	 */
 	public void test004() throws Exception {
@@ -302,25 +310,25 @@
 
 	/**
 	 * External folder Library BuildpathEntry test
-	 * 
+	 *
 	 * @throws Exception
 	 */
 	public void test005() throws Exception {
 		try {
-			URL url = ModelTestsPlugin.getDefault().getBundle().getEntry(
-					"workspace/Buildpath3");
+			URL url = ModelTestsPlugin.getDefault().getBundle()
+					.getEntry("workspace/Buildpath3");
 			URL res = FileLocator.resolve(url);
 			IPath filePath = new Path(res.getFile());
 			IScriptProject proj = this.createScriptProject("P", TEST_NATURE,
 					new String[] { "src" });
 			IBuildpathEntry[] originalCP = proj.getRawBuildpath();
 
-			IBuildpathEntry[] newCP = new IBuildpathEntry[originalCP.length + 1];
+			IBuildpathEntry[] newCP = new IBuildpathEntry[originalCP.length
+					+ 1];
 			System.arraycopy(originalCP, 0, newCP, 0, originalCP.length);
 			IEnvironment env = LocalEnvironment.getInstance();
-			newCP[originalCP.length] = DLTKCore
-					.newExtLibraryEntry(EnvironmentPathUtils.getFullPath(env,
-							filePath));
+			newCP[originalCP.length] = DLTKCore.newExtLibraryEntry(
+					EnvironmentPathUtils.getFullPath(env, filePath));
 
 			IModelStatus status = BuildpathEntry.validateBuildpath(proj, newCP);
 
@@ -342,18 +350,19 @@
 
 	public void test006() throws Exception {
 		try {
-			URL url = ModelTestsPlugin.getDefault().getBundle().getEntry(
-					"/workspace/Buildpath3");
+			URL url = ModelTestsPlugin.getDefault().getBundle()
+					.getEntry("/workspace/Buildpath3");
 			URL res = FileLocator.resolve(url);
 
-			IPath localPath = new Path("Testie").append(res.getFile()
-					.substring(1));
+			IPath localPath = new Path("Testie")
+					.append(res.getFile().substring(1));
 			IPath contPath = localPath;
 			IScriptProject proj = this.createScriptProject("P", TEST_NATURE,
 					new String[] { "src" });
 			IBuildpathEntry[] originalCP = proj.getRawBuildpath();
 
-			IBuildpathEntry[] newCP = new IBuildpathEntry[originalCP.length + 1];
+			IBuildpathEntry[] newCP = new IBuildpathEntry[originalCP.length
+					+ 1];
 			System.arraycopy(originalCP, 0, newCP, 0, originalCP.length);
 			newCP[originalCP.length] = DLTKCore.newContainerEntry(contPath);
 
@@ -380,8 +389,8 @@
 	 */
 	public void testEncodeDecodeEntry01() {
 		assertEncodeDecodeEntry("P",
-				"<buildpathentry kind=\"src\" path=\"src\"/>\n", DLTKCore
-						.newSourceEntry(new Path("/P/src")));
+				"<buildpathentry kind=\"src\" path=\"src\"/>\n",
+				DLTKCore.newSourceEntry(new Path("/P/src")));
 	}
 
 	/*
@@ -389,18 +398,17 @@
 	 * encoded and decoded.
 	 */
 	public void testEncodeDecodeEntry02() {
-		assertEncodeDecodeEntry(
-				"P",
+		assertEncodeDecodeEntry("P",
 				"<buildpathentry excluding=\"**/X.java\" including=\"**/Y.java\" kind=\"src\" path=\"src\">\n"
 						+ "	<attributes>\n"
 						+ "		<attribute name=\"attrName\" value=\"some value\"/>\n"
-						+ "	</attributes>\n" + "</buildpathentry>\n", DLTKCore
-						.newSourceEntry(new Path("/P/src"),
-								new IPath[] { new Path("**/Y.java") },
-								new IPath[] { new Path("**/X.java") },
-								new IBuildpathAttribute[] { DLTKCore
-										.newBuildpathAttribute("attrName",
-												"some value") }));
+						+ "	</attributes>\n" + "</buildpathentry>\n",
+				DLTKCore.newSourceEntry(new Path("/P/src"),
+						new IPath[] { new Path("**/Y.java") },
+						new IPath[] { new Path("**/X.java") },
+						new IBuildpathAttribute[] {
+								DLTKCore.newBuildpathAttribute("attrName",
+										"some value") }));
 	}
 
 	/*
@@ -408,8 +416,8 @@
 	 */
 	public void testEncodeDecodeEntry03() {
 		assertEncodeDecodeEntry("P1",
-				"<buildpathentry kind=\"prj\" path=\"/P2\"/>\n", DLTKCore
-						.newProjectEntry(new Path("/P2")));
+				"<buildpathentry kind=\"prj\" path=\"/P2\"/>\n",
+				DLTKCore.newProjectEntry(new Path("/P2")));
 	}
 
 	/**
@@ -425,13 +433,14 @@
 			// create container
 			DLTKCore.setBuildpathContainer(new Path("container/default"),
 					new IScriptProject[] { proj },
-					new IBuildpathContainer[] { new TestContainer(new Path(
-							"container/default"), new IBuildpathEntry[] {}) },
+					new IBuildpathContainer[] {
+							new TestContainer(new Path("container/default"),
+									new IBuildpathEntry[] {}) },
 					null);
 
 			// set P's Buildpath with this container
-			IBuildpathEntry container = DLTKCore.newContainerEntry(new Path(
-					"container/default"), true);
+			IBuildpathEntry container = DLTKCore
+					.newContainerEntry(new Path("container/default"), true);
 			proj.setRawBuildpath(new IBuildpathEntry[] { container }, null);
 
 			assertDeltas("Unexpected delta",
@@ -452,8 +461,7 @@
 			createScriptProject("P1i", TEST_NATURE, new String[] { "" });
 			IScriptProject proj = createScriptProject("P2i", TEST_NATURE,
 					new String[] { "" }, new String[] { "/P1i/src1/src2" });
-			assertMarkers(
-					"Unexpected markers",
+			assertMarkers("Unexpected markers",
 					"Illegal path for required project: '/P1i/src1/src2' in project P2i",
 					proj);
 		} finally {
@@ -471,7 +479,8 @@
 					new String[] { "src" });
 			IBuildpathEntry[] originalCP = proj.getRawBuildpath();
 
-			IBuildpathEntry[] newCP = new IBuildpathEntry[originalCP.length + 1];
+			IBuildpathEntry[] newCP = new IBuildpathEntry[originalCP.length
+					+ 1];
 			System.arraycopy(originalCP, 0, newCP, 0, originalCP.length);
 			newCP[originalCP.length] = newCP[0];
 
@@ -492,11 +501,12 @@
 					new String[] { "src" });
 			IBuildpathEntry[] originalCP = proj.getRawBuildpath();
 
-			IBuildpathEntry[] newCP = new IBuildpathEntry[originalCP.length + 1];
+			IBuildpathEntry[] newCP = new IBuildpathEntry[originalCP.length
+					+ 1];
 			System.arraycopy(originalCP, 0, newCP, 0, originalCP.length);
 			IEnvironment env = LocalEnvironment.getInstance();
-			IPath libPath = EnvironmentPathUtils.getFullPath(env, new Path(
-					"/opt2"));
+			IPath libPath = EnvironmentPathUtils.getFullPath(env,
+					new Path("/opt2"));
 			newCP[originalCP.length] = DLTKCore.newExtLibraryEntry(libPath);
 
 			IModelStatus status = BuildpathEntry.validateBuildpathEntry(proj,
@@ -505,7 +515,9 @@
 			assertStatus("should detect not pressent folders",
 					"Required library cannot denote external folder or archive: \'"
 							+ EnvironmentPathUtils.getLocalPath(libPath)
-									.toString() + "\' for project Pv0", status);
+									.toString()
+							+ "\' for project Pv0",
+					status);
 		} finally {
 			AbstractModelTests.deleteProject("Pv0");
 		}
@@ -520,7 +532,8 @@
 					new String[] { "src" });
 			IBuildpathEntry[] originalCP = proj.getRawBuildpath();
 
-			IBuildpathEntry[] newCP = new IBuildpathEntry[originalCP.length + 1];
+			IBuildpathEntry[] newCP = new IBuildpathEntry[originalCP.length
+					+ 1];
 			System.arraycopy(originalCP, 0, newCP, 0, originalCP.length);
 			newCP[originalCP.length] = DLTKCore.newSourceEntry(new Path("/P"));
 
@@ -543,10 +556,11 @@
 					new String[] { "src" });
 			IBuildpathEntry[] originalCP = proj.getRawBuildpath();
 
-			IBuildpathEntry[] newCP = new IBuildpathEntry[originalCP.length + 1];
+			IBuildpathEntry[] newCP = new IBuildpathEntry[originalCP.length
+					+ 1];
 			System.arraycopy(originalCP, 0, newCP, 0, originalCP.length);
-			newCP[originalCP.length] = DLTKCore.newLibraryEntry(new Path(
-					"/P/src/lib"));
+			newCP[originalCP.length] = DLTKCore
+					.newLibraryEntry(new Path("/P/src/lib"));
 
 			IModelStatus status = BuildpathEntry.validateBuildpath(proj, newCP);
 
@@ -595,23 +609,23 @@
 		try {
 
 			p = new IScriptProject[] {
-					this.createScriptProject("P0v", TEST_NATURE, new String[] {
-							"src0", "src1" }),
+					this.createScriptProject("P0v", TEST_NATURE,
+							new String[] { "src0", "src1" }),
 					this.createScriptProject("P1v", TEST_NATURE,
 							new String[] { "src1" }), };
 
-			DLTKCore
-					.setBuildpathContainer(new Path("container/default"),
-							new IScriptProject[] { p[0] },
-							new IBuildpathContainer[] { new TestContainer(
-									new Path("container/default"),
-									new IBuildpathEntry[] { DLTKCore
-											.newSourceEntry(new Path(
-													"/P0v/src0")) }) }, null);
+			DLTKCore.setBuildpathContainer(new Path("container/default"),
+					new IScriptProject[] { p[0] },
+					new IBuildpathContainer[] { new TestContainer(
+							new Path("container/default"),
+							new IBuildpathEntry[] { DLTKCore
+									.newSourceEntry(new Path("/P0v/src0")) }) },
+					null);
 
 			IBuildpathEntry[] newBuildpath = new IBuildpathEntry[] {
 					DLTKCore.newSourceEntry(new Path("/P0v/src1")),
-					DLTKCore.newContainerEntry(new Path("container/default")), };
+					DLTKCore.newContainerEntry(
+							new Path("container/default")), };
 
 			// validate Buildpath
 			IModelStatus status = BuildpathEntry.validateBuildpath(p[0],
@@ -649,8 +663,7 @@
 
 			IModelStatus status = BuildpathEntry.validateBuildpath(p[0],
 					newBuildpath);
-			assertStatus(
-					"should have detected nested source folder",
+			assertStatus("should have detected nested source folder",
 					"Cannot nest \'P0/src\' inside \'P0\'. To enable the nesting exclude \'src/\' from \'P0\'",
 					status);
 		} finally {
@@ -668,7 +681,8 @@
 					new String[] { "src" });
 			IBuildpathEntry[] originalCP = proj.getRawBuildpath();
 
-			IBuildpathEntry[] newCP = new IBuildpathEntry[originalCP.length + 1];
+			IBuildpathEntry[] newCP = new IBuildpathEntry[originalCP.length
+					+ 1];
 			System.arraycopy(originalCP, 0, newCP, 0, originalCP.length);
 			newCP[originalCP.length] = DLTKCore.newSourceEntry(new Path("/P"),
 					new IPath[] { new Path("src/") });
@@ -693,7 +707,8 @@
 					new String[] {});
 			IBuildpathEntry[] originalCP = proj.getRawBuildpath();
 
-			IBuildpathEntry[] newCP = new IBuildpathEntry[originalCP.length + 1];
+			IBuildpathEntry[] newCP = new IBuildpathEntry[originalCP.length
+					+ 1];
 			System.arraycopy(originalCP, 0, newCP, 0, originalCP.length);
 			newCP[originalCP.length] = DLTKCore.newSourceEntry(new Path("/P"),
 					new IPath[] { new Path("lib/") });
@@ -718,7 +733,8 @@
 					new String[] { "src" });
 			IBuildpathEntry[] originalCP = proj.getRawBuildpath();
 
-			IBuildpathEntry[] newCP = new IBuildpathEntry[originalCP.length + 1];
+			IBuildpathEntry[] newCP = new IBuildpathEntry[originalCP.length
+					+ 1];
 			System.arraycopy(originalCP, 0, newCP, 0, originalCP.length);
 			newCP[originalCP.length] = DLTKCore.newSourceEntry(new Path("/P"),
 					new IPath[] { new Path("**/src") });
@@ -742,12 +758,13 @@
 					new String[] {});
 			IBuildpathEntry[] originalCP = proj.getRawBuildpath();
 
-			IBuildpathEntry[] newCP = new IBuildpathEntry[originalCP.length + 1];
+			IBuildpathEntry[] newCP = new IBuildpathEntry[originalCP.length
+					+ 1];
 			System.arraycopy(originalCP, 0, newCP, 0, originalCP.length);
-			newCP[originalCP.length] = DLTKCore.newSourceEntry(new Path(
-					"/P/src"), new IPath[] { new Path("**/src") });
+			newCP[originalCP.length] = DLTKCore.newSourceEntry(
+					new Path("/P/src"), new IPath[] { new Path("**/src") });
 
-			Map<String, String> options = new Hashtable<String, String>(5);
+			Map<String, String> options = new Hashtable<>(5);
 			options.put(DLTKCore.CORE_ENABLE_BUILDPATH_EXCLUSION_PATTERNS,
 					DLTKCore.DISABLED);
 			proj.setOptions(options);
@@ -772,13 +789,15 @@
 					new String[] {});
 			IBuildpathEntry[] originalCP = proj.getRawBuildpath();
 
-			IBuildpathEntry[] newCP = new IBuildpathEntry[originalCP.length + 2];
+			IBuildpathEntry[] newCP = new IBuildpathEntry[originalCP.length
+					+ 2];
 			System.arraycopy(originalCP, 0, newCP, 0, originalCP.length);
 			newCP[originalCP.length] = DLTKCore.newSourceEntry(new Path("/P/"),
 					new IPath[] { new Path("src/") },
 					BuildpathEntry.EXCLUDE_NONE);
-			newCP[originalCP.length + 1] = DLTKCore.newSourceEntry(new Path(
-					"/P/src"), new IPath[0], BuildpathEntry.EXCLUDE_NONE);
+			newCP[originalCP.length + 1] = DLTKCore.newSourceEntry(
+					new Path("/P/src"), new IPath[0],
+					BuildpathEntry.EXCLUDE_NONE);
 
 			IModelStatus status = BuildpathEntry.validateBuildpath(proj, newCP);
 
@@ -800,7 +819,8 @@
 					new String[] { "src" });
 			IBuildpathEntry[] originalCP = proj.getRawBuildpath();
 
-			IBuildpathEntry[] newCP = new IBuildpathEntry[originalCP.length + 1];
+			IBuildpathEntry[] newCP = new IBuildpathEntry[originalCP.length
+					+ 1];
 			System.arraycopy(originalCP, 0, newCP, 0, originalCP.length);
 			newCP[originalCP.length] = DLTKCore.newSourceEntry(new Path("/P"),
 					new IPath[] { new Path("src/") }, new IPath[0], null);
@@ -826,7 +846,8 @@
 					new String[] { "src" });
 			IBuildpathEntry[] originalCP = proj.getRawBuildpath();
 
-			IBuildpathEntry[] newCP = new IBuildpathEntry[originalCP.length + 1];
+			IBuildpathEntry[] newCP = new IBuildpathEntry[originalCP.length
+					+ 1];
 			System.arraycopy(originalCP, 0, newCP, 0, originalCP.length);
 			newCP[originalCP.length] = DLTKCore.newSourceEntry(new Path("/P"),
 					new IPath[] { new Path("**/src") }, new Path[0], null);
@@ -848,13 +869,14 @@
 					new String[] {});
 			IBuildpathEntry[] originalCP = proj.getRawBuildpath();
 
-			IBuildpathEntry[] newCP = new IBuildpathEntry[originalCP.length + 1];
+			IBuildpathEntry[] newCP = new IBuildpathEntry[originalCP.length
+					+ 1];
 			System.arraycopy(originalCP, 0, newCP, 0, originalCP.length);
-			newCP[originalCP.length] = DLTKCore.newSourceEntry(new Path(
-					"/P/src"), new IPath[] { new Path("**/src") }, new Path[0],
-					null);
+			newCP[originalCP.length] = DLTKCore.newSourceEntry(
+					new Path("/P/src"), new IPath[] { new Path("**/src") },
+					new Path[0], null);
 
-			Map<String, String> options = new Hashtable<String, String>(5);
+			Map<String, String> options = new Hashtable<>(5);
 			options.put(DLTKCore.CORE_ENABLE_BUILDPATH_EXCLUSION_PATTERNS,
 					DLTKCore.DISABLED);
 			proj.setOptions(options);
@@ -882,7 +904,8 @@
 					DLTKCore.DISABLED);
 			IBuildpathEntry[] originalCP = proj.getRawBuildpath();
 
-			IBuildpathEntry[] newCP = new IBuildpathEntry[originalCP.length + 1];
+			IBuildpathEntry[] newCP = new IBuildpathEntry[originalCP.length
+					+ 1];
 			System.arraycopy(originalCP, 0, newCP, 0, originalCP.length);
 			newCP[originalCP.length] = DLTKCore.newSourceEntry(new Path("/P"));
 
@@ -927,18 +950,20 @@
 	 * not break the model. The buildpath should contain the entry, but the root
 	 * should not appear in the children.
 	 */
-	public void testBuildpathWithNonExistentProjectEntry() throws CoreException {
+	public void testBuildpathWithNonExistentProjectEntry()
+			throws CoreException {
 		try {
 			IScriptProject project = this.createScriptProject("P", TEST_NATURE,
 					new String[] { "src" });
 			IBuildpathEntry[] originalPath = project.getRawBuildpath();
 			IProjectFragment[] originalRoots = project.getProjectFragments();
 
-			IBuildpathEntry[] newPath = new IBuildpathEntry[originalPath.length + 1];
+			IBuildpathEntry[] newPath = new IBuildpathEntry[originalPath.length
+					+ 1];
 			System.arraycopy(originalPath, 0, newPath, 0, originalPath.length);
 
-			IBuildpathEntry newEntry = DLTKCore.newProjectEntry(new Path(
-					"/NoProject"), false);
+			IBuildpathEntry newEntry = DLTKCore
+					.newProjectEntry(new Path("/NoProject"), false);
 			newPath[originalPath.length] = newEntry;
 
 			project.setRawBuildpath(newPath, null);
@@ -947,16 +972,16 @@
 			assertTrue("should be the same length",
 					getPath.length == newPath.length);
 			for (int i = 0; i < getPath.length; i++) {
-				assertTrue("entries should be the same", getPath[i]
-						.equals(newPath[i]));
+				assertTrue("entries should be the same",
+						getPath[i].equals(newPath[i]));
 			}
 
 			IProjectFragment[] newRoots = project.getProjectFragments();
 			assertTrue("Should be the same number of roots",
 					originalRoots.length == newRoots.length);
 			for (int i = 0; i < newRoots.length; i++) {
-				assertTrue("roots should be the same", originalRoots[i]
-						.equals(newRoots[i]));
+				assertTrue("roots should be the same",
+						originalRoots[i].equals(newRoots[i]));
 			}
 		} finally {
 			AbstractModelTests.deleteProject("P");
@@ -975,11 +1000,12 @@
 			IBuildpathEntry[] originalPath = project.getRawBuildpath();
 			IProjectFragment[] originalRoots = project.getProjectFragments();
 
-			IBuildpathEntry[] newPath = new IBuildpathEntry[originalPath.length + 1];
+			IBuildpathEntry[] newPath = new IBuildpathEntry[originalPath.length
+					+ 1];
 			System.arraycopy(originalPath, 0, newPath, 0, originalPath.length);
 
-			IBuildpathEntry newEntry = DLTKCore.newSourceEntry(new Path(
-					"/P/moreSource"));
+			IBuildpathEntry newEntry = DLTKCore
+					.newSourceEntry(new Path("/P/moreSource"));
 			newPath[originalPath.length] = newEntry;
 
 			project.setRawBuildpath(newPath, null);
@@ -988,16 +1014,16 @@
 			assertTrue("should be the same length",
 					getPath.length == newPath.length);
 			for (int i = 0; i < getPath.length; i++) {
-				assertTrue("entries should be the same", getPath[i]
-						.equals(newPath[i]));
+				assertTrue("entries should be the same",
+						getPath[i].equals(newPath[i]));
 			}
 
 			IProjectFragment[] newRoots = project.getProjectFragments();
 			assertTrue("Should be the same number of roots",
 					originalRoots.length == newRoots.length);
 			for (int i = 0; i < newRoots.length; i++) {
-				assertTrue("roots should be the same", originalRoots[i]
-						.equals(newRoots[i]));
+				assertTrue("roots should be the same",
+						originalRoots[i].equals(newRoots[i]));
 			}
 		} finally {
 			AbstractModelTests.deleteProject("P");
@@ -1023,8 +1049,8 @@
 			int length = originalP2CP.length;
 			IBuildpathEntry[] newCP = new IBuildpathEntry[length + 1];
 			System.arraycopy(originalP2CP, 0, newCP, 0, length);
-			newCP[length] = DLTKCore.newProjectEntry(p1.getProject()
-					.getFullPath(), false);
+			newCP[length] = DLTKCore
+					.newProjectEntry(p1.getProject().getFullPath(), false);
 			p2.setRawBuildpath(newCP, null);
 			waitForAutoBuild(); // wait for markers to be created
 			assertEquals(0, numberOfBuildpathProblems(p1));
@@ -1085,16 +1111,16 @@
 			int length = originalP2CP.length;
 			IBuildpathEntry[] newCP = new IBuildpathEntry[length + 1];
 			System.arraycopy(originalP2CP, 0, newCP, 0, length);
-			newCP[length] = DLTKCore.newProjectEntry(p1.getProject()
-					.getFullPath(), false);
+			newCP[length] = DLTKCore
+					.newProjectEntry(p1.getProject().getFullPath(), false);
 			p2.setRawBuildpath(newCP, null);
 
 			// Add P3 as a prerequesite of P1
 			length = originalP1CP.length;
 			newCP = new IBuildpathEntry[length + 1];
 			System.arraycopy(originalP1CP, 0, newCP, 0, length);
-			newCP[length] = DLTKCore.newProjectEntry(p3.getProject()
-					.getFullPath(), false);
+			newCP[length] = DLTKCore
+					.newProjectEntry(p3.getProject().getFullPath(), false);
 			p1.setRawBuildpath(newCP, null);
 
 			waitForAutoBuild(); // wait for cycle markers to be created
@@ -1119,15 +1145,16 @@
 					TEST_NATURE, new String[] { "" });
 			project.getProject().getFolder("src").create(true, true, null);
 			// find folder & test it
-			final IScriptFolder folder = project.findScriptFolder(new Path(
-					"/A_/src"));
+			final IScriptFolder folder = project
+					.findScriptFolder(new Path("/A_/src"));
 			assertNotNull(folder);
 			assertTrue(folder.exists());
 			// change buildpath
-			final IBuildpathEntry entry1 = DLTKCore.newSourceEntry(new Path(
-					"/A_/src"));
-			final IBuildpathEntry entry2 = DLTKCore.newSourceEntry(new Path(
-					"/A_"), new IPath[0], new IPath[] { new Path("src/") });
+			final IBuildpathEntry entry1 = DLTKCore
+					.newSourceEntry(new Path("/A_/src"));
+			final IBuildpathEntry entry2 = DLTKCore.newSourceEntry(
+					new Path("/A_"), new IPath[0],
+					new IPath[] { new Path("src/") });
 			project.setRawBuildpath(new IBuildpathEntry[] { entry1, entry2 },
 					null);
 			// test folder after change
@@ -1194,30 +1221,32 @@
 		try {
 			startDeltas();
 			IProjectFragment oldRoot = getProjectFragment("P1c", "");
-			IBuildpathEntry projectEntry = DLTKCore.newProjectEntry(new Path(
-					"/P2c"), false);
-			IBuildpathEntry[] newBuildpath = new IBuildpathEntry[] { projectEntry };
+			IBuildpathEntry projectEntry = DLTKCore
+					.newProjectEntry(new Path("/P2c"), false);
+			IBuildpathEntry[] newBuildpath = new IBuildpathEntry[] {
+					projectEntry };
 			project.setRawBuildpath(newBuildpath, null);
 			project.getProjectFragments();
 			IModelElementDelta removedDelta = getDeltaFor(oldRoot, true);
 			assertDeltas("Unexpected delta",
-					"<project root>[*]: {REMOVED FROM BUILDPATH}", removedDelta);
+					"<project root>[*]: {REMOVED FROM BUILDPATH}",
+					removedDelta);
 		} finally {
 			stopDeltas();
 			this.deleteProjects(new String[] { "P1c", "P2c" });
 		}
 	}
 
-	public void testGetProjectFragmentByResource() throws CoreException,
-			IOException {
+	public void testGetProjectFragmentByResource()
+			throws CoreException, IOException {
 		try {
 			setUpScriptProject(BUILDPATH_PRJ_4);
 			String folderName = "library";
 			IModelElement element = DLTKCore.create(getWorkspaceRoot()
 					.getFolder(new Path(BUILDPATH_PRJ_4 + "/" + folderName)));
 			assertNotNull(element);
-			assertEquals(IModelElement.PROJECT_FRAGMENT, element
-					.getElementType());
+			assertEquals(IModelElement.PROJECT_FRAGMENT,
+					element.getElementType());
 			assertEquals(folderName, element.getElementName());
 		} finally {
 			deleteProject(BUILDPATH_PRJ_4);
diff --git a/core/tests/org.eclipse.dltk.core.tests/src/org/eclipse/dltk/core/tests/buildpath/SetContainerEventsTest.java b/core/tests/org.eclipse.dltk.core.tests/src/org/eclipse/dltk/core/tests/buildpath/SetContainerEventsTest.java
index 034a133..69e0b2c 100644
--- a/core/tests/org.eclipse.dltk.core.tests/src/org/eclipse/dltk/core/tests/buildpath/SetContainerEventsTest.java
+++ b/core/tests/org.eclipse.dltk.core.tests/src/org/eclipse/dltk/core/tests/buildpath/SetContainerEventsTest.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2013 NumberFour AG
+ * Copyright (c) 2013, 2017 NumberFour AG and others.
  *
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
@@ -58,9 +58,9 @@
 		ProblemTestUtil.assertNoProblems(project.get());
 	}
 
-	final List<IModelElementDelta> added = new ArrayList<IModelElementDelta>();
-	final List<IModelElementDelta> changed = new ArrayList<IModelElementDelta>();
-	final List<IModelElementDelta> removed = new ArrayList<IModelElementDelta>();
+	final List<IModelElementDelta> added = new ArrayList<>();
+	final List<IModelElementDelta> changed = new ArrayList<>();
+	final List<IModelElementDelta> removed = new ArrayList<>();
 
 	final IElementChangedListener listener = new IElementChangedListener() {
 		@Override
@@ -99,7 +99,7 @@
 
 	// @Test
 	// Disabled due to http://eclip.se/458130
-	public void setContainer() throws ModelException,IOException {
+	public void setContainer() throws ModelException, IOException {
 		final File folder1 = temp.newFolder("folder1");
 		DLTKCore.addElementChangedListener(listener,
 				IResourceChangeEvent.POST_CHANGE);
@@ -119,12 +119,13 @@
 	}
 
 	@Test
-	public void changeContainer() throws ModelException,IOException {
+	public void changeContainer() throws ModelException, IOException {
 		final File folder1 = temp.newFolder("folder1");
 		final File folder2 = temp.newFolder("folder2");
 		DLTKCore.setBuildpathContainer(TestContainer2.CONTAINER_ID,
 				new IScriptProject[] { project.getScriptProject() },
-				new IBuildpathContainer[] { new TestContainer2(folder1) }, null);
+				new IBuildpathContainer[] { new TestContainer2(folder1) },
+				null);
 		DLTKCore.addElementChangedListener(listener,
 				IResourceChangeEvent.POST_CHANGE);
 		try {
@@ -145,10 +146,10 @@
 		assertEquals(0, removed.size());
 		assertEquals(2, changed.size());
 		assertEquals(project.getScriptProject(), changed.get(0).getElement());
-		assertEquals("folder2",
-				((IProjectFragment) changed.get(1).getElement()).getPath()
-						.lastSegment());
-		assertTrue((changed.get(1).getFlags() & IModelElementDelta.F_ADDED_TO_BUILDPATH) != 0);
+		assertEquals("folder2", ((IProjectFragment) changed.get(1).getElement())
+				.getPath().lastSegment());
+		assertTrue((changed.get(1).getFlags()
+				& IModelElementDelta.F_ADDED_TO_BUILDPATH) != 0);
 	}
 
 }
diff --git a/core/tests/org.eclipse.dltk.core.tests/src/org/eclipse/dltk/core/tests/cache/SourceModuleInfoCacheTest.java b/core/tests/org.eclipse.dltk.core.tests/src/org/eclipse/dltk/core/tests/cache/SourceModuleInfoCacheTest.java
index 5e4aa36..c63a3ce 100644
--- a/core/tests/org.eclipse.dltk.core.tests/src/org/eclipse/dltk/core/tests/cache/SourceModuleInfoCacheTest.java
+++ b/core/tests/org.eclipse.dltk.core.tests/src/org/eclipse/dltk/core/tests/cache/SourceModuleInfoCacheTest.java
@@ -76,8 +76,8 @@
 		assertNotNull(SourceParserUtil.parse(module, null));
 		assertThat(module, IS_CACHED);
 		assertEquals(1, getCache().size());
-		((IFile) module.getResource()).create(new ByteArrayInputStream(
-				new byte[0]), false, null);
+		((IFile) module.getResource())
+				.create(new ByteArrayInputStream(new byte[0]), false, null);
 		// assertEquals(0, getCache().size());
 		assertThat(module, not(IS_CACHED));
 	}
@@ -176,7 +176,7 @@
 		final IScriptFolder folder = project.getScriptFolder("src", "folder1");
 		assertNotNull(folder);
 		final int capacity = getCache().capacity();
-		final List<ISourceModule> modules = new ArrayList<ISourceModule>();
+		final List<ISourceModule> modules = new ArrayList<>();
 		project.getWorkspace().run(monitor -> {
 			for (int i = 0; i < capacity; ++i) {
 				modules.add(folder.createSourceModule("m" + i + ".txt", "",
diff --git a/core/tests/org.eclipse.dltk.core.tests/src/org/eclipse/dltk/core/tests/ddp/CoreDDPTests.java b/core/tests/org.eclipse.dltk.core.tests/src/org/eclipse/dltk/core/tests/ddp/CoreDDPTests.java
index bf0d272..65628ce 100644
--- a/core/tests/org.eclipse.dltk.core.tests/src/org/eclipse/dltk/core/tests/ddp/CoreDDPTests.java
+++ b/core/tests/org.eclipse.dltk.core.tests/src/org/eclipse/dltk/core/tests/ddp/CoreDDPTests.java
@@ -1,11 +1,10 @@
 /*******************************************************************************
- * Copyright (c) 2005, 2007 IBM Corporation and others.
+ * Copyright (c) 2005, 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
  *
- 
  *******************************************************************************/
 package org.eclipse.dltk.core.tests.ddp;
 
@@ -13,8 +12,6 @@
 import java.util.Collection;
 import java.util.Iterator;
 
-import junit.framework.Test;
-
 import org.eclipse.dltk.ast.ASTNode;
 import org.eclipse.dltk.ast.expressions.Expression;
 import org.eclipse.dltk.ast.expressions.NumericLiteral;
@@ -29,12 +26,14 @@
 import org.eclipse.dltk.ti.goals.IGoal;
 import org.eclipse.dltk.ti.types.IEvaluatedType;
 
-public class CoreDDPTests extends SuiteOfTestCases {	
+import junit.framework.Test;
+
+public class CoreDDPTests extends SuiteOfTestCases {
 
 	public CoreDDPTests(String name) {
 		super(name);
 	}
-	
+
 	public static Test suite() {
 		return new Suite(CoreDDPTests.class);
 	}
@@ -45,7 +44,7 @@
 		private FixedAnswerGoalEvaluator(IGoal goal, IEvaluatedType answer) {
 			super(goal);
 			this.answer = answer;
-		}		
+		}
 
 		@Override
 		public Object produceResult() {
@@ -58,36 +57,39 @@
 		}
 
 		@Override
-		public IGoal[] subGoalDone(IGoal goal2, Object result, GoalState state) {
+		public IGoal[] subGoalDone(IGoal goal2, Object result,
+				GoalState state) {
 			return IGoal.NO_GOALS;
 		}
-				
-		
+
 	}
 
-	private static final class SingleDependentGoalEvaluator extends GoalEvaluator {
+	private static final class SingleDependentGoalEvaluator
+			extends GoalEvaluator {
 		private final IEvaluatedType answer;
 
 		private final IGoal[] dependents;
 
-//		private int state = 0;
-		
+		// private int state = 0;
+
 		private int produceCalls = 0;
-		
+
 		private int produceTypeCalls = 0;
 
-		private SingleDependentGoalEvaluator(IGoal goal, IGoal dependent, IEvaluatedType answer) {
+		private SingleDependentGoalEvaluator(IGoal goal, IGoal dependent,
+				IEvaluatedType answer) {
 			super(goal);
 			this.dependents = new IGoal[] { dependent };
 			this.answer = answer;
 		}
 
-		private SingleDependentGoalEvaluator(IGoal goal, IGoal[] dependents, Object answer) {
+		private SingleDependentGoalEvaluator(IGoal goal, IGoal[] dependents,
+				Object answer) {
 			super(goal);
 			this.dependents = dependents;
 			this.answer = (IEvaluatedType) answer;
 		}
-	
+
 		@Override
 		public IGoal[] init() {
 			++produceCalls;
@@ -95,9 +97,11 @@
 		}
 
 		@Override
-		public IGoal[] subGoalDone(IGoal goal2, Object result, GoalState _state) {
+		public IGoal[] subGoalDone(IGoal goal2, Object result,
+				GoalState _state) {
 			++produceCalls;
-			assertTrue(result instanceof MyNum || _state == GoalState.RECURSIVE);			
+			assertTrue(
+					result instanceof MyNum || _state == GoalState.RECURSIVE);
 			return IGoal.NO_GOALS;
 		}
 
@@ -106,16 +110,12 @@
 			++produceTypeCalls;
 			return answer;
 		}
-		
+
 		public void assertState() {
 			assertEquals(1, produceTypeCalls);
 			assertEquals(1 + dependents.length, produceCalls);
 		}
 
-		public int getProduceCalls() {
-			return produceCalls;
-		}
-		
 	}
 
 	class MyNum implements IEvaluatedType {
@@ -144,25 +144,20 @@
 		final Expression y = new SimpleReference(0, 0, "y");
 		final Expression num = new NumericLiteral(0, 0, 0);
 
-		IGoalEvaluatorFactory factory = new IGoalEvaluatorFactory() {
-
-			@Override
-			public GoalEvaluator createEvaluator(IGoal goal) {
-				if (goal instanceof ExpressionTypeGoal) {
-					ExpressionTypeGoal egoal = (ExpressionTypeGoal) goal;
-					ASTNode expr = egoal.getExpression();
-					if (expr == x)
-						return new SingleDependentGoalEvaluator(goal, new ExpressionTypeGoal(null, y),
-								new MyNum());
-					if (expr == y)
-						return new SingleDependentGoalEvaluator(goal, new ExpressionTypeGoal(null, num),
-								new MyNum());
-					if (expr == num)
-						return new FixedAnswerGoalEvaluator(goal, new MyNum());
-				}
-				return null;
+		IGoalEvaluatorFactory factory = goal -> {
+			if (goal instanceof ExpressionTypeGoal) {
+				ExpressionTypeGoal egoal = (ExpressionTypeGoal) goal;
+				ASTNode expr = egoal.getExpression();
+				if (expr == x)
+					return new SingleDependentGoalEvaluator(goal,
+							new ExpressionTypeGoal(null, y), new MyNum());
+				if (expr == y)
+					return new SingleDependentGoalEvaluator(goal,
+							new ExpressionTypeGoal(null, num), new MyNum());
+				if (expr == num)
+					return new FixedAnswerGoalEvaluator(goal, new MyNum());
 			}
-
+			return null;
 		};
 
 		final ITypeInferencer man = new DefaultTypeInferencer(factory);
@@ -177,9 +172,9 @@
 		final Expression x = new SimpleReference(0, 0, "x");
 		final Expression y = new SimpleReference(0, 0, "y");
 		final Expression z = new SimpleReference(0, 0, "z");
-		final Expression num = new NumericLiteral(0,0,0);
-		
-		final Collection<GoalEvaluator> evaluators = new ArrayList<GoalEvaluator>();
+		final Expression num = new NumericLiteral(0, 0, 0);
+
+		final Collection<GoalEvaluator> evaluators = new ArrayList<>();
 		IGoalEvaluatorFactory factory = new IGoalEvaluatorFactory() {
 
 			public GoalEvaluator createEvaluator2(IGoal goal) {
@@ -187,28 +182,33 @@
 					ExpressionTypeGoal egoal = (ExpressionTypeGoal) goal;
 					ASTNode expr = egoal.getExpression();
 					if (expr == x)
-						return new SingleDependentGoalEvaluator(goal, new IGoal[] {
-								new ExpressionTypeGoal(null, y), new ExpressionTypeGoal(null, z) }, new MyNum());
+						return new SingleDependentGoalEvaluator(goal,
+								new IGoal[] { new ExpressionTypeGoal(null, y),
+										new ExpressionTypeGoal(null, z) },
+								new MyNum());
 					if (expr == y)
 						return new SingleDependentGoalEvaluator(goal,
-								new IGoal[] { new ExpressionTypeGoal(null, z) }, new MyNum());
+								new IGoal[] { new ExpressionTypeGoal(null, z) },
+								new MyNum());
 					if (expr == z)
-						return new SingleDependentGoalEvaluator(goal, new IGoal[] {
-								new ExpressionTypeGoal(null, num), new ExpressionTypeGoal(null, y) }, new MyNum());
+						return new SingleDependentGoalEvaluator(goal,
+								new IGoal[] { new ExpressionTypeGoal(null, num),
+										new ExpressionTypeGoal(null, y) },
+								new MyNum());
 					if (expr == num)
 						return new FixedAnswerGoalEvaluator(goal, new MyNum());
 				}
 				return null;
 			}
-			
+
 			@Override
 			public GoalEvaluator createEvaluator(IGoal goal) {
 				GoalEvaluator result = createEvaluator2(goal);
-				if (result != null) 
+				if (result != null)
 					evaluators.add(result);
 				return result;
 			}
-			
+
 		};
 
 		final ITypeInferencer man = new DefaultTypeInferencer(factory);
@@ -217,8 +217,9 @@
 		IEvaluatedType answer = man.evaluateType(rootGoal, -1);
 
 		assertTrue(answer instanceof MyNum);
-		for (Iterator<GoalEvaluator> iter = evaluators.iterator(); iter.hasNext();) {
-			GoalEvaluator ev = (GoalEvaluator) iter.next();
+		for (Iterator<GoalEvaluator> iter = evaluators.iterator(); iter
+				.hasNext();) {
+			GoalEvaluator ev = iter.next();
 			if (ev instanceof SingleDependentGoalEvaluator) {
 				SingleDependentGoalEvaluator sdge = (SingleDependentGoalEvaluator) ev;
 				sdge.assertState();
diff --git a/core/tests/org.eclipse.dltk.core.tests/src/org/eclipse/dltk/core/tests/launching/EnvironmentResolverTests.java b/core/tests/org.eclipse.dltk.core.tests/src/org/eclipse/dltk/core/tests/launching/EnvironmentResolverTests.java
index 41fcce3..ccd1d89 100644
--- a/core/tests/org.eclipse.dltk.core.tests/src/org/eclipse/dltk/core/tests/launching/EnvironmentResolverTests.java
+++ b/core/tests/org.eclipse.dltk.core.tests/src/org/eclipse/dltk/core/tests/launching/EnvironmentResolverTests.java
@@ -3,19 +3,19 @@
 import java.util.HashMap;
 import java.util.Map;
 
-import junit.framework.Test;
-
 import org.eclipse.dltk.core.tests.model.SuiteOfTestCases;
 import org.eclipse.dltk.internal.launching.EnvironmentResolver;
 import org.eclipse.dltk.launching.EnvironmentVariable;
 
+import junit.framework.Test;
+
 public class EnvironmentResolverTests extends SuiteOfTestCases {
 	public EnvironmentResolverTests(String name) {
 		super(name);
 	}
 
 	public void testEnvironmentResolve001() {
-		Map<String, String> env = new HashMap<String, String>();
+		Map<String, String> env = new HashMap<>();
 		EnvironmentVariable[] vars = new EnvironmentVariable[] { mk("A", "a") };
 		EnvironmentVariable[] resolve = EnvironmentResolver.resolve(env, vars);
 		assertNotNull(resolve);
@@ -23,7 +23,7 @@
 	}
 
 	public void testEnvironmentResolve002() {
-		Map<String, String> env = new HashMap<String, String>();
+		Map<String, String> env = new HashMap<>();
 		EnvironmentVariable[] vars = new EnvironmentVariable[] { mk("A", "a"),
 				mk("B", "a$Ac") };
 		EnvironmentVariable[] resolve = EnvironmentResolver.resolve(env, vars,
@@ -34,7 +34,7 @@
 	}
 
 	public void testEnvironmentResolve002a() {
-		Map<String, String> env = new HashMap<String, String>();
+		Map<String, String> env = new HashMap<>();
 		EnvironmentVariable[] vars = new EnvironmentVariable[] { mk("A", "a"),
 				mk("B", "a$A:c") };
 		EnvironmentVariable[] resolve = EnvironmentResolver.resolve(env, vars);
@@ -44,7 +44,7 @@
 	}
 
 	public void testEnvironmentResolve003() {
-		Map<String, String> env = new HashMap<String, String>();
+		Map<String, String> env = new HashMap<>();
 		EnvironmentVariable[] vars = new EnvironmentVariable[] {
 				mk("AUTOTEST", "/Develop/cisco/ats5.0.0"),
 				mk("ATS_EASY", "$AUTOTEST/ats_easy") };
@@ -55,17 +55,17 @@
 	}
 
 	public void testEnvironmentResolve004() {
-		Map<String, String> env = new HashMap<String, String>();
+		Map<String, String> env = new HashMap<>();
 		env.put("PATH", "/bin:/usr/bin");
-		EnvironmentVariable[] vars = new EnvironmentVariable[] { mk("PATH",
-				"/sbin:$PATH") };
+		EnvironmentVariable[] vars = new EnvironmentVariable[] {
+				mk("PATH", "/sbin:$PATH") };
 		EnvironmentVariable[] resolve = EnvironmentResolver.resolve(env, vars);
 		assertNotNull(resolve);
 		test(resolve, "PATH", "/sbin:/bin:/usr/bin");
 	}
 
 	public void testEnvironmentResolve005() {
-		Map<String, String> env = new HashMap<String, String>();
+		Map<String, String> env = new HashMap<>();
 		env.put("PATH", "/bin:/usr/bin");
 		EnvironmentVariable[] vars = new EnvironmentVariable[] {
 				new EnvironmentVariable("a1", "A1"),
@@ -81,7 +81,7 @@
 	}
 
 	public void testEnvironmentResolve006() {
-		Map<String, String> env = new HashMap<String, String>();
+		Map<String, String> env = new HashMap<>();
 		env.put("PATH", "/bin:/usr/bin");
 		EnvironmentVariable[] vars = new EnvironmentVariable[] {
 				new EnvironmentVariable("a1", "A1$a4"),
@@ -93,7 +93,7 @@
 	}
 
 	public void testEnvironmentResolve007() {
-		Map<String, String> env = new HashMap<String, String>();
+		Map<String, String> env = new HashMap<>();
 		env.put("PATH", "/bin:/usr/bin");
 		EnvironmentVariable[] vars = new EnvironmentVariable[] {
 				new EnvironmentVariable("a1", "$a2"),
@@ -105,7 +105,7 @@
 	}
 
 	public void testEnvironmentResolve008() {
-		Map<String, String> env = new HashMap<String, String>();
+		Map<String, String> env = new HashMap<>();
 		env.put("PATH", "/bin:/usr/bin");
 		EnvironmentVariable[] vars = new EnvironmentVariable[] {
 				new EnvironmentVariable("PATH", "/sbii/bin/:$PATH"),
@@ -117,7 +117,7 @@
 	}
 
 	public void testEnvironmentResolve008a() {
-		Map<String, String> env = new HashMap<String, String>();
+		Map<String, String> env = new HashMap<>();
 		EnvironmentVariable[] vars = new EnvironmentVariable[] {
 				new EnvironmentVariable("PATH", "/sbii/bin/:$PATH"),
 				new EnvironmentVariable("a2", "alla{$PATH}") };
@@ -141,8 +141,8 @@
 		String name = environmentVariable.getName();
 		for (int i = 0; i < resolve.length; i++) {
 			if (resolve[i].getName().equals(name)) {
-				assertEquals("Variable:" + name,
-						environmentVariable.getValue(), resolve[i].getValue());
+				assertEquals("Variable:" + name, environmentVariable.getValue(),
+						resolve[i].getValue());
 				return;
 			}
 		}
diff --git a/core/tests/org.eclipse.dltk.core.tests/src/org/eclipse/dltk/core/tests/launching/PathFilesContainer.java b/core/tests/org.eclipse.dltk.core.tests/src/org/eclipse/dltk/core/tests/launching/PathFilesContainer.java
index a41fe25..f66a2e4 100644
--- a/core/tests/org.eclipse.dltk.core.tests/src/org/eclipse/dltk/core/tests/launching/PathFilesContainer.java
+++ b/core/tests/org.eclipse.dltk.core.tests/src/org/eclipse/dltk/core/tests/launching/PathFilesContainer.java
@@ -31,7 +31,8 @@
 		accept(visitor, -1, monitor);
 	}
 
-	public void accept(IFileVisitor visitor, int deep, IProgressMonitor monitor) {
+	public void accept(IFileVisitor visitor, int deep,
+			IProgressMonitor monitor) {
 		if (monitor.isCanceled()) {
 			return;
 		}
@@ -44,7 +45,7 @@
 		final Iterator<?> it = env.keySet().iterator();
 		while (it.hasNext()) {
 			final String name = (String) it.next();
-			if (name.compareToIgnoreCase(PATH) == 0) { //$NON-NLS-1$
+			if (name.compareToIgnoreCase(PATH) == 0) { // $NON-NLS-1$
 				path = (String) env.get(name);
 			}
 		}
@@ -54,18 +55,20 @@
 		}
 
 		// Folder list
-		final String separator = Platform.getOS().equals(Platform.OS_WIN32) ? ";" : ":"; //$NON-NLS-1$ $NON-NLS-1$
+		final String separator = Platform.getOS().equals(Platform.OS_WIN32)
+				? ";" //$NON-NLS-1$
+				: ":"; // $NON-NLS-1$
 
-		final List<IPath> folders = new ArrayList<IPath>();
+		final List<IPath> folders = new ArrayList<>();
 		String[] res = path.split(separator);
 		for (int i = 0; i < res.length; i++) {
 			folders.add(Path.fromOSString(res[i]));
 		}
 
-		ArrayList<IFileHandle> searchedFiles = new ArrayList<IFileHandle>();
+		ArrayList<IFileHandle> searchedFiles = new ArrayList<>();
 		final Iterator<IPath> iter = folders.iterator();
 		while (iter.hasNext()) {
-			final IPath folder = (IPath) iter.next();
+			final IPath folder = iter.next();
 
 			if (folder != null) {
 				IFileHandle f = environment.getFile(folder);
@@ -80,9 +83,9 @@
 	 * Searches the specified directory recursively for installed Interpreters,
 	 * adding each detected Interpreter to the <code>found</code> list. Any
 	 * directories specified in the <code>ignore</code> are not traversed.
-	 * 
+	 *
 	 * @param visitor
-	 * 
+	 *
 	 * @param ry
 	 * @param found
 	 * @param types
@@ -92,7 +95,8 @@
 	 * @param searchedFiles
 	 */
 	protected void visitFolder(IFileVisitor visitor, IFileHandle directory,
-			IProgressMonitor monitor, int deep, ArrayList<IFileHandle> searchedFiles) {
+			IProgressMonitor monitor, int deep,
+			ArrayList<IFileHandle> searchedFiles) {
 		if (deep == 0) {
 			return;
 		}
@@ -110,7 +114,7 @@
 			return;
 		}
 
-		List<?> subDirs = new ArrayList<Object>();
+		List<?> subDirs = new ArrayList<>();
 		for (int i = 0; i < childFiles.length; i++) {
 			if (monitor.isCanceled()) {
 				return;
diff --git a/core/tests/org.eclipse.dltk.core.tests/src/org/eclipse/dltk/core/tests/launching/ScriptLaunchingTests.java b/core/tests/org.eclipse.dltk.core.tests/src/org/eclipse/dltk/core/tests/launching/ScriptLaunchingTests.java
index 7024344..a09754c 100644
--- a/core/tests/org.eclipse.dltk.core.tests/src/org/eclipse/dltk/core/tests/launching/ScriptLaunchingTests.java
+++ b/core/tests/org.eclipse.dltk.core.tests/src/org/eclipse/dltk/core/tests/launching/ScriptLaunchingTests.java
@@ -76,7 +76,7 @@
 	/**
 	 * Should return predefined interpreters. Used with
 	 * hasPredefinedInterpreters method as true.
-	 * 
+	 *
 	 * @return Not null array of interpreter installs.
 	 */
 	protected IInterpreterInstall[] getPredefinedInterpreterInstalls() {
@@ -118,11 +118,11 @@
 			@Override
 			public boolean getAttribute(String attributeName,
 					boolean defaultValue) throws CoreException {
-				if (attributeName
-						.equals(ScriptLaunchConfigurationConstants.ATTR_DEFAULT_BUILDPATH)) {
+				if (attributeName.equals(
+						ScriptLaunchConfigurationConstants.ATTR_DEFAULT_BUILDPATH)) {
 					return true;
-				} else if (attributeName
-						.equals(ILaunchManager.ATTR_APPEND_ENVIRONMENT_VARIABLES)) {
+				} else if (attributeName.equals(
+						ILaunchManager.ATTR_APPEND_ENVIRONMENT_VARIABLES)) {
 					return true;
 				}
 
@@ -132,31 +132,31 @@
 			@Override
 			public int getAttribute(String attributeName, int defaultValue)
 					throws CoreException {
-				if (attributeName
-						.equals(ScriptLaunchConfigurationConstants.ATTR_DLTK_DBGP_WAITING_TIMEOUT)) {
+				if (attributeName.equals(
+						ScriptLaunchConfigurationConstants.ATTR_DLTK_DBGP_WAITING_TIMEOUT)) {
 					return 10000;
 				}
 				return defaultValue;
 			}
 
 			@Override
-			public List getAttribute(String attributeName, List defaultValue)
-					throws CoreException {
+			public List<String> getAttribute(String attributeName,
+					List<String> defaultValue) throws CoreException {
 				return defaultValue;
 			}
 
 			@Override
-			public Set getAttribute(String attributeName, Set defaultValue)
-					throws CoreException {
+			public Set<String> getAttribute(String attributeName,
+					Set<String> defaultValue) throws CoreException {
 				return defaultValue;
 			}
 
 			@Override
-			public Map getAttribute(String attributeName, Map defaultValue)
-					throws CoreException {
+			public Map<String, String> getAttribute(String attributeName,
+					Map<String, String> defaultValue) throws CoreException {
 				if (attributeName
 						.equals(ILaunchManager.ATTR_ENVIRONMENT_VARIABLES)) {
-					Map<Object, Object> env = new HashMap<Object, Object>();
+					Map<String, String> env = new HashMap<>();
 					configureEnvironment(env);
 					return env;
 				}
@@ -164,33 +164,33 @@
 			}
 
 			@Override
-			public String getAttribute(String attributeName, String defaultValue)
-					throws CoreException {
+			public String getAttribute(String attributeName,
+					String defaultValue) throws CoreException {
 
-				if (attributeName
-						.equals(ScriptLaunchConfigurationConstants.ATTR_MAIN_SCRIPT_NAME)) {
+				if (attributeName.equals(
+						ScriptLaunchConfigurationConstants.ATTR_MAIN_SCRIPT_NAME)) {
 					return script;
-				} else if (attributeName
-						.equals(ScriptLaunchConfigurationConstants.ATTR_PROJECT_NAME)) {
+				} else if (attributeName.equals(
+						ScriptLaunchConfigurationConstants.ATTR_PROJECT_NAME)) {
 					return projectName;
-				} else if (attributeName
-						.equals(ScriptLaunchConfigurationConstants.ATTR_WORKING_DIRECTORY)) {
+				} else if (attributeName.equals(
+						ScriptLaunchConfigurationConstants.ATTR_WORKING_DIRECTORY)) {
 					return null;
-				} else if (attributeName
-						.equals(ScriptLaunchConfigurationConstants.ATTR_SCRIPT_ARGUMENTS)) {
+				} else if (attributeName.equals(
+						ScriptLaunchConfigurationConstants.ATTR_SCRIPT_ARGUMENTS)) {
 					return arguments;
-				} else if (attributeName
-						.equals(ScriptLaunchConfigurationConstants.ATTR_INTERPRETER_ARGUMENTS)) {
+				} else if (attributeName.equals(
+						ScriptLaunchConfigurationConstants.ATTR_INTERPRETER_ARGUMENTS)) {
 					return "";
-				} else if (attributeName
-						.equals(ScriptLaunchConfigurationConstants.ATTR_SCRIPT_NATURE)) {
+				} else if (attributeName.equals(
+						ScriptLaunchConfigurationConstants.ATTR_SCRIPT_NATURE)) {
 					return natureId;
 				}
 				return defaultValue;
 			}
 
 			@Override
-			public Map getAttributes() throws CoreException {
+			public Map<String, Object> getAttributes() throws CoreException {
 				return null;
 			}
 
@@ -201,8 +201,8 @@
 
 			@Override
 			public IFile getFile() {
-				return ScriptLaunchingTests.this.getFile(projectName + '/'
-						+ script);
+				return ScriptLaunchingTests.this
+						.getFile(projectName + '/' + script);
 			}
 
 			@Override
@@ -221,7 +221,7 @@
 			}
 
 			@Override
-			public Set getModes() throws CoreException {
+			public Set<String> getModes() throws CoreException {
 				return null;
 			}
 
@@ -231,7 +231,7 @@
 			}
 
 			@Override
-			public ILaunchDelegate getPreferredDelegate(Set modes)
+			public ILaunchDelegate getPreferredDelegate(Set<String> modes)
 					throws CoreException {
 				return null;
 			}
@@ -312,7 +312,7 @@
 	}
 
 	public IInterpreterInstall[] searchInstalls(String natureId) {
-		final List<IInterpreterInstall> installs = new ArrayList<IInterpreterInstall>();
+		final List<IInterpreterInstall> installs = new ArrayList<>();
 		final InterpreterSearcher searcher = new InterpreterSearcher();
 
 		searcher.search(EnvironmentManager.getLocalEnvironment(), natureId,
@@ -345,8 +345,7 @@
 			}
 		}
 
-		return (IInterpreterInstall[]) installs
-				.toArray(new IInterpreterInstall[installs.size()]);
+		return installs.toArray(new IInterpreterInstall[installs.size()]);
 	}
 
 	public void internalTestRequiredInterpreterAvailable(String name) {
@@ -401,8 +400,8 @@
 			final String stdoutTest = Long.toString(time) + "_stdout";
 			final String stderrTest = Long.toString(time) + "_stderr";
 
-			final ILaunchConfiguration configuration = createLaunchConfiguration(stdoutTest
-					+ " " + stderrTest);
+			final ILaunchConfiguration configuration = createLaunchConfiguration(
+					stdoutTest + " " + stderrTest);
 
 			final ILaunch launch = new Launch(configuration,
 					ILaunchManager.RUN_MODE, null);
@@ -640,8 +639,8 @@
 
 	protected IInterpreterInstall createInstall(String path, String id,
 			IInterpreterInstallType type) {
-		IFileHandle file = EnvironmentManager.getLocalEnvironment().getFile(
-				new Path(path));
+		IFileHandle file = EnvironmentManager.getLocalEnvironment()
+				.getFile(new Path(path));
 		if (!file.exists()) {
 			return null;
 		}
@@ -657,8 +656,8 @@
 		return install;
 	}
 
-	protected void createAddInstall(List<IInterpreterInstall> installs, String path, String id,
-			IInterpreterInstallType type) {
+	protected void createAddInstall(List<IInterpreterInstall> installs,
+			String path, String id, IInterpreterInstallType type) {
 		IInterpreterInstall install = createInstall(path, id, type);
 		if (install != null) {
 			installs.add(install);
diff --git a/core/tests/org.eclipse.dltk.core.tests/src/org/eclipse/dltk/core/tests/model/AbstractDLTKSearchTests.java b/core/tests/org.eclipse.dltk.core.tests/src/org/eclipse/dltk/core/tests/model/AbstractDLTKSearchTests.java
index 9752557..6aa1e7f 100644
--- a/core/tests/org.eclipse.dltk.core.tests/src/org/eclipse/dltk/core/tests/model/AbstractDLTKSearchTests.java
+++ b/core/tests/org.eclipse.dltk.core.tests/src/org/eclipse/dltk/core/tests/model/AbstractDLTKSearchTests.java
@@ -1,11 +1,10 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
+ * Copyright (c) 2000, 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
  *
- 
  *******************************************************************************/
 package org.eclipse.dltk.core.tests.model;
 
@@ -47,8 +46,8 @@
 /**
  * Abstract class for Script Search tests.
  */
-public class AbstractDLTKSearchTests extends AbstractModelTests implements
-		IDLTKSearchConstants, IScriptProjectFilenames {
+public class AbstractDLTKSearchTests extends AbstractModelTests
+		implements IDLTKSearchConstants, IScriptProjectFilenames {
 
 	public static List<?> JAVA_SEARCH_SUITES = null;
 	protected IScriptProject SCRIPT_PROJECT;
@@ -90,7 +89,8 @@
 		}
 
 		protected void writeLineToResult() {
-			if (match.getAccuracy() == SearchMatch.A_ACCURATE || showPotential) {
+			if (match.getAccuracy() == SearchMatch.A_ACCURATE
+					|| showPotential) {
 				if (results.length() > 0)
 					results.append("\n");
 				results.append(line);
@@ -153,12 +153,12 @@
 						line.append(" [");
 						if (start > -1) {
 							if (this.showContext) {
-								int lineStart1 = CharOperation.lastIndexOf(
-										'\n', contents, 0, start);
-								int lineStart2 = CharOperation.lastIndexOf(
-										'\r', contents, 0, start);
-								int lineStart = Math
-										.max(lineStart1, lineStart2) + 1;
+								int lineStart1 = CharOperation.lastIndexOf('\n',
+										contents, 0, start);
+								int lineStart2 = CharOperation.lastIndexOf('\r',
+										contents, 0, start);
+								int lineStart = Math.max(lineStart1, lineStart2)
+										+ 1;
 								line.append(CharOperation.subarray(contents,
 										lineStart, start));
 								line.append("<");
@@ -171,8 +171,8 @@
 										contents, end);
 								int lineEnd2 = CharOperation.indexOf('\r',
 										contents, end);
-								int lineEnd = lineEnd1 > 0 && lineEnd2 > 0 ? Math
-										.min(lineEnd1, lineEnd2)
+								int lineEnd = lineEnd1 > 0 && lineEnd2 > 0
+										? Math.min(lineEnd1, lineEnd2)
 										: Math.max(lineEnd1, lineEnd2);
 								if (lineEnd == -1)
 									lineEnd = contents.length;
@@ -279,8 +279,8 @@
 			case IModelElement.SOURCE_MODULE:
 				IScriptFolder pkg = type.getScriptFolder();
 				append(pkg);
-				if (!pkg.getElementName().equals(
-						IScriptFolder.DEFAULT_FOLDER_NAME)) {
+				if (!pkg.getElementName()
+						.equals(IScriptFolder.DEFAULT_FOLDER_NAME)) {
 					line.append(IScriptFolder.PACKAGE_DELIMITER);
 				}
 				break;
@@ -316,13 +316,15 @@
 			return (IModelElement) searchMatch.getElement();
 		}
 
-		protected String getPathString(IResource resource, IModelElement element) {
+		protected String getPathString(IResource resource,
+				IModelElement element) {
 			String pathString;
 			if (resource != null) {
 				IPath path = resource.getProjectRelativePath();
 				if (path.segmentCount() == 0) {
 					IModelElement root = element;
-					while (root != null && !(root instanceof IProjectFragment)) {
+					while (root != null
+							&& !(root instanceof IProjectFragment)) {
 						root = root.getParent();
 					}
 					if (root != null) {
@@ -418,8 +420,8 @@
 						// ignore
 					}
 				}
-				System.out
-						.println("--------------------------------------------------------------------------------");
+				System.out.println(
+						"--------------------------------------------------------------------------------");
 				for (int i = 0; i < length; i += 2) {
 					System.out.println(sources[i]);
 					System.out.println(sources[i + 1]);
@@ -457,14 +459,14 @@
 
 	protected IDLTKSearchScope getScriptSearchPackageScope(String projectName,
 			String packageName, boolean addSubpackages) throws ModelException {
-		IScriptFolder fragment = getScriptFolder(projectName, "src", new Path(
-				packageName));
+		IScriptFolder fragment = getScriptFolder(projectName, "src",
+				new Path(packageName));
 		if (fragment == null)
 			return null;
 		IModelElement[] searchPackages = null;
 		if (addSubpackages) {
 			// Create list of package with first found one
-			List<IScriptFolder> packages = new ArrayList<IScriptFolder>();
+			List<IScriptFolder> packages = new ArrayList<>();
 			packages.add(fragment);
 			// Add all possible subpackages
 			IModelElement[] children = ((IProjectFragment) fragment.getParent())
@@ -497,8 +499,8 @@
 
 	IDLTKSearchScope getScriptSearchCUScope(String projectName,
 			String packageName, String cuName) throws ModelException {
-		ISourceModule cu = getSourceModule(projectName, "src", new Path(
-				packageName).append(cuName));
+		ISourceModule cu = getSourceModule(projectName, "src",
+				new Path(packageName).append(cuName));
 		return SearchEngine.createSearchScope(cu);
 	}
 
@@ -528,17 +530,17 @@
 				matchRule, scope.getLanguageToolkit());
 		assertNotNull("Pattern should not be null", pattern);
 		new SearchEngine().search(pattern,
-				new SearchParticipant[] { SearchEngine
-						.getDefaultSearchParticipant() }, scope, requestor,
-				null);
+				new SearchParticipant[] {
+						SearchEngine.getDefaultSearchParticipant() },
+				scope, requestor, null);
 	}
 
 	protected void search(SearchPattern searchPattern, IDLTKSearchScope scope,
 			SearchRequestor requestor) throws CoreException {
 		new SearchEngine().search(searchPattern,
-				new SearchParticipant[] { SearchEngine
-						.getDefaultSearchParticipant() }, scope, requestor,
-				null);
+				new SearchParticipant[] {
+						SearchEngine.getDefaultSearchParticipant() },
+				scope, requestor, null);
 	}
 
 	protected void search(String patternString, int searchFor, int limitTo,
@@ -564,9 +566,9 @@
 				searchFor, limitTo, matchRule, scope.getLanguageToolkit());
 		assertNotNull("Pattern should not be null", pattern);
 		new SearchEngine().search(pattern,
-				new SearchParticipant[] { SearchEngine
-						.getDefaultSearchParticipant() }, scope, requestor,
-				null);
+				new SearchParticipant[] {
+						SearchEngine.getDefaultSearchParticipant() },
+				scope, requestor, null);
 	}
 
 	// Search for sources only.
@@ -576,15 +578,17 @@
 				matchRule, scope.getLanguageToolkit());
 		assertNotNull("Pattern should not be null", pattern);
 		return new SearchEngine().searchSourceOnly(pattern,
-				new SearchParticipant[] { SearchEngine
-						.getDefaultSearchParticipant() }, scope, null);
+				new SearchParticipant[] {
+						SearchEngine.getDefaultSearchParticipant() },
+				scope, null);
 	}
 
 	protected List<?> searchSourceOnly(SearchPattern searchPattern,
 			IDLTKSearchScope scope) throws CoreException {
 		return new SearchEngine().searchSourceOnly(searchPattern,
-				new SearchParticipant[] { SearchEngine
-						.getDefaultSearchParticipant() }, scope, null);
+				new SearchParticipant[] {
+						SearchEngine.getDefaultSearchParticipant() },
+				scope, null);
 	}
 
 	protected List<?> searchSourceOnly(String patternString, int searchFor,
@@ -604,8 +608,9 @@
 				searchFor, limitTo, matchRule, scope.getLanguageToolkit());
 		assertNotNull("Pattern should not be null", pattern);
 		return new SearchEngine().searchSourceOnly(pattern,
-				new SearchParticipant[] { SearchEngine
-						.getDefaultSearchParticipant() }, scope, null);
+				new SearchParticipant[] {
+						SearchEngine.getDefaultSearchParticipant() },
+				scope, null);
 	}
 
 	// /
@@ -619,8 +624,8 @@
 	protected void searchDeclarationsOfReferencedTypes(
 			IModelElement enclosingElement, SearchRequestor requestor)
 			throws ModelException {
-		new SearchEngine().searchDeclarationsOfReferencedTypes(
-				enclosingElement, requestor, null);
+		new SearchEngine().searchDeclarationsOfReferencedTypes(enclosingElement,
+				requestor, null);
 	}
 
 	protected void searchDeclarationsOfSentMessages(
diff --git a/core/tests/org.eclipse.dltk.core.tests/src/org/eclipse/dltk/core/tests/model/AbstractModelTests.java b/core/tests/org.eclipse.dltk.core.tests/src/org/eclipse/dltk/core/tests/model/AbstractModelTests.java
index be85bfc..bdd2ce5 100644
--- a/core/tests/org.eclipse.dltk.core.tests/src/org/eclipse/dltk/core/tests/model/AbstractModelTests.java
+++ b/core/tests/org.eclipse.dltk.core.tests/src/org/eclipse/dltk/core/tests/model/AbstractModelTests.java
@@ -62,7 +62,6 @@
 import org.eclipse.osgi.util.NLS;
 import org.osgi.framework.Bundle;
 
-
 public abstract class AbstractModelTests extends SuiteOfTestCases {
 	protected boolean displayName = false;
 	protected String endChar = ",";
@@ -84,7 +83,8 @@
 
 		@Override
 		public void elementChanged(ElementChangedEvent ev) {
-			IModelElementDelta[] copy = new IModelElementDelta[deltas.length + 1];
+			IModelElementDelta[] copy = new IModelElementDelta[deltas.length
+					+ 1];
 			System.arraycopy(deltas, 0, copy, 0, deltas.length);
 			copy[deltas.length] = ev.getDelta();
 			deltas = copy;
@@ -182,9 +182,9 @@
 		try {
 			final Bundle bundle = Platform.getBundle(this.fTestProjectName);
 			if (bundle == null) {
-				throw new IllegalStateException(NLS.bind(
-						"Bundle \"{0}\" with test data not found",
-						fTestProjectName));
+				throw new IllegalStateException(
+						NLS.bind("Bundle \"{0}\" with test data not found",
+								fTestProjectName));
 			}
 			URL platformURL = bundle.getEntry("/");
 			return new File(FileLocator.toFileURL(platformURL).getFile());
@@ -230,8 +230,8 @@
 
 		final File source = new File(sourceWorkspacePath, fromName);
 		if (!source.isDirectory()) {
-			throw new IllegalArgumentException(NLS.bind(
-					"Source directory \"{0}\" doesn't exist", source));
+			throw new IllegalArgumentException(
+					NLS.bind("Source directory \"{0}\" doesn't exist", source));
 		}
 		copyDirectory(source, new File(targetWorkspacePath, projectName));
 
@@ -260,8 +260,8 @@
 
 	public ISourceModule getSourceModule(String projectName, String rootPath,
 			String path) throws ModelException {
-		IScriptFolder folder = getScriptFolder(projectName, rootPath, new Path(
-				path).removeLastSegments(1));
+		IScriptFolder folder = getScriptFolder(projectName, rootPath,
+				new Path(path).removeLastSegments(1));
 		if (folder == null) {
 			return null;
 		}
@@ -316,8 +316,7 @@
 				IProjectFragment root = roots[i];
 				IResource underlyingResource = root.getUnderlyingResource();
 				if (underlyingResource != null && underlyingResource
-						.getProjectRelativePath()
-						.equals(path)) {
+						.getProjectRelativePath().equals(path)) {
 					return root;
 				}
 				if (root.getPath().equals(path)) {
@@ -445,10 +444,8 @@
 
 			// create buildpath entries
 			IPath projectPath = project.getFullPath();
-			int sourceLength = sourceFolders == null ? 0
-					: sourceFolders.length;
-			int containersLength = containers == null ? 0
-					: containers.length;
+			int sourceLength = sourceFolders == null ? 0 : sourceFolders.length;
+			int containersLength = containers == null ? 0 : containers.length;
 			int projectLength = projects == null ? 0 : projects.length;
 			IBuildpathEntry[] entries = new IBuildpathEntry[sourceLength
 					+ projectLength + containersLength];
@@ -459,8 +456,8 @@
 					// create folder and its parents
 					IContainer container = project;
 					for (int j = 0; j < segmentCount; j++) {
-						IFolder folder = container.getFolder(new Path(
-								sourcePath.segment(j)));
+						IFolder folder = container
+								.getFolder(new Path(sourcePath.segment(j)));
 						if (!folder.exists()) {
 							folder.create(true, true, null);
 						}
@@ -468,8 +465,8 @@
 					}
 				}
 				// create source entry
-				entries[i1] = DLTKCore.newSourceEntry(projectPath
-						.append(sourcePath));
+				entries[i1] = DLTKCore
+						.newSourceEntry(projectPath.append(sourcePath));
 			}
 
 			for (int i2 = 0; i2 < projectLength; i2++) {
@@ -483,10 +480,10 @@
 				nonAccessibleFiles = new IPath[0];
 
 				entries[sourceLength + i2] = DLTKCore.newProjectEntry(
-						new Path(projects[i2]), BuildpathEntry
-								.getAccessRules(accessibleFiles,
-										nonAccessibleFiles), true,
-						new IBuildpathAttribute[0], false);
+						new Path(projects[i2]),
+						BuildpathEntry.getAccessRules(accessibleFiles,
+								nonAccessibleFiles),
+						true, new IBuildpathAttribute[0], false);
 			}
 
 			for (int i3 = 0; i3 < containersLength; i3++) {
@@ -551,12 +548,12 @@
 			} catch (CoreException e) {
 				lastException = e;
 				// just print for info
-				System.out.println("Retry " + retryCount + ": "
-						+ e.getMessage());
+				System.out
+						.println("Retry " + retryCount + ": " + e.getMessage());
 			} catch (IllegalArgumentException iae) {
 				// just print for info
-				System.out.println("Retry " + retryCount + ": "
-						+ iae.getMessage());
+				System.out.println(
+						"Retry " + retryCount + ": " + iae.getMessage());
 			}
 		}
 		if (!resource.isAccessible())
@@ -643,8 +640,8 @@
 			// elementB.toStringWithAncestors().toCharArray(),
 			// getExternalJCLPathString().toCharArray(),
 			// tempJCLPath));
-			return elementA.toStringWithAncestors().compareTo(
-					elementB.toStringWithAncestors().toString());
+			return elementA.toStringWithAncestors()
+					.compareTo(elementB.toStringWithAncestors().toString());
 			// return idA.compareTo(idB);
 		};
 		org.eclipse.dltk.internal.core.util.Util.sort(elements, comparer);
@@ -658,9 +655,10 @@
 
 	protected void assertElementsEqual(String message, String expected,
 			IModelElement[] elements) {
-		assertElementsEqual(message, expected, elements, false/*
-															 * don't show key
-															 */);
+		assertElementsEqual(message, expected, elements,
+				false/*
+						 * don't show key
+						 */);
 	}
 
 	protected void assertElementsEqual(String message, String expected,
@@ -672,8 +670,8 @@
 				if (element == null) {
 					buffer.append("<null>");
 				} else {
-					buffer.append(element
-							.toStringWithAncestors(showResolvedInfo));
+					buffer.append(
+							element.toStringWithAncestors(showResolvedInfo));
 				}
 				if (i != length - 1)
 					buffer.append("\n");
@@ -769,8 +767,8 @@
 		org.eclipse.dltk.internal.core.util.Util.Comparer comparer = (a, b) -> {
 			IMarker markerA = (IMarker) a;
 			IMarker markerB = (IMarker) b;
-			return markerA
-					.getAttribute(IMarker.MESSAGE, "").compareTo(markerB.getAttribute(IMarker.MESSAGE, "")); //$NON-NLS-1$ //$NON-NLS-2$
+			return markerA.getAttribute(IMarker.MESSAGE, "") //$NON-NLS-1$
+					.compareTo(markerB.getAttribute(IMarker.MESSAGE, "")); //$NON-NLS-1$
 		};
 		org.eclipse.dltk.internal.core.util.Util.sort(markers, comparer);
 	}
@@ -903,8 +901,8 @@
 			boolean found = false;
 			for (int i = 0; i < children.length; i++) {
 				if (children[i].equals(sibling)) {
-					assertTrue("element should be before sibling", i > 0
-							&& children[i - 1].equals(positioned));
+					assertTrue("element should be before sibling",
+							i > 0 && children[i - 1].equals(positioned));
 					found = true;
 					break;
 				}
@@ -934,24 +932,25 @@
 	public ISourceModule getWorkingCopy(String path, String source,
 			WorkingCopyOwner owner, boolean computeProblems)
 			throws ModelException {
-		IProblemRequestor problemRequestor = computeProblems ? new IProblemRequestor() {
-			@Override
-			public void acceptProblem(IProblem problem) {
-			}
+		IProblemRequestor problemRequestor = computeProblems
+				? new IProblemRequestor() {
+					@Override
+					public void acceptProblem(IProblem problem) {
+					}
 
-			@Override
-			public void beginReporting() {
-			}
+					@Override
+					public void beginReporting() {
+					}
 
-			@Override
-			public void endReporting() {
-			}
+					@Override
+					public void endReporting() {
+					}
 
-			@Override
-			public boolean isActive() {
-				return true;
-			}
-		}
+					@Override
+					public boolean isActive() {
+						return true;
+					}
+				}
 				: null;
 		return getWorkingCopy(path, source, owner, problemRequestor);
 	}
@@ -961,17 +960,15 @@
 			throws ModelException {
 		ISourceModule workingCopy = getSourceModule(path);
 		if (owner != null)
-			workingCopy = workingCopy
-					.getWorkingCopy(/* owner, problemRequestor, */null/*
-																	 * no
-																	 * progress
-																	 * monitor
-																	 */);
+			workingCopy = workingCopy.getWorkingCopy(
+					/* owner, problemRequestor, */null/*
+														 * no progress monitor
+														 */);
 		else
-			workingCopy.becomeWorkingCopy(problemRequestor, null/*
-																 * no progress
-																 * monitor
-																 */);
+			workingCopy.becomeWorkingCopy(problemRequestor,
+					null/*
+						 * no progress monitor
+						 */);
 		workingCopy.getBuffer().setContents(source);
 		// if (problemRequestor instanceof ProblemRequestor)
 		// ((ProblemRequestor)
@@ -985,26 +982,14 @@
 	}
 
 	public static void storeFile(File dest, URL url) throws IOException {
-		InputStream input = null;
-		OutputStream output = null;
-		try {
-			input = new BufferedInputStream(url.openStream());
-
-			output = new BufferedOutputStream(new FileOutputStream(dest));
-
+		try (InputStream input = new BufferedInputStream(url.openStream());
+				OutputStream output = new BufferedOutputStream(
+						new FileOutputStream(dest))) {
 			// Simple copy
 			int ch = -1;
 			while ((ch = input.read()) != -1) {
 				output.write(ch);
 			}
-		} finally {
-			if (input != null) {
-				input.close();
-			}
-
-			if (output != null) {
-				output.close();
-			}
 		}
 	}
 
diff --git a/core/tests/org.eclipse.dltk.core.tests/src/org/eclipse/dltk/core/tests/model/BufferTests.java b/core/tests/org.eclipse.dltk.core.tests/src/org/eclipse/dltk/core/tests/model/BufferTests.java
index d82341b..083249d 100644
--- a/core/tests/org.eclipse.dltk.core.tests/src/org/eclipse/dltk/core/tests/model/BufferTests.java
+++ b/core/tests/org.eclipse.dltk.core.tests/src/org/eclipse/dltk/core/tests/model/BufferTests.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2005, 2016 IBM Corporation and others.
+ * Copyright (c) 2005, 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
@@ -10,8 +10,6 @@
 
 import java.util.ArrayList;
 
-import junit.framework.Test;
-
 import org.eclipse.core.resources.IFile;
 import org.eclipse.core.resources.IResource;
 import org.eclipse.core.runtime.CoreException;
@@ -20,15 +18,16 @@
 import org.eclipse.dltk.core.IBufferChangedListener;
 import org.eclipse.dltk.core.ISourceModule;
 
+import junit.framework.Test;
 
-public class BufferTests extends ModifyingResourceTests implements IBufferChangedListener {
+public class BufferTests extends ModifyingResourceTests
+		implements IBufferChangedListener {
 
 	final static String[] TEST_NATURES = new String[] {
-		ModelTestsPlugin.TEST_NATURE
-	};
-	
+			ModelTestsPlugin.TEST_NATURE };
+
 	protected ArrayList<BufferChangedEvent> events = null;
-	
+
 	public BufferTests(String name) {
 		super(ModelTestsPlugin.PLUGIN_NAME, name);
 	}
@@ -36,7 +35,7 @@
 	public static Test suite() {
 		return new Suite(BufferTests.class);
 	}
-	
+
 	/**
 	 * @see AbstractModelTests#setUpSuite()
 	 */
@@ -44,7 +43,7 @@
 	public void setUpSuite() throws Exception {
 		super.setUpSuite();
 		try {
-			this.createScriptProject("P", TEST_NATURES, new String[] {""});
+			this.createScriptProject("P", TEST_NATURES, new String[] { "" });
 			this.createFolder("P/x/y");
 		} catch (CoreException e) {
 			e.printStackTrace();
@@ -57,28 +56,29 @@
 	@Override
 	public void tearDownSuite() throws Exception {
 		super.tearDownSuite();
-		BufferTests.deleteProject("P");
+		AbstractModelTests.deleteProject("P");
 	}
 
-	
-	protected IBuffer createBuffer(String path, String content) throws CoreException {
-		waitUntilIndexesReady(); // ensure that the indexer is not reading the file
+	protected IBuffer createBuffer(String path, String content)
+			throws CoreException {
+		waitUntilIndexesReady(); // ensure that the indexer is not reading the
+									// file
 		this.createFile(path, content);
 		ISourceModule sm = this.getSourceModule(path);
 		IBuffer buffer = sm.getBuffer();
 		buffer.addBufferChangedListener(this);
-		this.events = new ArrayList<BufferChangedEvent>();
+		this.events = new ArrayList<>();
 		return buffer;
 	}
 
 	/**
-	 * Verify the buffer changed event.
-	 * The given text must contain '\n' line separators.
+	 * Verify the buffer changed event. The given text must contain '\n' line
+	 * separators.
 	 */
 	protected void assertBufferEvent(int offset, int length, String text) {
 		assertTrue("events should not be null", this.events != null);
 		assertTrue("events should not be empty", !this.events.isEmpty());
-		BufferChangedEvent event = (BufferChangedEvent) this.events.get(0);
+		BufferChangedEvent event = this.events.get(0);
 		assertEquals("unexpected offset", offset, event.getOffset());
 		assertEquals("unexpected length", length, event.getLength());
 		if (text == null) {
@@ -87,7 +87,7 @@
 			assertSourceEquals("unexpected text", text, event.getText());
 		}
 	}
-	
+
 	protected void deleteBuffer(IBuffer buffer) throws CoreException {
 		buffer.removeBufferChangedListener(this);
 		IResource resource = buffer.getUnderlyingResource();
@@ -95,43 +95,31 @@
 			deleteResource(resource);
 		}
 	}
-	
-	
+
 	/**
 	 * Tests appending to a buffer.
 	 */
 	public void testAppend() throws CoreException {
-		IBuffer buffer = this.createBuffer(
-			"P/x/y/A.txt",
-			"package x.y;\n" +
-			"public class A {\n" +
-			"}"
-		);
+		IBuffer buffer = this.createBuffer("P/x/y/A.txt",
+				"package x.y;\n" + "public class A {\n" + "}");
 		try {
-			int oldLength= buffer.getLength();
+			int oldLength = buffer.getLength();
 			buffer.append("\nclass B {}");
 			assertBufferEvent(oldLength, 0, "\nclass B {}");
 			assertSourceEquals(
-				"unexpected buffer contents",
-				"package x.y;\n" +
-				"public class A {\n" +
-				"}\n" +
-				"class B {}",
-				buffer.getContents()
-			);
-			assertTrue("should have unsaved changes", buffer.hasUnsavedChanges());
+					"unexpected buffer contents", "package x.y;\n"
+							+ "public class A {\n" + "}\n" + "class B {}",
+					buffer.getContents());
+			assertTrue("should have unsaved changes",
+					buffer.hasUnsavedChanges());
 		} finally {
 			this.deleteBuffer(buffer);
 		}
 	}
-	
+
 	public void testClose() throws CoreException {
-		IBuffer buffer = this.createBuffer(
-			"P/x/y/A.txt",
-			"package x.y;\n" +
-			"public class A {\n" +
-			"}"
-		);
+		IBuffer buffer = this.createBuffer("P/x/y/A.txt",
+				"package x.y;\n" + "public class A {\n" + "}");
 		try {
 			buffer.close();
 			assertBufferEvent(0, 0, null);
@@ -139,24 +127,22 @@
 			this.deleteBuffer(buffer);
 		}
 	}
-	
+
 	/**
 	 * Tests getting the underlying resource of a buffer.
 	 */
 	public void testGetUnderlyingResource() throws CoreException {
-		IBuffer buffer = this.createBuffer(
-			"P/x/y/A.txt",
-			"package x.y;\n" +
-			"public class A {\n" +
-			"}"
-		);
+		IBuffer buffer = this.createBuffer("P/x/y/A.txt",
+				"package x.y;\n" + "public class A {\n" + "}");
 		ISourceModule copy = null;
 		try {
 			IFile file = this.getFile("P/x/y/A.txt");
-			assertEquals("Unexpected underlying resource", file, buffer.getUnderlyingResource());
-			
+			assertEquals("Unexpected underlying resource", file,
+					buffer.getUnderlyingResource());
+
 			copy = this.getSourceModule("P/x/y/A.txt").getWorkingCopy(null);
-			assertEquals("Unexpected underlying resource 2", file, copy.getBuffer().getUnderlyingResource());
+			assertEquals("Unexpected underlying resource 2", file,
+					copy.getBuffer().getUnderlyingResource());
 		} finally {
 			this.deleteBuffer(buffer);
 			if (copy != null) {
@@ -164,304 +150,243 @@
 			}
 		}
 	}
-	
+
 	/**
 	 * Tests deleting text at the beginning of a buffer.
 	 */
 	public void testDeleteBeginning() throws CoreException {
-		IBuffer buffer = this.createBuffer(
-			"P/x/y/A.txt",
-			"package x.y;\n" +
-			"public class A {\n" +
-			"}"
-		);
+		IBuffer buffer = this.createBuffer("P/x/y/A.txt",
+				"package x.y;\n" + "public class A {\n" + "}");
 		try {
 			buffer.replace(0, 13, "");
 			assertBufferEvent(0, 13, null);
-			assertSourceEquals(
-				"unexpected buffer contents",
-				"public class A {\n" +
-				"}",
-				buffer.getContents()
-			);
-			assertTrue("should have unsaved changes", buffer.hasUnsavedChanges());
+			assertSourceEquals("unexpected buffer contents",
+					"public class A {\n" + "}", buffer.getContents());
+			assertTrue("should have unsaved changes",
+					buffer.hasUnsavedChanges());
 		} finally {
 			this.deleteBuffer(buffer);
 		}
 	}
+
 	/**
 	 * Tests deleting text in the middle of a buffer.
 	 */
 	public void testDeleteMiddle() throws CoreException {
-		IBuffer buffer = this.createBuffer(
-			"P/x/y/A.txt",
-			"package x.y;\n" +
-			"public class A {\n" +
-			"}"
-		);
+		IBuffer buffer = this.createBuffer("P/x/y/A.txt",
+				"package x.y;\n" + "public class A {\n" + "}");
 		try {
 			// delete "public "
 			buffer.replace(13, 7, "");
 			assertBufferEvent(13, 7, null);
-			assertSourceEquals(
-				"unexpected buffer contents",
-				"package x.y;\n" +
-				"class A {\n" +
-				"}",
-				buffer.getContents()
-			);
-			assertTrue("should have unsaved changes", buffer.hasUnsavedChanges());
+			assertSourceEquals("unexpected buffer contents",
+					"package x.y;\n" + "class A {\n" + "}",
+					buffer.getContents());
+			assertTrue("should have unsaved changes",
+					buffer.hasUnsavedChanges());
 		} finally {
 			this.deleteBuffer(buffer);
 		}
 	}
+
 	/**
 	 * Tests deleting text at the end of a buffer.
 	 */
 	public void testDeleteEnd() throws CoreException {
-		IBuffer buffer = this.createBuffer(
-			"P/x/y/A.txt",
-			"package x.y;\n" +
-			"public class A {\n" +
-			"}"
-		);
+		IBuffer buffer = this.createBuffer("P/x/y/A.txt",
+				"package x.y;\n" + "public class A {\n" + "}");
 		try {
 			// delete "public class A {\n}"
 			buffer.replace(13, 18, "");
 			assertBufferEvent(13, 18, null);
-			assertSourceEquals(
-				"unexpected buffer contents",
-				"package x.y;\n",
-				buffer.getContents()
-			);
-			assertTrue("should have unsaved changes", buffer.hasUnsavedChanges());
+			assertSourceEquals("unexpected buffer contents", "package x.y;\n",
+					buffer.getContents());
+			assertTrue("should have unsaved changes",
+					buffer.hasUnsavedChanges());
 		} finally {
 			this.deleteBuffer(buffer);
 		}
 	}
+
 	/**
-	 * Tests the buffer char retrieval via source position 
+	 * Tests the buffer char retrieval via source position
 	 */
 	public void testGetChar() throws CoreException {
-		IBuffer buffer = this.createBuffer(
-			"P/x/y/A.txt",
-			"package x.y;\n" +
-			"public class A {\n" +
-			"}"
-		);
+		IBuffer buffer = this.createBuffer("P/x/y/A.txt",
+				"package x.y;\n" + "public class A {\n" + "}");
 		try {
-			assertEquals("Unexpected char at position 17", 'i', buffer.getChar(17));
+			assertEquals("Unexpected char at position 17", 'i',
+					buffer.getChar(17));
 		} finally {
 			this.deleteBuffer(buffer);
 		}
 	}
+
 	/**
-	 * Tests the buffer char retrieval via source position doesn't throw an exception if the buffer is closed.
-	 * (regression test for bug 46040 NPE in Eclipse console)
+	 * Tests the buffer char retrieval via source position doesn't throw an
+	 * exception if the buffer is closed. (regression test for bug 46040 NPE in
+	 * Eclipse console)
 	 */
 	public void testGetChar2() throws CoreException {
-		IBuffer buffer = this.createBuffer(
-			"P/x/y/A.txt",
-			"package x.y;\n" +
-			"public class A {\n" +
-			"}"
-		);
+		IBuffer buffer = this.createBuffer("P/x/y/A.txt",
+				"package x.y;\n" + "public class A {\n" + "}");
 		buffer.close();
 		try {
-			assertEquals("Unexpected char at position 17", Character.MIN_VALUE, buffer.getChar(17));
+			assertEquals("Unexpected char at position 17", Character.MIN_VALUE,
+					buffer.getChar(17));
 		} finally {
 			this.deleteBuffer(buffer);
 		}
 	}
+
 	/**
-	 * Tests the buffer getLength() 
+	 * Tests the buffer getLength()
 	 */
 	public void testGetLength() throws CoreException {
-		IBuffer buffer = this.createBuffer(
-			"P/x/y/A.txt",
-			"package x.y;\n" +
-			"public class A {\n" +
-			"}"
-		);
+		IBuffer buffer = this.createBuffer("P/x/y/A.txt",
+				"package x.y;\n" + "public class A {\n" + "}");
 		try {
 			assertEquals("Unexpected length", 31, buffer.getLength());
 		} finally {
 			this.deleteBuffer(buffer);
 		}
 	}
+
 	/**
-	 * Tests the buffer text retrieval via source position 
+	 * Tests the buffer text retrieval via source position
 	 */
 	public void testGetText() throws CoreException {
-		IBuffer buffer = this.createBuffer(
-			"P/x/y/A.txt",
-			"package x.y;\n" +
-			"public class A {\n" +
-			"}"
-		);
+		IBuffer buffer = this.createBuffer("P/x/y/A.txt",
+				"package x.y;\n" + "public class A {\n" + "}");
 		try {
-			assertSourceEquals("Unexpected text (1)", "p", buffer.getText(0, 1));
-			assertSourceEquals("Unexpected text (2)", "public", buffer.getText(13, 6));
-			assertSourceEquals("Unexpected text (3)", "", buffer.getText(10, 0));
+			assertSourceEquals("Unexpected text (1)", "p",
+					buffer.getText(0, 1));
+			assertSourceEquals("Unexpected text (2)", "public",
+					buffer.getText(13, 6));
+			assertSourceEquals("Unexpected text (3)", "",
+					buffer.getText(10, 0));
 		} finally {
 			this.deleteBuffer(buffer);
 		}
 	}
+
 	/**
 	 * Tests inserting text at the beginning of a buffer.
 	 */
 	public void testInsertBeginning() throws CoreException {
-		IBuffer buffer = this.createBuffer(
-			"P/x/y/A.txt",
-			"package x.y;\n" +
-			"public class A {\n" +
-			"}"
-		);
+		IBuffer buffer = this.createBuffer("P/x/y/A.txt",
+				"package x.y;\n" + "public class A {\n" + "}");
 		try {
 			buffer.replace(0, 0, "/* copyright mycompany */\n");
 			assertBufferEvent(0, 0, "/* copyright mycompany */\n");
 			assertSourceEquals(
-				"unexpected buffer contents",
-				"/* copyright mycompany */\n" +
-				"package x.y;\n" +
-				"public class A {\n" +
-				"}",
-				buffer.getContents()
-			);
-			assertTrue("should have unsaved changes", buffer.hasUnsavedChanges());
+					"unexpected buffer contents", "/* copyright mycompany */\n"
+							+ "package x.y;\n" + "public class A {\n" + "}",
+					buffer.getContents());
+			assertTrue("should have unsaved changes",
+					buffer.hasUnsavedChanges());
 		} finally {
 			this.deleteBuffer(buffer);
 		}
 	}
+
 	/**
 	 * Tests replacing text at the beginning of a buffer.
 	 */
 	public void testReplaceBeginning() throws CoreException {
-		IBuffer buffer = this.createBuffer(
-			"P/x/y/A.txt",
-			"package x.y;\n" +
-			"public class A {\n" +
-			"}"
-		);
+		IBuffer buffer = this.createBuffer("P/x/y/A.txt",
+				"package x.y;\n" + "public class A {\n" + "}");
 		try {
 			buffer.replace(0, 13, "package other;\n");
 			assertBufferEvent(0, 13, "package other;\n");
-			assertSourceEquals(
-				"unexpected buffer contents",
-				"package other;\n" +
-				"public class A {\n" +
-				"}",
-				buffer.getContents()
-			);
-			assertTrue("should have unsaved changes", buffer.hasUnsavedChanges());
+			assertSourceEquals("unexpected buffer contents",
+					"package other;\n" + "public class A {\n" + "}",
+					buffer.getContents());
+			assertTrue("should have unsaved changes",
+					buffer.hasUnsavedChanges());
 		} finally {
 			this.deleteBuffer(buffer);
 		}
 	}
+
 	/**
 	 * Tests replacing text in the middle of a buffer.
 	 */
 	public void testReplaceMiddle() throws CoreException {
-		IBuffer buffer = this.createBuffer(
-			"P/x/y/A.txt",
-			"package x.y;\n" +
-			"public class A {\n" +
-			"}"
-		);
+		IBuffer buffer = this.createBuffer("P/x/y/A.txt",
+				"package x.y;\n" + "public class A {\n" + "}");
 		try {
 			// replace "public class A" after the \n of package statement
 			buffer.replace(13, 14, "public class B");
 			assertBufferEvent(13, 14, "public class B");
-			assertSourceEquals(
-				"unexpected buffer contents",
-				"package x.y;\n" +
-				"public class B {\n" +
-				"}",
-				buffer.getContents()
-			);
-			assertTrue("should have unsaved changes", buffer.hasUnsavedChanges());
+			assertSourceEquals("unexpected buffer contents",
+					"package x.y;\n" + "public class B {\n" + "}",
+					buffer.getContents());
+			assertTrue("should have unsaved changes",
+					buffer.hasUnsavedChanges());
 		} finally {
 			this.deleteBuffer(buffer);
 		}
 	}
+
 	/**
 	 * Tests replacing text at the end of a buffer.
 	 */
 	public void testReplaceEnd() throws CoreException {
-		IBuffer buffer = this.createBuffer(
-			"P/x/y/A.txt",
-			"package x.y;\n" +
-			"public class A {\n" +
-			"}"
-		);
+		IBuffer buffer = this.createBuffer("P/x/y/A.txt",
+				"package x.y;\n" + "public class A {\n" + "}");
 		try {
 			// replace "}" at the end of cu with "}\n"
 			int end = buffer.getLength();
-			buffer.replace(end-1, 1, "}\n");
-			assertBufferEvent(end-1, 1, "}\n");
-			assertSourceEquals(
-				"unexpected buffer contents",
-				"package x.y;\n" +
-				"public class A {\n" +
-				"}\n",
-				buffer.getContents()
-			);
-			assertTrue("should have unsaved changes", buffer.hasUnsavedChanges());
+			buffer.replace(end - 1, 1, "}\n");
+			assertBufferEvent(end - 1, 1, "}\n");
+			assertSourceEquals("unexpected buffer contents",
+					"package x.y;\n" + "public class A {\n" + "}\n",
+					buffer.getContents());
+			assertTrue("should have unsaved changes",
+					buffer.hasUnsavedChanges());
 		} finally {
 			this.deleteBuffer(buffer);
 		}
 	}
+
 	/**
 	 * Tests inserting text in the middle of a buffer.
 	 */
 	public void testInsertMiddle() throws CoreException {
-		IBuffer buffer = this.createBuffer(
-			"P/x/y/A.txt",
-			"package x.y;\n" +
-			"public class A {\n" +
-			"}"
-		);
+		IBuffer buffer = this.createBuffer("P/x/y/A.txt",
+				"package x.y;\n" + "public class A {\n" + "}");
 		try {
 			// insert after the \n of package statement
 			buffer.replace(13, 0, "/* class comment */\n");
 			assertBufferEvent(13, 0, "/* class comment */\n");
-			assertSourceEquals(
-				"unexpected buffer contents",
-				"package x.y;\n" +
-				"/* class comment */\n" +
-				"public class A {\n" +
-				"}",
-				buffer.getContents()
-			);
-			assertTrue("should have unsaved changes", buffer.hasUnsavedChanges());
+			assertSourceEquals("unexpected buffer contents", "package x.y;\n"
+					+ "/* class comment */\n" + "public class A {\n" + "}",
+					buffer.getContents());
+			assertTrue("should have unsaved changes",
+					buffer.hasUnsavedChanges());
 		} finally {
 			this.deleteBuffer(buffer);
 		}
 	}
+
 	/**
 	 * Tests inserting text at the end of a buffer.
 	 */
 	public void testInsertEnd() throws CoreException {
-		IBuffer buffer = this.createBuffer(
-			"P/x/y/A.txt",
-			"package x.y;\n" +
-			"public class A {\n" +
-			"}"
-		);
+		IBuffer buffer = this.createBuffer("P/x/y/A.txt",
+				"package x.y;\n" + "public class A {\n" + "}");
 		try {
 			// insert after the \n of package statement
 			int end = buffer.getLength();
 			buffer.replace(end, 0, "\nclass B {}");
 			assertBufferEvent(end, 0, "\nclass B {}");
 			assertSourceEquals(
-				"unexpected buffer contents",
-				"package x.y;\n" +
-				"public class A {\n" +
-				"}\n" +
-				"class B {}",
-				buffer.getContents()
-			);
-			assertTrue("should have unsaved changes", buffer.hasUnsavedChanges());
+					"unexpected buffer contents", "package x.y;\n"
+							+ "public class A {\n" + "}\n" + "class B {}",
+					buffer.getContents());
+			assertTrue("should have unsaved changes",
+					buffer.hasUnsavedChanges());
 		} finally {
 			this.deleteBuffer(buffer);
 		}
diff --git a/core/tests/org.eclipse.dltk.core.tests/src/org/eclipse/dltk/core/tests/model/CompletionTestsRequestor.java b/core/tests/org.eclipse.dltk.core.tests/src/org/eclipse/dltk/core/tests/model/CompletionTestsRequestor.java
index 29bf5f6..2cefb75 100644
--- a/core/tests/org.eclipse.dltk.core.tests/src/org/eclipse/dltk/core/tests/model/CompletionTestsRequestor.java
+++ b/core/tests/org.eclipse.dltk.core.tests/src/org/eclipse/dltk/core/tests/model/CompletionTestsRequestor.java
@@ -1,11 +1,10 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
+ * Copyright (c) 2000, 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
  *
- 
  *******************************************************************************/
 package org.eclipse.dltk.core.tests.model;
 
@@ -17,11 +16,11 @@
 import org.junit.Assert;
 
 public class CompletionTestsRequestor extends CompletionRequestor {
-	private Vector<String> fElements = new Vector<String>();
-	private Vector<String> fCompletions = new Vector<String>();
-	private Vector<String> fRelevances = new Vector<String>();
-	private Vector<String> fCompletionStart = new Vector<String>();
-	private Vector<String> fCompletionEnd = new Vector<String>();
+	private Vector<String> fElements = new Vector<>();
+	private Vector<String> fCompletions = new Vector<>();
+	private Vector<String> fRelevances = new Vector<>();
+	private Vector<String> fCompletionStart = new Vector<>();
+	private Vector<String> fCompletionEnd = new Vector<>();
 
 	public boolean fDebug = false;
 
diff --git a/core/tests/org.eclipse.dltk.core.tests/src/org/eclipse/dltk/core/tests/model/ExternalFragmentTests.java b/core/tests/org.eclipse.dltk.core.tests/src/org/eclipse/dltk/core/tests/model/ExternalFragmentTests.java
index f00cf5e..113fda1 100644
--- a/core/tests/org.eclipse.dltk.core.tests/src/org/eclipse/dltk/core/tests/model/ExternalFragmentTests.java
+++ b/core/tests/org.eclipse.dltk.core.tests/src/org/eclipse/dltk/core/tests/model/ExternalFragmentTests.java
@@ -172,7 +172,7 @@
 
 	public static class FolderHandle extends AbstractFileHandle {
 
-		private final Collection<String> children = new ArrayList<String>();
+		private final Collection<String> children = new ArrayList<>();
 
 		public FolderHandle(IEnvironment environment, IPath path) {
 			super(environment, path);
@@ -184,10 +184,10 @@
 		public boolean isDirectory() {
 			return true;
 		}
-		
+
 		@Override
 		public IFileHandle[] getChildren() {
-			ArrayList<IFileHandle> rv = new ArrayList<IFileHandle>();
+			ArrayList<IFileHandle> rv = new ArrayList<>();
 			for (String name : children)
 				rv.add(getEnvironment().getFile(getPath().append(name)));
 			return rv.toArray(new IFileHandle[0]);
@@ -202,7 +202,6 @@
 			children.add(name);
 		}
 
-
 	}
 
 	public static class FileHandle extends AbstractFileHandle {
@@ -230,8 +229,8 @@
 		private final byte[] content;
 		private final Charset charset;
 
-		public FileHandle(IEnvironment environment, IPath path,
-				byte[] content, Charset charset) {
+		public FileHandle(IEnvironment environment, IPath path, byte[] content,
+				Charset charset) {
 			super(environment, path);
 			this.content = content;
 			this.charset = charset;
@@ -254,9 +253,8 @@
 
 	}
 
-
 	class Environment extends PlatformObject implements IEnvironment {
-		private final Map<IPath, IFileHandle> files = new HashMap<IPath, IFileHandle>();
+		private final Map<IPath, IFileHandle> files = new HashMap<>();
 
 		@Override
 		public boolean isLocal() {
@@ -370,13 +368,12 @@
 		Environment env = new Environment();
 		Path path = new Path("X.txt");
 		env.put(new FileHandle(env, path, content.getBytes(charset), charset));
-		Closeable environmentUnsetter = EnvironmentProvider.setEnvironment(env);
-		try {
+
+		try (Closeable environmentUnsetter = EnvironmentProvider
+				.setEnvironment(env)) {
 			ISourceModule module = getSourceModule(PRJ_NAME, "testEnv/:/",
 					path);
 			Assert.assertEquals(content, module.getSource());
-		} finally {
-			environmentUnsetter.close();
 		}
 	}
 }
diff --git a/core/tests/org.eclipse.dltk.core.tests/src/org/eclipse/dltk/core/tests/model/SuiteOfTestCases.java b/core/tests/org.eclipse.dltk.core.tests/src/org/eclipse/dltk/core/tests/model/SuiteOfTestCases.java
index c32f582..84b8d3c 100644
--- a/core/tests/org.eclipse.dltk.core.tests/src/org/eclipse/dltk/core/tests/model/SuiteOfTestCases.java
+++ b/core/tests/org.eclipse.dltk.core.tests/src/org/eclipse/dltk/core/tests/model/SuiteOfTestCases.java
@@ -1,11 +1,10 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
+ * Copyright (c) 2000, 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
  *
- 
  *******************************************************************************/
 package org.eclipse.dltk.core.tests.model;
 
@@ -16,6 +15,8 @@
 import java.util.Map;
 import java.util.concurrent.atomic.AtomicBoolean;
 
+import org.eclipse.dltk.core.tests.TestSupport;
+
 import junit.framework.AssertionFailedError;
 import junit.framework.Protectable;
 import junit.framework.Test;
@@ -24,8 +25,6 @@
 import junit.framework.TestResult;
 import junit.framework.TestSuite;
 
-import org.eclipse.dltk.core.tests.TestSupport;
-
 /**
  * A test case class that can be set up (using the setUpSuite() method) and tore
  * down (using the teardDownSuite() method) once for all test cases of this
@@ -51,7 +50,7 @@
 		/**
 		 * Creates a new suite on the given class. Only the methods specified in
 		 * the second parameter and included in the suite.
-		 * 
+		 *
 		 * @param theClass
 		 * @param methodNames
 		 */
@@ -119,18 +118,15 @@
 
 		@Override
 		public void run(final TestResult result) {
-			Protectable p = new Protectable() {
-				@Override
-				public void protect() throws Exception {
-					try {
-						// run suite (first test run will setup the suite)
-						superRun(result);
-					} finally {
-						// tear down the suite
-						if (Suite.this.currentTestCase != null) {
-							// protect against empty test suite
-							Suite.this.currentTestCase.tearDownSuite();
-						}
+			Protectable p = () -> {
+				try {
+					// run suite (first test run will setup the suite)
+					superRun(result);
+				} finally {
+					// tear down the suite
+					if (Suite.this.currentTestCase != null) {
+						// protect against empty test suite
+						Suite.this.currentTestCase.tearDownSuite();
 					}
 				}
 			};
@@ -176,7 +172,7 @@
 	}
 
 	Suite parentSuite;
-	private final static Map<String, Suite> initializedSuites = new HashMap<String, Suite>();
+	private final static Map<String, Suite> initializedSuites = new HashMap<>();
 
 	public SuiteOfTestCases(String name) {
 		super(name);
@@ -197,11 +193,11 @@
 	/**
 	 * Convenience method for subclasses of {@link SuiteOfTestCases}, identical
 	 * to
-	 * 
+	 *
 	 * <pre>
 	 * TestSupport.notYetImplemented(this);
 	 * </pre>
-	 * 
+	 *
 	 * @see TestSupport#notYetImplemented(junit.framework.TestCase)
 	 * @return <false> when not itself already in the call stack
 	 */
@@ -242,12 +238,7 @@
 					}
 				};
 				result.addListener(listener);
-				result.runProtected(this, new Protectable() {
-					@Override
-					public void protect() throws Throwable {
-						setUpSuite();
-					}
-				});
+				result.runProtected(this, () -> setUpSuite());
 				result.removeListener(listener);
 				if (errors.get()) {
 					return;
diff --git a/core/tests/org.eclipse.dltk.core.tests/src/org/eclipse/dltk/core/tests/model/TestBuffer.java b/core/tests/org.eclipse.dltk.core.tests/src/org/eclipse/dltk/core/tests/model/TestBuffer.java
index 6a9b073..8aed0f8 100644
--- a/core/tests/org.eclipse.dltk.core.tests/src/org/eclipse/dltk/core/tests/model/TestBuffer.java
+++ b/core/tests/org.eclipse.dltk.core.tests/src/org/eclipse/dltk/core/tests/model/TestBuffer.java
@@ -1,11 +1,10 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
+ * Copyright (c) 2000, 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
  *
- 
  *******************************************************************************/
 package org.eclipse.dltk.core.tests.model;
 
@@ -34,7 +33,7 @@
 	@Override
 	public void addBufferChangedListener(IBufferChangedListener listener) {
 		if (this.changeListeners == null) {
-			this.changeListeners = new ArrayList<IBufferChangedListener>(5);
+			this.changeListeners = new ArrayList<>(5);
 		}
 		if (!this.changeListeners.contains(listener)) {
 			this.changeListeners.add(listener);
@@ -58,8 +57,7 @@
 			BufferChangedEvent event = null;
 			event = new BufferChangedEvent(this, 0, 0, null);
 			for (int i = 0, size = this.changeListeners.size(); i < size; ++i) {
-				IBufferChangedListener listener = (IBufferChangedListener) this.changeListeners
-						.get(i);
+				IBufferChangedListener listener = this.changeListeners.get(i);
 				listener.bufferChanged(event);
 			}
 			this.changeListeners = null;
diff --git a/core/tests/org.eclipse.dltk.core.tests/src/org/eclipse/dltk/core/tests/model/TestLanguageToolkit.java b/core/tests/org.eclipse.dltk.core.tests/src/org/eclipse/dltk/core/tests/model/TestLanguageToolkit.java
index 63a7161..29835e4 100644
--- a/core/tests/org.eclipse.dltk.core.tests/src/org/eclipse/dltk/core/tests/model/TestLanguageToolkit.java
+++ b/core/tests/org.eclipse.dltk.core.tests/src/org/eclipse/dltk/core/tests/model/TestLanguageToolkit.java
@@ -1,11 +1,10 @@
 /*******************************************************************************
- * Copyright (c) 2005, 2007 IBM Corporation and others.
+ * Copyright (c) 2005, 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
  *
- 
  *******************************************************************************/
 package org.eclipse.dltk.core.tests.model;
 
@@ -20,16 +19,16 @@
 import org.eclipse.dltk.internal.core.util.Messages;
 import org.eclipse.osgi.util.NLS;
 
-public class TestLanguageToolkit extends AbstractLanguageToolkit implements
-		IDLTKLanguageToolkit {
+public class TestLanguageToolkit extends AbstractLanguageToolkit {
 	private static TestLanguageToolkit toolkit = new TestLanguageToolkit();
 
 	private IStatus validateSourceModule(String name) {
 		if (isScriptLikeFileName(name)) {
 			return IModelStatus.VERIFIED_OK;
 		}
-		return new Status(IStatus.ERROR, "TEST", -1, NLS.bind(
-				Messages.convention_unit_notScriptName, "txt", "Test"), null);
+		return new Status(IStatus.ERROR, "TEST", -1,
+				NLS.bind(Messages.convention_unit_notScriptName, "txt", "Test"),
+				null);
 	}
 
 	@Override
diff --git a/core/tests/org.eclipse.dltk.core.tests/src/org/eclipse/dltk/core/tests/model/TestModelProvider.java b/core/tests/org.eclipse.dltk.core.tests/src/org/eclipse/dltk/core/tests/model/TestModelProvider.java
index 0c2c5b9..a101dc5 100644
--- a/core/tests/org.eclipse.dltk.core.tests/src/org/eclipse/dltk/core/tests/model/TestModelProvider.java
+++ b/core/tests/org.eclipse.dltk.core.tests/src/org/eclipse/dltk/core/tests/model/TestModelProvider.java
@@ -4,7 +4,7 @@
  * 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  
+ * http://www.eclipse.org/legal/epl-v10.html
  *
  * Contributors:
  *     xored software, Inc. - initial API and Implementation (Andrei Sobolev)
@@ -26,15 +26,17 @@
 	}
 
 	@Override
-	public void provideModelChanges(IModelElement parentElement, List<IModelElement> children) {
+	public void provideModelChanges(IModelElement parentElement,
+			List<IModelElement> children) {
 		IScriptProject project = parentElement.getScriptProject();
 		if (!"ModelMembersq".equals(project.getElementName())) {
 			return;
 		}
 		switch (parentElement.getElementType()) {
 		case IModelElement.PROJECT_FRAGMENT:
-			List<TestFolder> addon = new ArrayList<TestFolder>();
-			for (Iterator<IModelElement> iterator = children.iterator(); iterator.hasNext();) {
+			List<TestFolder> addon = new ArrayList<>();
+			for (Iterator<IModelElement> iterator = children
+					.iterator(); iterator.hasNext();) {
 				IModelElement el = iterator.next();
 				if (el.getElementType() == IModelElement.SCRIPT_FOLDER) {
 					addon.add(new TestFolder((ModelElement) parentElement,
diff --git a/core/tests/org.eclipse.dltk.core.tests/src/org/eclipse/dltk/core/tests/model/TestSearchResults.java b/core/tests/org.eclipse.dltk.core.tests/src/org/eclipse/dltk/core/tests/model/TestSearchResults.java
index 96ddfea..29d6d8b 100644
--- a/core/tests/org.eclipse.dltk.core.tests/src/org/eclipse/dltk/core/tests/model/TestSearchResults.java
+++ b/core/tests/org.eclipse.dltk.core.tests/src/org/eclipse/dltk/core/tests/model/TestSearchResults.java
@@ -31,7 +31,7 @@
 		matches.add(match);
 	}
 
-	private List<SearchMatch> matches = new ArrayList<SearchMatch>();
+	private List<SearchMatch> matches = new ArrayList<>();
 
 	public int size() {
 		return matches.size();
@@ -47,8 +47,8 @@
 
 	public void assertSourceModule(String name) {
 		if (locate(ISourceModule.class, name, true) == null) {
-			Assert.fail("Not found " + name + ":"
-					+ ISourceModule.class.getName());
+			Assert.fail(
+					"Not found " + name + ":" + ISourceModule.class.getName());
 		}
 	}
 
@@ -78,8 +78,8 @@
 			Class<? extends IModelElement> modelElementClass,
 			String modelElementName, boolean allowAncestorCheck) {
 		Assert.assertNotNull(modelElementClass);
-		Assert.assertTrue(IModelElement.class
-				.isAssignableFrom(modelElementClass));
+		Assert.assertTrue(
+				IModelElement.class.isAssignableFrom(modelElementClass));
 		for (final SearchMatch match : matches) {
 			final IModelElement element;
 			if (modelElementClass.isInstance(match.getElement())) {
diff --git a/core/tests/org.eclipse.dltk.core.tests/src/org/eclipse/dltk/core/tests/model/TypeHierarchyTests.java b/core/tests/org.eclipse.dltk.core.tests/src/org/eclipse/dltk/core/tests/model/TypeHierarchyTests.java
index 0807a52..37c12e3 100644
--- a/core/tests/org.eclipse.dltk.core.tests/src/org/eclipse/dltk/core/tests/model/TypeHierarchyTests.java
+++ b/core/tests/org.eclipse.dltk.core.tests/src/org/eclipse/dltk/core/tests/model/TypeHierarchyTests.java
@@ -26,7 +26,8 @@
 
 public class TypeHierarchyTests extends ModifyingResourceTests {
 	private static boolean DEBUG = false;
-	private static final String[] TEST_NATURE = new String[] { "org.eclipse.dltk.core.tests.testnature" };
+	private static final String[] TEST_NATURE = new String[] {
+			"org.eclipse.dltk.core.tests.testnature" };
 
 	private ISourceModule cu = null;
 	private ISourceModule copy = null;
@@ -38,8 +39,8 @@
 		}
 	}
 
-	private final Set<IType> expectedExploredClasses = new HashSet<IType>();
-	private final Set<IType> expectedCyclicClasses = new HashSet<IType>();
+	private final Set<IType> expectedExploredClasses = new HashSet<>();
+	private final Set<IType> expectedCyclicClasses = new HashSet<>();
 	private final FakeTypeHierarchy typeHierarchy = new FakeTypeHierarchy();
 	private boolean useCacheSuperclass = true;
 
@@ -60,9 +61,7 @@
 		useCacheSuperclass = true;
 		try {
 
-			this.createScriptProject("P", TEST_NATURE, new String[] {
-					"src"
-			} );
+			this.createScriptProject("P", TEST_NATURE, new String[] { "src" });
 			this.createFolder("P/src/x/y");
 			this.createFile("P/src/x/y/Z.txt", "");
 			this.cu = this.getSourceModule("P/src/x/y/Z.txt");
@@ -111,8 +110,9 @@
 		}
 	}
 
-	private Map<String, SourceType> createFakeTypes(char begin, char end, ModelElement modelElement) {
-		Map<String, SourceType> types = new HashMap<String, SourceType>();
+	private Map<String, SourceType> createFakeTypes(char begin, char end,
+			ModelElement modelElement) {
+		Map<String, SourceType> types = new HashMap<>();
 		for (char i = begin; i <= end; i++) {
 			String name = Character.toString(i);
 			types.put(name, new SourceType(modelElement, name));
@@ -120,8 +120,8 @@
 		return types;
 	}
 
-	private void populate(SourceType parent, boolean isParentOnCyclicPath, SourceType child,
-			boolean isChildOnCyclicPath) {
+	private void populate(SourceType parent, boolean isParentOnCyclicPath,
+			SourceType child, boolean isChildOnCyclicPath) {
 		assertNotNull(parent);
 		assertNotNull(child);
 
@@ -147,7 +147,7 @@
 	}
 
 	private void print(Set<IType> classPaths) {
-		Set<IType> sortedClassPaths = new TreeSet<IType>((arg0, arg1) -> {
+		Set<IType> sortedClassPaths = new TreeSet<>((arg0, arg1) -> {
 			if (arg0 == arg1 || arg0.equals(arg1)) {
 				return 0;
 			}
@@ -169,54 +169,70 @@
 		System.out.println();
 	}
 
-	private void exploreAllGraphThroughSubclasses(SourceType type, boolean doReset) {
+	private void exploreAllGraphThroughSubclasses(SourceType type,
+			boolean doReset) {
 		assertNotNull(type);
 		if (doReset) {
 			typeHierarchy.resetClassPaths();
 		}
 		typeHierarchy.getSubclasses(type);
 		printCurrentState();
-		assertEquals(typeHierarchy.getExploredClasses(), expectedExploredClasses);
+		assertEquals(typeHierarchy.getExploredClasses(),
+				expectedExploredClasses);
 		assertEquals(typeHierarchy.getCyclicClasses(), expectedCyclicClasses);
 	}
 
-	private void exploreAllGraphThroughSuperclasses(SourceType type, boolean doReset) {
+	private void exploreAllGraphThroughSuperclasses(SourceType type,
+			boolean doReset) {
 		assertNotNull(type);
 		if (doReset) {
 			typeHierarchy.resetClassPaths();
 		}
 		typeHierarchy.getSuperclass(type);
 		printCurrentState();
-		assertEquals(typeHierarchy.getExploredClasses(), expectedExploredClasses);
+		assertEquals(typeHierarchy.getExploredClasses(),
+				expectedExploredClasses);
 		assertEquals(typeHierarchy.getCyclicClasses(), expectedCyclicClasses);
 	}
 
-	private void explorePartialGraphThroughSubclasses(SourceType type, boolean doReset) {
+	private void explorePartialGraphThroughSubclasses(SourceType type,
+			boolean doReset) {
 		assertNotNull(type);
 		if (doReset) {
 			typeHierarchy.resetClassPaths();
 		}
 		typeHierarchy.getSubclasses(type);
 		printCurrentState();
-		assertTrue(!expectedExploredClasses.contains(type) || !typeHierarchy.getExploredClasses().isEmpty());
-		assertTrue(typeHierarchy.getExploredClasses().containsAll(typeHierarchy.getCyclicClasses()));
-		assertTrue(expectedExploredClasses.containsAll(typeHierarchy.getExploredClasses()));
-		assertTrue(expectedExploredClasses.containsAll(typeHierarchy.getCyclicClasses()));
-		assertTrue(expectedCyclicClasses.containsAll(typeHierarchy.getCyclicClasses()));
+		assertTrue(!expectedExploredClasses.contains(type)
+				|| !typeHierarchy.getExploredClasses().isEmpty());
+		assertTrue(typeHierarchy.getExploredClasses()
+				.containsAll(typeHierarchy.getCyclicClasses()));
+		assertTrue(expectedExploredClasses
+				.containsAll(typeHierarchy.getExploredClasses()));
+		assertTrue(expectedExploredClasses
+				.containsAll(typeHierarchy.getCyclicClasses()));
+		assertTrue(expectedCyclicClasses
+				.containsAll(typeHierarchy.getCyclicClasses()));
 	}
 
-	private void explorePartialGraphThroughSuperclasses(SourceType type, boolean doReset) {
+	private void explorePartialGraphThroughSuperclasses(SourceType type,
+			boolean doReset) {
 		assertNotNull(type);
 		if (doReset) {
 			typeHierarchy.resetClassPaths();
 		}
 		typeHierarchy.getSuperclass(type);
 		printCurrentState();
-		assertTrue(!expectedExploredClasses.contains(type) || !typeHierarchy.getExploredClasses().isEmpty());
-		assertTrue(typeHierarchy.getExploredClasses().containsAll(typeHierarchy.getCyclicClasses()));
-		assertTrue(expectedExploredClasses.containsAll(typeHierarchy.getExploredClasses()));
-		assertTrue(expectedExploredClasses.containsAll(typeHierarchy.getCyclicClasses()));
-		assertTrue(expectedCyclicClasses.containsAll(typeHierarchy.getCyclicClasses()));
+		assertTrue(!expectedExploredClasses.contains(type)
+				|| !typeHierarchy.getExploredClasses().isEmpty());
+		assertTrue(typeHierarchy.getExploredClasses()
+				.containsAll(typeHierarchy.getCyclicClasses()));
+		assertTrue(expectedExploredClasses
+				.containsAll(typeHierarchy.getExploredClasses()));
+		assertTrue(expectedExploredClasses
+				.containsAll(typeHierarchy.getCyclicClasses()));
+		assertTrue(expectedCyclicClasses
+				.containsAll(typeHierarchy.getCyclicClasses()));
 	}
 
 	public void testCyclicHierarchy001() throws Exception {
@@ -225,38 +241,45 @@
 		assertTrue(p instanceof ModelElement);
 
 		typeHierarchy.resetClassPaths();
-		Map<String, SourceType> types = createFakeTypes('A', 'U', (ModelElement) p);
+		Map<String, SourceType> types = createFakeTypes('A', 'U',
+				(ModelElement) p);
 
-		//* Class hierarchy representation, "(c)" means that the relevant class in on a cyclic path
-		//*
-		//*                                                                      +------+
-		//*                                                                      |  L   |
-		//*                                                                      +------+
-		//*                                                                        ^
-		//*                                                                        |                      +-------------------------------------+
-		//*                                                                        |                      v                                     |
-		//*     +------+     +------+     +------+     +------+     +------+     +------+     +---+     +------+     +---+     +---+     +---+  |
-		//*  +> | B(c) | <-- | A(c) | --> | H(c) | --> |      | --> | J(c) | --> | K(c) | --> | O | --> | P(c) | --> | R | --> | S | --> | U |  |
-		//*  |  +------+     +------+     +------+     |      |     +------+     +------+     +---+     +------+     +---+     +---+     +---+  |
-		//*  |    |            ^                       |      |                    |                      |            |                   ^    |
-		//*  |    |            +---------------------- | I(c) | <------------------+                      |            |                   |    |
-		//*  |    v                                    |      |                                           v            v                   |    |
-		//*  |  +------+                               |      |                                         +------+     +---+                 |    |
-		//*  |  | C(c) | <------------------+       +- |      | --------------+                         | Q(c) |     | T | ----------------+    |
-		//*  |  +------+                    |       |  +------+               |                         +------+     +---+                      |
-		//*  |    |                         |       |                         |                           |                                     |
-		//*  |    |                         |       |    +------------+       |                           |                                     |
-		//*  |    v                         |       |    v            |       |                           |                                     |
-		//*  |  +------+     +------+     +------+  |  +------+     +------+  |                           |                                     |
-		//*  +- | D(c) | --> | E(c) | --> | F(c) |  +> | M(c) | --> | N(c) |  |                           +-------------------------------------+
-		//*     +------+     +------+     +------+     +------+     +------+  |
-		//*                    |            ^                                 |
-		//*                    |            +---------------------------------+
-		//*                    v
-		//*                  +------+
-		//*                  |  G   |
-		//*                  +------+
-		//*
+		// * Class hierarchy representation, "(c)" means that the relevant class
+		// in on a cyclic path
+		// *
+		// * +------+
+		// * | L |
+		// * +------+
+		// * ^
+		// * | +-------------------------------------+
+		// * | v |
+		// * +------+ +------+ +------+ +------+ +------+ +------+ +---+
+		// +------+ +---+ +---+ +---+ |
+		// * +> | B(c) | <-- | A(c) | --> | H(c) | --> | | --> | J(c) | --> |
+		// K(c) | --> | O | --> | P(c) | --> | R | --> | S | --> | U | |
+		// * | +------+ +------+ +------+ | | +------+ +------+ +---+ +------+
+		// +---+ +---+ +---+ |
+		// * | | ^ | | | | | ^ |
+		// * | | +---------------------- | I(c) | <------------------+ | | | |
+		// * | v | | v v | |
+		// * | +------+ | | +------+ +---+ | |
+		// * | | C(c) | <------------------+ +- | | --------------+ | Q(c) | | T
+		// | ----------------+ |
+		// * | +------+ | | +------+ | +------+ +---+ |
+		// * | | | | | | |
+		// * | | | | +------------+ | | |
+		// * | v | | v | | | |
+		// * | +------+ +------+ +------+ | +------+ +------+ | | |
+		// * +- | D(c) | --> | E(c) | --> | F(c) | +> | M(c) | --> | N(c) | |
+		// +-------------------------------------+
+		// * +------+ +------+ +------+ +------+ +------+ |
+		// * | ^ |
+		// * | +---------------------------------+
+		// * v
+		// * +------+
+		// * | G |
+		// * +------+
+		// *
 		populate(types.get("A"), true, types.get("B"), true);
 		populate(types.get("B"), true, types.get("C"), true);
 		populate(types.get("C"), true, types.get("D"), true);
@@ -317,20 +340,22 @@
 		assertTrue(p instanceof ModelElement);
 
 		typeHierarchy.resetClassPaths();
-		Map<String, SourceType> types = createFakeTypes('A', 'Z', (ModelElement) p);
+		Map<String, SourceType> types = createFakeTypes('A', 'Z',
+				(ModelElement) p);
 
-		//* Class hierarchy representation, "(c)" means that the relevant class in on a cyclic path
-		//*
-		//*     +------+     +---+     +---+
-		//*  +> | W(c) | --> | V | --> | H |
-		//*  |  +------+     +---+     +---+
-		//*  |    |
-		//*  |    |
-		//*  |    v
-		//*  |  +------+
-		//*  +- | X(c) |
-		//*     +------+
-		//*
+		// * Class hierarchy representation, "(c)" means that the relevant class
+		// in on a cyclic path
+		// *
+		// * +------+ +---+ +---+
+		// * +> | W(c) | --> | V | --> | H |
+		// * | +------+ +---+ +---+
+		// * | |
+		// * | |
+		// * | v
+		// * | +------+
+		// * +- | X(c) |
+		// * +------+
+		// *
 		populate(types.get("W"), true, types.get("X"), true);
 		populate(types.get("W"), true, types.get("V"), false);
 		populate(types.get("V"), false, types.get("H"), false);
@@ -359,26 +384,28 @@
 		assertTrue(p instanceof ModelElement);
 
 		typeHierarchy.resetClassPaths();
-		Map<String, SourceType> types = createFakeTypes('A', 'F', (ModelElement) p);
+		Map<String, SourceType> types = createFakeTypes('A', 'F',
+				(ModelElement) p);
 
-		//* Class hierarchy representation, "(c)" means that the relevant class in on a cyclic path
-		//*
-		//*                     +---+
-		//*                     | F |
-		//*                     +---+
-		//*                       ^
-		//*                       |
-		//*                       |
-		//* +---+     +---+     +---+     +---+
-		//* | A | --> | B | --> | D | --> | E |
-		//* +---+     +---+     +---+     +---+
-		//*   |                   ^
-		//*   |                   |
-		//*   v                   |
-		//* +---+                 |
-		//* | C | ----------------+
-		//* +---+
-		//*
+		// * Class hierarchy representation, "(c)" means that the relevant class
+		// in on a cyclic path
+		// *
+		// * +---+
+		// * | F |
+		// * +---+
+		// * ^
+		// * |
+		// * |
+		// * +---+ +---+ +---+ +---+
+		// * | A | --> | B | --> | D | --> | E |
+		// * +---+ +---+ +---+ +---+
+		// * | ^
+		// * | |
+		// * v |
+		// * +---+ |
+		// * | C | ----------------+
+		// * +---+
+		// *
 		populate(types.get("A"), false, types.get("B"), false);
 		populate(types.get("A"), false, types.get("C"), false);
 		populate(types.get("B"), false, types.get("D"), false);
@@ -435,24 +462,27 @@
 		assertTrue(p instanceof ModelElement);
 
 		typeHierarchy.resetClassPaths();
-		Map<String, SourceType> types = createFakeTypes('A', 'H', (ModelElement) p);
+		Map<String, SourceType> types = createFakeTypes('A', 'H',
+				(ModelElement) p);
 
-		//* Class hierarchy representation, "(c)" means that the relevant class in on a cyclic path
-		//*
-		//*                +---------------------------------------------------+
-		//*                v                                                   |
-		//* +------+     +------+     +------+     +------+     +------+     +------+
-		//* | A(c) | --> | B(c) | --> | C(c) | --> | G(c) | --> | H(c) | --> | F(c) |
-		//* +------+     +------+     +------+     +------+     +------+     +------+
-		//*   ^                         |
-		//*   |                         |
-		//*   |                         v
-		//*   |                       +------+     +------+
-		//*   |                       | D(c) | --> | E(c) |
-		//*   |                       +------+     +------+
-		//*   |                                      |
-		//*   +--------------------------------------+
-		//*
+		// * Class hierarchy representation, "(c)" means that the relevant class
+		// in on a cyclic path
+		// *
+		// * +---------------------------------------------------+
+		// * v |
+		// * +------+ +------+ +------+ +------+ +------+ +------+
+		// * | A(c) | --> | B(c) | --> | C(c) | --> | G(c) | --> | H(c) | --> |
+		// F(c) |
+		// * +------+ +------+ +------+ +------+ +------+ +------+
+		// * ^ |
+		// * | |
+		// * | v
+		// * | +------+ +------+
+		// * | | D(c) | --> | E(c) |
+		// * | +------+ +------+
+		// * | |
+		// * +--------------------------------------+
+		// *
 		populate(types.get("A"), true, types.get("B"), true);
 		populate(types.get("B"), true, types.get("C"), true);
 		populate(types.get("C"), true, types.get("D"), true);
diff --git a/core/tests/org.eclipse.dltk.core.tests/src/org/eclipse/dltk/core/tests/search/Bug387751Test.java b/core/tests/org.eclipse.dltk.core.tests/src/org/eclipse/dltk/core/tests/search/Bug387751Test.java
index ce3775c..d1ec2c1 100644
--- a/core/tests/org.eclipse.dltk.core.tests/src/org/eclipse/dltk/core/tests/search/Bug387751Test.java
+++ b/core/tests/org.eclipse.dltk.core.tests/src/org/eclipse/dltk/core/tests/search/Bug387751Test.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2012 NumberFour AG
+ * Copyright (c) 2012, 2017 NumberFour AG and others.
  *
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
@@ -27,7 +27,6 @@
 import org.eclipse.dltk.core.IBuildpathEntry;
 import org.eclipse.dltk.core.IMethod;
 import org.eclipse.dltk.core.IModelElement;
-import org.eclipse.dltk.core.IModelElementVisitor;
 import org.eclipse.dltk.core.IScriptProject;
 import org.eclipse.dltk.core.ISourceModule;
 import org.eclipse.dltk.core.IType;
@@ -96,8 +95,8 @@
 				SearchEngine.createSearchScope(project.getScriptProject()),
 				"Foo");
 		assertEquals(1, types.size());
-		assertEquals(project.getSourceModule("", "test.txt"), types.get(0)
-				.getSourceModule());
+		assertEquals(project.getSourceModule("", "test.txt"),
+				types.get(0).getSourceModule());
 	}
 
 	/**
@@ -105,8 +104,8 @@
 	 * the project
 	 */
 	@Test
-	public void searchExternalLibraryProjectScope() throws IOException,
-			CoreException {
+	public void searchExternalLibraryProjectScope()
+			throws IOException, CoreException {
 		final IFile file = project.getFile("test.txt");
 		addExternalLibraryFromFile(file, file.getName());
 		file.delete(true, null);
@@ -127,8 +126,8 @@
 	 * the external module
 	 */
 	@Test
-	public void searchExternalLibraryModuleScope() throws IOException,
-			CoreException {
+	public void searchExternalLibraryModuleScope()
+			throws IOException, CoreException {
 		final IFile file = project.getFile("test.txt");
 		addExternalLibraryFromFile(file, file.getName());
 		file.delete(true, null);
@@ -155,8 +154,8 @@
 		addExternalLibraryFromFile(file, "tests/" + file.getName());
 		file.delete(true, null);
 		addBuildpathEntry(project.getScriptProject(), DLTKCore.newLibraryEntry(
-				getFullPath(temp.getRoot()), BuildpathEntry.NO_ACCESS_RULES,
-				BuildpathEntry.NO_EXTRA_ATTRIBUTES, BuildpathEntry.INCLUDE_ALL,
+				getFullPath(temp.getRoot()), IBuildpathEntry.NO_ACCESS_RULES,
+				IBuildpathEntry.NO_EXTRA_ATTRIBUTES, BuildpathEntry.INCLUDE_ALL,
 				new IPath[] { new Path("tests/") }, false /* not exported */,
 				true));
 
@@ -172,10 +171,10 @@
 
 	private List<IType> searchAllTypeNames(final IDLTKSearchScope scope,
 			final String name) throws ModelException {
-		final List<IType> types = new ArrayList<IType>();
+		final List<IType> types = new ArrayList<>();
 		new SearchEngine((WorkingCopyOwner) null).searchAllTypeNames(null, 0,
-				name.toCharArray(), SearchPattern.R_EXACT_MATCH
-						| SearchPattern.R_CASE_SENSITIVE,
+				name.toCharArray(),
+				SearchPattern.R_EXACT_MATCH | SearchPattern.R_CASE_SENSITIVE,
 				IDLTKSearchConstants.TYPE, scope, new TypeNameMatchRequestor() {
 					@Override
 					public void acceptTypeNameMatch(TypeNameMatch match) {
@@ -186,15 +185,12 @@
 	}
 
 	private List<ISourceModule> listModules() throws ModelException {
-		final List<ISourceModule> modules = new ArrayList<ISourceModule>();
-		project.getScriptProject().accept(new IModelElementVisitor() {
-			@Override
-			public boolean visit(IModelElement element) {
-				if (element instanceof ISourceModule) {
-					modules.add((ISourceModule) element);
-				}
-				return element.getElementType() < IModelElement.SOURCE_MODULE;
+		final List<ISourceModule> modules = new ArrayList<>();
+		project.getScriptProject().accept(element -> {
+			if (element instanceof ISourceModule) {
+				modules.add((ISourceModule) element);
 			}
+			return element.getElementType() < IModelElement.SOURCE_MODULE;
 		});
 		return modules;
 	}
@@ -202,19 +198,12 @@
 	private void addExternalLibraryFromFile(IFile file, String filename)
 			throws IOException, CoreException {
 		final File externalFile = new File(temp.getRoot(), filename);
-		final InputStream input = file.getContents();
-		try {
+
+		try (final InputStream input = file.getContents()) {
 			Util.copy(externalFile, input);
-		} finally {
-			try {
-				input.close();
-			} catch (IOException e) {
-				// ignore
-			}
 		}
-		addBuildpathEntry(project.getScriptProject(),
-				DLTKCore.newExtLibraryEntry(getFullPath(externalFile
-						.getParentFile())));
+		addBuildpathEntry(project.getScriptProject(), DLTKCore
+				.newExtLibraryEntry(getFullPath(externalFile.getParentFile())));
 	}
 
 	private IPath getFullPath(File file) {
@@ -224,7 +213,7 @@
 
 	private void addBuildpathEntry(IScriptProject scriptProject,
 			IBuildpathEntry entry) throws ModelException {
-		final List<IBuildpathEntry> buildpath = new ArrayList<IBuildpathEntry>();
+		final List<IBuildpathEntry> buildpath = new ArrayList<>();
 		buildpath.add(entry);
 		Collections.addAll(buildpath, scriptProject.getRawBuildpath());
 		scriptProject.setRawBuildpath(
diff --git a/core/tests/org.eclipse.dltk.core.tests/src/org/eclipse/dltk/core/tests/util/ModelTestUtils.java b/core/tests/org.eclipse.dltk.core.tests/src/org/eclipse/dltk/core/tests/util/ModelTestUtils.java
index 9eace98..af21521 100644
--- a/core/tests/org.eclipse.dltk.core.tests/src/org/eclipse/dltk/core/tests/util/ModelTestUtils.java
+++ b/core/tests/org.eclipse.dltk.core.tests/src/org/eclipse/dltk/core/tests/util/ModelTestUtils.java
@@ -1,11 +1,10 @@
 /*******************************************************************************
- * Copyright (c) 2005, 2007 IBM Corporation and others.
+ * Copyright (c) 2005, 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
  *
- 
  *******************************************************************************/
 package org.eclipse.dltk.core.tests.util;
 
@@ -20,8 +19,6 @@
 import java.util.zip.ZipEntry;
 import java.util.zip.ZipInputStream;
 
-import junit.framework.TestCase;
-
 import org.eclipse.core.resources.IFile;
 import org.eclipse.core.resources.IFolder;
 import org.eclipse.core.resources.IProject;
@@ -36,18 +33,18 @@
 import org.eclipse.dltk.core.IType;
 import org.eclipse.dltk.core.ModelException;
 
+import junit.framework.TestCase;
 
+public class ModelTestUtils {
 
-public class ModelTestUtils
-{
-
-	public static void assertParameterNames( IMethod method, String[] names ) throws Exception {
+	public static void assertParameterNames(IMethod method, String[] names)
+			throws Exception {
 		String[] params = method.getParameterNames();
-		TestCase.assertNotNull( params );
+		TestCase.assertNotNull(params);
 		int index = 0;
-		for( int i = 0; i < params.length; ++i ) {		
+		for (int i = 0; i < params.length; ++i) {
 			TestCase.assertNotNull(params[i]);
-			TestCase.assertEquals( params[i],  names[index] );
+			TestCase.assertEquals(params[i], names[index]);
 			index++;
 		}
 	}
@@ -55,36 +52,35 @@
 	/**
 	 * Used to count classes, field and methods in collection. throws assert
 	 * expression if not equal to specified counts.
-	 * 
+	 *
 	 * @param moduleChildren
 	 * @param classCountNeed
 	 * @param fieldCountNeed
 	 * @param methodCountNeed
 	 * @throws Exception
 	 */
-	public static void counterAssert( IModelElement[] children, int classCountNeed, int fieldCountNeed, int methodCountNeed)
-			throws Exception
-	{
+	public static void counterAssert(IModelElement[] children,
+			int classCountNeed, int fieldCountNeed, int methodCountNeed)
+			throws Exception {
 		int classCount = 0;
 		int fieldCount = 0;
 		int methodCount = 0;
-		
+
 		IModelElement parent = getElementsParent(children);
-		if(parent==null){
-			TestCase.assertTrue("Can't get children's parent",false);
+		if (parent == null) {
+			TestCase.assertTrue("Can't get children's parent", false);
 		}
-		
-		Collection<IModelElement> classes = new ArrayList<IModelElement>(1);
-		Collection<IModelElement> methods = new ArrayList<IModelElement>(1);
-		Collection<IModelElement> fields = new ArrayList<IModelElement>(1);
-		
-		getElementChildren(parent,classes,methods,fields);
-	
+
+		Collection<IModelElement> classes = new ArrayList<>(1);
+		Collection<IModelElement> methods = new ArrayList<>(1);
+		Collection<IModelElement> fields = new ArrayList<>(1);
+
+		getElementChildren(parent, classes, methods, fields);
+
 		classCount = classes.size();
 		methodCount = methods.size();
 		fieldCount = fields.size();
-		
-		
+
 		TestCase.assertEquals(classCountNeed, classCount);
 		TestCase.assertEquals(fieldCountNeed, fieldCount);
 		TestCase.assertEquals(methodCountNeed, methodCount);
@@ -92,36 +88,36 @@
 
 	/**
 	 * Assert check and return filed by name.
-	 * 
+	 *
 	 * @param elements
 	 * @param name
 	 * @return
 	 */
-	
-	public static IField getAssertField( IModelElement[] elements, String name) throws Exception
-	{
-	
+
+	public static IField getAssertField(IModelElement[] elements, String name)
+			throws Exception {
+
 		IModelElement parent = getElementsParent(elements);
-		if(parent==null){
-			TestCase.assertTrue("Can't get children's parent",false);
+		if (parent == null) {
+			TestCase.assertTrue("Can't get children's parent", false);
 		}
-		
-		Collection<IModelElement> classes = new ArrayList<IModelElement>(1);
-		Collection<IModelElement> methods = new ArrayList<IModelElement>(1);
-		Collection<IModelElement> fields = new ArrayList<IModelElement>(1);
-		
-		getElementChildren(parent,classes,methods,fields);
-		
+
+		Collection<IModelElement> classes = new ArrayList<>(1);
+		Collection<IModelElement> methods = new ArrayList<>(1);
+		Collection<IModelElement> fields = new ArrayList<>(1);
+
+		getElementChildren(parent, classes, methods, fields);
+
 		Iterator<IModelElement> i = fields.iterator();
-		while( i.hasNext() ) {
-			IModelElement element = (IModelElement)i.next();
-			
+		while (i.hasNext()) {
+			IModelElement element = i.next();
+
 			IField field = (IField) element;
 			TestCase.assertNotNull(field);
-			if( field.getElementName().equals(name) ) {
+			if (field.getElementName().equals(name)) {
 				return field;
 			}
-			
+
 		}
 		TestCase.assertEquals("Field not exist", "", name);
 		return null;
@@ -131,31 +127,30 @@
 	 * Assert check and return method by name. Also checks for arguments count
 	 * to determine method.
 	 */
-	
-	public static IMethod getAssertMethod( IModelElement[] elements, String name, int argCount) throws Exception
-	{
-		IModelElement parent = getElementsParent(elements);
-		if(parent==null){
-			TestCase.assertTrue("Can't get children's parent",false);
-		}
-		
-		Collection<IModelElement> classes = new ArrayList<IModelElement>(1);
-		Collection<IModelElement> methods = new ArrayList<IModelElement>(1);
-		Collection<IModelElement> fields = new ArrayList<IModelElement>(1);
-		
-		getElementChildren(parent,classes,methods,fields);
-		
-		Iterator<IModelElement> i = methods.iterator();
-		while( i.hasNext() ) {
-			IModelElement element = (IModelElement)i.next();
 
-			
+	public static IMethod getAssertMethod(IModelElement[] elements, String name,
+			int argCount) throws Exception {
+		IModelElement parent = getElementsParent(elements);
+		if (parent == null) {
+			TestCase.assertTrue("Can't get children's parent", false);
+		}
+
+		Collection<IModelElement> classes = new ArrayList<>(1);
+		Collection<IModelElement> methods = new ArrayList<>(1);
+		Collection<IModelElement> fields = new ArrayList<>(1);
+
+		getElementChildren(parent, classes, methods, fields);
+
+		Iterator<IModelElement> i = methods.iterator();
+		while (i.hasNext()) {
+			IModelElement element = i.next();
+
 			IMethod method = (IMethod) element;
 			TestCase.assertNotNull(method);
-			if( method.getElementName().equals(name) ) {
+			if (method.getElementName().equals(name)) {
 				String[] params = method.getParameterNames();
 				TestCase.assertNotNull(params);
-				TestCase.assertEquals(argCount, params.length );
+				TestCase.assertEquals(argCount, params.length);
 
 				return method;
 			}
@@ -163,118 +158,119 @@
 		TestCase.assertEquals("Method not exist", name, "");
 		return null;
 	}
+
 	/**
 	 * Assert check and return method by name. Also checks for arguments count
 	 * to determine method.
-	 * 
+	 *
 	 * Multiple declarations of one class in one module is ignored.
-	 */	
-	public static IType getAssertClass( IModelElement[] elements, String name ) throws Exception
-	{
+	 */
+	public static IType getAssertClass(IModelElement[] elements, String name)
+			throws Exception {
 		IModelElement parent = getElementsParent(elements);
-		if(parent==null){
-			TestCase.assertTrue("Can't get children's parent",false);
+		if (parent == null) {
+			TestCase.assertTrue("Can't get children's parent", false);
 		}
-		
-		Collection<IModelElement> classes = new ArrayList<IModelElement>(1);
-		Collection<IModelElement> methods = new ArrayList<IModelElement>(1);
-		Collection<IModelElement> fields = new ArrayList<IModelElement>(1);
-		
-		getElementChildren(parent,classes,methods,fields);
-		Iterator<IModelElement> i = classes.iterator();
-		while( i.hasNext() ) {
-			IModelElement element = (IModelElement)i.next();
 
-			
-			IType classElement= (IType) element;
-			TestCase.assertNotNull( classElement );
-			if( classElement.getElementName().equals(name) ) {									
+		Collection<IModelElement> classes = new ArrayList<>(1);
+		Collection<IModelElement> methods = new ArrayList<>(1);
+		Collection<IModelElement> fields = new ArrayList<>(1);
+
+		getElementChildren(parent, classes, methods, fields);
+		Iterator<IModelElement> i = classes.iterator();
+		while (i.hasNext()) {
+			IModelElement element = i.next();
+
+			IType classElement = (IType) element;
+			TestCase.assertNotNull(classElement);
+			if (classElement.getElementName().equals(name)) {
 				return classElement;
 			}
-			
+
 		}
 		TestCase.assertEquals("Class not exist", "", name);
 		return null;
 	}
-	private static void getElementChildren(IModelElement element,Collection<IModelElement> classes, 
-			Collection<IModelElement> methods, Collection<IModelElement> fields) throws ModelException{
-		
+
+	private static void getElementChildren(IModelElement element,
+			Collection<IModelElement> classes,
+			Collection<IModelElement> methods, Collection<IModelElement> fields)
+			throws ModelException {
+
 		classes.clear();
 		fields.clear();
 		methods.clear();
-		
-		//we don't use IModelElement children getting here cause we want to test each model element
-		//descendant's getters.
-		
-		//checking parent element type
-		if(element.getElementType()==IModelElement.SOURCE_MODULE){
-			IModule parentModule = (IModule)element;
-			
-			IModelElement[] childs = parentModule.getChildren();			
-			
-			for( int i = 0; i < childs.length; ++i ) {
+
+		// we don't use IModelElement children getting here cause we want to
+		// test each model element
+		// descendant's getters.
+
+		// checking parent element type
+		if (element.getElementType() == IModelElement.SOURCE_MODULE) {
+			IModule parentModule = (IModule) element;
+
+			IModelElement[] childs = parentModule.getChildren();
+
+			for (int i = 0; i < childs.length; ++i) {
 				IModelElement c = childs[i];
-				if( c.getElementType() == IModelElement.FIELD ) {
-					fields.add( c );
-				}
-				else if( c.getElementType() == IModelElement.METHOD ) {
-					methods.add( c );
-				}
-				else if( c.getElementType() == IModelElement.TYPE ) {
-					classes.add( c );
+				if (c.getElementType() == IModelElement.FIELD) {
+					fields.add(c);
+				} else if (c.getElementType() == IModelElement.METHOD) {
+					methods.add(c);
+				} else if (c.getElementType() == IModelElement.TYPE) {
+					classes.add(c);
 				}
 			}
-			
-		}else if(element.getElementType()==IModelElement.TYPE){
-			IType parentClass = (IType)element;
-						
+
+		} else if (element.getElementType() == IModelElement.TYPE) {
+			IType parentClass = (IType) element;
+
 			IModelElement[] childs = parentClass.getChildren();
-			for( int i = 0; i < childs.length; ++i ) {
+			for (int i = 0; i < childs.length; ++i) {
 				IModelElement c = childs[i];
-				if( c.getElementType() == IModelElement.FIELD ) {
-					fields.add( c );
+				if (c.getElementType() == IModelElement.FIELD) {
+					fields.add(c);
+				} else if (c.getElementType() == IModelElement.METHOD) {
+					methods.add(c);
+				} else if (c.getElementType() == IModelElement.TYPE) {
+					classes.add(c);
 				}
-				else if( c.getElementType() == IModelElement.METHOD ) {
-					methods.add( c );
-				}
-				else if( c.getElementType() == IModelElement.TYPE ) {
-					classes.add( c );
-				}
-			}			
-		}else if(element.getElementType()==IModelElement.METHOD ){
-			IMethod parentMethod = (IMethod)element;
-			
+			}
+		} else if (element.getElementType() == IModelElement.METHOD) {
+			IMethod parentMethod = (IMethod) element;
+
 			IModelElement[] childs = parentMethod.getChildren();
-			for( int i = 0; i < childs.length; ++i ) {
+			for (int i = 0; i < childs.length; ++i) {
 				IModelElement c = childs[i];
-				if( c.getElementType() == IModelElement.FIELD ) {
-					fields.add( (IField)c );
+				if (c.getElementType() == IModelElement.FIELD) {
+					fields.add(c);
 				}
-				if( c.getElementType() == IModelElement.METHOD ) {
-					methods.add( c );
+				if (c.getElementType() == IModelElement.METHOD) {
+					methods.add(c);
+				} else if (c.getElementType() == IModelElement.TYPE) {
+					classes.add(c);
 				}
-				else if( c.getElementType() == IModelElement.TYPE ) {
-					classes.add( c );
-				}
-			}	
-			//classes.addAll(parentMethod.getClasses());
-			//methods.addAll(parentMethod.getMethods());
-		}else{
+			}
+			// classes.addAll(parentMethod.getClasses());
+			// methods.addAll(parentMethod.getMethods());
+		} else {
 			return;
 		}
 	}
-	
-	private static IModelElement getElementsParent( IModelElement[] elements){
-		if(elements.length ==0){
+
+	private static IModelElement getElementsParent(IModelElement[] elements) {
+		if (elements.length == 0) {
 			return null;
-		}				
-		if( elements[ 0 ] != null ) {
-			return elements[ 0 ].getParent();
+		}
+		if (elements[0] != null) {
+			return elements[0].getParent();
 		}
 		return null;
 	}
-	public static void exractZipInto(IScriptProject scriptProject, URL entry) throws IOException, CoreException {
-		
+
+	public static void exractZipInto(IScriptProject scriptProject, URL entry)
+			throws IOException, CoreException {
+
 		IProject prj = scriptProject.getProject();
 
 		NullProgressMonitor monitor = new NullProgressMonitor();
@@ -285,15 +281,16 @@
 			ZipEntry nextEntry = zis.getNextEntry();
 			if (nextEntry != null) {
 				String name = nextEntry.getName();
-//				System.out.println(name);
+				// System.out.println(name);
 				if (!nextEntry.isDirectory()) {
 					byte[] buf = new byte[1024];
-			        int len;
-			        ByteArrayOutputStream arrayOut = new ByteArrayOutputStream();
-			        while ((len = zis.read(buf)) > 0) {
-			            arrayOut.write(buf, 0, len);
-			        }
-					ByteArrayInputStream bis = new ByteArrayInputStream(arrayOut.toByteArray());
+					int len;
+					ByteArrayOutputStream arrayOut = new ByteArrayOutputStream();
+					while ((len = zis.read(buf)) > 0) {
+						arrayOut.write(buf, 0, len);
+					}
+					ByteArrayInputStream bis = new ByteArrayInputStream(
+							arrayOut.toByteArray());
 					IFile file = prj.getFile(new Path(name));
 					file.create(bis, true, monitor);
 				} else {
@@ -301,8 +298,7 @@
 					f.create(true, true, monitor);
 				}
 				zis.closeEntry();
-			}
-			else {
+			} else {
 				break;
 			}
 		}
diff --git a/core/tests/org.eclipse.dltk.core.tests/src/org/eclipse/dltk/core/tests/util/Util.java b/core/tests/org.eclipse.dltk.core.tests/src/org/eclipse/dltk/core/tests/util/Util.java
index d509561..33d9b1e 100644
--- a/core/tests/org.eclipse.dltk.core.tests/src/org/eclipse/dltk/core/tests/util/Util.java
+++ b/core/tests/org.eclipse.dltk.core.tests/src/org/eclipse/dltk/core/tests/util/Util.java
@@ -1,11 +1,10 @@
 /*******************************************************************************
- * Copyright (c) 2005, 2007 IBM Corporation and others.
+ * Copyright (c) 2005, 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
  *
- 
  *******************************************************************************/
 package org.eclipse.dltk.core.tests.util;
 
@@ -25,10 +24,10 @@
 
 	/**
 	 * Generate a display string from the given String.
-	 * 
+	 *
 	 * @param inputString
 	 *            the given input string
-	 * 
+	 *
 	 */
 	public static String displayString(String inputString) {
 		return displayString(inputString, 0);
@@ -51,43 +50,43 @@
 	 * <p>
 	 * Example of use: <o>
 	 * <li>
-	 * 
+	 *
 	 * <pre>
 	 * input string = &quot;abc\ndef\tghi&quot;,
 	 * indent = 3
 	 * result = &quot;\&quot;\t\t\tabc\\n&quot; +
 	 * 			&quot;\t\t\tdef\tghi\&quot;&quot;
 	 * </pre>
-	 * 
+	 *
 	 * </li>
 	 * <li>
-	 * 
+	 *
 	 * <pre>
 	 * input string = &quot;abc\ndef\tghi\n&quot;,
 	 * indent = 3
 	 * result = &quot;\&quot;\t\t\tabc\\n&quot; +
 	 * 			&quot;\t\t\tdef\tghi\\n\&quot;&quot;
 	 * </pre>
-	 * 
+	 *
 	 * </li>
 	 * <li>
-	 * 
+	 *
 	 * <pre>
 	 * input string = &quot;abc\r\ndef\tghi\r\n&quot;,
 	 * indent = 3
 	 * result = &quot;\&quot;\t\t\tabc\\r\\n&quot; +
 	 * 			&quot;\t\t\tdef\tghi\\r\\n\&quot;&quot;
 	 * </pre>
-	 * 
+	 *
 	 * </li>
 	 * </ol>
 	 * </p>
-	 * 
+	 *
 	 * @param inputString
 	 *            the given input string
 	 * @param indent
 	 *            number of tabs are added at the begining of each line.
-	 * 
+	 *
 	 * @return the displayed string
 	 */
 	public static String displayString(String inputString, int indent) {
@@ -205,45 +204,40 @@
 	public static void unzip(String zipPath, String destDirPath)
 			throws IOException {
 
-		InputStream zipIn = new FileInputStream(zipPath);
-		byte[] buf = new byte[8192];
-		File destDir = new File(destDirPath);
-		ZipInputStream zis = new ZipInputStream(zipIn);
-		FileOutputStream fos = null;
-		try {
-			ZipEntry zEntry;
-			while ((zEntry = zis.getNextEntry()) != null) {
-				// if it is empty directory, create it
-				if (zEntry.isDirectory()) {
-					new File(destDir, zEntry.getName()).mkdirs();
-					continue;
-				}
-				// if it is a file, extract it
-				File outFile = new File(destDir, zEntry.getName());
-				// create directory for a file
-				outFile.getParentFile().mkdirs();
-				// write file
-				fos = new FileOutputStream(outFile);
-				int n = 0;
-				while ((n = zis.read(buf)) >= 0) {
-					fos.write(buf, 0, n);
-				}
-				fos.close();
-			}
-		} catch (IOException ioe) {
-			if (fos != null) {
+		try (InputStream zipIn = new FileInputStream(zipPath)) {
+			byte[] buf = new byte[8192];
+			File destDir = new File(destDirPath);
+			try (ZipInputStream zis = new ZipInputStream(zipIn)) {
+				FileOutputStream fos = null;
 				try {
-					fos.close();
-				} catch (IOException ioe2) {
+					ZipEntry zEntry;
+					while ((zEntry = zis.getNextEntry()) != null) {
+						// if it is empty directory, create it
+						if (zEntry.isDirectory()) {
+							new File(destDir, zEntry.getName()).mkdirs();
+							continue;
+						}
+						// if it is a file, extract it
+						File outFile = new File(destDir, zEntry.getName());
+						// create directory for a file
+						outFile.getParentFile().mkdirs();
+						// write file
+						fos = new FileOutputStream(outFile);
+						int n = 0;
+						while ((n = zis.read(buf)) >= 0) {
+							fos.write(buf, 0, n);
+						}
+						fos.close();
+					}
+				} catch (IOException ioe) {
+					if (fos != null) {
+						try {
+							fos.close();
+						} catch (IOException ioe2) {
+						}
+					}
 				}
 			}
-		} finally {
-			try {
-				zipIn.close();
-				if (zis != null)
-					zis.close();
-			} catch (IOException ioe) {
-			}
 		}
 	}
 
@@ -262,8 +256,8 @@
 			} else if (files[i].isFile()) {
 				BufferedInputStream input;
 				try {
-					input = new BufferedInputStream(new FileInputStream(
-							files[i]));
+					input = new BufferedInputStream(
+							new FileInputStream(files[i]));
 					org.eclipse.dltk.compiler.util.Util.copy(child, input);
 					input.close();
 				} catch (FileNotFoundException e) {
diff --git a/core/tests/org.eclipse.dltk.core.tests/src/org/eclipse/dltk/core/tests/utils/MultiArrayIteratorTest.java b/core/tests/org.eclipse.dltk.core.tests/src/org/eclipse/dltk/core/tests/utils/MultiArrayIteratorTest.java
index 9be35a6..0d4cef2 100644
--- a/core/tests/org.eclipse.dltk.core.tests/src/org/eclipse/dltk/core/tests/utils/MultiArrayIteratorTest.java
+++ b/core/tests/org.eclipse.dltk.core.tests/src/org/eclipse/dltk/core/tests/utils/MultiArrayIteratorTest.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2012 NumberFour AG
+ * Copyright (c) 2012, 2017 NumberFour AG and others.
  *
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
@@ -26,7 +26,7 @@
 public class MultiArrayIteratorTest extends Assert {
 
 	private static <E> List<E> toList(Iterator<E> iterator) {
-		final List<E> list = new ArrayList<E>();
+		final List<E> list = new ArrayList<>();
 		while (iterator.hasNext()) {
 			list.add(iterator.next());
 		}
@@ -36,20 +36,22 @@
 	@Test
 	public void both() {
 		assertEquals(Arrays.asList("A", "B"),
-				toList(new MultiArrayIterator<String>(new String[] { "A" },
+				toList(new MultiArrayIterator<>(new String[] { "A" },
 						new String[] { "B" })));
 	}
 
 	@Test
 	public void firstEmpty() {
-		assertEquals(Arrays.asList("B"), toList(new MultiArrayIterator<String>(
-				new String[] {}, new String[] { "B" })));
+		assertEquals(Arrays.asList("B"),
+				toList(new MultiArrayIterator<>(new String[] {},
+						new String[] { "B" })));
 	}
 
 	@Test
 	public void secondEmpty() {
-		assertEquals(Arrays.asList("A"), toList(new MultiArrayIterator<String>(
-				new String[] { "A" }, new String[] {})));
+		assertEquals(Arrays.asList("A"),
+				toList(new MultiArrayIterator<>(new String[] { "A" },
+						new String[] {})));
 	}
 
 }
diff --git a/core/tests/org.eclipse.dltk.core.tests/src/org/eclipse/dltk/core/tests/xml/DOMSerializer.java b/core/tests/org.eclipse.dltk.core.tests/src/org/eclipse/dltk/core/tests/xml/DOMSerializer.java
index d641b97..f36062d 100644
--- a/core/tests/org.eclipse.dltk.core.tests/src/org/eclipse/dltk/core/tests/xml/DOMSerializer.java
+++ b/core/tests/org.eclipse.dltk.core.tests/src/org/eclipse/dltk/core/tests/xml/DOMSerializer.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2008 xored software, Inc.
+ * Copyright (c) 2008, 2017 xored software, Inc. and others.
  *
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
@@ -124,7 +124,8 @@
 				for (int i = 0; i < children.length; i++) {
 					serializeNode(children[i], writer, indentLevel + indent);
 				}
-				if (children[children.length - 1].getNodeType() == Node.ELEMENT_NODE) {
+				if (children[children.length - 1]
+						.getNodeType() == Node.ELEMENT_NODE) {
 					writer.write(indentLevel);
 				}
 				writer.write("</" + name + ">");
@@ -189,7 +190,8 @@
 			String attributeSeperator = " ";
 			// If we only have one attribute write it on the same line
 			// otherwise indent
-			if (displayAttributesOnSeperateLine && attributes.getLength() != 1) {
+			if (displayAttributesOnSeperateLine
+					&& attributes.getLength() != 1) {
 				attributeSeperator = lineSeparator + indentLevel + indent;
 			}
 			// Double indentLevel to match parent element and then one
@@ -205,7 +207,7 @@
 	private Node[] collectChildren(Node parent) {
 		final NodeList children = parent.getChildNodes();
 		if (children != null && children.getLength() > 0) {
-			final List<Node> result = new ArrayList<Node>();
+			final List<Node> result = new ArrayList<>();
 			for (int i = 0; i < children.getLength(); i++) {
 				final Node child = children.item(i);
 				if (child == null) {
@@ -218,7 +220,7 @@
 				result.add(child);
 			}
 			if (!result.isEmpty()) {
-				return (Node[]) result.toArray(new Node[result.size()]);
+				return result.toArray(new Node[result.size()]);
 			}
 		}
 		return null;