Remove unnecessary type specifications
Since Java 7 the diamond operator can be used instead of explicit
type parameters.
Change-Id: Ief1d79592e1daa287b79f6af197200ce8f75879f
Signed-off-by: Carsten Hammer <carsten.hammer@t-online.de>
diff --git a/ant/org.eclipse.ant.core/src_ant/org/eclipse/ant/internal/core/ant/ProgressBuildListener.java b/ant/org.eclipse.ant.core/src_ant/org/eclipse/ant/internal/core/ant/ProgressBuildListener.java
index 394521c..e6aa683 100644
--- a/ant/org.eclipse.ant.core/src_ant/org/eclipse/ant/internal/core/ant/ProgressBuildListener.java
+++ b/ant/org.eclipse.ant.core/src_ant/org/eclipse/ant/internal/core/ant/ProgressBuildListener.java
@@ -126,7 +126,7 @@
protected int computeWork(List<Target> targets) {
int result = 0;
for (int i = 0; i < targets.size(); i++) {
- result = result + countTarget(targets.get(i), new ArrayList<String>());
+ result = result + countTarget(targets.get(i), new ArrayList<>());
}
return result;
}
diff --git a/ant/org.eclipse.ant.launching/remote/org/eclipse/ant/internal/launching/remote/EclipseDefaultExecutor.java b/ant/org.eclipse.ant.launching/remote/org/eclipse/ant/internal/launching/remote/EclipseDefaultExecutor.java
index 14f860f..309a0d8 100644
--- a/ant/org.eclipse.ant.launching/remote/org/eclipse/ant/internal/launching/remote/EclipseDefaultExecutor.java
+++ b/ant/org.eclipse.ant.launching/remote/org/eclipse/ant/internal/launching/remote/EclipseDefaultExecutor.java
@@ -33,7 +33,7 @@
@SuppressWarnings("unused")
@Override
public void executeTargets(Project project, String[] targetNames) throws BuildException {
- Vector<String> v = new Vector<String>();
+ Vector<String> v = new Vector<>();
v.addAll(Arrays.asList(targetNames));
project.addReference(IAntCoreConstants.TARGET_VECTOR_NAME, v);
super.executeTargets(project, targetNames);
diff --git a/ant/org.eclipse.ant.launching/remote/org/eclipse/ant/internal/launching/remote/EclipseSingleCheckExecutor.java b/ant/org.eclipse.ant.launching/remote/org/eclipse/ant/internal/launching/remote/EclipseSingleCheckExecutor.java
index 699e4f3..5199367 100644
--- a/ant/org.eclipse.ant.launching/remote/org/eclipse/ant/internal/launching/remote/EclipseSingleCheckExecutor.java
+++ b/ant/org.eclipse.ant.launching/remote/org/eclipse/ant/internal/launching/remote/EclipseSingleCheckExecutor.java
@@ -31,7 +31,7 @@
@SuppressWarnings("unused")
@Override
public void executeTargets(Project project, String[] targetNames) throws BuildException {
- Vector<String> v = new Vector<String>();
+ Vector<String> v = new Vector<>();
v.addAll(Arrays.asList(targetNames));
project.addReference(IAntCoreConstants.TARGET_VECTOR_NAME, v);
super.executeTargets(project, targetNames);
diff --git a/ant/org.eclipse.ant.launching/remote/org/eclipse/ant/internal/launching/remote/InternalAntRunner.java b/ant/org.eclipse.ant.launching/remote/org/eclipse/ant/internal/launching/remote/InternalAntRunner.java
index 2f0087e..ed46ac4 100644
--- a/ant/org.eclipse.ant.launching/remote/org/eclipse/ant/internal/launching/remote/InternalAntRunner.java
+++ b/ant/org.eclipse.ant.launching/remote/org/eclipse/ant/internal/launching/remote/InternalAntRunner.java
@@ -115,7 +115,7 @@
private boolean scriptExecuted = false;
@SuppressWarnings("unused")
- private List<String> propertyFiles = new ArrayList<String>();
+ private List<String> propertyFiles = new ArrayList<>();
/**
* The Ant InputHandler class. There may be only one input handler.
@@ -160,7 +160,7 @@
// We could be using Arrays.asList() here, but it does not specify
// what kind of list it will return. We need a list that
// implements the method List.remove(Object) and ArrayList does.
- ArrayList<String> result = new ArrayList<String>(args.length);
+ ArrayList<String> result = new ArrayList<>(args.length);
for (int i = 0; i < args.length; i++) {
result.add(args[i]);
}
@@ -262,9 +262,9 @@
Target currentTarget;
// split the targets in top-level and sub-targets depending
// on the presence of a description
- List<String> topNames = new ArrayList<String>();
- List<String> topDescriptions = new ArrayList<String>();
- List<String> subNames = new ArrayList<String>();
+ List<String> topNames = new ArrayList<>();
+ List<String> topDescriptions = new ArrayList<>();
+ List<String> subNames = new ArrayList<>();
while (ptargets.hasMoreElements()) {
currentTarget = ptargets.nextElement();
@@ -287,13 +287,13 @@
String defaultTargetName = project.getDefaultTarget();
if (defaultTargetName != null && !IAntCoreConstants.EMPTY_STRING.equals(defaultTargetName)) { // shouldn't need to check but...
- List<String> defaultName = new ArrayList<String>(1);
+ List<String> defaultName = new ArrayList<>(1);
List<String> defaultDesc = null;
defaultName.add(defaultTargetName);
int indexOfDefDesc = topNames.indexOf(defaultTargetName);
if (indexOfDefDesc >= 0) {
- defaultDesc = new ArrayList<String>(1);
+ defaultDesc = new ArrayList<>(1);
defaultDesc.add(topDescriptions.get(indexOfDefDesc));
}
printTargets(project, defaultName, defaultDesc, RemoteAntMessages.getString("InternalAntRunner.Default_target__3"), maxLength); //$NON-NLS-1$
@@ -450,7 +450,7 @@
System.setSecurityManager(new AntSecurityManager(originalSM, Thread.currentThread()));
if (targets == null) {
- targets = new Vector<String>(1);
+ targets = new Vector<>(1);
}
if (targets.isEmpty() && getCurrentProject().getDefaultTarget() != null) {
targets.add(getCurrentProject().getDefaultTarget());
@@ -797,7 +797,7 @@
throw new BuildException(RemoteAntMessages.getString("InternalAntRunner.You_must_specify_a_classname_when_using_the_-listener_argument_1")); //$NON-NLS-1$
}
if (buildListeners == null) {
- buildListeners = new ArrayList<String>(1);
+ buildListeners = new ArrayList<>(1);
}
buildListeners.add(arg);
arg = getArgument(commands, "-listener"); //$NON-NLS-1$
@@ -956,7 +956,7 @@
String arg = getArgument(commands, "-eclipseTask"); //$NON-NLS-1$
while (arg != null) {
if (eclipseSpecifiedTasks == null) {
- eclipseSpecifiedTasks = new HashMap<String, String>();
+ eclipseSpecifiedTasks = new HashMap<>();
}
int index = arg.indexOf(',');
if (index != -1) {
@@ -970,7 +970,7 @@
arg = getArgument(commands, "-eclipseType"); //$NON-NLS-1$
while (arg != null) {
if (eclipseSpecifiedTypes == null) {
- eclipseSpecifiedTypes = new HashMap<String, String>();
+ eclipseSpecifiedTypes = new HashMap<>();
}
int index = arg.indexOf(',');
if (index != -1) {
@@ -1020,7 +1020,7 @@
@SuppressWarnings("unused")
private void processTargets(List<String> commands) {
if (targets == null) {
- targets = new Vector<String>(commands.size());
+ targets = new Vector<>(commands.size());
}
for (String string : commands) {
targets.add(string);
@@ -1115,7 +1115,7 @@
continue;
}
if (userProperties == null) {
- userProperties = new HashMap<String, String>();
+ userProperties = new HashMap<>();
}
userProperties.put(name, value);
commands.remove(args[i]);
@@ -1295,7 +1295,7 @@
filename, e.getMessage() });
}
if (userProperties == null) {
- userProperties = new HashMap<String, String>();
+ userProperties = new HashMap<>();
}
Enumeration<?> propertyNames = props.propertyNames();
while (propertyNames.hasMoreElements()) {
diff --git a/ant/org.eclipse.ant.launching/remote/org/eclipse/ant/internal/launching/remote/logger/RemoteAntDebugBuildLogger.java b/ant/org.eclipse.ant.launching/remote/org/eclipse/ant/internal/launching/remote/logger/RemoteAntDebugBuildLogger.java
index 25ce3cf..129dcb6 100644
--- a/ant/org.eclipse.ant.launching/remote/org/eclipse/ant/internal/launching/remote/logger/RemoteAntDebugBuildLogger.java
+++ b/ant/org.eclipse.ant.launching/remote/org/eclipse/ant/internal/launching/remote/logger/RemoteAntDebugBuildLogger.java
@@ -366,7 +366,7 @@
@SuppressWarnings("unused")
protected void addBreakpoint(String breakpointRepresentation) {
if (fBreakpoints == null) {
- fBreakpoints = new ArrayList<RemoteAntBreakpoint>();
+ fBreakpoints = new ArrayList<>();
}
RemoteAntBreakpoint newBreakpoint = new RemoteAntBreakpoint(breakpointRepresentation);
if (!fBreakpoints.contains(newBreakpoint)) {
diff --git a/ant/org.eclipse.ant.launching/src/org/eclipse/ant/internal/launching/launchConfigurations/AntLaunchDelegate.java b/ant/org.eclipse.ant.launching/src/org/eclipse/ant/internal/launching/launchConfigurations/AntLaunchDelegate.java
index bcf3f60..ea72e20 100644
--- a/ant/org.eclipse.ant.launching/src/org/eclipse/ant/internal/launching/launchConfigurations/AntLaunchDelegate.java
+++ b/ant/org.eclipse.ant.launching/src/org/eclipse/ant/internal/launching/launchConfigurations/AntLaunchDelegate.java
@@ -573,7 +573,7 @@
// set the ANT_HOME environment variable
if (antHome != null) {
- Map<String, String> vars = copy.getAttribute(ILaunchManager.ATTR_ENVIRONMENT_VARIABLES, new HashMap<String, String>(1));
+ Map<String, String> vars = copy.getAttribute(ILaunchManager.ATTR_ENVIRONMENT_VARIABLES, new HashMap<>(1));
vars.put("ANT_HOME", antHome); //$NON-NLS-1$
copy.setAttribute(ILaunchManager.ATTR_ENVIRONMENT_VARIABLES, vars);
}
diff --git a/ant/org.eclipse.ant.tests.ui/External Tools/org/eclipse/ant/tests/ui/externaltools/BuilderCoreUtilsTests.java b/ant/org.eclipse.ant.tests.ui/External Tools/org/eclipse/ant/tests/ui/externaltools/BuilderCoreUtilsTests.java
index df9f9f4..b339019 100644
--- a/ant/org.eclipse.ant.tests.ui/External Tools/org/eclipse/ant/tests/ui/externaltools/BuilderCoreUtilsTests.java
+++ b/ant/org.eclipse.ant.tests.ui/External Tools/org/eclipse/ant/tests/ui/externaltools/BuilderCoreUtilsTests.java
@@ -61,7 +61,7 @@
* @throws Exception
*/
public void testConfigFromBuildCommandArgs1() throws Exception {
- ILaunchConfiguration config = BuilderCoreUtils.configFromBuildCommandArgs(getProject(), new HashMap<String, String>(), new String[] { BuilderCoreUtils.VERSION_1_0 });
+ ILaunchConfiguration config = BuilderCoreUtils.configFromBuildCommandArgs(getProject(), new HashMap<>(), new String[] { BuilderCoreUtils.VERSION_1_0 });
assertNull("There should be no configuration returned without the config handle and arguments", config); //$NON-NLS-1$
}
diff --git a/ant/org.eclipse.ant.ui/Ant Tools Support/org/eclipse/ant/internal/ui/datatransfer/AppletUtil.java b/ant/org.eclipse.ant.ui/Ant Tools Support/org/eclipse/ant/internal/ui/datatransfer/AppletUtil.java
index 182921a..57033fc 100644
--- a/ant/org.eclipse.ant.ui/Ant Tools Support/org/eclipse/ant/internal/ui/datatransfer/AppletUtil.java
+++ b/ant/org.eclipse.ant.ui/Ant Tools Support/org/eclipse/ant/internal/ui/datatransfer/AppletUtil.java
@@ -68,7 +68,7 @@
b.append("\" height=\""); //$NON-NLS-1$
b.append(Integer.toString(configuration.getAttribute(IJavaLaunchConfigurationConstants.ATTR_APPLET_HEIGHT, 200)));
b.append("\">" + ExportUtil.NEWLINE); //$NON-NLS-1$
- Map<String, String> parameters = configuration.getAttribute(IJavaLaunchConfigurationConstants.ATTR_APPLET_PARAMETERS, new HashMap<String, String>());
+ Map<String, String> parameters = configuration.getAttribute(IJavaLaunchConfigurationConstants.ATTR_APPLET_PARAMETERS, new HashMap<>());
if (parameters.size() != 0) {
Iterator<Entry<String, String>> iterator = parameters.entrySet().iterator();
while (iterator.hasNext()) {
diff --git a/ant/org.eclipse.ant.ui/Ant Tools Support/org/eclipse/ant/internal/ui/datatransfer/BuildFileCreator.java b/ant/org.eclipse.ant.ui/Ant Tools Support/org/eclipse/ant/internal/ui/datatransfer/BuildFileCreator.java
index a36bd08..3fc876a 100644
--- a/ant/org.eclipse.ant.ui/Ant Tools Support/org/eclipse/ant/internal/ui/datatransfer/BuildFileCreator.java
+++ b/ant/org.eclipse.ant.ui/Ant Tools Support/org/eclipse/ant/internal/ui/datatransfer/BuildFileCreator.java
@@ -990,7 +990,7 @@
if (!conf.getAttribute(ILaunchManager.ATTR_APPEND_ENVIRONMENT_VARIABLES, true)) {
javaElement.setAttribute("newenvironment", "true"); //$NON-NLS-1$ //$NON-NLS-2$
}
- Map<String, String> props = conf.getAttribute(ILaunchManager.ATTR_ENVIRONMENT_VARIABLES, new TreeMap<String, String>());
+ Map<String, String> props = conf.getAttribute(ILaunchManager.ATTR_ENVIRONMENT_VARIABLES, new TreeMap<>());
addElements(props, doc, javaElement, "env", "key", IAntCoreConstants.VALUE); //$NON-NLS-1$ //$NON-NLS-2$
addElement(conf.getAttribute(IJavaLaunchConfigurationConstants.ATTR_VM_ARGUMENTS, IAntCoreConstants.EMPTY_STRING), doc, javaElement, "jvmarg", "line", variable2value, projectRoot); //$NON-NLS-1$ //$NON-NLS-2$
addElement(conf.getAttribute(IJavaLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS, IAntCoreConstants.EMPTY_STRING), doc, javaElement, "arg", "line", variable2value, projectRoot); //$NON-NLS-1$ //$NON-NLS-2$
@@ -1131,7 +1131,7 @@
junitElement.appendChild(testElement);
}
}
- Map<String, String> props = conf.getAttribute(ILaunchManager.ATTR_ENVIRONMENT_VARIABLES, new TreeMap<String, String>());
+ Map<String, String> props = conf.getAttribute(ILaunchManager.ATTR_ENVIRONMENT_VARIABLES, new TreeMap<>());
addElements(props, doc, junitElement, "env", "key", IAntCoreConstants.VALUE); //$NON-NLS-1$ //$NON-NLS-2$
addElement(conf.getAttribute(IJavaLaunchConfigurationConstants.ATTR_VM_ARGUMENTS, IAntCoreConstants.EMPTY_STRING), doc, junitElement, "jvmarg", "line", variable2value, projectRoot); //$NON-NLS-1$ //$NON-NLS-2$
element.appendChild(junitElement);
diff --git a/ant/org.eclipse.ant.ui/Ant Tools Support/org/eclipse/ant/internal/ui/datatransfer/EclipseClasspath.java b/ant/org.eclipse.ant.ui/Ant Tools Support/org/eclipse/ant/internal/ui/datatransfer/EclipseClasspath.java
index a323757..e96a0cd 100644
--- a/ant/org.eclipse.ant.ui/Ant Tools Support/org/eclipse/ant/internal/ui/datatransfer/EclipseClasspath.java
+++ b/ant/org.eclipse.ant.ui/Ant Tools Support/org/eclipse/ant/internal/ui/datatransfer/EclipseClasspath.java
@@ -319,8 +319,8 @@
classDirs.add(refName);
rawClassPathEntries.add(refName);
rawClassPathEntriesAbsolute.add(refName);
- inclusionLists.add(new ArrayList<String>());
- exclusionLists.add(new ArrayList<String>());
+ inclusionLists.add(new ArrayList<>());
+ exclusionLists.add(new ArrayList<>());
}
}
@@ -340,8 +340,8 @@
classDirs.add(classpathRef);
rawClassPathEntries.add(classpathRef);
rawClassPathEntriesAbsolute.add(classpathRef);
- inclusionLists.add(new ArrayList<String>());
- exclusionLists.add(new ArrayList<String>());
+ inclusionLists.add(new ArrayList<>());
+ exclusionLists.add(new ArrayList<>());
}
}
diff --git a/ant/org.eclipse.ant.ui/Ant Tools Support/org/eclipse/ant/internal/ui/model/AntModelProject.java b/ant/org.eclipse.ant.ui/Ant Tools Support/org/eclipse/ant/internal/ui/model/AntModelProject.java
index ae08d2c..d75a4e7 100644
--- a/ant/org.eclipse.ant.ui/Ant Tools Support/org/eclipse/ant/internal/ui/model/AntModelProject.java
+++ b/ant/org.eclipse.ant.ui/Ant Tools Support/org/eclipse/ant/internal/ui/model/AntModelProject.java
@@ -66,7 +66,7 @@
}
private AntPropertyNode fCurrentConfiguringPropertyNode;
- private Map<String, Object> idrefs = Collections.synchronizedMap(new HashMap<String, Object>());
+ private Map<String, Object> idrefs = Collections.synchronizedMap(new HashMap<>());
private static Object loaderLock = new Object();
private Hashtable<String, AntClassLoader> loaders = null;