Use an empty array in favor of pre-sized array.master
@@ -570,8 +570,7 @@ public class DirectoryScanner | |||||
*/ | */ | ||||
public static String[] getDefaultExcludes() { | public static String[] getDefaultExcludes() { | ||||
synchronized (defaultExcludes) { | synchronized (defaultExcludes) { | ||||
return defaultExcludes.toArray(new String[defaultExcludes | |||||
.size()]); | |||||
return defaultExcludes.toArray(new String[0]); | |||||
} | } | ||||
} | } | ||||
@@ -1228,7 +1227,7 @@ public class DirectoryScanner | |||||
noLinks.add(newFile); | noLinks.add(newFile); | ||||
} | } | ||||
} | } | ||||
newFiles = noLinks.toArray(new String[noLinks.size()]); | |||||
newFiles = noLinks.toArray(new String[0]); | |||||
} else { | } else { | ||||
directoryNamesFollowed.addFirst(dir.getName()); | directoryNamesFollowed.addFirst(dir.getName()); | ||||
} | } | ||||
@@ -1522,7 +1521,7 @@ public class DirectoryScanner | |||||
if (filesIncluded == null) { | if (filesIncluded == null) { | ||||
throw new IllegalStateException("Must call scan() first"); | throw new IllegalStateException("Must call scan() first"); | ||||
} | } | ||||
files = filesIncluded.toArray(new String[filesIncluded.size()]); | |||||
files = filesIncluded.toArray(new String[0]); | |||||
} | } | ||||
Arrays.sort(files); | Arrays.sort(files); | ||||
return files; | return files; | ||||
@@ -1553,7 +1552,7 @@ public class DirectoryScanner | |||||
@Override | @Override | ||||
public synchronized String[] getNotIncludedFiles() { | public synchronized String[] getNotIncludedFiles() { | ||||
slowScan(); | slowScan(); | ||||
return filesNotIncluded.toArray(new String[filesNotIncluded.size()]); | |||||
return filesNotIncluded.toArray(new String[0]); | |||||
} | } | ||||
/** | /** | ||||
@@ -1570,7 +1569,7 @@ public class DirectoryScanner | |||||
@Override | @Override | ||||
public synchronized String[] getExcludedFiles() { | public synchronized String[] getExcludedFiles() { | ||||
slowScan(); | slowScan(); | ||||
return filesExcluded.toArray(new String[filesExcluded.size()]); | |||||
return filesExcluded.toArray(new String[0]); | |||||
} | } | ||||
/** | /** | ||||
@@ -1587,7 +1586,7 @@ public class DirectoryScanner | |||||
@Override | @Override | ||||
public synchronized String[] getDeselectedFiles() { | public synchronized String[] getDeselectedFiles() { | ||||
slowScan(); | slowScan(); | ||||
return filesDeselected.toArray(new String[filesDeselected.size()]); | |||||
return filesDeselected.toArray(new String[0]); | |||||
} | } | ||||
/** | /** | ||||
@@ -1605,7 +1604,7 @@ public class DirectoryScanner | |||||
if (dirsIncluded == null) { | if (dirsIncluded == null) { | ||||
throw new IllegalStateException("Must call scan() first"); | throw new IllegalStateException("Must call scan() first"); | ||||
} | } | ||||
directories = dirsIncluded.toArray(new String[dirsIncluded.size()]); | |||||
directories = dirsIncluded.toArray(new String[0]); | |||||
} | } | ||||
Arrays.sort(directories); | Arrays.sort(directories); | ||||
return directories; | return directories; | ||||
@@ -1636,7 +1635,7 @@ public class DirectoryScanner | |||||
@Override | @Override | ||||
public synchronized String[] getNotIncludedDirectories() { | public synchronized String[] getNotIncludedDirectories() { | ||||
slowScan(); | slowScan(); | ||||
return dirsNotIncluded.toArray(new String[dirsNotIncluded.size()]); | |||||
return dirsNotIncluded.toArray(new String[0]); | |||||
} | } | ||||
/** | /** | ||||
@@ -1653,7 +1652,7 @@ public class DirectoryScanner | |||||
@Override | @Override | ||||
public synchronized String[] getExcludedDirectories() { | public synchronized String[] getExcludedDirectories() { | ||||
slowScan(); | slowScan(); | ||||
return dirsExcluded.toArray(new String[dirsExcluded.size()]); | |||||
return dirsExcluded.toArray(new String[0]); | |||||
} | } | ||||
/** | /** | ||||
@@ -1670,7 +1669,7 @@ public class DirectoryScanner | |||||
@Override | @Override | ||||
public synchronized String[] getDeselectedDirectories() { | public synchronized String[] getDeselectedDirectories() { | ||||
slowScan(); | slowScan(); | ||||
return dirsDeselected.toArray(new String[dirsDeselected.size()]); | |||||
return dirsDeselected.toArray(new String[0]); | |||||
} | } | ||||
/** | /** | ||||
@@ -1685,7 +1684,7 @@ public class DirectoryScanner | |||||
public synchronized String[] getNotFollowedSymlinks() { | public synchronized String[] getNotFollowedSymlinks() { | ||||
String[] links; | String[] links; | ||||
synchronized (this) { | synchronized (this) { | ||||
links = notFollowedSymlinks.toArray(new String[notFollowedSymlinks.size()]); | |||||
links = notFollowedSymlinks.toArray(new String[0]); | |||||
} | } | ||||
Arrays.sort(links); | Arrays.sort(links); | ||||
return links; | return links; | ||||
@@ -1783,7 +1782,7 @@ public class DirectoryScanner | |||||
map.put(s, new TokenizedPath(s)); | map.put(s, new TokenizedPath(s)); | ||||
} | } | ||||
} | } | ||||
return al.toArray(new TokenizedPattern[al.size()]); | |||||
return al.toArray(new TokenizedPattern[0]); | |||||
} | } | ||||
/** | /** | ||||
@@ -1261,7 +1261,7 @@ public class Project implements ResourceFactory { | |||||
public void executeTargets(final Vector<String> names) throws BuildException { | public void executeTargets(final Vector<String> names) throws BuildException { | ||||
setUserProperty(MagicNames.PROJECT_INVOKED_TARGETS, | setUserProperty(MagicNames.PROJECT_INVOKED_TARGETS, | ||||
String.join(",", names)); | String.join(",", names)); | ||||
getExecutor().executeTargets(this, names.toArray(new String[names.size()])); | |||||
getExecutor().executeTargets(this, names.toArray(new String[0])); | |||||
} | } | ||||
/** | /** | ||||
@@ -232,7 +232,7 @@ public class Target implements TaskContainer { | |||||
tasks.add((Task) o); | tasks.add((Task) o); | ||||
} | } | ||||
} | } | ||||
return tasks.toArray(new Task[tasks.size()]); | |||||
return tasks.toArray(new Task[0]); | |||||
} | } | ||||
/** | /** | ||||
@@ -245,7 +245,7 @@ public class Launcher { | |||||
if (argList.size() == args.length) { | if (argList.size() == args.length) { | ||||
newArgs = args; | newArgs = args; | ||||
} else { | } else { | ||||
newArgs = argList.toArray(new String[argList.size()]); | |||||
newArgs = argList.toArray(new String[0]); | |||||
} | } | ||||
final URL[] libURLs = getLibPathURLs( | final URL[] libURLs = getLibPathURLs( | ||||
@@ -327,7 +327,7 @@ public class Launcher { | |||||
addPath(libPath, true, libPathURLs); | addPath(libPath, true, libPathURLs); | ||||
} | } | ||||
return libPathURLs.toArray(new URL[libPathURLs.size()]); | |||||
return libPathURLs.toArray(new URL[0]); | |||||
} | } | ||||
/** | /** | ||||
@@ -544,7 +544,7 @@ public class Checksum extends MatchingTask implements Condition { | |||||
if (totalproperty != null) { | if (totalproperty != null) { | ||||
// Calculate the total checksum | // Calculate the total checksum | ||||
// Convert the keys (source files) into a sorted array. | // Convert the keys (source files) into a sorted array. | ||||
File[] keyArray = allDigests.keySet().toArray(new File[allDigests.size()]); | |||||
File[] keyArray = allDigests.keySet().toArray(new File[0]); | |||||
// File is Comparable, but sort-order is platform | // File is Comparable, but sort-order is platform | ||||
// dependent (case-insensitive on Windows) | // dependent (case-insensitive on Windows) | ||||
Arrays.sort(keyArray, Comparator.nullsFirst( | Arrays.sort(keyArray, Comparator.nullsFirst( | ||||
@@ -577,7 +577,7 @@ public class Copy extends Task { | |||||
if (!nonFileResources.isEmpty() || singleResource != null) { | if (!nonFileResources.isEmpty() || singleResource != null) { | ||||
final Resource[] nonFiles = | final Resource[] nonFiles = | ||||
nonFileResources.toArray(new Resource[nonFileResources.size()]); | |||||
nonFileResources.toArray(new Resource[0]); | |||||
// restrict to out-of-date resources | // restrict to out-of-date resources | ||||
final Map<Resource, String[]> map = scan(nonFiles, destDir); | final Map<Resource, String[]> map = scan(nonFiles, destDir); | ||||
if (singleResource != null) { | if (singleResource != null) { | ||||
@@ -779,7 +779,7 @@ public class Copy extends Task { | |||||
v.add(name); | v.add(name); | ||||
} | } | ||||
} | } | ||||
toCopy = v.toArray(new String[v.size()]); | |||||
toCopy = v.toArray(new String[0]); | |||||
} else { | } else { | ||||
final SourceFileScanner ds = new SourceFileScanner(this); | final SourceFileScanner ds = new SourceFileScanner(this); | ||||
toCopy = ds.restrict(names, fromDir, toDir, mapper, granularity); | toCopy = ds.restrict(names, fromDir, toDir, mapper, granularity); | ||||
@@ -824,7 +824,7 @@ public class Copy extends Task { | |||||
v.add(rc); | v.add(rc); | ||||
} | } | ||||
} | } | ||||
toCopy = v.toArray(new Resource[v.size()]); | |||||
toCopy = v.toArray(new Resource[0]); | |||||
} else { | } else { | ||||
toCopy = ResourceUtils.selectOutOfDateSources(this, fromResources, mapper, | toCopy = ResourceUtils.selectOutOfDateSources(this, fromResources, mapper, | ||||
name -> new FileResource(toDir, name), granularity); | name -> new FileResource(toDir, name), granularity); | ||||
@@ -539,7 +539,7 @@ public class ExecuteOn extends ExecTask { | |||||
} | } | ||||
} | } | ||||
} | } | ||||
String[] targetFiles = targets.toArray(new String[targets.size()]); | |||||
String[] targetFiles = targets.toArray(new String[0]); | |||||
if (!addSourceFile) { | if (!addSourceFile) { | ||||
srcFiles = new String[0]; | srcFiles = new String[0]; | ||||
@@ -687,8 +687,8 @@ public class ExecuteOn extends ExecTask { | |||||
protected void runParallel(Execute exe, Vector<String> fileNames, | protected void runParallel(Execute exe, Vector<String> fileNames, | ||||
Vector<File> baseDirs) | Vector<File> baseDirs) | ||||
throws IOException, BuildException { | throws IOException, BuildException { | ||||
String[] s = fileNames.toArray(new String[fileNames.size()]); | |||||
File[] b = baseDirs.toArray(new File[baseDirs.size()]); | |||||
String[] s = fileNames.toArray(new String[0]); | |||||
File[] b = baseDirs.toArray(new File[0]); | |||||
if (maxParallel <= 0 || s.length == 0 /* this is skipEmpty == false */) { | if (maxParallel <= 0 || s.length == 0 /* this is skipEmpty == false */) { | ||||
String[] command = getCommandline(s, b); | String[] command = getCommandline(s, b); | ||||
@@ -663,7 +663,7 @@ public class Tar extends MatchingTask { | |||||
* @since Ant 1.9.5 | * @since Ant 1.9.5 | ||||
*/ | */ | ||||
protected boolean check(final File basedir, final Collection<String> files) { | protected boolean check(final File basedir, final Collection<String> files) { | ||||
return check(basedir, files.toArray(new String[files.size()])); | |||||
return check(basedir, files.toArray(new String[0])); | |||||
} | } | ||||
/** | /** | ||||
@@ -663,7 +663,7 @@ public class Zip extends MatchingTask { | |||||
vfss.addAll(resources); | vfss.addAll(resources); | ||||
final ResourceCollection[] fss = | final ResourceCollection[] fss = | ||||
vfss.toArray(new ResourceCollection[vfss.size()]); | |||||
vfss.toArray(new ResourceCollection[0]); | |||||
boolean success = false; | boolean success = false; | ||||
try { | try { | ||||
@@ -1255,11 +1255,11 @@ public class Zip extends MatchingTask { | |||||
} | } | ||||
} | } | ||||
final ResourceCollection[] rc = | final ResourceCollection[] rc = | ||||
rest.toArray(new ResourceCollection[rest.size()]); | |||||
rest.toArray(new ResourceCollection[0]); | |||||
ArchiveState as = getNonFileSetResourcesToAdd(rc, zipFile, | ArchiveState as = getNonFileSetResourcesToAdd(rc, zipFile, | ||||
needsUpdate); | needsUpdate); | ||||
final FileSet[] fs = filesets.toArray(new FileSet[filesets.size()]); | |||||
final FileSet[] fs = filesets.toArray(new FileSet[0]); | |||||
final ArchiveState as2 = getResourcesToAdd(fs, zipFile, as.isOutOfDate()); | final ArchiveState as2 = getResourcesToAdd(fs, zipFile, as.isOutOfDate()); | ||||
if (!as.isOutOfDate() && as2.isOutOfDate()) { | if (!as.isOutOfDate() && as2.isOutOfDate()) { | ||||
/* | /* | ||||
@@ -1602,7 +1602,7 @@ public class Zip extends MatchingTask { | |||||
resources.add(rs.getResource(f)); | resources.add(rs.getResource(f)); | ||||
} | } | ||||
} | } | ||||
result[i] = resources.toArray(new Resource[resources.size()]); | |||||
result[i] = resources.toArray(new Resource[0]); | |||||
} | } | ||||
return result; | return result; | ||||
} | } | ||||
@@ -1632,7 +1632,7 @@ public class Zip extends MatchingTask { | |||||
dirs.sort(Comparator.comparing(Resource::getName)); | dirs.sort(Comparator.comparing(Resource::getName)); | ||||
final List<Resource> rs = new ArrayList<>(dirs); | final List<Resource> rs = new ArrayList<>(dirs); | ||||
rs.addAll(files); | rs.addAll(files); | ||||
result[i] = rs.toArray(new Resource[rs.size()]); | |||||
result[i] = rs.toArray(new Resource[0]); | |||||
} | } | ||||
return result; | return result; | ||||
} | } | ||||
@@ -85,7 +85,7 @@ class ChangeLogParser { | |||||
} | } | ||||
modules.stream().map(Module::getName).forEach(names::add); | modules.stream().map(Module::getName).forEach(names::add); | ||||
moduleNames = names.toArray(new String[names.size()]); | |||||
moduleNames = names.toArray(new String[0]); | |||||
moduleNameLengths = new int[moduleNames.length]; | moduleNameLengths = new int[moduleNames.length]; | ||||
for (int i = 0; i < moduleNames.length; i++) { | for (int i = 0; i < moduleNames.length; i++) { | ||||
moduleNameLengths[i] = moduleNames[i].length(); | moduleNameLengths[i] = moduleNames[i].length(); | ||||
@@ -102,7 +102,7 @@ class ChangeLogParser { | |||||
* @return a list of rcs entries as an array | * @return a list of rcs entries as an array | ||||
*/ | */ | ||||
public CVSEntry[] getEntrySetAsArray() { | public CVSEntry[] getEntrySetAsArray() { | ||||
return entries.values().toArray(new CVSEntry[entries.size()]); | |||||
return entries.values().toArray(new CVSEntry[0]); | |||||
} | } | ||||
/** | /** | ||||
@@ -391,7 +391,7 @@ public class ChangeLogTask extends AbstractCvsTask { | |||||
results.add(cvsEntry); | results.add(cvsEntry); | ||||
} | } | ||||
return results.toArray(new CVSEntry[results.size()]); | |||||
return results.toArray(new CVSEntry[0]); | |||||
} | } | ||||
/** | /** | ||||
@@ -329,7 +329,7 @@ public class CvsTagDiff extends AbstractCvsTask { | |||||
line = reader.readLine(); | line = reader.readLine(); | ||||
} | } | ||||
return entries.toArray(new CvsTagEntry[entries.size()]); | |||||
return entries.toArray(new CvsTagEntry[0]); | |||||
} catch (IOException e) { | } catch (IOException e) { | ||||
throw new BuildException("Error in parsing", e); | throw new BuildException("Error in parsing", e); | ||||
} | } | ||||
@@ -905,7 +905,7 @@ public class NetRexxC extends MatchingTask { | |||||
options.add(utf8 ? "-utf8" : "-noutf8"); | options.add(utf8 ? "-utf8" : "-noutf8"); | ||||
options.add("-" + verbose); | options.add("-" + verbose); | ||||
return options.toArray(new String[options.size()]); | |||||
return options.toArray(new String[0]); | |||||
} | } | ||||
/** | /** | ||||
@@ -539,7 +539,7 @@ public class IPlanetEjbc { | |||||
arguments.add(ejb.getImplementation().getQualifiedClassName()); | arguments.add(ejb.getImplementation().getQualifiedClassName()); | ||||
/* Convert the List into an Array and return it */ | /* Convert the List into an Array and return it */ | ||||
return arguments.toArray(new String[arguments.size()]); | |||||
return arguments.toArray(new String[0]); | |||||
} | } | ||||
/** | /** | ||||
@@ -634,7 +634,7 @@ public class IPlanetEjbc { | |||||
* parsing. | * parsing. | ||||
*/ | */ | ||||
public EjbInfo[] getEjbs() { | public EjbInfo[] getEjbs() { | ||||
return ejbs.values().toArray(new EjbInfo[ejbs.size()]); | |||||
return ejbs.values().toArray(new EjbInfo[0]); | |||||
} | } | ||||
/** | /** | ||||
@@ -542,7 +542,7 @@ public final class Extension { | |||||
manifest.getEntries().values() | manifest.getEntries().values() | ||||
.forEach(attributes -> getExtension(attributes, results, listKey)); | .forEach(attributes -> getExtension(attributes, results, listKey)); | ||||
return results.toArray(new Extension[results.size()]); | |||||
return results.toArray(new Extension[0]); | |||||
} | } | ||||
/** | /** | ||||
@@ -100,7 +100,7 @@ public class ExtensionSet | |||||
dieOnCircularReference(); | dieOnCircularReference(); | ||||
final List<Extension> extensionsList = ExtensionUtil.toExtensions(extensions); | final List<Extension> extensionsList = ExtensionUtil.toExtensions(extensions); | ||||
ExtensionUtil.extractExtensions(proj, extensionsList, extensionsFilesets); | ExtensionUtil.extractExtensions(proj, extensionsList, extensionsFilesets); | ||||
return extensionsList.toArray(new Extension[extensionsList.size()]); | |||||
return extensionsList.toArray(new Extension[0]); | |||||
} | } | ||||
/** | /** | ||||
@@ -100,7 +100,7 @@ public final class ExtensionUtil { | |||||
loadExtensions(file, extensions, includeImpl, includeURL); | loadExtensions(file, extensions, includeImpl, includeURL); | ||||
} | } | ||||
} | } | ||||
return extensions.toArray(new Extension[extensions.size()]); | |||||
return extensions.toArray(new Extension[0]); | |||||
} | } | ||||
/** | /** | ||||
@@ -178,7 +178,7 @@ public final class Specification { | |||||
.ifPresent(results::add); | .ifPresent(results::add); | ||||
} | } | ||||
return removeDuplicates(results) | return removeDuplicates(results) | ||||
.toArray(new Specification[removeDuplicates(results).size()]); | |||||
.toArray(new Specification[0]); | |||||
} | } | ||||
/** | /** | ||||
@@ -141,7 +141,7 @@ public class LauncherSupport { | |||||
try { | try { | ||||
firstListener.switchedSysOutHandle = trySwitchSysOutErr(testRequest, StreamType.SYS_OUT, originalSysErr); | firstListener.switchedSysOutHandle = trySwitchSysOutErr(testRequest, StreamType.SYS_OUT, originalSysErr); | ||||
firstListener.switchedSysErrHandle = trySwitchSysOutErr(testRequest, StreamType.SYS_ERR, originalSysErr); | firstListener.switchedSysErrHandle = trySwitchSysOutErr(testRequest, StreamType.SYS_ERR, originalSysErr); | ||||
launcher.execute(request, testExecutionListeners.toArray(new TestExecutionListener[testExecutionListeners.size()])); | |||||
launcher.execute(request, testExecutionListeners.toArray(new TestExecutionListener[0])); | |||||
} finally { | } finally { | ||||
// switch back sysout/syserr to the original | // switch back sysout/syserr to the original | ||||
try { | try { | ||||
@@ -87,7 +87,7 @@ public class SingleTestClass extends TestDefinition implements NamedTest { | |||||
if (!hasMethodsSpecified()) { | if (!hasMethodsSpecified()) { | ||||
return null; | return null; | ||||
} | } | ||||
return this.testMethods.toArray(new String[this.testMethods.size()]); | |||||
return this.testMethods.toArray(new String[0]); | |||||
} | } | ||||
@Override | @Override | ||||
@@ -140,7 +140,7 @@ public abstract class TestDefinition { | |||||
} | } | ||||
parts.add(part); | parts.add(part); | ||||
} | } | ||||
return parts.toArray(new String[parts.size()]); | |||||
return parts.toArray(new String[0]); | |||||
} | } | ||||
protected abstract void toForkedRepresentation(JUnitLauncherTask task, XMLStreamWriter writer) throws XMLStreamException; | protected abstract void toForkedRepresentation(JUnitLauncherTask task, XMLStreamWriter writer) throws XMLStreamException; | ||||
@@ -336,7 +336,7 @@ public abstract class DefaultRmicAdapter implements RmicAdapter { | |||||
args.add(arg); | args.add(arg); | ||||
} | } | ||||
} | } | ||||
return args.toArray(new String[args.size()]); | |||||
return args.toArray(new String[0]); | |||||
} | } | ||||
@@ -640,7 +640,7 @@ public abstract class AbstractFileSet extends DataType | |||||
return getRef(getProject()).getSelectors(p); | return getRef(getProject()).getSelectors(p); | ||||
} | } | ||||
dieOnCircularReference(p); | dieOnCircularReference(p); | ||||
return selectors.toArray(new FileSelector[selectors.size()]); | |||||
return selectors.toArray(new FileSelector[0]); | |||||
} | } | ||||
/** | /** | ||||
@@ -138,7 +138,7 @@ public final class AntFilterReader extends DataType { | |||||
getRef().getParams(); | getRef().getParams(); | ||||
} | } | ||||
dieOnCircularReference(); | dieOnCircularReference(); | ||||
return parameters.toArray(new Parameter[parameters.size()]); | |||||
return parameters.toArray(new Parameter[0]); | |||||
} | } | ||||
/** | /** | ||||
@@ -158,7 +158,7 @@ public abstract class ArchiveScanner extends DirectoryScanner { | |||||
return super.getIncludedFiles(); | return super.getIncludedFiles(); | ||||
} | } | ||||
scanme(); | scanme(); | ||||
return matchFileEntries.keySet().toArray(new String[matchFileEntries.size()]); | |||||
return matchFileEntries.keySet().toArray(new String[0]); | |||||
} | } | ||||
/** | /** | ||||
@@ -187,7 +187,7 @@ public abstract class ArchiveScanner extends DirectoryScanner { | |||||
return super.getIncludedDirectories(); | return super.getIncludedDirectories(); | ||||
} | } | ||||
scanme(); | scanme(); | ||||
return matchDirEntries.keySet().toArray(new String[matchDirEntries.size()]); | |||||
return matchDirEntries.keySet().toArray(new String[0]); | |||||
} | } | ||||
/** | /** | ||||
@@ -372,7 +372,7 @@ public class Commandline implements Cloneable { | |||||
public String[] getCommandline() { | public String[] getCommandline() { | ||||
final List<String> commands = new LinkedList<>(); | final List<String> commands = new LinkedList<>(); | ||||
addCommandToList(commands.listIterator()); | addCommandToList(commands.listIterator()); | ||||
return commands.toArray(new String[commands.size()]); | |||||
return commands.toArray(new String[0]); | |||||
} | } | ||||
/** | /** | ||||
@@ -395,7 +395,7 @@ public class Commandline implements Cloneable { | |||||
public String[] getArguments() { | public String[] getArguments() { | ||||
List<String> result = new ArrayList<>(arguments.size() * 2); | List<String> result = new ArrayList<>(arguments.size() * 2); | ||||
addArgumentsToList(result.listIterator()); | addArgumentsToList(result.listIterator()); | ||||
return result.toArray(new String[result.size()]); | |||||
return result.toArray(new String[0]); | |||||
} | } | ||||
/** | /** | ||||
@@ -537,7 +537,7 @@ public class Commandline implements Cloneable { | |||||
if (state == inQuote || state == inDoubleQuote) { | if (state == inQuote || state == inDoubleQuote) { | ||||
throw new BuildException("unbalanced quotes in " + toProcess); | throw new BuildException("unbalanced quotes in " + toProcess); | ||||
} | } | ||||
return result.toArray(new String[result.size()]); | |||||
return result.toArray(new String[0]); | |||||
} | } | ||||
/** | /** | ||||
@@ -97,7 +97,7 @@ public class CommandlineJava implements Cloneable { | |||||
if (definitions.isEmpty()) { | if (definitions.isEmpty()) { | ||||
return null; | return null; | ||||
} | } | ||||
return definitions.toArray(new String[definitions.size()]); | |||||
return definitions.toArray(new String[0]); | |||||
} | } | ||||
/** | /** | ||||
@@ -500,7 +500,7 @@ public class CommandlineJava implements Cloneable { | |||||
//fill it | //fill it | ||||
addCommandsToList(commands.listIterator()); | addCommandsToList(commands.listIterator()); | ||||
//convert to an array | //convert to an array | ||||
return commands.toArray(new String[commands.size()]); | |||||
return commands.toArray(new String[0]); | |||||
} | } | ||||
/** | /** | ||||
@@ -133,7 +133,7 @@ public class FileList extends DataType implements ResourceCollection { | |||||
throw new BuildException("No files specified for filelist."); | throw new BuildException("No files specified for filelist."); | ||||
} | } | ||||
return filenames.toArray(new String[filenames.size()]); | |||||
return filenames.toArray(new String[0]); | |||||
} | } | ||||
/** | /** | ||||
@@ -184,7 +184,7 @@ public class FileList extends DataType implements ResourceCollection { | |||||
return getRef().iterator(); | return getRef().iterator(); | ||||
} | } | ||||
return new FileResourceIterator(getProject(), dir, | return new FileResourceIterator(getProject(), dir, | ||||
filenames.toArray(new String[filenames.size()])); | |||||
filenames.toArray(new String[0])); | |||||
} | } | ||||
/** | /** | ||||
@@ -420,7 +420,7 @@ public class Path extends DataType implements Cloneable, ResourceCollection { | |||||
} | } | ||||
result.add(element.toString()); | result.add(element.toString()); | ||||
} | } | ||||
return result.toArray(new String[result.size()]); | |||||
return result.toArray(new String[0]); | |||||
} | } | ||||
/** | /** | ||||
@@ -578,7 +578,7 @@ public class RedirectorElement extends DataType { | |||||
list.add(getProject().resolveFile(n)); | list.add(getProject().resolveFile(n)); | ||||
} | } | ||||
} | } | ||||
return list.toArray(new File[list.size()]); | |||||
return list.toArray(new File[0]); | |||||
} | } | ||||
/** | /** | ||||
@@ -86,6 +86,6 @@ public class ScriptMapper extends AbstractScriptComponent implements FileNameMap | |||||
if (files.isEmpty()) { | if (files.isEmpty()) { | ||||
return null; | return null; | ||||
} | } | ||||
return files.toArray(new String[files.size()]); | |||||
return files.toArray(new String[0]); | |||||
} | } | ||||
} | } |
@@ -78,7 +78,7 @@ public abstract class AbstractSelectorContainer extends DataType | |||||
return getRef(p).getSelectors(p); | return getRef(p).getSelectors(p); | ||||
} | } | ||||
dieOnCircularReference(p); | dieOnCircularReference(p); | ||||
return selectorsList.toArray(new FileSelector[selectorsList.size()]); | |||||
return selectorsList.toArray(new FileSelector[0]); | |||||
} | } | ||||
/** | /** | ||||
@@ -66,7 +66,7 @@ public abstract class BaseSelectorContainer extends BaseSelector | |||||
*/ | */ | ||||
public FileSelector[] getSelectors(Project p) { | public FileSelector[] getSelectors(Project p) { | ||||
dieOnCircularReference(); | dieOnCircularReference(); | ||||
return selectorsList.toArray(new FileSelector[selectorsList.size()]); | |||||
return selectorsList.toArray(new FileSelector[0]); | |||||
} | } | ||||
/** | /** | ||||
@@ -188,7 +188,7 @@ public class ExtendSelector extends BaseSelector { | |||||
if (!parameters.isEmpty() && dynselector instanceof ExtendFileSelector) { | if (!parameters.isEmpty() && dynselector instanceof ExtendFileSelector) { | ||||
// We know that dynselector must be non-null if no error message | // We know that dynselector must be non-null if no error message | ||||
((ExtendFileSelector) dynselector).setParameters( | ((ExtendFileSelector) dynselector).setParameters( | ||||
parameters.toArray(new Parameter[parameters.size()])); | |||||
parameters.toArray(new Parameter[0])); | |||||
} | } | ||||
return dynselector.isSelected(basedir, filename, file); | return dynselector.isSelected(basedir, filename, file); | ||||
} | } | ||||
@@ -316,7 +316,7 @@ public class ZipEntry extends java.util.zip.ZipEntry implements Cloneable { | |||||
newFields.add(field); | newFields.add(field); | ||||
} | } | ||||
} | } | ||||
extraFields = newFields.toArray(new ZipExtraField[newFields.size()]); | |||||
extraFields = newFields.toArray(new ZipExtraField[0]); | |||||
setExtra(); | setExtra(); | ||||
} | } | ||||
@@ -467,7 +467,7 @@ public class ZipEntry extends java.util.zip.ZipEntry implements Cloneable { | |||||
if (extraFields.length == newResult.size()) { | if (extraFields.length == newResult.size()) { | ||||
throw new NoSuchElementException(); | throw new NoSuchElementException(); | ||||
} | } | ||||
extraFields = newResult.toArray(new ZipExtraField[newResult.size()]); | |||||
extraFields = newResult.toArray(new ZipExtraField[0]); | |||||
setExtra(); | setExtra(); | ||||
} | } | ||||