Cosmetics: o.e.dltk.launching.
Enable warnings and fix them.
Change-Id: Ie8d042804e305deee97e0ef1c838cc8fe9083fb4
Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
diff --git a/core/plugins/org.eclipse.dltk.launching/.settings/org.eclipse.jdt.core.prefs b/core/plugins/org.eclipse.dltk.launching/.settings/org.eclipse.jdt.core.prefs
index 1a53062..965f24b 100644
--- a/core/plugins/org.eclipse.dltk.launching/.settings/org.eclipse.jdt.core.prefs
+++ b/core/plugins/org.eclipse.dltk.launching/.settings/org.eclipse.jdt.core.prefs
@@ -1,13 +1,108 @@
eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.annotation.inheritNullAnnotations=disabled
+org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore
+org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull
+org.eclipse.jdt.core.compiler.annotation.nonnull.secondary=
+org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault
+org.eclipse.jdt.core.compiler.annotation.nonnullbydefault.secondary=
+org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable
+org.eclipse.jdt.core.compiler.annotation.nullable.secondary=
+org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
+org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning
+org.eclipse.jdt.core.compiler.problem.deadCode=warning
+org.eclipse.jdt.core.compiler.problem.deprecation=warning
+org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
+org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled
+org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
+org.eclipse.jdt.core.compiler.problem.emptyStatement=warning
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=warning
+org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
+org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled
+org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore
+org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
+org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
+org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
+org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled
+org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
+org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=warning
+org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=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
+org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=warning
+org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=disabled
+org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=warning
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled
+org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
+org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore
+org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
+org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
+org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
+org.eclipse.jdt.core.compiler.problem.nonnullParameterAnnotationDropped=warning
+org.eclipse.jdt.core.compiler.problem.nonnullTypeVariableFromLegacyInvocation=warning
+org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error
+org.eclipse.jdt.core.compiler.problem.nullReference=warning
+org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error
+org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning
+org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
+org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
+org.eclipse.jdt.core.compiler.problem.pessimisticNullAnalysisForFreeTypeVariables=warning
+org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore
+org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore
+org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore
+org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning
+org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning
+org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore
+org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=warning
+org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=warning
+org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
+org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore
+org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
+org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
+org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled
+org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
+org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=disabled
+org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
+org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
+org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=disabled
+org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
+org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning
+org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
+org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
+org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning
+org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
+org.eclipse.jdt.core.compiler.problem.unusedExceptionParameter=ignore
+org.eclipse.jdt.core.compiler.problem.unusedImport=warning
+org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
+org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
+org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore
+org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
+org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
+org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
+org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore
+org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
org.eclipse.jdt.core.compiler.source=1.8
org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
diff --git a/core/plugins/org.eclipse.dltk.launching/src/org/eclipse/dltk/internal/launching/AbstractInterpreterInstallType.java b/core/plugins/org.eclipse.dltk.launching/src/org/eclipse/dltk/internal/launching/AbstractInterpreterInstallType.java
index 820c8f9..9b6cdc7 100644
--- a/core/plugins/org.eclipse.dltk.launching/src/org/eclipse/dltk/internal/launching/AbstractInterpreterInstallType.java
+++ b/core/plugins/org.eclipse.dltk.launching/src/org/eclipse/dltk/internal/launching/AbstractInterpreterInstallType.java
@@ -82,10 +82,10 @@
private String fId;
- private static HashMap<Object, LibraryLocation[]> fCachedLocations = new HashMap<Object, LibraryLocation[]>();
+ private static HashMap<Object, LibraryLocation[]> fCachedLocations = new HashMap<>();
protected AbstractInterpreterInstallType() {
- fInterpreters = new ArrayList<IInterpreterInstall>();
+ fInterpreters = new ArrayList<>();
}
@Override
@@ -134,7 +134,7 @@
/**
* Subclasses should return a new instance of the appropriate
* <code>IInterpreterInstall</code> subclass from this method.
- *
+ *
* @param id
* The Interpreter's id. The <code>IInterpreterInstall</code>
* instance that is created must return <code>id</code> from its
@@ -148,7 +148,7 @@
/**
* Initializes the id parameter from the "id" attribute in the configuration
* markup. Subclasses should not override this method.
- *
+ *
* @param config
* the configuration element used to trigger this execution. It
* can be queried by the executable extension for specific
@@ -187,25 +187,14 @@
}
protected 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();
- }
}
}
@@ -226,7 +215,7 @@
}
}
- List<String> list = new ArrayList<String>();
+ List<String> list = new ArrayList<>();
for (Map.Entry<String, String> entry : env.entrySet()) {
list.add(entry.getKey() + "=" + entry.getValue()); //$NON-NLS-1$
}
@@ -236,11 +225,11 @@
/**
* filter out any undesirable entries from the system environment
- *
+ *
* <p>
* default implementation does nothing. subclasses are free to override.
* </p>
- *
+ *
* @param environment
* system environment
*/
@@ -251,7 +240,7 @@
/**
* Process should write one line into console with format 'path1 path2
* path3'
- *
+ *
* @param monitor
* @param process
* @return
@@ -264,7 +253,7 @@
final BufferedReader dataIn = new BufferedReader(
new InputStreamReader(process.getInputStream()));
- final List<String> result = new ArrayList<String>();
+ final List<String> result = new ArrayList<>();
// final Object lock = new Object();
@@ -363,7 +352,7 @@
public static LibraryLocation[] correctLocations(
final List<LibraryLocation> locs, IProgressMonitor monitor) {
- List<LibraryLocation> resolvedLocs = new ArrayList<LibraryLocation>();
+ List<LibraryLocation> resolvedLocs = new ArrayList<>();
if (monitor != null) {
monitor.beginTask(
LaunchingMessages.AbstractInterpreterInstallType_correctingLocations,
@@ -457,7 +446,7 @@
res = res.substring(DLTK_PATH_PREFIX.length());
}
String[] paths = res.split(getBuildPathDelimeter());
- List<String> filtered = new ArrayList<String>();
+ List<String> filtered = new ArrayList<>();
for (int i = 0; i < paths.length; ++i) {
if (!paths[i].equals(".")) { //$NON-NLS-1$
filtered.add(paths[i].trim());
@@ -471,12 +460,12 @@
/**
* Then multiple lines of output are provided, we parse only paths started
* from "DLTK:" sequence.
- *
+ *
* @param result
* @return
*/
protected String[] parsePaths(String[] result) {
- List<String> filtered = new ArrayList<String>();
+ List<String> filtered = new ArrayList<>();
for (int k = 0; k < result.length; ++k) {
String res = result[k];
if (res.startsWith(DLTK_PATH_PREFIX)) {
@@ -497,7 +486,7 @@
* Please override the following method instead
* <b>validateInstallLocation</b>(iFileHandle, EnvironmentVariable[],
* LibraryLocation[])
- *
+ *
* @param installLocation
* @return
*/
@@ -767,7 +756,7 @@
return fCachedLocations.get(cacheKey);
}
- final ArrayList<LibraryLocation> locations = new ArrayList<LibraryLocation>();
+ final ArrayList<LibraryLocation> locations = new ArrayList<>();
final ILookupRunnable runnable = createLookupRunnable(installLocation,
locations, variables);
diff --git a/core/plugins/org.eclipse.dltk.launching/src/org/eclipse/dltk/internal/launching/CompositeId.java b/core/plugins/org.eclipse.dltk.launching/src/org/eclipse/dltk/internal/launching/CompositeId.java
index e1c07d8..1ea36d7 100644
--- a/core/plugins/org.eclipse.dltk.launching/src/org/eclipse/dltk/internal/launching/CompositeId.java
+++ b/core/plugins/org.eclipse.dltk.launching/src/org/eclipse/dltk/internal/launching/CompositeId.java
@@ -1,11 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
+ * Copyright (c) 2000, 2016 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.internal.launching;
@@ -22,13 +21,13 @@
}
public static CompositeId fromString(String idString) {
- ArrayList<String> parts = new ArrayList<String>();
+ ArrayList<String> parts = new ArrayList<>();
int commaIndex = idString.indexOf(',');
while (commaIndex > 0) {
int length = Integer.valueOf(idString.substring(0, commaIndex))
.intValue();
- String part = idString.substring(commaIndex + 1, commaIndex + 1
- + length);
+ String part = idString.substring(commaIndex + 1,
+ commaIndex + 1 + length);
parts.add(part);
idString = idString.substring(commaIndex + 1 + length);
commaIndex = idString.indexOf(',');
diff --git a/core/plugins/org.eclipse.dltk.launching/src/org/eclipse/dltk/internal/launching/DLTKLaunchingPlugin.java b/core/plugins/org.eclipse.dltk.launching/src/org/eclipse/dltk/internal/launching/DLTKLaunchingPlugin.java
index d749e3e..d1c885b 100644
--- a/core/plugins/org.eclipse.dltk.launching/src/org/eclipse/dltk/internal/launching/DLTKLaunchingPlugin.java
+++ b/core/plugins/org.eclipse.dltk.launching/src/org/eclipse/dltk/internal/launching/DLTKLaunchingPlugin.java
@@ -155,7 +155,7 @@
/**
* Returns a Document that can be used to build a DOM tree
- *
+ *
* @return the Document
* @throws ParserConfigurationException
* if an exception occurs creating the document builder
@@ -170,7 +170,7 @@
/**
* Serializes a XML document into a string - encoded in UTF8 format, with
* platform line separators.
- *
+ *
* @param doc
* document to serialize
* @return the document as a string
@@ -193,11 +193,11 @@
/**
* Returns a shared XML parser.
- *
+ *
* @return an XML parser
* @throws CoreException
* if unable to create a parser
- *
+ *
*/
public static DocumentBuilder getParser() throws CoreException {
if (fgXMLParser == null) {
@@ -216,7 +216,7 @@
/**
* Throws an exception with the given message and underlying exception.
- *
+ *
* @param message
* error message
* @param exception
@@ -233,7 +233,7 @@
/**
* Returns a new runtime buildpath entry of the specified type.
- *
+ *
* @param id
* extension type id
* @return new uninitialized runtime buildpath entry
@@ -263,7 +263,7 @@
ID_EXTENSION_POINT_RUNTIME_BUILDPATH_ENTRIES);
IConfigurationElement[] configs = extensionPoint
.getConfigurationElements();
- fBuildpathEntryExtensions = new HashMap<String, IConfigurationElement>(
+ fBuildpathEntryExtensions = new HashMap<>(
configs.length);
for (int i = 0; i < configs.length; i++) {
fBuildpathEntryExtensions.put(configs[i].getAttribute("id"), //$NON-NLS-1$
@@ -318,7 +318,7 @@
/**
* Clears zip file cache. Shutdown the launch config helper.
- *
+ *
* @see Plugin#stop(BundleContext)
*/
@Override
@@ -351,7 +351,7 @@
/**
* Save preferences whenever the connect timeout changes. Process changes to
* the list of installed InterpreterEnvironments.
- *
+ *
* @see org.eclipse.core.runtime.Preferences.IPropertyChangeListener#propertyChange(PropertyChangeEvent)
*/
@Override
@@ -371,7 +371,7 @@
* Check for differences between the old & new sets of installed
* InterpreterEnvironments. Differences may include additions, deletions and
* changes. Take appropriate action for each type of difference.
- *
+ *
* When importing preferences, TWO propertyChange events are fired. The
* first has an old value but an empty new value. The second has a new
* value, but an empty old value. Normal user changes to the preferences
@@ -488,7 +488,7 @@
/**
* Parse the given xml into a Interpreter definitions container, returning
* an empty container if an exception occurs.
- *
+ *
* @param xml
* @return InterpreterDefinitionsContainer
*/
@@ -554,7 +554,7 @@
/**
* Re-bind buildpath variables and containers affected by the
* InterpreterEnvironment changes.
- *
+ *
* @param monitor
*/
public void rebind(IProgressMonitor monitor, IScriptProject[] projects,
@@ -617,7 +617,7 @@
class InterpreterChanges implements IInterpreterInstallChangedListener {
// old container ids to new
- private HashMap<IPath, IPath> fRenamedContainerIds = new HashMap<IPath, IPath>();
+ private HashMap<IPath, IPath> fRenamedContainerIds = new HashMap<>();
@Override
public void defaultInterpreterInstallChanged(
diff --git a/core/plugins/org.eclipse.dltk.launching/src/org/eclipse/dltk/internal/launching/EnvironmentResolver.java b/core/plugins/org.eclipse.dltk.launching/src/org/eclipse/dltk/internal/launching/EnvironmentResolver.java
index ecf92a2..985ba6b 100644
--- a/core/plugins/org.eclipse.dltk.launching/src/org/eclipse/dltk/internal/launching/EnvironmentResolver.java
+++ b/core/plugins/org.eclipse.dltk.launching/src/org/eclipse/dltk/internal/launching/EnvironmentResolver.java
@@ -13,7 +13,7 @@
public final class EnvironmentResolver {
private static class REnvironmentVariable {
EnvironmentVariable var;
- final Set<String> dependencies = new HashSet<String>();
+ final Set<String> dependencies = new HashSet<>();
public REnvironmentVariable(EnvironmentVariable var) {
this.var = var;
@@ -36,8 +36,8 @@
if (variables == null) {
return null;
}
- Map<String, String> env = new HashMap<String, String>();
- Map<String, String> selfDep = new HashMap<String, String>();
+ Map<String, String> env = new HashMap<>();
+ Map<String, String> selfDep = new HashMap<>();
for (Map.Entry<String, String> entry : penv.entrySet()) {
String name = entry.getKey();
String value = entry.getValue();
@@ -51,10 +51,10 @@
env.remove(name);
}
}
- Map<String, String> resolved = new HashMap<String, String>();
- List<EnvironmentVariable> result = new ArrayList<EnvironmentVariable>();
+ Map<String, String> resolved = new HashMap<>();
+ List<EnvironmentVariable> result = new ArrayList<>();
// 1) replace all top level environment variables
- List<REnvironmentVariable> unresolved = new ArrayList<REnvironmentVariable>();
+ List<REnvironmentVariable> unresolved = new ArrayList<>();
for (int i = 0; i < variables.length; i++) {
REnvironmentVariable var = new REnvironmentVariable(
new EnvironmentVariable(variables[i]));
@@ -137,8 +137,8 @@
for (REnvironmentVariable rvar : unresolved) {
if (!rvar.var.getName().equals(t.getName())
&& containVar(t, rvar.var.getName())) {
- t = resolveVariable(t, rvar.var.getName(), rvar.var
- .getValue());
+ t = resolveVariable(t, rvar.var.getName(),
+ rvar.var.getValue());
step = true;
}
}
@@ -213,9 +213,8 @@
final String value = var.getValue();
final String ref = "$" + vName; //$NON-NLS-1$
final int pos = value.indexOf(ref);
- if (pos != -1
- && (pos + ref.length() >= value.length() || !Character
- .isLetterOrDigit(value.charAt(pos + ref.length())))) {
+ if (pos != -1 && (pos + ref.length() >= value.length() || !Character
+ .isLetterOrDigit(value.charAt(pos + ref.length())))) {
return true;
}
return false;
@@ -223,7 +222,7 @@
/**
* Finds the variable with the specified name
- *
+ *
* @param vars
* @param name
* @return
diff --git a/core/plugins/org.eclipse.dltk.launching/src/org/eclipse/dltk/internal/launching/InterpreterContainer.java b/core/plugins/org.eclipse.dltk.launching/src/org/eclipse/dltk/internal/launching/InterpreterContainer.java
index ef032c9..f10f294 100644
--- a/core/plugins/org.eclipse.dltk.launching/src/org/eclipse/dltk/internal/launching/InterpreterContainer.java
+++ b/core/plugins/org.eclipse.dltk.launching/src/org/eclipse/dltk/internal/launching/InterpreterContainer.java
@@ -40,8 +40,7 @@
/**
* Interpreter Container - resolves a buildpath container to an interpreter
*/
-public class InterpreterContainer
- implements IBuildpathContainer, IBuildpathContainerExtension {
+public class InterpreterContainer implements IBuildpathContainerExtension {
/**
* Corresponding interpreter
*/
@@ -59,7 +58,7 @@
* Cache of buildpath entries per Interpreter install. Cleared when a
* Interpreter changes.
*/
- private static final Map<IInterpreterInstall, IBuildpathEntry[]> fgBuildpathEntries = new HashMap<IInterpreterInstall, IBuildpathEntry[]>(
+ private static final Map<IInterpreterInstall, IBuildpathEntry[]> fgBuildpathEntries = new HashMap<>(
10);
private static ChangeListener changeListener = null;
@@ -98,7 +97,7 @@
/**
* Returns the buildpath entries associated with the given interpreter.
- *
+ *
* @param interpreter
* @return buildpath entries
*/
@@ -128,16 +127,15 @@
/**
* Computes the buildpath entries associated with a interpreter - one entry
* per library.
- *
+ *
* @param interpreter
* @return buildpath entries
*/
private static IBuildpathEntry[] computeBuildpathEntries(
IInterpreterInstall interpreter) {
LibraryLocation[] libs = ScriptRuntime.getLibraryLocations(interpreter);
- List<IBuildpathEntry> entries = new ArrayList<IBuildpathEntry>(
- libs.length);
- Set<IPath> rawEntries = new HashSet<IPath>(libs.length);
+ List<IBuildpathEntry> entries = new ArrayList<>(libs.length);
+ Set<IPath> rawEntries = new HashSet<>(libs.length);
for (int i = 0; i < libs.length; i++) {
IPath entryPath = libs[i].getLibraryPath();
@@ -146,7 +144,7 @@
continue;
IBuildpathAttribute[] attributes = new IBuildpathAttribute[0];
- ArrayList<IPath> excluded = new ArrayList<IPath>(); // paths to
+ ArrayList<IPath> excluded = new ArrayList<>(); // paths to
// exclude
for (int j = 0; j < libs.length; j++) {
IPath otherPath = libs[j].getLibraryPath();
@@ -196,7 +194,7 @@
/**
* Constructs a interpreter buildpath container on the given interpreter
* install
- *
+ *
* @param interpreter
* Interpreter install - cannot be <code>null</code>
* @param path
@@ -223,7 +221,7 @@
private IBuildpathEntry[] computeBuildpathEntries() {
IBuildpathEntry[] buildpathEntries = getBuildpathEntries(
fInterpreterInstall);
- List<IBuildpathEntry> entries = new ArrayList<IBuildpathEntry>(
+ List<IBuildpathEntry> entries = new ArrayList<>(
buildpathEntries.length);
Collections.addAll(entries, buildpathEntries);
// customize entries for this project
diff --git a/core/plugins/org.eclipse.dltk.launching/src/org/eclipse/dltk/internal/launching/InterpreterDefinitionsContainer.java b/core/plugins/org.eclipse.dltk.launching/src/org/eclipse/dltk/internal/launching/InterpreterDefinitionsContainer.java
index f60afed..1092d46 100644
--- a/core/plugins/org.eclipse.dltk.launching/src/org/eclipse/dltk/internal/launching/InterpreterDefinitionsContainer.java
+++ b/core/plugins/org.eclipse.dltk.launching/src/org/eclipse/dltk/internal/launching/InterpreterDefinitionsContainer.java
@@ -119,21 +119,20 @@
* Constructs an empty Interpreter container
*/
public InterpreterDefinitionsContainer() {
- fInterTypeToInterMap = new HashMap<IInterpreterInstallType, List<IInterpreterInstall>>(
- 10);
+ fInterTypeToInterMap = new HashMap<>(10);
// fInvalidInterpreterList = new ArrayList(10);
- fInterpreterList = new ArrayList<IInterpreterInstall>(10);
- fDefaultInterpreterInstallCompositeID = new HashMap<DefaultInterpreterEntry, String>();
- fDefaultInterpreterInstallConnectorTypeID = new HashMap<DefaultInterpreterEntry, String>();
+ fInterpreterList = new ArrayList<>(10);
+ fDefaultInterpreterInstallCompositeID = new HashMap<>();
+ fDefaultInterpreterInstallConnectorTypeID = new HashMap<>();
}
/**
* Returns list of default interpreters natures TODO: rename
- *
+ *
* @return
*/
public DefaultInterpreterEntry[] getInterpreterNatures() {
- Set<DefaultInterpreterEntry> s = new HashSet<DefaultInterpreterEntry>(
+ Set<DefaultInterpreterEntry> s = new HashSet<>(
fDefaultInterpreterInstallCompositeID.keySet());
for (IInterpreterInstall install : fInterpreterList) {
s.add(new DefaultInterpreterEntry(install.getNatureId(),
@@ -150,7 +149,7 @@
* specified Interpreter must have already had its install location set. An
* invalid Interpreter is one whose install location doesn't exist.
* </p>
- *
+ *
* @param interpreter
* the Interpreter to be added to this container
*/
@@ -166,7 +165,7 @@
* specified Interpreter must have already had its install location set. An
* invalid Interpreter is one whose install location doesn't exist.
* </p>
- *
+ *
* @param interpreter
* the Interpreter to be added to this container
* @param overwrite
@@ -183,7 +182,7 @@
List<IInterpreterInstall> interpreterList = fInterTypeToInterMap
.get(interpreterInstallType);
if (interpreterList == null) {
- interpreterList = new ArrayList<IInterpreterInstall>(3);
+ interpreterList = new ArrayList<>(3);
fInterTypeToInterMap.put(interpreterInstallType,
interpreterList);
}
@@ -209,7 +208,7 @@
* specified Interpreters must have already had their install locations set.
* An invalid Interpreter is one whose install location doesn't exist.
* </p>
- *
+ *
* @param interpreterList
* a list of Interpreters to be added to this container
*/
@@ -227,7 +226,7 @@
* <code>IInterpreterInstallType</code>. The values are instances of
* <code>java.util.List</code> which contain instances of
* <code>IInterpreterInstall</code>.
- *
+ *
* @return Map the mapping of Interpreter install types to lists of
* Interpreters
*/
@@ -240,7 +239,7 @@
* invalid Interpreters. An invalid Interpreter is one whose install
* location does not exist on the file system. The order of the list is not
* specified.
- *
+ *
* @return List the data structure containing all Interpreters managed by
* this container
*/
@@ -253,13 +252,13 @@
* invalid Interpreters. An invalid Interpreter is one whose install
* location does not exist on the file system. The order of the list is not
* specified.
- *
+ *
* @return List the data structure containing all Interpreters managed by
* this container
*/
public List<IInterpreterInstall> getInterpreterList(
DefaultInterpreterEntry nature) {
- List<IInterpreterInstall> res = new ArrayList<IInterpreterInstall>(
+ List<IInterpreterInstall> res = new ArrayList<>(
fInterpreterList.size());
for (IInterpreterInstall interpreter : fInterpreterList) {
final String environmentId = interpreter.getEnvironmentId();
@@ -276,12 +275,12 @@
* Return a list of all valid Interpreters in this container. A valid
* Interpreter is one whose install location exists on the file system. The
* order of the list is not specified.
- *
+ *
* @return List
*/
public List<IInterpreterInstall> getValidInterpreterList() {
List<IInterpreterInstall> Interpreters = getInterpreterList();
- List<IInterpreterInstall> resultList = new ArrayList<IInterpreterInstall>(
+ List<IInterpreterInstall> resultList = new ArrayList<>(
Interpreters.size());
resultList.addAll(Interpreters);
// resultList.removeAll(fInvalidInterpreterList);
@@ -292,13 +291,13 @@
* Return filtered list of valid Interpreters in this container. A valid
* Interpreter is one whose install location exists on the file system. The
* order of the list is not specified.
- *
+ *
* @return List
*/
public List<IInterpreterInstall> getValidInterpreterList(
DefaultInterpreterEntry nature) {
List<IInterpreterInstall> interpreters = getInterpreterList(nature);
- List<IInterpreterInstall> resultList = new ArrayList<IInterpreterInstall>(
+ List<IInterpreterInstall> resultList = new ArrayList<>(
interpreters.size());
resultList.addAll(interpreters);
// resultList.removeAll(fInvalidInterpreterList);
@@ -310,7 +309,7 @@
* consists of an ID for the Interpreter install type together with an ID
* for Interpreter. This is necessary because Interpreter ids by themselves
* are not necessarily unique across Interpreter install types.
- *
+ *
* @return String returns the composite ID of the current default
* Interpreter
*/
@@ -329,7 +328,7 @@
* consists of an ID for the Interpreter install type together with an ID
* for Interpreter. This is necessary because Interpreter ids by themselves
* are not necessarily unique across Interpreter install types.
- *
+ *
* @param id
* identifies the new default Interpreter using a composite ID
*/
@@ -343,7 +342,7 @@
/**
* Return the default Interpreter's connector type ID.
- *
+ *
* @return String the current value of the default Interpreter's connector
* type ID
*/
@@ -354,7 +353,7 @@
/**
* Set the default Interpreter's connector type ID.
- *
+ *
* @param id
* the new value of the default Interpreter's connector type ID
*/
@@ -370,7 +369,7 @@
* The resulting XML is compatible with the static method
* <code>parseXMLIntoContainer</code>.
* </p>
- *
+ *
* @return String the results of flattening this object into XML
* @throws IOException
* if this method fails. Reasons include:
@@ -398,7 +397,7 @@
};
// Set the defaultInterpreter attribute on the top-level node
- List<DefaultInterpreterEntry> keys = new ArrayList<DefaultInterpreterEntry>();
+ List<DefaultInterpreterEntry> keys = new ArrayList<>();
keys.addAll(fDefaultInterpreterInstallCompositeID.keySet());
Collections.sort(keys, comparator);
@@ -413,7 +412,7 @@
fDefaultInterpreterInstallCompositeID.get(entry));
}
- List<DefaultInterpreterEntry> keys2 = new ArrayList<DefaultInterpreterEntry>();
+ List<DefaultInterpreterEntry> keys2 = new ArrayList<>();
keys2.addAll(fDefaultInterpreterInstallConnectorTypeID.keySet());
Collections.sort(keys2, comparator);
@@ -584,7 +583,7 @@
* necessarily syntactically equivalent) as the XML contained in
* <code>inputStream</code>.
* </p>
- *
+ *
* @param inputStream
* the <code>InputStream</code> containing XML that declares a
* set of Interpreters and a default Interpreter
@@ -599,17 +598,16 @@
* formatted</li>
* <li>the top-level node was not 'InterpreterSettings'</li>
* </ul>
- *
+ *
*/
public static void parseXMLIntoContainer(Reader inputStream,
InterpreterDefinitionsContainer container) throws IOException {
- // Wrapper the stream for efficient parsing
- BufferedReader stream = new BufferedReader(inputStream);
-
- // Do the parsing and obtain the top-level node
Element config = null;
- try {
+ // Wrapper the stream for efficient parsing
+ try (BufferedReader stream = new BufferedReader(inputStream)) {
+
+ // Do the parsing and obtain the top-level node
DocumentBuilder parser = DocumentBuilderFactory.newInstance()
.newDocumentBuilder();
parser.setErrorHandler(new DefaultHandler());
@@ -617,10 +615,7 @@
} catch (SAXException e) {
throw new IOException(LaunchingMessages.ScriptRuntime_badFormat);
} catch (ParserConfigurationException e) {
- stream.close();
throw new IOException(LaunchingMessages.ScriptRuntime_badFormat);
- } finally {
- stream.close();
}
// If the top-level node wasn't what we expected, bail out
@@ -835,8 +830,7 @@
Element libLocationsElement) {
NodeList list = libLocationsElement.getChildNodes();
int length = list.getLength();
- List<LibraryLocation> locations = new ArrayList<LibraryLocation>(
- length);
+ List<LibraryLocation> locations = new ArrayList<>(length);
for (int i = 0; i < length; ++i) {
Node node = list.item(i);
short type = node.getNodeType();
@@ -856,8 +850,7 @@
Element environmentVariablesElement) {
NodeList list = environmentVariablesElement.getChildNodes();
int length = list.getLength();
- List<EnvironmentVariable> variables = new ArrayList<EnvironmentVariable>(
- length);
+ List<EnvironmentVariable> variables = new ArrayList<>(length);
for (int i = 0; i < length; ++i) {
Node node = list.item(i);
short type = node.getNodeType();
@@ -875,7 +868,7 @@
/**
* Removes the Interpreter from this container.
- *
+ *
* @param interpreter
* Interpreter intall
*/
diff --git a/core/plugins/org.eclipse.dltk.launching/src/org/eclipse/dltk/internal/launching/InterpreterRuntimeBuildpathEntryResolver.java b/core/plugins/org.eclipse.dltk.launching/src/org/eclipse/dltk/internal/launching/InterpreterRuntimeBuildpathEntryResolver.java
index 8ad20f3..c18aea3 100644
--- a/core/plugins/org.eclipse.dltk.launching/src/org/eclipse/dltk/internal/launching/InterpreterRuntimeBuildpathEntryResolver.java
+++ b/core/plugins/org.eclipse.dltk.launching/src/org/eclipse/dltk/internal/launching/InterpreterRuntimeBuildpathEntryResolver.java
@@ -126,7 +126,7 @@
// determine if bootpath should be explicit
kind = IRuntimeBuildpathEntry.BOOTSTRAP_ENTRY;
}
- List<IRuntimeBuildpathEntry> resolvedEntries = new ArrayList<IRuntimeBuildpathEntry>(
+ List<IRuntimeBuildpathEntry> resolvedEntries = new ArrayList<>(
libs.length);
final IEnvironment environment = interpreter.getEnvironment();
for (int i = 0; i < libs.length; i++) {
@@ -193,7 +193,7 @@
* Return whether the given list of libraries refer to the same archives in
* the same order. Only considers the binary archive (not source or javadoc
* locations).
- *
+ *
* @param libs
* @param defaultLibs
* @return whether the given list of libraries refer to the same archives in
@@ -247,12 +247,12 @@
/**
* Returns a runtime buildpath entry for the given library in the specified
* Interpreter.
- *
+ *
* @param Interpreter
* @param location
* @param kind
* @return runtime buildpath entry
- *
+ *
*/
private IRuntimeBuildpathEntry resolveLibraryLocation(
IInterpreterInstall Interpreter, LibraryLocation location,
diff --git a/core/plugins/org.eclipse.dltk.launching/src/org/eclipse/dltk/internal/launching/ScriptSourceLookupUtil.java b/core/plugins/org.eclipse.dltk.launching/src/org/eclipse/dltk/internal/launching/ScriptSourceLookupUtil.java
index 8662212..6811290 100644
--- a/core/plugins/org.eclipse.dltk.launching/src/org/eclipse/dltk/internal/launching/ScriptSourceLookupUtil.java
+++ b/core/plugins/org.eclipse.dltk.launching/src/org/eclipse/dltk/internal/launching/ScriptSourceLookupUtil.java
@@ -24,16 +24,15 @@
/**
* Translate the runtime buildpath entries into a set of source containers.
- *
+ *
* @param entries
* build path entries
- *
+ *
* @return source container representation of the build path entries
*/
public static ISourceContainer[] translate(
IRuntimeBuildpathEntry[] entries) {
- List<ISourceContainer> containers = new ArrayList<ISourceContainer>(
- entries.length);
+ List<ISourceContainer> containers = new ArrayList<>(entries.length);
for (int i = 0; i < entries.length; i++) {
IRuntimeBuildpathEntry entry = entries[i];
diff --git a/core/plugins/org.eclipse.dltk.launching/src/org/eclipse/dltk/internal/launching/execution/EFSDeployment.java b/core/plugins/org.eclipse.dltk.launching/src/org/eclipse/dltk/internal/launching/execution/EFSDeployment.java
index d5ca6bf..4a44d2c 100644
--- a/core/plugins/org.eclipse.dltk.launching/src/org/eclipse/dltk/internal/launching/execution/EFSDeployment.java
+++ b/core/plugins/org.eclipse.dltk.launching/src/org/eclipse/dltk/internal/launching/execution/EFSDeployment.java
@@ -96,14 +96,8 @@
private static void copy(URL url, IFileStore file)
throws IOException, CoreException {
- InputStream input = null;
- try {
- input = url.openStream();
+ try (InputStream input = url.openStream();) {
copy(input, file);
- } finally {
- if (input != null) {
- input.close();
- }
}
}
diff --git a/core/plugins/org.eclipse.dltk.launching/src/org/eclipse/dltk/launching/AbstractInterpreterInstall.java b/core/plugins/org.eclipse.dltk.launching/src/org/eclipse/dltk/launching/AbstractInterpreterInstall.java
index c9092b8..c6d062b 100644
--- a/core/plugins/org.eclipse.dltk.launching/src/org/eclipse/dltk/launching/AbstractInterpreterInstall.java
+++ b/core/plugins/org.eclipse.dltk.launching/src/org/eclipse/dltk/launching/AbstractInterpreterInstall.java
@@ -43,7 +43,7 @@
* <p>
* Clients implementing interpreter installs must subclass this class.
* </p>
- *
+ *
* @since 2.0
*/
public abstract class AbstractInterpreterInstall
@@ -67,7 +67,7 @@
/**
* Constructs a new interpreter install.
- *
+ *
* @param type
* The type of this interpreter install. Must not be
* <code>null</code>
@@ -212,7 +212,7 @@
/**
* Whether this Interpreter should fire property change notifications.
- *
+ *
* @param notify
*/
protected void setNotify(boolean notify) {
@@ -285,7 +285,7 @@
/**
* Throws a core exception with an error status object built from the given
* message, lower level exception, and error code.
- *
+ *
* @param message
* the status message
* @param exception
@@ -295,7 +295,7 @@
* error code
* @throws CoreException
* the "abort" core exception
- *
+ *
*/
protected void abort(String message, Throwable exception, int code)
throws CoreException {
@@ -423,7 +423,7 @@
if (copy instanceof List<?>) {
return (List<EObject>) copy;
} else {
- return new ArrayList<EObject>(copy);
+ return new ArrayList<>(copy);
}
} else {
return Collections.emptyList();
@@ -436,7 +436,7 @@
@Override
public List<EObject> getExtensions() {
if (resource != null && !resource.getContents().isEmpty()) {
- return new ArrayList<EObject>(resource.getContents());
+ return new ArrayList<>(resource.getContents());
} else {
return Collections.emptyList();
}
@@ -452,7 +452,7 @@
resource = createResource();
oldValue = null;
} else {
- oldValue = new ArrayList<EObject>(resource.getContents());
+ oldValue = new ArrayList<>(resource.getContents());
resource.getContents().clear();
}
resource.getContents().addAll(value);
@@ -469,7 +469,7 @@
if (resource != null && !resource.getContents().isEmpty()) {
StringWriter stringWriter = new StringWriter();
try {
- Map<String, Object> saveOptions = new HashMap<String, Object>();
+ Map<String, Object> saveOptions = new HashMap<>();
saveOptions.put(XMLResource.OPTION_DECLARE_XML, Boolean.FALSE);
saveOptions.put(XMLResource.OPTION_FORMATTED, Boolean.FALSE);
resource.save(new URIConverter.WriteableOutputStream(
diff --git a/core/plugins/org.eclipse.dltk.launching/src/org/eclipse/dltk/launching/AbstractInterpreterRunner.java b/core/plugins/org.eclipse.dltk.launching/src/org/eclipse/dltk/launching/AbstractInterpreterRunner.java
index 038ea11..66f869f 100644
--- a/core/plugins/org.eclipse.dltk.launching/src/org/eclipse/dltk/launching/AbstractInterpreterRunner.java
+++ b/core/plugins/org.eclipse.dltk.launching/src/org/eclipse/dltk/launching/AbstractInterpreterRunner.java
@@ -43,9 +43,9 @@
* <p>
* Clients implementing interpreter runners should subclass this class.
* </p>
- *
+ *
* @see IInterpreterRunner
- *
+ *
*/
public abstract class AbstractInterpreterRunner implements IInterpreterRunner {
private IInterpreterInstall interpreterInstall;
@@ -64,7 +64,7 @@
/**
* String representation of the command line
- *
+ *
* @param commandLine
* @return
*/
@@ -126,7 +126,7 @@
//
protected Map<String, String> getDefaultProcessMap() {
- Map<String, String> map = new HashMap<String, String>();
+ Map<String, String> map = new HashMap<>();
map.put(IProcess.ATTR_PROCESS_TYPE, getProcessType());
return map;
}
@@ -164,7 +164,7 @@
/**
* Returns a new process aborting if the process could not be created.
- *
+ *
* @param launch
* the launch the process is contained in
* @param p
@@ -177,7 +177,7 @@
* @throws CoreException
* problems occurred creating the process
* @since 2.0
- *
+ *
*/
protected IProcess newProcess(ILaunch launch, Process p, String label,
Map<String, String> attributes) throws CoreException {
diff --git a/core/plugins/org.eclipse.dltk.launching/src/org/eclipse/dltk/launching/AbstractScriptLaunchConfigurationDelegate.java b/core/plugins/org.eclipse.dltk.launching/src/org/eclipse/dltk/launching/AbstractScriptLaunchConfigurationDelegate.java
index 6042bd9..86e8cf4 100644
--- a/core/plugins/org.eclipse.dltk.launching/src/org/eclipse/dltk/launching/AbstractScriptLaunchConfigurationDelegate.java
+++ b/core/plugins/org.eclipse.dltk.launching/src/org/eclipse/dltk/launching/AbstractScriptLaunchConfigurationDelegate.java
@@ -76,7 +76,7 @@
/**
* Convenience method to get the launch manager.
- *
+ *
* @return the launch manager
*/
protected ILaunchManager getLaunchManager() {
@@ -86,7 +86,7 @@
/**
* Throws a core exception with an error status object built from the given
* message, lower level exception, and error code.
- *
+ *
* @param message
* the status message
* @param exception
@@ -118,7 +118,7 @@
/**
* Returns the Interpreter install specified by the given launch
* configuration, or <code>null</code> if none.
- *
+ *
* @param configuration
* launch configuration
* @return the Interpreter install specified by the given launch
@@ -134,7 +134,7 @@
/**
* Verifies the Interpreter install specified by the given launch
* configuration exists and returns the Interpreter install.
- *
+ *
* @param configuration
* launch configuration
* @return the Interpreter install specified by the given launch
@@ -172,7 +172,7 @@
/**
* Returns the Interpreter connector identifier specified by the given
* launch configuration, or <code>null</code> if none.
- *
+ *
* @param configuration
* launch configuration
* @return the Interpreter connector identifier specified by the given
@@ -197,7 +197,7 @@
* buildpath as specified by the given launch configuration, as an array of
* resolved strings. The returned array is empty if no buildpath is
* specified.
- *
+ *
* @param configuration
* launch configuration
* @return the buildpath specified by the given launch configuration,
@@ -214,7 +214,7 @@
entries = ScriptRuntime.resolveRuntimeBuildpath(entries, configuration);
// Get USER_ENTRY
- List<String> userEntries = new ArrayList<String>();
+ List<String> userEntries = new ArrayList<>();
for (int i = 0; i < entries.length; i++) {
if (entries[i]
.getBuildpathProperty() == IRuntimeBuildpathEntry.USER_ENTRY) {
@@ -248,7 +248,7 @@
* resolved strings. The returned array is <code>null</code> if all entries
* are standard (i.e. appear by default), or empty to represent an empty
* bootpath.
- *
+ *
* @param configuration
* launch configuration
* @return the bootpath specified by the given launch configuration. An
@@ -270,7 +270,7 @@
IRuntimeBuildpathEntry[] entries = ScriptRuntime
.computeUnresolvedRuntimeBuildpath(configuration);
entries = ScriptRuntime.resolveRuntimeBuildpath(entries, configuration);
- List<String> bootEntries = new ArrayList<String>(entries.length);
+ List<String> bootEntries = new ArrayList<>(entries.length);
boolean empty = true;
boolean allStandard = true;
for (int i = 0; i < entries.length; i++) {
@@ -303,21 +303,21 @@
* part of the boot buildpath -<code>null</code> represents the default
* bootbuildpath. The third array represents the buildpath that should be
* appended to the boot buildpath.
- *
+ *
* @param configuration
* launch configuration
* @return a description of the boot buildpath specified by the given launch
* configuration.
* @exception CoreException
* if unable to retrieve the attribute
- *
+ *
*/
public String[][] getBootpathExt(ILaunchConfiguration configuration)
throws CoreException {
String[][] bootpathInfo = new String[3][];
IRuntimeBuildpathEntry[] entries = ScriptRuntime
.computeUnresolvedRuntimeBuildpath(configuration);
- List<IRuntimeBuildpathEntry> bootEntriesPrepend = new ArrayList<IRuntimeBuildpathEntry>();
+ List<IRuntimeBuildpathEntry> bootEntriesPrepend = new ArrayList<>();
int index = 0;
IRuntimeBuildpathEntry interpreterEnvironmentEntry = null;
IScriptProject project = getScriptProject(configuration);
@@ -347,7 +347,7 @@
}
}
if (interpreterEnvironmentEntry != null) {
- List<IRuntimeBuildpathEntry> bootEntriesAppend = new ArrayList<IRuntimeBuildpathEntry>();
+ List<IRuntimeBuildpathEntry> bootEntriesAppend = new ArrayList<>();
for (; index < entries.length; index++) {
IRuntimeBuildpathEntry entry = entries[index];
if (entry
@@ -441,7 +441,7 @@
/**
* Returns the Script project specified by the given launch configuration,
* or <code>null</code> if none.
- *
+ *
* @param configuration
* launch configuration
* @return the Script project specified by the given launch configuration,
@@ -487,7 +487,7 @@
/**
* Returns the Script project name specified by the given launch
* configuration, or <code>null</code> if none.
- *
+ *
* @param configuration
* launch configuration
* @return the Script project name specified by the given launch
@@ -505,7 +505,7 @@
/**
* Returns the main type name specified by the given launch configuration,
* or <code>null</code> if none.
- *
+ *
* @param configuration
* launch configuration
* @return the main type name specified by the given launch configuration,
@@ -529,7 +529,7 @@
* Returns the program arguments specified by the given launch
* configuration, as a string. The returned string is empty if no program
* arguments are specified.
- *
+ *
* @param configuration
* launch configuration
* @return the program arguments specified by the given launch
@@ -551,7 +551,7 @@
* Returns the Interpreter arguments specified by the given launch
* configuration, as a string. The returned string is empty if no
* Interpreter arguments are specified.
- *
+ *
* @param configuration
* launch configuration
* @return the Interpreter arguments specified by the given launch
@@ -574,7 +574,7 @@
/**
* Returns the Map of Interpreter-specific attributes specified by the given
* launch configuration, or <code>null</code> if none.
- *
+ *
* @param configuration
* launch configuration
* @return the <code>Map</code> of Interpreter-specific attributes
@@ -592,7 +592,7 @@
/**
* Returns the working directory specified by the given launch
* configuration, or <code>null</code> if none.
- *
+ *
* @param configuration
* launch configuration
* @return the working directory specified by the given launch
@@ -608,7 +608,7 @@
/**
* Returns the working directory path specified by the given launch
* configuration, or <code>null</code> if none.
- *
+ *
* @param configuration
* launch configuration
* @return the working directory path specified by the given launch
@@ -641,7 +641,7 @@
* Verifies the working directory specified by the given launch
* configuration exists, and returns the working directory, or
* <code>null</code> if none is specified.
- *
+ *
* @param configuration
* launch configuration
* @return the working directory specified by the given launch
@@ -699,7 +699,7 @@
/**
* Verifies a main script name is specified by the given launch
* configuration, and returns the script type name.
- *
+ *
* @param configuration
* launch configuration
* @return the main type name specified by the given launch configuration
@@ -792,7 +792,7 @@
ILaunchManager.ATTR_ENVIRONMENT_VARIABLES,
(Map<String, String>) null);
// build base environment
- final Map<String, String> env = new HashMap<String, String>();
+ final Map<String, String> env = new HashMap<>();
if (append || configEnv == null) {
Map<String, String> envVars = scriptExecEnvironment
.getEnvironmentVariables(false);
@@ -888,9 +888,9 @@
* reset ATTR_CAPTURE_OUTPUT, since it's not used now. This attribute is
* set in ScriptCommonTab if interactive console is on, but at the
* moment we use another way, so this attribute should be removed.
- *
+ *
* TODO #1: do it in migration delegate?
- *
+ *
* TODO #2: modify ScriptCommonTab so, it would not set it.
*/
launch.setAttribute(DebugPlugin.ATTR_CAPTURE_OUTPUT, null);
@@ -1004,7 +1004,7 @@
protected IPath[] createBuildPath(ILaunchConfiguration configuration,
IEnvironment environment) throws CoreException {
- List<Path> paths = new ArrayList<Path>();
+ List<Path> paths = new ArrayList<>();
// Buildpath
String[] buildpath = getBuildpath(configuration, environment);
@@ -1074,7 +1074,7 @@
/**
* Returns the Interpreter runner for the given launch mode to use when
* launching the given configuration.
- *
+ *
* @param configuration
* launch configuration
* @param mode
@@ -1085,7 +1085,7 @@
* in the given mode
* @throws CoreException
* if a Interpreter runner cannot be determined
- *
+ *
*/
public IInterpreterRunner getInterpreterRunner(
ILaunchConfiguration configuration, String mode)
@@ -1108,13 +1108,13 @@
/**
* Returns an array of environment variables to be used when launching the
* given configuration or <code>null</code> if unspecified.
- *
+ *
* @param configuration
* launch configuration
* @throws CoreException
* if unable to access associated attribute or if unable to
* resolve a variable in an environment variable's value
- *
+ *
*/
public String[] getEnvironment(ILaunchConfiguration configuration)
throws CoreException {
@@ -1125,13 +1125,13 @@
/**
* Returns the default working directory for the given launch configuration,
* or <code>null</code> if none. Subclasses may override as necessary.
- *
+ *
* @param configuration
* @return default working directory or <code>null</code> if none
* @throws CoreException
* if an exception occurs computing the default working
* directory
- *
+ *
*/
protected IPath getDefaultWorkingDirectory(
ILaunchConfiguration configuration) throws CoreException {
diff --git a/core/plugins/org.eclipse.dltk.launching/src/org/eclipse/dltk/launching/DebugSessionAcceptor.java b/core/plugins/org.eclipse.dltk.launching/src/org/eclipse/dltk/launching/DebugSessionAcceptor.java
index 0e4780a..60415df 100644
--- a/core/plugins/org.eclipse.dltk.launching/src/org/eclipse/dltk/launching/DebugSessionAcceptor.java
+++ b/core/plugins/org.eclipse.dltk.launching/src/org/eclipse/dltk/launching/DebugSessionAcceptor.java
@@ -31,7 +31,7 @@
implements IDbgpThreadAcceptor, IScriptDebugTargetListener {
private static class NopLaunchStatusHandler
- implements ILaunchStatusHandler, ILaunchStatusHandlerExtension {
+ implements ILaunchStatusHandlerExtension {
@Override
public void initialize(IDebugTarget target, IProgressMonitor monitor) {
diff --git a/core/plugins/org.eclipse.dltk.launching/src/org/eclipse/dltk/launching/InternalScriptExecutor.java b/core/plugins/org.eclipse.dltk.launching/src/org/eclipse/dltk/launching/InternalScriptExecutor.java
index 15fab82..d6384eb 100644
--- a/core/plugins/org.eclipse.dltk.launching/src/org/eclipse/dltk/launching/InternalScriptExecutor.java
+++ b/core/plugins/org.eclipse.dltk.launching/src/org/eclipse/dltk/launching/InternalScriptExecutor.java
@@ -15,7 +15,7 @@
/**
* Utility class which may be used to execute a script, or perform an
* interpreter action on a script, such as compilation.
- *
+ *
* @see IScriptProcessHandler
*/
public class InternalScriptExecutor {
@@ -32,8 +32,7 @@
public InternalScriptExecutor(IInterpreterInstall install,
IScriptProcessHandler handler) {
- Assert.isNotNull(
- install,
+ Assert.isNotNull(install,
Messages.InternalScriptExecutor_iInterpreterInstallMustNotBeNull);
Assert.isNotNull(handler,
Messages.InternalScriptExecutor_iProcessHandlerMustNotBeNull);
@@ -44,21 +43,21 @@
/**
* Execute a script.
- *
+ *
* @param deployer
* implementation of <code>IInternalScriptDeployer</code> to
* deploy the script being executed.
- *
+ *
* @param interpreterArgs
* command line arguments for the interpreter, may be
* <code>null</code>
- *
+ *
* @param scriptArgs
* command line arguments for the script, may be
* <code>null</code>
* @param stdin
* stdin to pass to script, may be <code>null</code>
- *
+ *
* @throws CoreException
* if there was an error handling the process
* @throws IOException
@@ -94,16 +93,16 @@
/**
* Execute an interpreter action.
- *
+ *
* @param interpreterArgs
* command line arguments for the interpreter, may be
* <code>null</code>
* @param stdin
* stdin to pass to script, may be <code>null</code>
- *
+ *
* @throws CoreException
* if there was an error handling the process
- *
+ *
* @throws CoreException
*/
public ScriptResult execute(String[] interpreterArgs, char[] stdin)
@@ -128,7 +127,7 @@
private String[] buildCommandLine(IFileHandle interpreter,
String[] interpreterArgs, IFileHandle script, String[] scriptArgs) {
- List<String> cmdLine = new ArrayList<String>();
+ List<String> cmdLine = new ArrayList<>();
cmdLine.add(interpreter.getCanonicalPath());
addArgs(cmdLine, interpreterArgs);
diff --git a/core/plugins/org.eclipse.dltk.launching/src/org/eclipse/dltk/launching/InterpreterConfig.java b/core/plugins/org.eclipse.dltk.launching/src/org/eclipse/dltk/launching/InterpreterConfig.java
index 05e0cf9..3e5b132 100644
--- a/core/plugins/org.eclipse.dltk.launching/src/org/eclipse/dltk/launching/InterpreterConfig.java
+++ b/core/plugins/org.eclipse.dltk.launching/src/org/eclipse/dltk/launching/InterpreterConfig.java
@@ -85,10 +85,10 @@
: scriptFile.removeLastSegments(1);
}
- this.interpreterArgs = new ArrayList<String>();
- this.scriptArgs = new ArrayList<String>();
- this.environmentVariables = new HashMap<String, String>();
- this.properties = new HashMap<String, Object>();
+ this.interpreterArgs = new ArrayList<>();
+ this.scriptArgs = new ArrayList<>();
+ this.environmentVariables = new HashMap<>();
+ this.properties = new HashMap<>();
}
public InterpreterConfig() {
@@ -271,7 +271,7 @@
}
public String[] getEnvironmentAsStrings() {
- ArrayList<String> list = new ArrayList<String>();
+ ArrayList<String> list = new ArrayList<>();
Iterator<String> it = environmentVariables.keySet().iterator();
while (it.hasNext()) {
String key = it.next();
@@ -287,8 +287,8 @@
EnvironmentVariable[] variables = EnvironmentResolver
.resolve(getEnvVars(), vars, true);
- Set<String> pressentVars = new HashSet<String>();
- ArrayList<String> list = new ArrayList<String>();
+ Set<String> pressentVars = new HashSet<>();
+ ArrayList<String> list = new ArrayList<>();
if (variables != null) {
for (int i = 0; i < variables.length; i++) {
String name = variables[i].getName();
@@ -343,7 +343,7 @@
}
public String[] renderCommandLine(IInterpreterInstall interpreter) {
- final List<String> items = new ArrayList<String>();
+ final List<String> items = new ArrayList<>();
items.add(interpreter.getInstallLocation().toOSString());
items.addAll(interpreterArgs);
@@ -361,7 +361,7 @@
protected String[] renderCommandLine(IEnvironment environment,
IPath interpreter) {
- final List<String> items = new ArrayList<String>();
+ final List<String> items = new ArrayList<>();
items.add(environment.convertPathToString(interpreter));
items.addAll(interpreterArgs);
@@ -382,7 +382,7 @@
// TODO: make more real implementation
@Override
public String toString() {
- final List<String> items = new ArrayList<String>();
+ final List<String> items = new ArrayList<>();
items.add("<interpreter>"); //$NON-NLS-1$
items.addAll(interpreterArgs);
items.add(String.valueOf(scriptFile));
diff --git a/core/plugins/org.eclipse.dltk.launching/src/org/eclipse/dltk/launching/InterpreterContainerHelper.java b/core/plugins/org.eclipse.dltk.launching/src/org/eclipse/dltk/launching/InterpreterContainerHelper.java
index 2692399..03f4006 100644
--- a/core/plugins/org.eclipse.dltk.launching/src/org/eclipse/dltk/launching/InterpreterContainerHelper.java
+++ b/core/plugins/org.eclipse.dltk.launching/src/org/eclipse/dltk/launching/InterpreterContainerHelper.java
@@ -13,7 +13,6 @@
import org.eclipse.dltk.core.IBuildpathEntry;
import org.eclipse.dltk.core.IScriptProject;
import org.eclipse.dltk.core.ModelException;
-import org.eclipse.dltk.internal.core.BuildpathEntry;
import org.eclipse.dltk.utils.TextUtils;
public class InterpreterContainerHelper {
@@ -54,7 +53,8 @@
for (int j = 0; j < split.length; j++) {
packages.add(split[j]);
}
- } else if (extraAttributes[i].getName().equals(PACKAGES_AUTO_ATTR)) {
+ } else if (extraAttributes[i].getName()
+ .equals(PACKAGES_AUTO_ATTR)) {
String value = extraAttributes[i].getValue();
String[] split = split(value);
for (int j = 0; j < split.length; j++) {
@@ -80,18 +80,18 @@
e1.printStackTrace();
}
}
- IPath containerName = new Path(CONTAINER_PATH).append(project
- .getElementName());
+ IPath containerName = new Path(CONTAINER_PATH)
+ .append(project.getElementName());
- List<IBuildpathEntry> newBuildpath = new ArrayList<IBuildpathEntry>();
+ List<IBuildpathEntry> newBuildpath = new ArrayList<>();
boolean found = false;
for (int i = 0; i < rawBuildpath.length; i++) {
if (!rawBuildpath[i].getPath().segment(0).equals(CONTAINER_PATH)) {
newBuildpath.add(rawBuildpath[i]);
} else {
found = true;
- newBuildpath.add(createPackagesContainer(packages,
- autoPackages, rawBuildpath[i].getPath()));
+ newBuildpath.add(createPackagesContainer(packages, autoPackages,
+ rawBuildpath[i].getPath()));
}
}
if (!found) {
@@ -111,7 +111,7 @@
public static IBuildpathEntry createPackagesContainer(Set<String> names,
Set<String> autoPackages, IPath containerName) {
- final List<IBuildpathAttribute> attributes = new ArrayList<IBuildpathAttribute>(
+ final List<IBuildpathAttribute> attributes = new ArrayList<>(
2);
if (names != null && !names.isEmpty()) {
attributes.add(DLTKCore.newBuildpathAttribute(PACKAGES_ATTR,
@@ -122,13 +122,13 @@
pkgsToString(autoPackages)));
}
return DLTKCore.newContainerEntry(containerName,
- BuildpathEntry.NO_ACCESS_RULES,
+ IBuildpathEntry.NO_ACCESS_RULES,
attributes.toArray(new IBuildpathAttribute[attributes.size()]),
false/* not exported */);
}
private static String pkgsToString(Set<String> names) {
- final List<String> sorted = new ArrayList<String>(names);
+ final List<String> sorted = new ArrayList<>(names);
Collections.sort(sorted);
return TextUtils.join(sorted, SEPARATOR);
}
diff --git a/core/plugins/org.eclipse.dltk.launching/src/org/eclipse/dltk/launching/InterpreterSearcher.java b/core/plugins/org.eclipse.dltk.launching/src/org/eclipse/dltk/launching/InterpreterSearcher.java
index 4fc09b4..cfe00d3 100644
--- a/core/plugins/org.eclipse.dltk.launching/src/org/eclipse/dltk/launching/InterpreterSearcher.java
+++ b/core/plugins/org.eclipse.dltk.launching/src/org/eclipse/dltk/launching/InterpreterSearcher.java
@@ -58,7 +58,7 @@
// Folder list
final String separator = environment.getPathsSeparator();
- 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]));
@@ -79,7 +79,7 @@
* 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 directory
* @param found
* @param types
@@ -106,7 +106,7 @@
return;
}
- List<IFileHandle> subDirs = new ArrayList<IFileHandle>();
+ List<IFileHandle> subDirs = new ArrayList<>();
for (int i = 0; i < files.length; i++) {
if (monitor.isCanceled()) {
return;
@@ -160,9 +160,9 @@
}
public InterpreterSearcher() {
- this.searchedDirs = new HashSet<IFileHandle>();
- this.found = new ArrayList<IFileHandle>();
- this.types = new ArrayList<IInterpreterInstallType>();
+ this.searchedDirs = new HashSet<>();
+ this.found = new ArrayList<>();
+ this.types = new ArrayList<>();
}
public void search(IEnvironment environment, String natureId,
diff --git a/core/plugins/org.eclipse.dltk.launching/src/org/eclipse/dltk/launching/LaunchLogger.java b/core/plugins/org.eclipse.dltk.launching/src/org/eclipse/dltk/launching/LaunchLogger.java
index d5540ff..e120010 100644
--- a/core/plugins/org.eclipse.dltk.launching/src/org/eclipse/dltk/launching/LaunchLogger.java
+++ b/core/plugins/org.eclipse.dltk.launching/src/org/eclipse/dltk/launching/LaunchLogger.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 (Alex Panchenko)
@@ -32,18 +32,9 @@
@Override
public void logLine(String line) {
final File file = new File(System.getProperty("user.home"), fileName);
- try {
- final FileWriter writer = new FileWriter(file, true);
- try {
- writer.write(line);
- writer.write("\n");
- } finally {
- try {
- writer.close();
- } catch (IOException e) {
- // ignore
- }
- }
+ try (final FileWriter writer = new FileWriter(file, true)) {
+ writer.write(line);
+ writer.write("\n");
} catch (IOException e) {
// ignore?
}
diff --git a/core/plugins/org.eclipse.dltk.launching/src/org/eclipse/dltk/launching/ScriptRuntime.java b/core/plugins/org.eclipse.dltk.launching/src/org/eclipse/dltk/launching/ScriptRuntime.java
index 64e897d..1504240 100644
--- a/core/plugins/org.eclipse.dltk.launching/src/org/eclipse/dltk/launching/ScriptRuntime.java
+++ b/core/plugins/org.eclipse.dltk.launching/src/org/eclipse/dltk/launching/ScriptRuntime.java
@@ -1,11 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 IBM Corporation and others.
+ * Copyright (c) 2005, 2016 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.launching;
@@ -124,7 +123,7 @@
* <li>Identifier of a contributed execution environment</li>
* </ol>
* </p>
- *
+ *
*/
public static final String INTERPRETER_CONTAINER = DLTKLaunchingPlugin
.getUniqueIdentifier() + ".INTERPRETER_CONTAINER"; //$NON-NLS-1$
@@ -134,19 +133,19 @@
* <code>"runtimeBuildpathEntryResolvers"</code>) for the runtime buildpath
* entry resolvers extension point.
*/
- public static final String EXTENSION_POINT_RUNTIME_BUILDPATH_ENTRY_RESOLVERS = "runtimeBuildpathEntryResolvers"; //$NON-NLS-1$
+ public static final String EXTENSION_POINT_RUNTIME_BUILDPATH_ENTRY_RESOLVERS = "runtimeBuildpathEntryResolvers"; //$NON-NLS-1$
/**
* Simple identifier constant (value <code>"buildpathProviders"</code>) for
* the runtime buildpath providers extension point.
*/
- public static final String EXTENSION_POINT_RUNTIME_BUILDPATH_PROVIDERS = "buildpathProviders"; //$NON-NLS-1$
+ public static final String EXTENSION_POINT_RUNTIME_BUILDPATH_PROVIDERS = "buildpathProviders"; //$NON-NLS-1$
/**
* Simple identifier constant (value <code>"interpreterInstalls"</code>) for
* the interpreters installs extension point.
*/
- public static final String EXTENSION_POINT_INTERPRETER_INSTALLS = "interpreterInstalls"; //$NON-NLS-1$
+ public static final String EXTENSION_POINT_INTERPRETER_INSTALLS = "interpreterInstalls"; //$NON-NLS-1$
/**
* A status code indicating that a interpreter could not be resolved for a
@@ -274,12 +273,12 @@
* Contain association of default interpreter entries to interprter
* identifiers.
*/
- private static Map<DefaultInterpreterEntry, String> fgDefaultInterpreterId = new HashMap<DefaultInterpreterEntry, String>();
+ private static Map<DefaultInterpreterEntry, String> fgDefaultInterpreterId = new HashMap<>();
/**
* Contain DefaultInterpreterEntry entry assocications
*/
- private static Map<DefaultInterpreterEntry, String> fgDefaultInterpreterConnectorId = new HashMap<DefaultInterpreterEntry, String>();
+ private static Map<DefaultInterpreterEntry, String> fgDefaultInterpreterConnectorId = new HashMap<>();
/**
* Resolvers keyed by variable name, container id, and runtime buildpath
@@ -310,14 +309,14 @@
* cycles in project dependencies when resolving buildpath container
* entries. Counters used to know when entering/exiting to clear cache
*/
- private static ThreadLocal<List<IScriptProject>> fgProjects = new ThreadLocal<List<IScriptProject>>();
- private static ThreadLocal<Integer> fgEntryCount = new ThreadLocal<Integer>();
+ private static ThreadLocal<List<IScriptProject>> fgProjects = new ThreadLocal<>();
+ private static ThreadLocal<Integer> fgEntryCount = new ThreadLocal<>();
/**
* Set of IDs of Interpreters contributed via InterpreterInstalls extension
* point.
*/
- private static Set<String> fgContributedInterpreters = new HashSet<String>();
+ private static Set<String> fgContributedInterpreters = new HashSet<>();
/**
* This class contains only static methods, and is not intended to be
@@ -354,7 +353,7 @@
// only happens on a CoreException
DLTKLaunchingPlugin.log(status);
// cleanup null entries in fgInterpreterTypes
- List<IInterpreterInstallType> temp = new ArrayList<IInterpreterInstallType>(
+ List<IInterpreterInstallType> temp = new ArrayList<>(
fgInterpreterTypes.length);
for (int i = 0; i < fgInterpreterTypes.length; i++) {
if (fgInterpreterTypes[i] != null) {
@@ -386,7 +385,7 @@
* Returns the interpreter assigned to build the given script project. The
* project must exist. The interpreter assigned to a project is determined
* from its build path.
- *
+ *
* @param project
* the project to retrieve the interpreter from
* @return the interpreter instance that is assigned to build the given
@@ -406,8 +405,8 @@
IBuildpathEntry entry = buildpath[i];
switch (entry.getEntryKind()) {
case IBuildpathEntry.BPE_CONTAINER:
- IRuntimeBuildpathEntryResolver resolver = getContainerResolver(entry
- .getPath().segment(0));
+ IRuntimeBuildpathEntryResolver resolver = getContainerResolver(
+ entry.getPath().segment(0));
if (resolver != null) {
interpreter = resolver.resolveInterpreterInstall(
getNatureFromProject(project),
@@ -426,7 +425,7 @@
/**
* Returns the interpreter install type with the given unique id.
- *
+ *
* @param id
* the interpreter install type unique id
* @return The interpreter install type for the given id, or
@@ -452,7 +451,7 @@
/**
* Sets a Interpreter as the system-wide default Interpreter, and notifies
* registered Interpreter install change listeners of the change.
- *
+ *
* @param interpreter
* The Interpreter to make the default. May be <code>null</code>
* to clear the default.
@@ -468,7 +467,7 @@
/**
* Sets a Interpreter as the nature default Interpreter, and notifies
* registered Interpreter install change listeners of the change.
- *
+ *
* @param interpreter
* The Interpreter to make the default. May be <code>null</code>
* to clear the default.
@@ -477,7 +476,7 @@
* @param savePreference
* If <code>true</code>, update workbench preferences to reflect
* the new default Interpreter.
- *
+ *
*/
public static void setDefaultInterpreterInstall(
IInterpreterInstall interpreter, IProgressMonitor monitor,
@@ -493,8 +492,8 @@
DefaultInterpreterEntry defaultInterpreterID = new DefaultInterpreterEntry(
nature, environmentId);
if (fgDefaultInterpreterId.get(defaultInterpreterID) != null) {
- previous = getInterpreterFromCompositeId(fgDefaultInterpreterId
- .get(defaultInterpreterID));
+ previous = getInterpreterFromCompositeId(
+ fgDefaultInterpreterId.get(defaultInterpreterID));
}
fgDefaultInterpreterId.put(defaultInterpreterID,
getCompositeIdFromInterpreter(interpreter));
@@ -503,8 +502,8 @@
}
IInterpreterInstall current = null;
if (fgDefaultInterpreterId.get(defaultInterpreterID) != null) {
- current = getInterpreterFromCompositeId(fgDefaultInterpreterId
- .get(defaultInterpreterID));
+ current = getInterpreterFromCompositeId(
+ fgDefaultInterpreterId.get(defaultInterpreterID));
}
if (previous != current) {
notifyDefaultInterpreterChanged(previous, current);
@@ -526,13 +525,14 @@
/**
* Return the default Interpreter set with
* <code>setDefaultInterpreter()</code>.
- *
+ *
* @return Returns the default Interpreter.
*/
@Deprecated
public static IInterpreterInstall getDefaultInterpreterInstall(
DefaultInterpreterEntry entry) {
- IInterpreterInstall install = getInterpreterFromCompositeId(getDefaultInterpreterId(entry));
+ IInterpreterInstall install = getInterpreterFromCompositeId(
+ getDefaultInterpreterId(entry));
if (install != null && install.getInstallLocation().exists()) {
return install;
}
@@ -541,7 +541,8 @@
// install.getInterpreterInstallType().disposeInterpreterInstall(
// install.getId());
}
- if (!hasInterpreterInstalls(entry.getNature(), entry.getEnvironment())) {
+ if (!hasInterpreterInstalls(entry.getNature(),
+ entry.getEnvironment())) {
/*
* If there are no any interpreters for the specified nature and
* environment - just return null and avoid re-initialization.
@@ -562,7 +563,7 @@
/**
* Tests if there are any interpreters for the specified nature and host.
- *
+ *
* @param natureId
* @param environmentId
* @return
@@ -572,7 +573,8 @@
if (environmentId == null) {
return false;
}
- for (IInterpreterInstallType type : getInterpreterInstallTypes(natureId)) {
+ for (IInterpreterInstallType type : getInterpreterInstallTypes(
+ natureId)) {
for (IInterpreterInstall install : type.getInterpreterInstalls()) {
if (environmentId.equals(install.getEnvironmentId())) {
return true;
@@ -587,7 +589,7 @@
* registered via <code>"org.eclipse.dltk.launching.interpreterTypes"</code>
* extension point. Returns an empty list if there are no registered
* interpreter types.
- *
+ *
* @return the list of registered Interpreter types
*/
public static IInterpreterInstallType[] getInterpreterInstallTypes() {
@@ -601,12 +603,12 @@
* <code>"org.eclipse.dltk.launching.interpreterTypes"</code> extension
* point. Returns an empty list if there are no registered interpreter
* types.
- *
+ *
* @return the list of registered Interpreter types
*/
public static IInterpreterInstallType[] getInterpreterInstallTypes(
String nature) {
- List<IInterpreterInstallType> res = new ArrayList<IInterpreterInstallType>();
+ List<IInterpreterInstallType> res = new ArrayList<>();
synchronized (fgInterpreterLock) {
initializeInterpreters();
for (int i = 0; i < fgInterpreterTypes.length; i++) {
@@ -623,7 +625,8 @@
return set.toArray(new DefaultInterpreterEntry[set.size()]);
}
- private static String getDefaultInterpreterId(DefaultInterpreterEntry entry) {
+ private static String getDefaultInterpreterId(
+ DefaultInterpreterEntry entry) {
initializeInterpreters();
return fgDefaultInterpreterId.get(entry);
}
@@ -637,11 +640,11 @@
/**
* Returns a String that uniquely identifies the specified Interpreter
* across all Interpreter types.
- *
+ *
* @param interpreter
* the instance of IInterpreterInstallType to be identified
- *
- *
+ *
+ *
*/
public static String getCompositeIdFromInterpreter(
IInterpreterInstall interpreter) {
@@ -651,20 +654,20 @@
IInterpreterInstallType interpreterType = interpreter
.getInterpreterInstallType();
String typeID = interpreterType.getId();
- CompositeId id = new CompositeId(new String[] { typeID,
- interpreter.getId() });
+ CompositeId id = new CompositeId(
+ new String[] { typeID, interpreter.getId() });
return id.toString();
}
/**
* Return the Interpreter corresponding to the specified composite Id. The
* id uniquely identifies a Interpreter across all Interpreter types.
- *
+ *
* @param idString
* the composite id that specifies an instance of
* IInterpreterInstall
- *
- *
+ *
+ *
*/
public static IInterpreterInstall getInterpreterFromCompositeId(
String idString) {
@@ -673,8 +676,8 @@
}
CompositeId id = CompositeId.fromString(idString);
if (id.getPartCount() == 2) {
- IInterpreterInstallType InterpreterType = getInterpreterInstallType(id
- .get(0));
+ IInterpreterInstallType InterpreterType = getInterpreterInstallType(
+ id.get(0));
if (InterpreterType != null) {
return InterpreterType.findInterpreterInstall(id.get(1));
}
@@ -685,10 +688,10 @@
/**
* Return the <code>IScriptProject</code> referenced in the specified
* configuration or <code>null</code> if none.
- *
+ *
* @exception CoreException
* if the referenced Script project does not exist
- *
+ *
*/
public static IScriptProject getScriptProject(
ILaunchConfiguration configuration) throws CoreException {
@@ -698,18 +701,19 @@
if ((projectName == null) || (projectName.trim().length() < 1)) {
return null;
}
- IScriptProject scriptProject = getScriptModel().getScriptProject(
- projectName);
+ IScriptProject scriptProject = getScriptModel()
+ .getScriptProject(projectName);
if (scriptProject != null && scriptProject.getProject().exists()
&& !scriptProject.getProject().isOpen()) {
abort(MessageFormat.format(LaunchingMessages.ScriptRuntime_28,
configuration.getName(), projectName),
- ScriptLaunchConfigurationConstants.ERR_PROJECT_CLOSED, null);
+ ScriptLaunchConfigurationConstants.ERR_PROJECT_CLOSED,
+ null);
}
if ((scriptProject == null) || !scriptProject.exists()) {
- abort(MessageFormat
- .format(LaunchingMessages.ScriptRuntime_Launch_configuration__0__references_non_existing_project__1___1,
- configuration.getName(), projectName),
+ abort(MessageFormat.format(
+ LaunchingMessages.ScriptRuntime_Launch_configuration__0__references_non_existing_project__1___1,
+ configuration.getName(), projectName),
ScriptLaunchConfigurationConstants.ERR_NOT_A_SCRIPT_PROJECT,
null);
}
@@ -730,18 +734,19 @@
* <li>The Interpreter install is explicitly specified on the launch
* configuration via the <code>ATTR_CONTAINER_PATH</code> attribute.</li>
* <li>If no explicit Interpreter install is specified, the Interpreter
- * install associated with the launch configuration's project is returned.</li>
+ * install associated with the launch configuration's project is
+ * returned.</li>
* <li>If no project is specified, or the project does not specify a custom
* Interpreter install, the workspace default Interpreter install is
* returned.</li>
* </ol>
- *
+ *
* @param configuration
* launch configuration
* @return interpreter install
* @exception CoreException
* if unable to compute a Interpreter install
- *
+ *
*/
public static IInterpreterInstall computeInterpreterInstall(
ILaunchConfiguration configuration) throws CoreException {
@@ -769,8 +774,8 @@
} else {
IPath interpreterPath = Path.fromPortableString(containerPath);
IBuildpathEntry entry = DLTKCore.newContainerEntry(interpreterPath);
- IRuntimeBuildpathEntryResolver2 resolver = getContainerResolver(interpreterPath
- .segment(0));
+ IRuntimeBuildpathEntryResolver2 resolver = getContainerResolver(
+ interpreterPath.segment(0));
if (resolver != null) {
return resolver.resolveInterpreterInstall(nature, environment,
entry);
@@ -803,7 +808,7 @@
/**
* Throws a core exception with an internal error status.
- *
+ *
* @param message
* the status message
* @param exception
@@ -819,14 +824,14 @@
/**
* Throws a core exception with an internal error status.
- *
+ *
* @param message
* the status message
* @param code
* status code
* @param exception
* lower level exception associated with the
- *
+ *
* error, or <code>null</code> if none
*/
private static CoreException abort(String message, int code,
@@ -903,21 +908,21 @@
* preference or old Interpreter configurations file. The interpreters found
* in the preference or interpreter configurations file are added to the
* given Interpreter definitions container.
- *
+ *
* Returns whether the user preferences should be set - i.e. if it was not
* already set when initialized.
*/
private static boolean addPersistedInterpreters(
InterpreterDefinitionsContainer interpreterDefs) {
// Try retrieving the interpreter preferences from the preference store
- String interpreterXMLString = getPreferences().get(
- PREF_INTERPRETER_XML, "");
+ String interpreterXMLString = getPreferences().get(PREF_INTERPRETER_XML,
+ "");
if (interpreterXMLString.length() == 0) {
// default scope value could be specified in the
// plugin_customization.ini file
- interpreterXMLString = DefaultScope.INSTANCE.getNode(
- DLTKLaunchingPlugin.PLUGIN_ID)
+ interpreterXMLString = DefaultScope.INSTANCE
+ .getNode(DLTKLaunchingPlugin.PLUGIN_ID)
.get(PREF_INTERPRETER_XML, "");
}
@@ -925,8 +930,8 @@
if (interpreterXMLString.length() > 0) {
try {
Reader inputStream = new StringReader(interpreterXMLString);
- InterpreterDefinitionsContainer.parseXMLIntoContainer(
- inputStream, interpreterDefs);
+ InterpreterDefinitionsContainer
+ .parseXMLIntoContainer(inputStream, interpreterDefs);
return false;
} catch (IOException ioe) {
DLTKLaunchingPlugin.log(ioe);
@@ -937,11 +942,11 @@
/**
* Performs string substitution on the given expression.
- *
+ *
* @param expression
* @return expression after string substitution
* @throws CoreException
- *
+ *
*/
private static String substitute(String expression) throws CoreException {
return VariablesPlugin.getDefault().getStringVariableManager()
@@ -951,12 +956,12 @@
/**
* Returns whether the Interpreter install with the specified id was
* contributed via the InterpreterInstalls extension point.
- *
+ *
* @param id
* Interpreter id
* @return whether the Interpreter install was contributed via extension
* point
- *
+ *
*/
public static boolean isContributedInterpreterInstall(String id) {
getInterpreterInstallTypes(); // ensure Interpreters are initialized
@@ -967,9 +972,9 @@
* Evaluates library locations for a IInterpreterInstall. If no library
* locations are set on the install, a default location is evaluated and
* checked if it exists.
- *
+ *
* @return library locations with paths that exist or are empty
- *
+ *
*/
public static LibraryLocation[] getLibraryLocations(
IInterpreterInstall interperterInstall) {
@@ -989,12 +994,12 @@
interperterInstall.getInstallLocation(),
interperterInstall.getEnvironmentVariables(), monitor);
- List<LibraryLocation> existingDefaultLocations = new ArrayList<LibraryLocation>();
+ List<LibraryLocation> existingDefaultLocations = new ArrayList<>();
for (int i = 0; i < defaultLocations.length; ++i) {
LibraryLocation location = defaultLocations[i];
- IFileHandle file = EnvironmentPathUtils.getFile(location
- .getLibraryPath());
+ IFileHandle file = EnvironmentPathUtils
+ .getFile(location.getLibraryPath());
if (file.exists()) {
existingDefaultLocations.add(location);
}
@@ -1007,10 +1012,10 @@
/**
* Creates and returns a buildpath entry describing the default interpreter
* container entry.
- *
+ *
* @return a new IBuildpathEntry that describes the default interpreter
* container entry
- *
+ *
*/
public static IBuildpathEntry getDefaultInterpreterContainerEntry() {
return DLTKCore.newContainerEntry(newDefaultInterpreterContainerPath());
@@ -1019,9 +1024,9 @@
/**
* Returns a path for the interpreter buildpath container identifying the
* default interpreter install.
- *
+ *
* @return buildpath container path
- *
+ *
*/
public static IPath newDefaultInterpreterContainerPath() {
return new Path(INTERPRETER_CONTAINER);
@@ -1030,11 +1035,11 @@
/**
* Returns a path for the interpreter buildpath container identifying the
* specified Interpreter install by type and name.
- *
+ *
* @param Interpreter
* Interpreter install
* @return buildpath container path
- *
+ *
*/
public static IPath newInterpreterContainerPath(
IInterpreterInstall interpreter) {
@@ -1049,15 +1054,16 @@
/**
* Returns a path for the InterpreterEnvironment buildpath container
* identifying the specified Interpreter install by type and name.
- *
+ *
* @param typeId
* Interpreter install type identifier
* @param name
* Interpreter install name
* @return buildpath container path
- *
+ *
*/
- public static IPath newInterpreterContainerPath(String typeId, String name) {
+ public static IPath newInterpreterContainerPath(String typeId,
+ String name) {
if (typeId == null || name == null) {
return null;
}
@@ -1072,12 +1078,12 @@
* Returns the InterpreterEnvironment referenced by the specified
* InterpreterEnvironment buildpath container path or <code>null</code> if
* none.
- *
+ *
* @param InterpreterEnvironmentContainerPath
* @return InterpreterEnvironment referenced by the specified
* InterpreterEnvironment buildpath container path or
* <code>null</code>
- *
+ *
*/
public static IInterpreterInstall getInterpreterInstall(String nature,
String environment, IPath InterpreterEnvironmentContainerPath) {
@@ -1092,28 +1098,29 @@
/**
* Returns the <code>IInterpreterInstall</code> represented by the specified
* <code>compositeId</code>.
- *
+ *
* <p>
* If an interpreter can not be found for the given <code>compositeId</code>
* , the default interpreter for the specified <code>natureId</code> will be
* returned.
- *
+ *
* If no default interpreter has been configured, <code>null</code> will be
* returned.
* </p>
- *
+ *
* @param compositeId
* the composite id that specifies an instance of
* IInterpreterInstall
* @param natureId
* nature id
- *
+ *
* @return IInterpreterInstall instance or <code>null</code> if one can not
* be found.
*/
public static IInterpreterInstall getInterpreterInstall(String compositeId,
String natureId) {
- IInterpreterInstall install = getInterpreterFromCompositeId(compositeId);
+ IInterpreterInstall install = getInterpreterFromCompositeId(
+ compositeId);
if (install == null) {
DefaultInterpreterEntry entry = new DefaultInterpreterEntry(
natureId, LocalEnvironment.ENVIRONMENT_ID);
@@ -1127,10 +1134,10 @@
* Returns the identifier of the Interpreter install type referenced by the
* given InterpreterEnvironment buildpath container path, or
* <code>null</code> if none.
- *
+ *
* @param InterpreterEnvironmentContainerPath
* @return Interpreter install type identifier or <code>null</code>
- *
+ *
*/
public static String getInterpreterInstallTypeId(
IPath InterpreterEnvironmentContainerPath) {
@@ -1142,10 +1149,10 @@
* Returns the name of the Interpreter install referenced by the given
* InterpreterEnvironment buildpath container path, or <code>null</code> if
* none.
- *
+ *
* @param InterpreterEnvironmentContainerPath
* @return Interpreter name or <code>null</code>
- *
+ *
*/
public static String getInterpreterInstallName(
IPath InterpreterEnvironmentContainerPath) {
@@ -1171,7 +1178,7 @@
* workspace default interpreter is used to create a container path.</li>
* </ol>
* </p>
- *
+ *
* @param configuration
* @return buildpath container path identifying a interpreter or
* <code>null</code>
@@ -1208,14 +1215,14 @@
* referenced by the specified project, or <code>null</code> if none. The
* entry returned represents a either a buildpath variable or buildpath
* container that resolves to a InterpreterEnvironment.
- *
+ *
* @param project
* Script project
* @return InterpreterEnvironment runtime buildpath entry or
* <code>null</code>
* @exception org.eclipse.core.runtime.CoreException
* if an exception occurs accessing the project's buildpath
- *
+ *
*/
public static IRuntimeBuildpathEntry computeInterpreterEntry(
IScriptProject project) throws CoreException {
@@ -1231,7 +1238,8 @@
getNatureFromProject(project),
getEnvironmentFromProject(project), entry)) {
IBuildpathContainer container = DLTKCore
- .getBuildpathContainer(entry.getPath(), project);
+ .getBuildpathContainer(entry.getPath(),
+ project);
if (container != null) {
switch (container.getKind()) {
case IBuildpathContainer.K_APPLICATION:
@@ -1258,11 +1266,11 @@
/**
* Returns whether the given runtime buildpath entry refers to a Interpreter
* install.
- *
+ *
* @param entry
* @return whether the given runtime buildpath entry refers to a Interpreter
* install
- *
+ *
*/
public static boolean isInterpreterInstallReference(String lang,
String environment, IRuntimeBuildpathEntry entry) {
@@ -1270,8 +1278,8 @@
if (buildpathEntry != null) {
switch (buildpathEntry.getEntryKind()) {
case IBuildpathEntry.BPE_CONTAINER:
- IRuntimeBuildpathEntryResolver2 resolver = getContainerResolver(buildpathEntry
- .getPath().segment(0));
+ IRuntimeBuildpathEntryResolver2 resolver = getContainerResolver(
+ buildpathEntry.getPath().segment(0));
if (resolver != null) {
return resolver.isInterpreterInstallReference(lang,
environment, buildpathEntry);
@@ -1286,10 +1294,10 @@
* Adds the given listener to the list of registered Interpreter install
* changed listeners. Has no effect if an identical listener is already
* registered.
- *
+ *
* @param listener
* the listener to add
- *
+ *
*/
public static void addInterpreterInstallChangedListener(
IInterpreterInstallChangedListener listener) {
@@ -1300,10 +1308,10 @@
* Removes the given listener from the list of registered Interpreter
* install changed listeners. Has no effect if an identical listener is not
* already registered.
- *
+ *
* @param listener
* the listener to remove
- *
+ *
*/
public static void removeInterpreterInstallChangedListener(
IInterpreterInstallChangedListener listener) {
@@ -1322,10 +1330,10 @@
/**
* Notifies all Interpreter install changed listeners of the given property
* change.
- *
+ *
* @param event
* event describing the change.
- *
+ *
*/
public static void fireInterpreterChanged(PropertyChangeEvent event) {
Object[] listeners = fgInterpreterListeners.getListeners();
@@ -1338,10 +1346,10 @@
/**
* Notifies all Interpreter install changed listeners of the Interpreter
* addition
- *
+ *
* @param Interpreter
* the Interpreter that has been added
- *
+ *
*/
public static void fireInterpreterAdded(IInterpreterInstall Interpreter) {
if (!fgInitializingInterpreters) {
@@ -1356,10 +1364,10 @@
/**
* Notifies all Interpreter install changed listeners of the Interpreter
* removal
- *
+ *
* @param Interpreter
* the Interpreter that has been removed
- *
+ *
*/
public static void fireInterpreterRemoved(IInterpreterInstall Interpreter) {
Object[] listeners = fgInterpreterListeners.getListeners();
@@ -1371,7 +1379,7 @@
/**
* Returns the preference store for the launching plug-in.
- *
+ *
* @return the preference store for the launching plug-in
* @since 5.0 return type changed to {@link IEclipsePreferences}
*/
@@ -1381,8 +1389,8 @@
/**
* Saves the preferences for the launching plug-in.
- *
- *
+ *
+ *
*/
public static void savePreferences() {
try {
@@ -1394,15 +1402,16 @@
/**
* Registers the given resolver for the specified container.
- *
+ *
* @param resolver
* runtime buildpath entry resolver
* @param containerIdentifier
* identifier of the buildpath container to register for
- *
+ *
*/
public static void addContainerResolver(
- IRuntimeBuildpathEntryResolver resolver, String containerIdentifier) {
+ IRuntimeBuildpathEntryResolver resolver,
+ String containerIdentifier) {
Map<String, IRuntimeBuildpathEntryResolver> map = getContainerResolvers();
map.put(containerIdentifier, resolver);
}
@@ -1422,10 +1431,8 @@
.getExtensionPoint(DLTKLaunchingPlugin.PLUGIN_ID,
EXTENSION_POINT_RUNTIME_BUILDPATH_ENTRY_RESOLVERS);
IConfigurationElement[] extensions = point.getConfigurationElements();
- fgContainerResolvers = new HashMap<String, IRuntimeBuildpathEntryResolver>(
- extensions.length);
- fgRuntimeBuildpathEntryResolvers = new HashMap<String, IRuntimeBuildpathEntryResolver>(
- extensions.length);
+ fgContainerResolvers = new HashMap<>(extensions.length);
+ fgRuntimeBuildpathEntryResolvers = new HashMap<>(extensions.length);
for (int i = 0; i < extensions.length; i++) {
RuntimeBuildpathEntryResolver res = new RuntimeBuildpathEntryResolver(
extensions[i]);
@@ -1455,8 +1462,7 @@
.getExtensionPoint(DLTKLaunchingPlugin.PLUGIN_ID,
EXTENSION_POINT_RUNTIME_BUILDPATH_PROVIDERS);
IConfigurationElement[] extensions = point.getConfigurationElements();
- fgPathProviders = new HashMap<String, IRuntimeBuildpathProvider>(
- extensions.length);
+ fgPathProviders = new HashMap<>(extensions.length);
for (int i = 0; i < extensions.length; i++) {
RuntimeBuildpathProvider res = new RuntimeBuildpathProvider(
extensions[i]);
@@ -1467,7 +1473,7 @@
/**
* Returns the resolver registered for the given container id, or
* <code>null</code> if none.
- *
+ *
* @param containerId
* the container to determine the resolver for
* @return the resolver registered for the given container id, or
@@ -1475,8 +1481,8 @@
*/
private static IRuntimeBuildpathEntryResolver2 getContainerResolver(
String containerId) {
- return (IRuntimeBuildpathEntryResolver2) getContainerResolvers().get(
- containerId);
+ return (IRuntimeBuildpathEntryResolver2) getContainerResolvers()
+ .get(containerId);
}
/**
@@ -1484,7 +1490,7 @@
* project's library path when launched. Entries are searched for on the
* project's build path as extra buildpath attributes. Each entry represents
* an absolute path in the local file system.
- *
+ *
* @param project
* the project to compute the <code>java.library.path</code> for
* @param requiredProjects
@@ -1493,17 +1499,17 @@
* appended to the given project's <code>java.library.path</code>
* @throws CoreException
* if unable to compute the Script library path
- *
+ *
* @see org.eclipse.dltk.core.IBuildpathAttribute
* @see ScriptRuntime#BUILDPATH_ATTR_LIBRARY_PATH_ENTRY
*/
public static String[] computeScriptLibraryPath(IScriptProject project,
boolean requiredProjects) throws CoreException {
- Set<IScriptProject> visited = new HashSet<IScriptProject>();
- List<String> entries = new ArrayList<String>();
+ Set<IScriptProject> visited = new HashSet<>();
+ List<String> entries = new ArrayList<>();
gatherScriptLibraryPathEntries(project, requiredProjects, visited,
entries);
- List<String> resolved = new ArrayList<String>(entries.size());
+ List<String> resolved = new ArrayList<>(entries.size());
IStringVariableManager manager = VariablesPlugin.getDefault()
.getStringVariableManager();
IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
@@ -1529,7 +1535,7 @@
/**
* Gathers all Script library entries for the given project and optionally
* its required projects.
- *
+ *
* @param project
* project to gather entries for
* @param requiredProjects
@@ -1540,7 +1546,7 @@
* collection to add library entries to
* @throws CoreException
* if unable to gather buildpath entries
- *
+ *
*/
private static void gatherScriptLibraryPathEntries(IScriptProject project,
boolean requiredProjects, Set<IScriptProject> visited,
@@ -1573,7 +1579,7 @@
* Adds all library path extra buildpath entry values to the given entries
* collection specified on the given project's buildpath, and returns a
* collection of required projects, or <code>null</code>.
- *
+ *
* @param project
* project being processed
* @param collectRequired
@@ -1584,7 +1590,7 @@
* collection to add script library path entries to
* @return required project buildpath entries or <code>null</code>
* @throws CoreException
- *
+ *
*/
private static IBuildpathEntry[] processScriptLibraryPathEntries(
IScriptProject project, boolean collectRequired,
@@ -1603,15 +1609,15 @@
}
}
if (entry.getEntryKind() == IBuildpathEntry.BPE_CONTAINER) {
- IBuildpathContainer container = DLTKCore.getBuildpathContainer(
- entry.getPath(), project);
+ IBuildpathContainer container = DLTKCore
+ .getBuildpathContainer(entry.getPath(), project);
if (container != null) {
IBuildpathEntry[] requiredProjects = processScriptLibraryPathEntries(
project, collectRequired,
container.getBuildpathEntries(), entries);
if (requiredProjects != null) {
if (req == null) {
- req = new ArrayList<IBuildpathEntry>();
+ req = new ArrayList<>();
}
for (int j = 0; j < requiredProjects.length; j++) {
req.add(requiredProjects[j]);
@@ -1621,7 +1627,7 @@
} else if (collectRequired
&& entry.getEntryKind() == IBuildpathEntry.BPE_PROJECT) {
if (req == null) {
- req = new ArrayList<IBuildpathEntry>();
+ req = new ArrayList<>();
}
req.add(entry);
}
@@ -1641,7 +1647,7 @@
* <code>getLibraryPaths(IBuildpathAttribute)</code> should be used to
* encode and decode the attribute value.
* </p>
- *
+ *
* @param paths
* an array of strings representing paths of shared libraries.
* Each string is used to create an <code>IPath</code> using the
@@ -1652,7 +1658,7 @@
* @return a buildpath attribute with the name
* <code>CLASSPATH_ATTR_LIBRARY_PATH_ENTRY</code> and an value
* encoded to the specified paths.
- *
+ *
*/
public static IBuildpathAttribute newLibraryPathsAttribute(String[] paths) {
StringBuffer value = new StringBuffer();
@@ -1662,8 +1668,8 @@
value.append("|"); //$NON-NLS-1$
}
}
- return DLTKCore.newBuildpathAttribute(
- BUILDPATH_ATTR_LIBRARY_PATH_ENTRY, value.toString());
+ return DLTKCore.newBuildpathAttribute(BUILDPATH_ATTR_LIBRARY_PATH_ENTRY,
+ value.toString());
}
/**
@@ -1672,14 +1678,14 @@
* for an associated {@link IBuildpathEntry}, or <code>null</code> if the
* given attribute is not a <code>CLASSPATH_ATTR_LIBRARY_PATH_ENTRY</code>.
* Each string is used to create an <code>IPath</code> using the constructor
- * <code>Path(String)</code>, and may contain <code>IStringVariable</code>
+ * <code>Path(String)</code>, and may contain <code>IStringVariable</code>
* 's.
* <p>
* The factory methods <code>newLibraryPathsAttribute(String[])</code> and
* <code>getLibraryPaths(IBuildpathAttribute)</code> should be used to
* encode and decode the attribute value.
* </p>
- *
+ *
* @param attribute
* a <code>CLASSPATH_ATTR_LIBRARY_PATH_ENTRY</code> buildpath
* attribute
@@ -1691,7 +1697,7 @@
* used to create an <code>IPath</code> using the constructor
* <code>Path(String)</code>, and may contain
* <code>IStringVariable</code>'s.
- *
+ *
*/
public static String[] getLibraryPaths(IBuildpathAttribute attribute) {
if (BUILDPATH_ATTR_LIBRARY_PATH_ENTRY.equals(attribute.getName())) {
@@ -1703,7 +1709,7 @@
/**
* Loads contributed interpreter installs
- *
+ *
*/
private static void addInterpreterExtensions(
InterpreterDefinitionsContainer InterpreterDefs) {
@@ -1729,13 +1735,13 @@
"Missing required id attribute for interpreterInstall contributed by {0}", //$NON-NLS-1$
element.getContributor().getName()), null);
}
- IInterpreterInstallType installType = getInterpreterInstallType(InterpreterType);
+ IInterpreterInstallType installType = getInterpreterInstallType(
+ InterpreterType);
if (installType == null) {
- throw abort(
- MessageFormat.format(
- "InterpreterInstall {0} contributed by {1} references undefined Interpreter install type {2}", //$NON-NLS-1$
- id, element.getContributor().getName(),
- InterpreterType), null);
+ throw abort(MessageFormat.format(
+ "InterpreterInstall {0} contributed by {1} references undefined Interpreter install type {2}", //$NON-NLS-1$
+ id, element.getContributor().getName(),
+ InterpreterType), null);
}
IInterpreterInstall install = installType
.findInterpreterInstall(id);
@@ -1767,12 +1773,12 @@
final IEnvironment localEnv = EnvironmentManager
.getLocalEnvironment();
- IFileHandle homeFile = localEnv.getFile(toPath(element,
- substitute(home)));
+ IFileHandle homeFile = localEnv
+ .getFile(toPath(element, substitute(home)));
if (homeFile.exists()) {
// adjust for relative path names
- homeFile = localEnv.getFile(new Path(homeFile
- .getCanonicalPath()));
+ homeFile = localEnv.getFile(
+ new Path(homeFile.getCanonicalPath()));
}
IStatus status = installType.validateInstallLocation(
homeFile, standin.getEnvironmentVariables(),
@@ -1781,9 +1787,9 @@
if (!status.isOK()) {
abort(MessageFormat.format(
"Illegal install location {0} for interpreterInstall {1} contributed by {2}: {3}", //$NON-NLS-1$
- home, id, element.getContributor()
- .getName(), status.getMessage()),
- null);
+ home, id,
+ element.getContributor().getName(),
+ status.getMessage()), null);
}
standin.setInstallLocation(homeFile);
@@ -1802,12 +1808,13 @@
if (libPathStr == null) {
abort(MessageFormat.format(
"library for interpreterInstall {0} contributed by {1} missing required attribute libPath", //$NON-NLS-1$
- id, element.getContributor()
- .getName()), null);
+ id,
+ element.getContributor().getName()),
+ null);
}
- locations[j] = new LibraryLocation(homeFile
- .getFullPath().append(
+ locations[j] = new LibraryLocation(
+ homeFile.getFullPath().append(
substitute(libPathStr)));
}
}
@@ -1818,8 +1825,8 @@
} else {
abort(MessageFormat.format(
"Illegal element {0} in InterpreterInstalls extension contributed by {1}", //$NON-NLS-1$
- element.getName(), element.getContributor()
- .getName()), null);
+ element.getName(),
+ element.getContributor().getName()), null);
}
} catch (CoreException e) {
DLTKLaunchingPlugin.log(e);
@@ -1861,8 +1868,8 @@
long unique = System.currentTimeMillis();
final InterpreterStandin[] result = new InterpreterStandin[detectedLocations.length];
for (int j = 0; j < detectedLocations.length; ++j) {
- while (interpType.findInterpreterInstall(String
- .valueOf(unique)) != null) {
+ while (interpType.findInterpreterInstall(
+ String.valueOf(unique)) != null) {
unique++;
}
final IFileHandle location = detectedLocations[j];
@@ -1881,7 +1888,7 @@
}
private static Map<String, List<IInterpreterInstallType>> getInterpreterTypesByNature() {
- Map<String, List<IInterpreterInstallType>> result = new HashMap<String, List<IInterpreterInstallType>>();
+ Map<String, List<IInterpreterInstallType>> result = new HashMap<>();
for (IInterpreterInstallType type : fgInterpreterTypes) {
String natureId = type.getNatureId();
if (!result.containsKey(natureId)) {
@@ -1894,7 +1901,7 @@
private static Map<String, List<IInterpreterInstall>> getValidInterpretersByNature(
List<IInterpreterInstall> validInterpreters) {
- Map<String, List<IInterpreterInstall>> result = new HashMap<String, List<IInterpreterInstall>>();
+ Map<String, List<IInterpreterInstall>> result = new HashMap<>();
for (IInterpreterInstall install : validInterpreters) {
String natureId = install.getNatureId();
if (!result.containsKey(natureId)) {
@@ -1908,8 +1915,8 @@
/**
* Perform Interpreter type and Interpreter install initialization. Does not
* hold locks while performing change notification.
- *
- *
+ *
+ *
*/
private static void initializeInterpreters() {
InterpreterDefinitionsContainer defs = null;
@@ -1927,8 +1934,8 @@
// 3. if there are none, detect interpreters
Map<String, List<IInterpreterInstallType>> typesByNature = getInterpreterTypesByNature();
- Map<String, List<IInterpreterInstall>> interpsByNature = getValidInterpretersByNature(defs
- .getValidInterpreterList());
+ Map<String, List<IInterpreterInstall>> interpsByNature = getValidInterpretersByNature(
+ defs.getValidInterpreterList());
for (String natureId : typesByNature.keySet()) {
if (!interpsByNature.containsKey(natureId)
|| interpsByNature.get(natureId).isEmpty()) {
@@ -1949,9 +1956,11 @@
}
defs.setDefaultInterpreterInstallCompositeID(
new DefaultInterpreterEntry(
- natureId, interp[0]
+ natureId,
+ interp[0]
.getEnvironmentId()),
- getCompositeIdFromInterpreter(interp[0]));
+ getCompositeIdFromInterpreter(
+ interp[0]));
}
} else {
// interpreters were changed - reflect current
@@ -1975,7 +1984,8 @@
.getInterpreterNatures();
for (int i = 0; i < natures.length; i++) {
String defId = defs
- .getDefaultInterpreterInstallCompositeID(natures[i]);
+ .getDefaultInterpreterInstallCompositeID(
+ natures[i]);
boolean validDef = false;
if (defId != null) {
for (IInterpreterInstall iterpreter : defs
@@ -1997,15 +2007,18 @@
IInterpreterInstall Interpreter = list.get(0);
defs.setDefaultInterpreterInstallCompositeID(
natures[i],
- getCompositeIdFromInterpreter(Interpreter));
+ getCompositeIdFromInterpreter(
+ Interpreter));
}
}
String defInstCID = defs
- .getDefaultInterpreterInstallCompositeID(natures[i]);
+ .getDefaultInterpreterInstallCompositeID(
+ natures[i]);
fgDefaultInterpreterId.put(natures[i], defInstCID);
String defIntCTypeID = defs
- .getDefaultInterpreterInstallConnectorTypeID(natures[i]);
+ .getDefaultInterpreterInstallConnectorTypeID(
+ natures[i]);
fgDefaultInterpreterConnectorId.put(natures[i],
defIntCTypeID);
}
@@ -2060,11 +2073,11 @@
/**
* Returns a new runtime buildpath entry containing the default buildpath
* for the specified script project.
- *
+ *
* @param project
* project
* @return runtime buildpath entry
- *
+ *
*/
public static IRuntimeBuildpathEntry newDefaultProjectBuildpathEntry(
IScriptProject project) {
@@ -2073,26 +2086,26 @@
/**
* Returns a new runtime buildpath entry for the given project.
- *
+ *
* @param project
* Script project
* @return runtime buildpath entry
- *
+ *
*/
public static IRuntimeBuildpathEntry newProjectRuntimeBuildpathEntry(
IScriptProject project) {
- IBuildpathEntry cpe = DLTKCore.newProjectEntry(project.getProject()
- .getFullPath());
+ IBuildpathEntry cpe = DLTKCore
+ .newProjectEntry(project.getProject().getFullPath());
return newRuntimeBuildpathEntry(cpe);
}
/**
* Returns a new runtime buildpath entry for the given archive.
- *
+ *
* @param resource
* archive resource
* @return runtime buildpath entry
- *
+ *
*/
public static IRuntimeBuildpathEntry newArchiveRuntimeBuildpathEntry(
IResource resource) {
@@ -2103,11 +2116,11 @@
/**
* Returns a new runtime buildpath entry for the given archive (possibly
* external).
- *
+ *
* @param path
* absolute path to an archive
* @return runtime buildpath entry
- *
+ *
*/
public static IRuntimeBuildpathEntry newArchiveRuntimeBuildpathEntry(
IPath path) {
@@ -2118,7 +2131,7 @@
/**
* Returns a runtime buildpath entry for the given container path with the
* given buildpath property.
- *
+ *
* @param path
* container path
* @param buildpathProperty
@@ -2127,7 +2140,7 @@
* @return runtime buildpath entry
* @exception CoreException
* if unable to construct a runtime buildpath entry
- *
+ *
*/
public static IRuntimeBuildpathEntry newRuntimeContainerBuildpathEntry(
IPath path, int buildpathProperty) throws CoreException {
@@ -2138,7 +2151,7 @@
* Returns a runtime buildpath entry for the given container path with the
* given buildpath property to be resolved in the context of the given
* Script project.
- *
+ *
* @param path
* container path
* @param buildpathProperty
@@ -2164,15 +2177,15 @@
/**
* Returns a runtime buildpath entry constructed from the given memento.
- *
+ *
* @param memento
* a memento for a runtime buildpath entry
* @return runtime buildpath entry
* @exception CoreException
* if unable to construct a runtime buildpath entry
*/
- public static IRuntimeBuildpathEntry newRuntimeBuildpathEntry(String memento)
- throws CoreException {
+ public static IRuntimeBuildpathEntry newRuntimeBuildpathEntry(
+ String memento) throws CoreException {
try {
Element root = null;
DocumentBuilder parser = DLTKLaunchingPlugin.getParser();
@@ -2211,7 +2224,7 @@
* Returns a runtime buildpath entry that corresponds to the given buildpath
* entry. The buildpath entry may not be of type <code>CPE_SOURCE</code> or
* <code>BPE_CONTAINER</code>.
- *
+ *
* @param entry
* a buildpath entry
* @return runtime buildpath entry
@@ -2224,24 +2237,23 @@
/**
* Computes and returns the default unresolved runtime buildpath for the
* given project.
- *
+ *
* @return runtime buildpath entries
* @exception CoreException
* if unable to compute the runtime buildpath
* @see IRuntimeBuildpathEntry
- *
+ *
*/
public static IRuntimeBuildpathEntry[] computeUnresolvedRuntimeBuildpath(
IScriptProject project) throws CoreException {
IBuildpathEntry[] entries = project.getRawBuildpath();
- List<IRuntimeBuildpathEntry> buildpathEntries = new ArrayList<IRuntimeBuildpathEntry>(
- 3);
+ List<IRuntimeBuildpathEntry> buildpathEntries = new ArrayList<>(3);
for (int i = 0; i < entries.length; i++) {
IBuildpathEntry entry = entries[i];
switch (entry.getEntryKind()) {
case IBuildpathEntry.BPE_CONTAINER:
- IBuildpathContainer container = DLTKCore.getBuildpathContainer(
- entry.getPath(), project);
+ IBuildpathContainer container = DLTKCore
+ .getBuildpathContainer(entry.getPath(), project);
if (container != null) {
switch (container.getKind()) {
case IBuildpathContainer.K_APPLICATION:
@@ -2249,11 +2261,10 @@
break;
case IBuildpathContainer.K_DEFAULT_SYSTEM:
case IBuildpathContainer.K_SYSTEM:
- buildpathEntries
- .add(newRuntimeContainerBuildpathEntry(
- container.getPath(),
- IRuntimeBuildpathEntry.STANDARD_ENTRY,
- project));
+ buildpathEntries.add(newRuntimeContainerBuildpathEntry(
+ container.getPath(),
+ IRuntimeBuildpathEntry.STANDARD_ENTRY,
+ project));
break;
}
}
@@ -2269,7 +2280,7 @@
/**
* Returns the buildpath provider for the given launch configuration.
- *
+ *
* @param configuration
* launch configuration
* @return buildpath provider
@@ -2339,8 +2350,8 @@
// cannot resolve without entry or project context
return new IRuntimeBuildpathEntry[0];
}
- IBuildpathContainer container = DLTKCore.getBuildpathContainer(
- entry.getPath(), project);
+ IBuildpathContainer container = DLTKCore
+ .getBuildpathContainer(entry.getPath(), project);
if (container == null) {
abort(MessageFormat.format(
LaunchingMessages.ScriptRuntime_Could_not_resolve_classpath_container___0__1,
@@ -2361,12 +2372,11 @@
property = IRuntimeBuildpathEntry.BOOTSTRAP_ENTRY;
break;
}
- List<IRuntimeBuildpathEntry> resolved = new ArrayList<IRuntimeBuildpathEntry>(
- cpes.length);
+ List<IRuntimeBuildpathEntry> resolved = new ArrayList<>(cpes.length);
List<IScriptProject> projects = fgProjects.get();
Integer count = fgEntryCount.get();
if (projects == null) {
- projects = new ArrayList<IScriptProject>();
+ projects = new ArrayList<>();
fgProjects.set(projects);
count = Integer.valueOf(0);
}
@@ -2382,7 +2392,8 @@
IScriptProject jp = DLTKCore.create(p);
if (!projects.contains(jp)) {
projects.add(jp);
- IRuntimeBuildpathEntry buildpath = newDefaultProjectBuildpathEntry(jp);
+ IRuntimeBuildpathEntry buildpath = newDefaultProjectBuildpathEntry(
+ jp);
IRuntimeBuildpathEntry[] entries = resolveRuntimeBuildpathEntry(
buildpath, jp);
for (int j = 0; j < entries.length; j++) {
@@ -2429,7 +2440,7 @@
* container buildpath entries, in the context of the project associated
* with the given launch configuration.
* </p>
- *
+ *
* @param entry
* runtime classpath entry
* @param configuration
@@ -2438,7 +2449,7 @@
* @exception CoreException
* if unable to resolve
* @see IRuntimeBuildpathEntryResolver
- *
+ *
*/
public static IRuntimeBuildpathEntry[] resolveRuntimeBuildpathEntry(
IRuntimeBuildpathEntry entry, ILaunchConfiguration configuration)
@@ -2461,8 +2472,8 @@
}
break;
case IRuntimeBuildpathEntry.CONTAINER:
- IRuntimeBuildpathEntryResolver resolver = getContainerResolver(entry
- .getContainerName());
+ IRuntimeBuildpathEntryResolver resolver = getContainerResolver(
+ entry.getContainerName());
if (resolver == null) {
return computeDefaultContainerEntries(entry, configuration);
}
@@ -2488,8 +2499,8 @@
}
break;
case IRuntimeBuildpathEntry.OTHER:
- resolver = getContributedResolver(((IRuntimeBuildpathEntry2) entry)
- .getTypeId());
+ resolver = getContributedResolver(
+ ((IRuntimeBuildpathEntry2) entry).getTypeId());
return resolver.resolveRuntimeBuildpathEntry(entry, configuration);
default:
break;
@@ -2506,7 +2517,7 @@
* resolved runtime classpath entries are calculated from the associated
* container classpath entries, in the context of the given project.
* </p>
- *
+ *
* @param entry
* runtime classpath entry
* @param project
@@ -2515,22 +2526,22 @@
* @exception CoreException
* if unable to resolve
* @see IRuntimeBuildpathEntryResolver
- *
+ *
*/
public static IRuntimeBuildpathEntry[] resolveRuntimeBuildpathEntry(
IRuntimeBuildpathEntry entry, IScriptProject project)
throws CoreException {
switch (entry.getType()) {
case IRuntimeBuildpathEntry.CONTAINER:
- IRuntimeBuildpathEntryResolver resolver = getContainerResolver(entry
- .getContainerName());
+ IRuntimeBuildpathEntryResolver resolver = getContainerResolver(
+ entry.getContainerName());
if (resolver == null) {
return computeDefaultContainerEntries(entry, project);
}
return resolver.resolveRuntimeBuildpathEntry(entry, project);
case IRuntimeBuildpathEntry.OTHER:
- resolver = getContributedResolver(((IRuntimeBuildpathEntry2) entry)
- .getTypeId());
+ resolver = getContributedResolver(
+ ((IRuntimeBuildpathEntry2) entry).getTypeId());
return resolver.resolveRuntimeBuildpathEntry(entry, project);
default:
break;
@@ -2541,7 +2552,7 @@
/**
* Computes and returns the unresolved build path for the given launch
* configuration. Variable and container entries are unresolved.
- *
+ *
* @param configuration
* launch configuration
* @return unresolved runtime buildpath entries
@@ -2550,14 +2561,14 @@
*/
public static IRuntimeBuildpathEntry[] computeUnresolvedRuntimeBuildpath(
ILaunchConfiguration configuration) throws CoreException {
- return getBuildpathProvider(configuration).computeUnresolvedBuildpath(
- configuration);
+ return getBuildpathProvider(configuration)
+ .computeUnresolvedBuildpath(configuration);
}
/**
* Resolves the given buildpath, returning the resolved buildpath in the
* context of the given launch configuration.
- *
+ *
* @param entries
* unresolved buildpath
* @param configuration
@@ -2567,8 +2578,8 @@
* if unable to compute the buildpath
*/
public static IRuntimeBuildpathEntry[] resolveRuntimeBuildpath(
- IRuntimeBuildpathEntry[] entries, ILaunchConfiguration configuration)
- throws CoreException {
+ IRuntimeBuildpathEntry[] entries,
+ ILaunchConfiguration configuration) throws CoreException {
return getBuildpathProvider(configuration).resolveBuildpath(entries,
configuration);
}
@@ -2586,15 +2597,15 @@
/**
* Returns the resolver registered for the given contributed buildpath entry
* type.
- *
+ *
* @param typeId
* the id of the contributed buildpath entry
* @return the resolver registered for the given buildpath entry
*/
private static IRuntimeBuildpathEntryResolver getContributedResolver(
String typeId) {
- IRuntimeBuildpathEntryResolver resolver = getEntryResolvers().get(
- typeId);
+ IRuntimeBuildpathEntryResolver resolver = getEntryResolvers()
+ .get(typeId);
if (resolver == null) {
return new DefaultEntryResolver();
}
@@ -2603,7 +2614,7 @@
/**
* Computes the default application buildpath entries for the given project.
- *
+ *
* @param jproject
* The project to compute the buildpath for
* @return The computed buildpath. May be empty, but not null.
@@ -2612,13 +2623,15 @@
*/
public static String[] computeDefaultRuntimeClassPath(
IScriptProject jproject) throws CoreException {
- IRuntimeBuildpathEntry[] unresolved = computeUnresolvedRuntimeBuildpath(jproject);
+ IRuntimeBuildpathEntry[] unresolved = computeUnresolvedRuntimeBuildpath(
+ jproject);
// 1. remove bootpath entries
// 2. resolve & translate to local file system paths
- List<String> resolved = new ArrayList<String>(unresolved.length);
+ List<String> resolved = new ArrayList<>(unresolved.length);
for (int i = 0; i < unresolved.length; i++) {
IRuntimeBuildpathEntry entry = unresolved[i];
- if (entry.getBuildpathProperty() == IRuntimeBuildpathEntry.USER_ENTRY) {
+ if (entry
+ .getBuildpathProperty() == IRuntimeBuildpathEntry.USER_ENTRY) {
IRuntimeBuildpathEntry[] entries = resolveRuntimeBuildpathEntry(
entry, jproject);
for (int j = 0; j < entries.length; j++) {
@@ -2639,8 +2652,8 @@
public static IRuntimeBuildpathEntry[] computeUnresolvedSourceBuildpath(
ILaunchConfiguration configuration) throws CoreException {
- return getScriptpathProvider(configuration).computeUnresolvedBuildpath(
- configuration);
+ return getScriptpathProvider(configuration)
+ .computeUnresolvedBuildpath(configuration);
}
}
\ No newline at end of file
diff --git a/core/plugins/org.eclipse.dltk.launching/src/org/eclipse/dltk/launching/StandardBuildpathProvider.java b/core/plugins/org.eclipse.dltk.launching/src/org/eclipse/dltk/launching/StandardBuildpathProvider.java
index ca8d156..ba46f30 100644
--- a/core/plugins/org.eclipse.dltk.launching/src/org/eclipse/dltk/launching/StandardBuildpathProvider.java
+++ b/core/plugins/org.eclipse.dltk.launching/src/org/eclipse/dltk/launching/StandardBuildpathProvider.java
@@ -69,8 +69,7 @@
public IRuntimeBuildpathEntry[] resolveBuildpath(
IRuntimeBuildpathEntry[] entries,
ILaunchConfiguration configuration) throws CoreException {
- List<IRuntimeBuildpathEntry> all = new ArrayList<IRuntimeBuildpathEntry>(
- entries.length);
+ List<IRuntimeBuildpathEntry> all = new ArrayList<>(entries.length);
for (int i = 0; i < entries.length; i++) {
IRuntimeBuildpathEntry[] resolved = ScriptRuntime
.resolveRuntimeBuildpathEntry(entries[i], configuration);
@@ -85,7 +84,7 @@
* Returns a collection of runtime buildpath entries that are defined in the
* specified attribute of the given launch configuration. When present, the
* attribute must contain a list of runtime buildpath entry mementos.
- *
+ *
* @param configuration
* launch configuration
* @param attribute
diff --git a/core/plugins/org.eclipse.dltk.launching/src/org/eclipse/dltk/launching/StandardSourcepathProvider.java b/core/plugins/org.eclipse.dltk.launching/src/org/eclipse/dltk/launching/StandardSourcepathProvider.java
index fc3f94c..7c1f146 100644
--- a/core/plugins/org.eclipse.dltk.launching/src/org/eclipse/dltk/launching/StandardSourcepathProvider.java
+++ b/core/plugins/org.eclipse.dltk.launching/src/org/eclipse/dltk/launching/StandardSourcepathProvider.java
@@ -60,7 +60,7 @@
public UniqueList(int length) {
super(length);
- set = new HashSet<T>(length);
+ set = new HashSet<>(length);
}
@Override