java 5-8 java8 75/head
authorMatt Benson <mbenson@apache.org>
Thu, 13 Apr 2017 15:15:22 +0000 (10:15 -0500)
committerMatt Benson <mbenson@apache.org>
Thu, 13 Apr 2017 15:15:22 +0000 (10:15 -0500)
609 files changed:
src/main/org/apache/tools/ant/AntClassLoader.java
src/main/org/apache/tools/ant/ArgumentProcessorRegistry.java
src/main/org/apache/tools/ant/BuildException.java
src/main/org/apache/tools/ant/ComponentHelper.java
src/main/org/apache/tools/ant/DefaultDefinitions.java
src/main/org/apache/tools/ant/DefaultLogger.java
src/main/org/apache/tools/ant/DemuxInputStream.java
src/main/org/apache/tools/ant/DemuxOutputStream.java
src/main/org/apache/tools/ant/Diagnostics.java
src/main/org/apache/tools/ant/DirectoryScanner.java
src/main/org/apache/tools/ant/DynamicConfigurator.java
src/main/org/apache/tools/ant/Evaluable.java
src/main/org/apache/tools/ant/IntrospectionHelper.java
src/main/org/apache/tools/ant/Location.java
src/main/org/apache/tools/ant/Main.java
src/main/org/apache/tools/ant/PathTokenizer.java
src/main/org/apache/tools/ant/Project.java
src/main/org/apache/tools/ant/ProjectComponent.java
src/main/org/apache/tools/ant/ProjectHelper.java
src/main/org/apache/tools/ant/ProjectHelperRepository.java
src/main/org/apache/tools/ant/PropertyHelper.java
src/main/org/apache/tools/ant/RuntimeConfigurable.java
src/main/org/apache/tools/ant/Target.java
src/main/org/apache/tools/ant/Task.java
src/main/org/apache/tools/ant/TaskAdapter.java
src/main/org/apache/tools/ant/TaskConfigurationChecker.java
src/main/org/apache/tools/ant/UnknownElement.java
src/main/org/apache/tools/ant/XmlLogger.java
src/main/org/apache/tools/ant/attribute/BaseIfAttribute.java
src/main/org/apache/tools/ant/dispatch/DispatchTask.java
src/main/org/apache/tools/ant/dispatch/DispatchUtils.java
src/main/org/apache/tools/ant/filters/util/ChainReaderHelper.java
src/main/org/apache/tools/ant/helper/ProjectHelper2.java
src/main/org/apache/tools/ant/input/MultipleChoiceInputRequest.java
src/main/org/apache/tools/ant/launch/Launcher.java
src/main/org/apache/tools/ant/launch/Locator.java
src/main/org/apache/tools/ant/listener/AnsiColorLogger.java
src/main/org/apache/tools/ant/listener/CommonsLoggingListener.java
src/main/org/apache/tools/ant/listener/Log4jListener.java
src/main/org/apache/tools/ant/listener/MailLogger.java
src/main/org/apache/tools/ant/listener/ProfileLogger.java
src/main/org/apache/tools/ant/listener/SimpleBigProjectLogger.java
src/main/org/apache/tools/ant/listener/TimestampedLogger.java
src/main/org/apache/tools/ant/property/LocalProperties.java
src/main/org/apache/tools/ant/property/LocalPropertyStack.java
src/main/org/apache/tools/ant/property/NullReturn.java
src/main/org/apache/tools/ant/property/ParseProperties.java
src/main/org/apache/tools/ant/property/ResolvePropertyMap.java
src/main/org/apache/tools/ant/taskdefs/AbstractCvsTask.java
src/main/org/apache/tools/ant/taskdefs/AbstractJarSignerTask.java
src/main/org/apache/tools/ant/taskdefs/Ant.java
src/main/org/apache/tools/ant/taskdefs/AntStructure.java
src/main/org/apache/tools/ant/taskdefs/Antlib.java
src/main/org/apache/tools/ant/taskdefs/AntlibDefinition.java
src/main/org/apache/tools/ant/taskdefs/Available.java
src/main/org/apache/tools/ant/taskdefs/Basename.java
src/main/org/apache/tools/ant/taskdefs/BindTargets.java
src/main/org/apache/tools/ant/taskdefs/BuildNumber.java
src/main/org/apache/tools/ant/taskdefs/CVSPass.java
src/main/org/apache/tools/ant/taskdefs/Checksum.java
src/main/org/apache/tools/ant/taskdefs/Chmod.java
src/main/org/apache/tools/ant/taskdefs/Classloader.java
src/main/org/apache/tools/ant/taskdefs/Concat.java
src/main/org/apache/tools/ant/taskdefs/ConditionTask.java
src/main/org/apache/tools/ant/taskdefs/Copy.java
src/main/org/apache/tools/ant/taskdefs/Copydir.java
src/main/org/apache/tools/ant/taskdefs/Copyfile.java
src/main/org/apache/tools/ant/taskdefs/DefaultExcludes.java
src/main/org/apache/tools/ant/taskdefs/Definer.java
src/main/org/apache/tools/ant/taskdefs/Delete.java
src/main/org/apache/tools/ant/taskdefs/DependSet.java
src/main/org/apache/tools/ant/taskdefs/Dirname.java
src/main/org/apache/tools/ant/taskdefs/Ear.java
src/main/org/apache/tools/ant/taskdefs/EchoXML.java
src/main/org/apache/tools/ant/taskdefs/Exec.java
src/main/org/apache/tools/ant/taskdefs/ExecTask.java
src/main/org/apache/tools/ant/taskdefs/Execute.java
src/main/org/apache/tools/ant/taskdefs/ExecuteJava.java
src/main/org/apache/tools/ant/taskdefs/ExecuteOn.java
src/main/org/apache/tools/ant/taskdefs/ExecuteWatchdog.java
src/main/org/apache/tools/ant/taskdefs/Exit.java
src/main/org/apache/tools/ant/taskdefs/Expand.java
src/main/org/apache/tools/ant/taskdefs/Filter.java
src/main/org/apache/tools/ant/taskdefs/FixCRLF.java
src/main/org/apache/tools/ant/taskdefs/GUnzip.java
src/main/org/apache/tools/ant/taskdefs/GZip.java
src/main/org/apache/tools/ant/taskdefs/GenerateKey.java
src/main/org/apache/tools/ant/taskdefs/Get.java
src/main/org/apache/tools/ant/taskdefs/HostInfo.java
src/main/org/apache/tools/ant/taskdefs/ImportTask.java
src/main/org/apache/tools/ant/taskdefs/Input.java
src/main/org/apache/tools/ant/taskdefs/JDBCTask.java
src/main/org/apache/tools/ant/taskdefs/Jar.java
src/main/org/apache/tools/ant/taskdefs/Java.java
src/main/org/apache/tools/ant/taskdefs/Javac.java
src/main/org/apache/tools/ant/taskdefs/Javadoc.java
src/main/org/apache/tools/ant/taskdefs/Length.java
src/main/org/apache/tools/ant/taskdefs/LoadProperties.java
src/main/org/apache/tools/ant/taskdefs/LoadResource.java
src/main/org/apache/tools/ant/taskdefs/LogStreamHandler.java
src/main/org/apache/tools/ant/taskdefs/MacroDef.java
src/main/org/apache/tools/ant/taskdefs/MacroInstance.java
src/main/org/apache/tools/ant/taskdefs/MakeUrl.java
src/main/org/apache/tools/ant/taskdefs/Manifest.java
src/main/org/apache/tools/ant/taskdefs/ManifestClassPath.java
src/main/org/apache/tools/ant/taskdefs/ManifestTask.java
src/main/org/apache/tools/ant/taskdefs/MatchingTask.java
src/main/org/apache/tools/ant/taskdefs/Mkdir.java
src/main/org/apache/tools/ant/taskdefs/Move.java
src/main/org/apache/tools/ant/taskdefs/Nice.java
src/main/org/apache/tools/ant/taskdefs/Pack.java
src/main/org/apache/tools/ant/taskdefs/Parallel.java
src/main/org/apache/tools/ant/taskdefs/Patch.java
src/main/org/apache/tools/ant/taskdefs/PathConvert.java
src/main/org/apache/tools/ant/taskdefs/PreSetDef.java
src/main/org/apache/tools/ant/taskdefs/ProcessDestroyer.java
src/main/org/apache/tools/ant/taskdefs/ProjectHelperTask.java
src/main/org/apache/tools/ant/taskdefs/Property.java
src/main/org/apache/tools/ant/taskdefs/PropertyHelperTask.java
src/main/org/apache/tools/ant/taskdefs/Replace.java
src/main/org/apache/tools/ant/taskdefs/ResourceCount.java
src/main/org/apache/tools/ant/taskdefs/Retry.java
src/main/org/apache/tools/ant/taskdefs/Rmic.java
src/main/org/apache/tools/ant/taskdefs/SQLExec.java
src/main/org/apache/tools/ant/taskdefs/Sequential.java
src/main/org/apache/tools/ant/taskdefs/SetPermissions.java
src/main/org/apache/tools/ant/taskdefs/SignJar.java
src/main/org/apache/tools/ant/taskdefs/Sleep.java
src/main/org/apache/tools/ant/taskdefs/StreamPumper.java
src/main/org/apache/tools/ant/taskdefs/SubAnt.java
src/main/org/apache/tools/ant/taskdefs/Sync.java
src/main/org/apache/tools/ant/taskdefs/Tar.java
src/main/org/apache/tools/ant/taskdefs/Taskdef.java
src/main/org/apache/tools/ant/taskdefs/TempFile.java
src/main/org/apache/tools/ant/taskdefs/Touch.java
src/main/org/apache/tools/ant/taskdefs/Tstamp.java
src/main/org/apache/tools/ant/taskdefs/Typedef.java
src/main/org/apache/tools/ant/taskdefs/Unpack.java
src/main/org/apache/tools/ant/taskdefs/Untar.java
src/main/org/apache/tools/ant/taskdefs/UpToDate.java
src/main/org/apache/tools/ant/taskdefs/VerifyJar.java
src/main/org/apache/tools/ant/taskdefs/WaitFor.java
src/main/org/apache/tools/ant/taskdefs/War.java
src/main/org/apache/tools/ant/taskdefs/WhichResource.java
src/main/org/apache/tools/ant/taskdefs/XSLTProcess.java
src/main/org/apache/tools/ant/taskdefs/XmlProperty.java
src/main/org/apache/tools/ant/taskdefs/Zip.java
src/main/org/apache/tools/ant/taskdefs/compilers/CompilerAdapterFactory.java
src/main/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapter.java
src/main/org/apache/tools/ant/taskdefs/compilers/Gcj.java
src/main/org/apache/tools/ant/taskdefs/compilers/Javac13.java
src/main/org/apache/tools/ant/taskdefs/compilers/JavacExternal.java
src/main/org/apache/tools/ant/taskdefs/compilers/Jikes.java
src/main/org/apache/tools/ant/taskdefs/compilers/Jvc.java
src/main/org/apache/tools/ant/taskdefs/compilers/Kjc.java
src/main/org/apache/tools/ant/taskdefs/compilers/Sj.java
src/main/org/apache/tools/ant/taskdefs/condition/And.java
src/main/org/apache/tools/ant/taskdefs/condition/AntVersion.java
src/main/org/apache/tools/ant/taskdefs/condition/Condition.java
src/main/org/apache/tools/ant/taskdefs/condition/ConditionBase.java
src/main/org/apache/tools/ant/taskdefs/condition/Contains.java
src/main/org/apache/tools/ant/taskdefs/condition/FilesMatch.java
src/main/org/apache/tools/ant/taskdefs/condition/HasFreeSpace.java
src/main/org/apache/tools/ant/taskdefs/condition/HasMethod.java
src/main/org/apache/tools/ant/taskdefs/condition/Http.java
src/main/org/apache/tools/ant/taskdefs/condition/IsLastModified.java
src/main/org/apache/tools/ant/taskdefs/condition/IsReachable.java
src/main/org/apache/tools/ant/taskdefs/condition/IsReference.java
src/main/org/apache/tools/ant/taskdefs/condition/IsSet.java
src/main/org/apache/tools/ant/taskdefs/condition/IsSigned.java
src/main/org/apache/tools/ant/taskdefs/condition/IsTrue.java
src/main/org/apache/tools/ant/taskdefs/condition/Not.java
src/main/org/apache/tools/ant/taskdefs/condition/Or.java
src/main/org/apache/tools/ant/taskdefs/condition/Os.java
src/main/org/apache/tools/ant/taskdefs/condition/ParserSupports.java
src/main/org/apache/tools/ant/taskdefs/condition/ResourceContains.java
src/main/org/apache/tools/ant/taskdefs/condition/ResourcesMatch.java
src/main/org/apache/tools/ant/taskdefs/condition/Socket.java
src/main/org/apache/tools/ant/taskdefs/condition/TypeFound.java
src/main/org/apache/tools/ant/taskdefs/condition/Xor.java
src/main/org/apache/tools/ant/taskdefs/cvslib/CVSEntry.java
src/main/org/apache/tools/ant/taskdefs/cvslib/ChangeLogParser.java
src/main/org/apache/tools/ant/taskdefs/cvslib/ChangeLogTask.java
src/main/org/apache/tools/ant/taskdefs/cvslib/ChangeLogWriter.java
src/main/org/apache/tools/ant/taskdefs/cvslib/CvsTagDiff.java
src/main/org/apache/tools/ant/taskdefs/cvslib/CvsTagEntry.java
src/main/org/apache/tools/ant/taskdefs/cvslib/CvsUser.java
src/main/org/apache/tools/ant/taskdefs/cvslib/CvsVersion.java
src/main/org/apache/tools/ant/taskdefs/cvslib/RCSFile.java
src/main/org/apache/tools/ant/taskdefs/cvslib/RedirectingOutputStream.java
src/main/org/apache/tools/ant/taskdefs/cvslib/RedirectingStreamHandler.java
src/main/org/apache/tools/ant/taskdefs/email/EmailAddress.java
src/main/org/apache/tools/ant/taskdefs/email/EmailTask.java
src/main/org/apache/tools/ant/taskdefs/email/Mailer.java
src/main/org/apache/tools/ant/taskdefs/email/Message.java
src/main/org/apache/tools/ant/taskdefs/email/MimeMailer.java
src/main/org/apache/tools/ant/taskdefs/email/PlainMailer.java
src/main/org/apache/tools/ant/taskdefs/email/UUMailer.java
src/main/org/apache/tools/ant/taskdefs/launcher/CommandLauncher.java
src/main/org/apache/tools/ant/taskdefs/launcher/PerlScriptCommandLauncher.java
src/main/org/apache/tools/ant/taskdefs/launcher/ScriptCommandLauncher.java
src/main/org/apache/tools/ant/taskdefs/launcher/VmsCommandLauncher.java
src/main/org/apache/tools/ant/taskdefs/optional/ANTLR.java
src/main/org/apache/tools/ant/taskdefs/optional/Cab.java
src/main/org/apache/tools/ant/taskdefs/optional/EchoProperties.java
src/main/org/apache/tools/ant/taskdefs/optional/Javah.java
src/main/org/apache/tools/ant/taskdefs/optional/Native2Ascii.java
src/main/org/apache/tools/ant/taskdefs/optional/NetRexxC.java
src/main/org/apache/tools/ant/taskdefs/optional/PropertyFile.java
src/main/org/apache/tools/ant/taskdefs/optional/ReplaceRegExp.java
src/main/org/apache/tools/ant/taskdefs/optional/Rpm.java
src/main/org/apache/tools/ant/taskdefs/optional/SchemaValidate.java
src/main/org/apache/tools/ant/taskdefs/optional/ccm/CCMCheck.java
src/main/org/apache/tools/ant/taskdefs/optional/ccm/CCMCheckin.java
src/main/org/apache/tools/ant/taskdefs/optional/ccm/CCMCheckinDefault.java
src/main/org/apache/tools/ant/taskdefs/optional/ccm/CCMCheckout.java
src/main/org/apache/tools/ant/taskdefs/optional/ccm/CCMCreateTask.java
src/main/org/apache/tools/ant/taskdefs/optional/ccm/CCMReconfigure.java
src/main/org/apache/tools/ant/taskdefs/optional/ccm/Continuus.java
src/main/org/apache/tools/ant/taskdefs/optional/clearcase/CCCheckin.java
src/main/org/apache/tools/ant/taskdefs/optional/clearcase/CCCheckout.java
src/main/org/apache/tools/ant/taskdefs/optional/clearcase/CCLock.java
src/main/org/apache/tools/ant/taskdefs/optional/clearcase/CCMkattr.java
src/main/org/apache/tools/ant/taskdefs/optional/clearcase/CCMkbl.java
src/main/org/apache/tools/ant/taskdefs/optional/clearcase/CCMkdir.java
src/main/org/apache/tools/ant/taskdefs/optional/clearcase/CCMkelem.java
src/main/org/apache/tools/ant/taskdefs/optional/clearcase/CCMklabel.java
src/main/org/apache/tools/ant/taskdefs/optional/clearcase/CCMklbtype.java
src/main/org/apache/tools/ant/taskdefs/optional/clearcase/CCRmtype.java
src/main/org/apache/tools/ant/taskdefs/optional/clearcase/CCUnCheckout.java
src/main/org/apache/tools/ant/taskdefs/optional/clearcase/CCUnlock.java
src/main/org/apache/tools/ant/taskdefs/optional/clearcase/CCUpdate.java
src/main/org/apache/tools/ant/taskdefs/optional/clearcase/ClearCase.java
src/main/org/apache/tools/ant/taskdefs/optional/depend/AntAnalyzer.java
src/main/org/apache/tools/ant/taskdefs/optional/depend/ClassFile.java
src/main/org/apache/tools/ant/taskdefs/optional/depend/ClassFileIterator.java
src/main/org/apache/tools/ant/taskdefs/optional/depend/ClassFileUtils.java
src/main/org/apache/tools/ant/taskdefs/optional/depend/Depend.java
src/main/org/apache/tools/ant/taskdefs/optional/depend/DirectoryIterator.java
src/main/org/apache/tools/ant/taskdefs/optional/depend/JarFileIterator.java
src/main/org/apache/tools/ant/taskdefs/optional/depend/constantpool/ClassCPInfo.java
src/main/org/apache/tools/ant/taskdefs/optional/depend/constantpool/ConstantCPInfo.java
src/main/org/apache/tools/ant/taskdefs/optional/depend/constantpool/ConstantPool.java
src/main/org/apache/tools/ant/taskdefs/optional/depend/constantpool/ConstantPoolEntry.java
src/main/org/apache/tools/ant/taskdefs/optional/depend/constantpool/DoubleCPInfo.java
src/main/org/apache/tools/ant/taskdefs/optional/depend/constantpool/FieldRefCPInfo.java
src/main/org/apache/tools/ant/taskdefs/optional/depend/constantpool/FloatCPInfo.java
src/main/org/apache/tools/ant/taskdefs/optional/depend/constantpool/IntegerCPInfo.java
src/main/org/apache/tools/ant/taskdefs/optional/depend/constantpool/InterfaceMethodRefCPInfo.java
src/main/org/apache/tools/ant/taskdefs/optional/depend/constantpool/InvokeDynamicCPInfo.java
src/main/org/apache/tools/ant/taskdefs/optional/depend/constantpool/LongCPInfo.java
src/main/org/apache/tools/ant/taskdefs/optional/depend/constantpool/MethodHandleCPInfo.java
src/main/org/apache/tools/ant/taskdefs/optional/depend/constantpool/MethodRefCPInfo.java
src/main/org/apache/tools/ant/taskdefs/optional/depend/constantpool/MethodTypeCPInfo.java
src/main/org/apache/tools/ant/taskdefs/optional/depend/constantpool/NameAndTypeCPInfo.java
src/main/org/apache/tools/ant/taskdefs/optional/depend/constantpool/StringCPInfo.java
src/main/org/apache/tools/ant/taskdefs/optional/depend/constantpool/Utf8CPInfo.java
src/main/org/apache/tools/ant/taskdefs/optional/ejb/BorlandDeploymentTool.java
src/main/org/apache/tools/ant/taskdefs/optional/ejb/BorlandGenerateClient.java
src/main/org/apache/tools/ant/taskdefs/optional/ejb/DescriptorHandler.java
src/main/org/apache/tools/ant/taskdefs/optional/ejb/EJBDeploymentTool.java
src/main/org/apache/tools/ant/taskdefs/optional/ejb/EjbJar.java
src/main/org/apache/tools/ant/taskdefs/optional/ejb/GenericDeploymentTool.java
src/main/org/apache/tools/ant/taskdefs/optional/ejb/IPlanetDeploymentTool.java
src/main/org/apache/tools/ant/taskdefs/optional/ejb/IPlanetEjbc.java
src/main/org/apache/tools/ant/taskdefs/optional/ejb/IPlanetEjbcTask.java
src/main/org/apache/tools/ant/taskdefs/optional/ejb/InnerClassFilenameFilter.java
src/main/org/apache/tools/ant/taskdefs/optional/ejb/JbossDeploymentTool.java
src/main/org/apache/tools/ant/taskdefs/optional/ejb/JonasDeploymentTool.java
src/main/org/apache/tools/ant/taskdefs/optional/ejb/WeblogicDeploymentTool.java
src/main/org/apache/tools/ant/taskdefs/optional/ejb/WeblogicTOPLinkDeploymentTool.java
src/main/org/apache/tools/ant/taskdefs/optional/ejb/WebsphereDeploymentTool.java
src/main/org/apache/tools/ant/taskdefs/optional/extension/Compatability.java
src/main/org/apache/tools/ant/taskdefs/optional/extension/Compatibility.java
src/main/org/apache/tools/ant/taskdefs/optional/extension/Extension.java
src/main/org/apache/tools/ant/taskdefs/optional/extension/ExtensionAdapter.java
src/main/org/apache/tools/ant/taskdefs/optional/extension/ExtensionSet.java
src/main/org/apache/tools/ant/taskdefs/optional/extension/ExtensionUtil.java
src/main/org/apache/tools/ant/taskdefs/optional/extension/ExtraAttribute.java
src/main/org/apache/tools/ant/taskdefs/optional/extension/JarLibAvailableTask.java
src/main/org/apache/tools/ant/taskdefs/optional/extension/JarLibDisplayTask.java
src/main/org/apache/tools/ant/taskdefs/optional/extension/JarLibManifestTask.java
src/main/org/apache/tools/ant/taskdefs/optional/extension/JarLibResolveTask.java
src/main/org/apache/tools/ant/taskdefs/optional/extension/LibFileSet.java
src/main/org/apache/tools/ant/taskdefs/optional/extension/LibraryDisplayer.java
src/main/org/apache/tools/ant/taskdefs/optional/extension/Specification.java
src/main/org/apache/tools/ant/taskdefs/optional/extension/resolvers/AntResolver.java
src/main/org/apache/tools/ant/taskdefs/optional/extension/resolvers/LocationResolver.java
src/main/org/apache/tools/ant/taskdefs/optional/extension/resolvers/URLResolver.java
src/main/org/apache/tools/ant/taskdefs/optional/i18n/Translate.java
src/main/org/apache/tools/ant/taskdefs/optional/image/Image.java
src/main/org/apache/tools/ant/taskdefs/optional/j2ee/AbstractHotDeploymentTool.java
src/main/org/apache/tools/ant/taskdefs/optional/j2ee/GenericHotDeploymentTool.java
src/main/org/apache/tools/ant/taskdefs/optional/j2ee/JonasHotDeploymentTool.java
src/main/org/apache/tools/ant/taskdefs/optional/j2ee/ServerDeploy.java
src/main/org/apache/tools/ant/taskdefs/optional/j2ee/WebLogicHotDeploymentTool.java
src/main/org/apache/tools/ant/taskdefs/optional/javacc/JJDoc.java
src/main/org/apache/tools/ant/taskdefs/optional/javacc/JJTree.java
src/main/org/apache/tools/ant/taskdefs/optional/javacc/JavaCC.java
src/main/org/apache/tools/ant/taskdefs/optional/javah/JavahAdapterFactory.java
src/main/org/apache/tools/ant/taskdefs/optional/javah/SunJavah.java
src/main/org/apache/tools/ant/taskdefs/optional/jdepend/JDependTask.java
src/main/org/apache/tools/ant/taskdefs/optional/jlink/ClassNameReader.java
src/main/org/apache/tools/ant/taskdefs/optional/jlink/JlinkTask.java
src/main/org/apache/tools/ant/taskdefs/optional/jlink/jlink.java
src/main/org/apache/tools/ant/taskdefs/optional/jsp/Jasper41Mangler.java
src/main/org/apache/tools/ant/taskdefs/optional/jsp/JspC.java
src/main/org/apache/tools/ant/taskdefs/optional/jsp/JspNameMangler.java
src/main/org/apache/tools/ant/taskdefs/optional/jsp/WLJspc.java
src/main/org/apache/tools/ant/taskdefs/optional/jsp/compilers/DefaultJspCompilerAdapter.java
src/main/org/apache/tools/ant/taskdefs/optional/jsp/compilers/JasperC.java
src/main/org/apache/tools/ant/taskdefs/optional/jsp/compilers/JspCompilerAdapterFactory.java
src/main/org/apache/tools/ant/taskdefs/optional/junit/AggregateTransformer.java
src/main/org/apache/tools/ant/taskdefs/optional/junit/BaseTest.java
src/main/org/apache/tools/ant/taskdefs/optional/junit/BatchTest.java
src/main/org/apache/tools/ant/taskdefs/optional/junit/BriefJUnitResultFormatter.java
src/main/org/apache/tools/ant/taskdefs/optional/junit/CustomJUnit4TestAdapterCache.java
src/main/org/apache/tools/ant/taskdefs/optional/junit/DOMUtil.java
src/main/org/apache/tools/ant/taskdefs/optional/junit/Enumerations.java
src/main/org/apache/tools/ant/taskdefs/optional/junit/FailureRecorder.java
src/main/org/apache/tools/ant/taskdefs/optional/junit/FormatterElement.java
src/main/org/apache/tools/ant/taskdefs/optional/junit/IgnoredTestResult.java
src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnit4TestMethodAdapter.java
src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java
src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTaskMirrorImpl.java
src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTest.java
src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTestRunner.java
src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitVersionHelper.java
src/main/org/apache/tools/ant/taskdefs/optional/junit/PlainJUnitResultFormatter.java
src/main/org/apache/tools/ant/taskdefs/optional/junit/SummaryJUnitResultFormatter.java
src/main/org/apache/tools/ant/taskdefs/optional/junit/TearDownOnVmCrash.java
src/main/org/apache/tools/ant/taskdefs/optional/junit/TestListenerWrapper.java
src/main/org/apache/tools/ant/taskdefs/optional/junit/XMLJUnitResultFormatter.java
src/main/org/apache/tools/ant/taskdefs/optional/junit/XMLResultAggregator.java
src/main/org/apache/tools/ant/taskdefs/optional/native2ascii/BuiltinNative2Ascii.java
src/main/org/apache/tools/ant/taskdefs/optional/native2ascii/DefaultNative2Ascii.java
src/main/org/apache/tools/ant/taskdefs/optional/native2ascii/KaffeNative2Ascii.java
src/main/org/apache/tools/ant/taskdefs/optional/native2ascii/SunNative2Ascii.java
src/main/org/apache/tools/ant/taskdefs/optional/net/FTP.java
src/main/org/apache/tools/ant/taskdefs/optional/net/FTPTask.java
src/main/org/apache/tools/ant/taskdefs/optional/net/FTPTaskMirrorImpl.java
src/main/org/apache/tools/ant/taskdefs/optional/net/MimeMail.java
src/main/org/apache/tools/ant/taskdefs/optional/net/RExecTask.java
src/main/org/apache/tools/ant/taskdefs/optional/net/SetProxy.java
src/main/org/apache/tools/ant/taskdefs/optional/net/TelnetTask.java
src/main/org/apache/tools/ant/taskdefs/optional/pvcs/Pvcs.java
src/main/org/apache/tools/ant/taskdefs/optional/pvcs/PvcsProject.java
src/main/org/apache/tools/ant/taskdefs/optional/script/ScriptDef.java
src/main/org/apache/tools/ant/taskdefs/optional/script/ScriptDefBase.java
src/main/org/apache/tools/ant/taskdefs/optional/sos/SOS.java
src/main/org/apache/tools/ant/taskdefs/optional/sos/SOSCheckin.java
src/main/org/apache/tools/ant/taskdefs/optional/sos/SOSCheckout.java
src/main/org/apache/tools/ant/taskdefs/optional/sos/SOSGet.java
src/main/org/apache/tools/ant/taskdefs/optional/sos/SOSLabel.java
src/main/org/apache/tools/ant/taskdefs/optional/sound/AntSoundPlayer.java
src/main/org/apache/tools/ant/taskdefs/optional/splash/SplashScreen.java
src/main/org/apache/tools/ant/taskdefs/optional/splash/SplashTask.java
src/main/org/apache/tools/ant/taskdefs/optional/ssh/AbstractSshMessage.java
src/main/org/apache/tools/ant/taskdefs/optional/ssh/Directory.java
src/main/org/apache/tools/ant/taskdefs/optional/ssh/SSHBase.java
src/main/org/apache/tools/ant/taskdefs/optional/ssh/SSHExec.java
src/main/org/apache/tools/ant/taskdefs/optional/ssh/SSHSession.java
src/main/org/apache/tools/ant/taskdefs/optional/ssh/SSHUserInfo.java
src/main/org/apache/tools/ant/taskdefs/optional/ssh/Scp.java
src/main/org/apache/tools/ant/taskdefs/optional/ssh/ScpFromMessage.java
src/main/org/apache/tools/ant/taskdefs/optional/ssh/ScpFromMessageBySftp.java
src/main/org/apache/tools/ant/taskdefs/optional/ssh/ScpToMessage.java
src/main/org/apache/tools/ant/taskdefs/optional/ssh/ScpToMessageBySftp.java
src/main/org/apache/tools/ant/taskdefs/optional/testing/BlockFor.java
src/main/org/apache/tools/ant/taskdefs/optional/testing/Funtest.java
src/main/org/apache/tools/ant/taskdefs/optional/unix/AbstractAccessTask.java
src/main/org/apache/tools/ant/taskdefs/optional/unix/Chgrp.java
src/main/org/apache/tools/ant/taskdefs/optional/unix/Chown.java
src/main/org/apache/tools/ant/taskdefs/optional/unix/Symlink.java
src/main/org/apache/tools/ant/taskdefs/optional/windows/Attrib.java
src/main/org/apache/tools/ant/taskdefs/optional/xz/Unxz.java
src/main/org/apache/tools/ant/taskdefs/optional/xz/Xz.java
src/main/org/apache/tools/ant/taskdefs/rmic/DefaultRmicAdapter.java
src/main/org/apache/tools/ant/taskdefs/rmic/ForkingSunRmic.java
src/main/org/apache/tools/ant/taskdefs/rmic/KaffeRmic.java
src/main/org/apache/tools/ant/taskdefs/rmic/RmicAdapterFactory.java
src/main/org/apache/tools/ant/taskdefs/rmic/SunRmic.java
src/main/org/apache/tools/ant/taskdefs/rmic/WLRmic.java
src/main/org/apache/tools/ant/taskdefs/rmic/XNewRmic.java
src/main/org/apache/tools/ant/types/AbstractFileSet.java
src/main/org/apache/tools/ant/types/AntFilterReader.java
src/main/org/apache/tools/ant/types/ArchiveFileSet.java
src/main/org/apache/tools/ant/types/ArchiveScanner.java
src/main/org/apache/tools/ant/types/Assertions.java
src/main/org/apache/tools/ant/types/Commandline.java
src/main/org/apache/tools/ant/types/CommandlineJava.java
src/main/org/apache/tools/ant/types/DataType.java
src/main/org/apache/tools/ant/types/Description.java
src/main/org/apache/tools/ant/types/DirSet.java
src/main/org/apache/tools/ant/types/EnumeratedAttribute.java
src/main/org/apache/tools/ant/types/Environment.java
src/main/org/apache/tools/ant/types/FileList.java
src/main/org/apache/tools/ant/types/FileSet.java
src/main/org/apache/tools/ant/types/FilterSet.java
src/main/org/apache/tools/ant/types/FilterSetCollection.java
src/main/org/apache/tools/ant/types/FlexInteger.java
src/main/org/apache/tools/ant/types/LogLevel.java
src/main/org/apache/tools/ant/types/Mapper.java
src/main/org/apache/tools/ant/types/Parameterizable.java
src/main/org/apache/tools/ant/types/Path.java
src/main/org/apache/tools/ant/types/PatternSet.java
src/main/org/apache/tools/ant/types/Permissions.java
src/main/org/apache/tools/ant/types/PropertySet.java
src/main/org/apache/tools/ant/types/Quantifier.java
src/main/org/apache/tools/ant/types/RedirectorElement.java
src/main/org/apache/tools/ant/types/RegularExpression.java
src/main/org/apache/tools/ant/types/Resource.java
src/main/org/apache/tools/ant/types/ResourceCollection.java
src/main/org/apache/tools/ant/types/TarFileSet.java
src/main/org/apache/tools/ant/types/TarScanner.java
src/main/org/apache/tools/ant/types/XMLCatalog.java
src/main/org/apache/tools/ant/types/ZipFileSet.java
src/main/org/apache/tools/ant/types/ZipScanner.java
src/main/org/apache/tools/ant/types/mappers/CutDirsMapper.java
src/main/org/apache/tools/ant/types/mappers/FilterMapper.java
src/main/org/apache/tools/ant/types/optional/AbstractScriptComponent.java
src/main/org/apache/tools/ant/types/optional/ScriptCondition.java
src/main/org/apache/tools/ant/types/optional/ScriptFilter.java
src/main/org/apache/tools/ant/types/optional/ScriptMapper.java
src/main/org/apache/tools/ant/types/optional/ScriptSelector.java
src/main/org/apache/tools/ant/types/optional/depend/ClassfileSet.java
src/main/org/apache/tools/ant/types/optional/depend/DependScanner.java
src/main/org/apache/tools/ant/types/optional/image/Arc.java
src/main/org/apache/tools/ant/types/optional/image/ColorMapper.java
src/main/org/apache/tools/ant/types/optional/image/Draw.java
src/main/org/apache/tools/ant/types/optional/image/Ellipse.java
src/main/org/apache/tools/ant/types/optional/image/ImageOperation.java
src/main/org/apache/tools/ant/types/optional/image/Rectangle.java
src/main/org/apache/tools/ant/types/optional/image/Rotate.java
src/main/org/apache/tools/ant/types/optional/image/Scale.java
src/main/org/apache/tools/ant/types/optional/image/Text.java
src/main/org/apache/tools/ant/types/optional/image/TransformOperation.java
src/main/org/apache/tools/ant/types/optional/xz/XzResource.java
src/main/org/apache/tools/ant/types/resolver/ApacheCatalog.java
src/main/org/apache/tools/ant/types/resolver/ApacheCatalogResolver.java
src/main/org/apache/tools/ant/types/resources/AbstractClasspathResource.java
src/main/org/apache/tools/ant/types/resources/AbstractResourceCollectionWrapper.java
src/main/org/apache/tools/ant/types/resources/AllButFirst.java
src/main/org/apache/tools/ant/types/resources/AllButLast.java
src/main/org/apache/tools/ant/types/resources/ArchiveResource.java
src/main/org/apache/tools/ant/types/resources/Archives.java
src/main/org/apache/tools/ant/types/resources/BCFileSet.java
src/main/org/apache/tools/ant/types/resources/BZip2Resource.java
src/main/org/apache/tools/ant/types/resources/BaseResourceCollectionContainer.java
src/main/org/apache/tools/ant/types/resources/BaseResourceCollectionWrapper.java
src/main/org/apache/tools/ant/types/resources/CompressedResource.java
src/main/org/apache/tools/ant/types/resources/ContentTransformingResource.java
src/main/org/apache/tools/ant/types/resources/Difference.java
src/main/org/apache/tools/ant/types/resources/FailFast.java
src/main/org/apache/tools/ant/types/resources/FileResource.java
src/main/org/apache/tools/ant/types/resources/FileResourceIterator.java
src/main/org/apache/tools/ant/types/resources/Files.java
src/main/org/apache/tools/ant/types/resources/First.java
src/main/org/apache/tools/ant/types/resources/GZipResource.java
src/main/org/apache/tools/ant/types/resources/Intersect.java
src/main/org/apache/tools/ant/types/resources/JavaConstantResource.java
src/main/org/apache/tools/ant/types/resources/JavaResource.java
src/main/org/apache/tools/ant/types/resources/Last.java
src/main/org/apache/tools/ant/types/resources/LazyResourceCollectionWrapper.java
src/main/org/apache/tools/ant/types/resources/LogOutputResource.java
src/main/org/apache/tools/ant/types/resources/MappedResourceCollection.java
src/main/org/apache/tools/ant/types/resources/MultiRootFileSet.java
src/main/org/apache/tools/ant/types/resources/PropertyResource.java
src/main/org/apache/tools/ant/types/resources/ResourceDecorator.java
src/main/org/apache/tools/ant/types/resources/ResourceList.java
src/main/org/apache/tools/ant/types/resources/Resources.java
src/main/org/apache/tools/ant/types/resources/Restrict.java
src/main/org/apache/tools/ant/types/resources/SizeLimitCollection.java
src/main/org/apache/tools/ant/types/resources/Sort.java
src/main/org/apache/tools/ant/types/resources/StringResource.java
src/main/org/apache/tools/ant/types/resources/TarResource.java
src/main/org/apache/tools/ant/types/resources/Tokens.java
src/main/org/apache/tools/ant/types/resources/Union.java
src/main/org/apache/tools/ant/types/resources/comparators/Content.java
src/main/org/apache/tools/ant/types/resources/comparators/Date.java
src/main/org/apache/tools/ant/types/resources/comparators/DelegatedResourceComparator.java
src/main/org/apache/tools/ant/types/resources/comparators/Exists.java
src/main/org/apache/tools/ant/types/resources/comparators/FileSystem.java
src/main/org/apache/tools/ant/types/resources/comparators/ResourceComparator.java
src/main/org/apache/tools/ant/types/resources/comparators/Reverse.java
src/main/org/apache/tools/ant/types/resources/comparators/Size.java
src/main/org/apache/tools/ant/types/resources/comparators/Type.java
src/main/org/apache/tools/ant/types/resources/selectors/And.java
src/main/org/apache/tools/ant/types/resources/selectors/Date.java
src/main/org/apache/tools/ant/types/resources/selectors/InstanceOf.java
src/main/org/apache/tools/ant/types/resources/selectors/Majority.java
src/main/org/apache/tools/ant/types/resources/selectors/Name.java
src/main/org/apache/tools/ant/types/resources/selectors/None.java
src/main/org/apache/tools/ant/types/resources/selectors/Or.java
src/main/org/apache/tools/ant/types/resources/selectors/ResourceSelectorContainer.java
src/main/org/apache/tools/ant/types/selectors/AbstractSelectorContainer.java
src/main/org/apache/tools/ant/types/selectors/AndSelector.java
src/main/org/apache/tools/ant/types/selectors/BaseExtendSelector.java
src/main/org/apache/tools/ant/types/selectors/BaseSelector.java
src/main/org/apache/tools/ant/types/selectors/BaseSelectorContainer.java
src/main/org/apache/tools/ant/types/selectors/ContainsRegexpSelector.java
src/main/org/apache/tools/ant/types/selectors/ContainsSelector.java
src/main/org/apache/tools/ant/types/selectors/DateSelector.java
src/main/org/apache/tools/ant/types/selectors/DependSelector.java
src/main/org/apache/tools/ant/types/selectors/DepthSelector.java
src/main/org/apache/tools/ant/types/selectors/DifferentSelector.java
src/main/org/apache/tools/ant/types/selectors/ExecutableSelector.java
src/main/org/apache/tools/ant/types/selectors/ExtendSelector.java
src/main/org/apache/tools/ant/types/selectors/FileSelector.java
src/main/org/apache/tools/ant/types/selectors/FilenameSelector.java
src/main/org/apache/tools/ant/types/selectors/MajoritySelector.java
src/main/org/apache/tools/ant/types/selectors/MappingSelector.java
src/main/org/apache/tools/ant/types/selectors/NoneSelector.java
src/main/org/apache/tools/ant/types/selectors/NotSelector.java
src/main/org/apache/tools/ant/types/selectors/OrSelector.java
src/main/org/apache/tools/ant/types/selectors/OwnedBySelector.java
src/main/org/apache/tools/ant/types/selectors/PresentSelector.java
src/main/org/apache/tools/ant/types/selectors/ReadableSelector.java
src/main/org/apache/tools/ant/types/selectors/SelectSelector.java
src/main/org/apache/tools/ant/types/selectors/SelectorUtils.java
src/main/org/apache/tools/ant/types/selectors/SignedSelector.java
src/main/org/apache/tools/ant/types/selectors/SizeSelector.java
src/main/org/apache/tools/ant/types/selectors/SymlinkSelector.java
src/main/org/apache/tools/ant/types/selectors/TokenizedPath.java
src/main/org/apache/tools/ant/types/selectors/TokenizedPattern.java
src/main/org/apache/tools/ant/types/selectors/TypeSelector.java
src/main/org/apache/tools/ant/types/selectors/WritableSelector.java
src/main/org/apache/tools/ant/types/selectors/modifiedselector/ChecksumAlgorithm.java
src/main/org/apache/tools/ant/types/selectors/modifiedselector/DigestAlgorithm.java
src/main/org/apache/tools/ant/types/selectors/modifiedselector/ModifiedSelector.java
src/main/org/apache/tools/ant/types/selectors/modifiedselector/PropertiesfileCache.java
src/main/org/apache/tools/ant/types/spi/Provider.java
src/main/org/apache/tools/ant/types/spi/Service.java
src/main/org/apache/tools/ant/util/ChainedMapper.java
src/main/org/apache/tools/ant/util/ClasspathUtils.java
src/main/org/apache/tools/ant/util/CollectionUtils.java
src/main/org/apache/tools/ant/util/CompositeMapper.java
src/main/org/apache/tools/ant/util/ConcatFileInputStream.java
src/main/org/apache/tools/ant/util/ConcatResourceInputStream.java
src/main/org/apache/tools/ant/util/ContainerMapper.java
src/main/org/apache/tools/ant/util/DOMElementWriter.java
src/main/org/apache/tools/ant/util/DOMUtils.java
src/main/org/apache/tools/ant/util/DateUtils.java
src/main/org/apache/tools/ant/util/DeweyDecimal.java
src/main/org/apache/tools/ant/util/FileTokenizer.java
src/main/org/apache/tools/ant/util/FileUtils.java
src/main/org/apache/tools/ant/util/FirstMatchMapper.java
src/main/org/apache/tools/ant/util/FlatFileNameMapper.java
src/main/org/apache/tools/ant/util/GlobPatternMapper.java
src/main/org/apache/tools/ant/util/IdentityMapper.java
src/main/org/apache/tools/ant/util/IdentityStack.java
src/main/org/apache/tools/ant/util/JAXPUtils.java
src/main/org/apache/tools/ant/util/JavaEnvUtils.java
src/main/org/apache/tools/ant/util/LayoutPreservingProperties.java
src/main/org/apache/tools/ant/util/LazyFileOutputStream.java
src/main/org/apache/tools/ant/util/LazyHashtable.java
src/main/org/apache/tools/ant/util/LeadPipeInputStream.java
src/main/org/apache/tools/ant/util/LineTokenizer.java
src/main/org/apache/tools/ant/util/LinkedHashtable.java
src/main/org/apache/tools/ant/util/LoaderUtils.java
src/main/org/apache/tools/ant/util/MergingMapper.java
src/main/org/apache/tools/ant/util/OutputStreamFunneler.java
src/main/org/apache/tools/ant/util/PackageNameMapper.java
src/main/org/apache/tools/ant/util/PropertyOutputStream.java
src/main/org/apache/tools/ant/util/ProxySetup.java
src/main/org/apache/tools/ant/util/ReaderInputStream.java
src/main/org/apache/tools/ant/util/ReflectUtil.java
src/main/org/apache/tools/ant/util/ReflectWrapper.java
src/main/org/apache/tools/ant/util/RegexpPatternMapper.java
src/main/org/apache/tools/ant/util/ResourceUtils.java
src/main/org/apache/tools/ant/util/ScriptFixBSFPath.java
src/main/org/apache/tools/ant/util/ScriptRunnerBase.java
src/main/org/apache/tools/ant/util/SourceFileScanner.java
src/main/org/apache/tools/ant/util/SplitClassLoader.java
src/main/org/apache/tools/ant/util/StringTokenizer.java
src/main/org/apache/tools/ant/util/StringUtils.java
src/main/org/apache/tools/ant/util/SymbolicLinkUtils.java
src/main/org/apache/tools/ant/util/TeeOutputStream.java
src/main/org/apache/tools/ant/util/UnPackageNameMapper.java
src/main/org/apache/tools/ant/util/VectorSet.java
src/main/org/apache/tools/ant/util/Watchdog.java
src/main/org/apache/tools/ant/util/WeakishReference.java
src/main/org/apache/tools/ant/util/XMLFragment.java
src/main/org/apache/tools/ant/util/depend/AbstractAnalyzer.java
src/main/org/apache/tools/ant/util/depend/bcel/AncestorAnalyzer.java
src/main/org/apache/tools/ant/util/depend/bcel/DependencyVisitor.java
src/main/org/apache/tools/ant/util/depend/bcel/FullAnalyzer.java
src/main/org/apache/tools/ant/util/facade/FacadeTaskHelper.java
src/main/org/apache/tools/ant/util/facade/ImplementationSpecificArgument.java
src/main/org/apache/tools/ant/util/java15/ProxyDiagnostics.java
src/main/org/apache/tools/ant/util/optional/JavaxScriptRunner.java
src/main/org/apache/tools/ant/util/optional/NoExitSecurityManager.java
src/main/org/apache/tools/ant/util/optional/ScriptRunner.java
src/main/org/apache/tools/ant/util/optional/WeakishReference12.java
src/main/org/apache/tools/ant/util/regexp/JakartaOroMatcher.java
src/main/org/apache/tools/ant/util/regexp/JakartaOroRegexp.java
src/main/org/apache/tools/ant/util/regexp/JakartaRegexpMatcher.java
src/main/org/apache/tools/ant/util/regexp/JakartaRegexpRegexp.java
src/main/org/apache/tools/ant/util/regexp/Jdk14RegexpMatcher.java
src/main/org/apache/tools/ant/util/regexp/Jdk14RegexpRegexp.java
src/main/org/apache/tools/ant/util/regexp/RegexpFactory.java
src/main/org/apache/tools/ant/util/regexp/RegexpMatcher.java
src/main/org/apache/tools/ant/util/regexp/RegexpMatcherFactory.java
src/main/org/apache/tools/ant/util/regexp/RegexpUtil.java
src/main/org/apache/tools/mail/ErrorInQuitException.java
src/main/org/apache/tools/mail/MailMessage.java
src/main/org/apache/tools/mail/SmtpResponseReader.java
src/tests/junit/org/apache/tools/ant/taskdefs/ProtectedJarMethodsTest.java
src/tests/junit/org/apache/tools/ant/types/resources/LazyResourceCollectionTest.java

index 22c4b29..5f313e2 100644 (file)
@@ -178,7 +178,7 @@ public class AntClassLoader extends ClassLoader implements SubBuildListener, Clo
      * The components of the classpath that the classloader searches
      * for classes.
      */
-    private final Vector<File> pathComponents  = new VectorSet<File>();
+    private final Vector<File> pathComponents  = new VectorSet<>();
 
     /**
      * The project to which this class loader belongs.
@@ -196,14 +196,14 @@ public class AntClassLoader extends ClassLoader implements SubBuildListener, Clo
      * loader regardless of whether the parent class loader is being searched
      * first or not.
      */
-    private final Vector<String> systemPackages = new Vector<String>();
+    private final Vector<String> systemPackages = new Vector<>();
 
     /**
      * These are the package roots that are to be loaded by this class loader
      * regardless of whether the parent class loader is being searched first
      * or not.
      */
-    private final Vector<String> loaderPackages = new Vector<String>();
+    private final Vector<String> loaderPackages = new Vector<>();
 
     /**
      * Whether or not this classloader will ignore the base
@@ -221,7 +221,7 @@ public class AntClassLoader extends ClassLoader implements SubBuildListener, Clo
     /**
      * A hashtable of zip files opened by the classloader (File to JarFile).
      */
-    private Hashtable<File, JarFile> jarFiles = new Hashtable<File, JarFile>();
+    private Hashtable<File, JarFile> jarFiles = new Hashtable<>();
 
     /** Static map of jar file/time to manifest class-path entries */
     private static Map<String, String> pathMap =
@@ -293,8 +293,8 @@ public class AntClassLoader extends ClassLoader implements SubBuildListener, Clo
      *                    classloader should be consulted  before trying to
      *                    load the a class through this loader.
      */
-    public AntClassLoader(
-                          final ClassLoader parent, final Project project, final Path classpath, final boolean parentFirst) {
+    public AntClassLoader(final ClassLoader parent, final Project project,
+        final Path classpath, final boolean parentFirst) {
         this(project, classpath);
         if (parent != null) {
             setParent(parent);
@@ -315,7 +315,8 @@ public class AntClassLoader extends ClassLoader implements SubBuildListener, Clo
      *                    classloader should be consulted before trying to
      *                    load the a class through this loader.
      */
-    public AntClassLoader(final Project project, final Path classpath, final boolean parentFirst) {
+    public AntClassLoader(final Project project, final Path classpath,
+        final boolean parentFirst) {
         this(null, project, classpath, parentFirst);
     }
 
index ed3331f..c378cd5 100644 (file)
@@ -21,6 +21,7 @@ import java.io.BufferedReader;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.InputStreamReader;
+import java.io.UnsupportedEncodingException;
 import java.net.URL;
 import java.net.URLConnection;
 import java.util.ArrayList;
@@ -151,7 +152,7 @@ public class ArgumentProcessorRegistry {
         try {
             try {
                 isr = new InputStreamReader(is, "UTF-8");
-            } catch (java.io.UnsupportedEncodingException e) {
+            } catch (UnsupportedEncodingException e) {
                 isr = new InputStreamReader(is);
             }
             BufferedReader rd = new BufferedReader(isr);
index 34c1605..6729744 100644 (file)
@@ -38,13 +38,26 @@ public class BuildException extends RuntimeException {
      * Constructs an exception with the given descriptive message.
      *
      * @param message A description of or information about the exception.
-     *            Should not be <code>null</code>.
+     *            Should not be {@code null}.
      */
     public BuildException(String message) {
         super(message);
     }
 
     /**
+     * Constructs an exception with the given format pattern and arguments.
+     *
+     * @param pattern A description of or information about the exception.
+     *            Should not be {@code null}.
+     * @param formatArguments
+     * @see String#format(String, Object...)
+     * @since Ant 1.11
+     */
+    public BuildException(String pattern, Object... formatArguments) {
+        super(String.format(pattern, formatArguments));
+    }
+
+    /**
      * Constructs an exception with the given message and exception as
      * a root cause.
      *
index 4942d24..c772d1b 100644 (file)
@@ -59,31 +59,31 @@ import org.apache.tools.ant.util.FileUtils;
  */
 public class ComponentHelper  {
     /** Map of component name to lists of restricted definitions */
-    private Map<String, List<AntTypeDefinition>>          restrictedDefinitions = new HashMap<String, List<AntTypeDefinition>>();
+    private Map<String, List<AntTypeDefinition>>          restrictedDefinitions = new HashMap<>();
 
     /** Map from component name to anttypedefinition */
-    private final Hashtable<String, AntTypeDefinition> antTypeTable = new Hashtable<String, AntTypeDefinition>();
+    private final Hashtable<String, AntTypeDefinition> antTypeTable = new Hashtable<>();
 
     /** Map of tasks generated from antTypeTable */
-    private final Hashtable<String, Class<?>> taskClassDefinitions = new Hashtable<String, Class<?>>();
+    private final Hashtable<String, Class<?>> taskClassDefinitions = new Hashtable<>();
 
     /** flag to rebuild taskClassDefinitions */
     private boolean rebuildTaskClassDefinitions = true;
 
     /** Map of types generated from antTypeTable */
-    private final Hashtable<String, Class<?>> typeClassDefinitions = new Hashtable<String, Class<?>>();
+    private final Hashtable<String, Class<?>> typeClassDefinitions = new Hashtable<>();
 
     /** flag to rebuild typeClassDefinitions */
     private boolean rebuildTypeClassDefinitions = true;
 
     /** Set of namespaces that have been checked for antlibs */
-    private final HashSet<String> checkedNamespaces = new HashSet<String>();
+    private final HashSet<String> checkedNamespaces = new HashSet<>();
 
     /**
      * Stack of antlib contexts used to resolve definitions while
      *   processing antlib
      */
-    private Stack<String> antLibStack = new Stack<String>();
+    private Stack<String> antLibStack = new Stack<>();
 
     /** current antlib uri */
     private String antLibCurrentUri = null;
@@ -189,7 +189,6 @@ public class ComponentHelper  {
      */
     public void setProject(Project project) {
         this.project = project;
-//        antTypeTable = new Hashtable<String, AntTypeDefinition>(project);
     }
 
     /**
@@ -205,13 +204,13 @@ public class ComponentHelper  {
      * @return A deep copy of the restrictredDefinition
      */
     private Map<String, List<AntTypeDefinition>> getRestrictedDefinition() {
-        final Map<String, List<AntTypeDefinition>> result = new HashMap<String, List<AntTypeDefinition>>();
+        final Map<String, List<AntTypeDefinition>> result = new HashMap<>();
         synchronized (restrictedDefinitions) {
             for (Map.Entry<String, List<AntTypeDefinition>> entry : restrictedDefinitions.entrySet()) {
                 List<AntTypeDefinition> entryVal = entry.getValue();
                 synchronized (entryVal) {
                     //copy the entryVal
-                    entryVal = new ArrayList<AntTypeDefinition> (entryVal);
+                    entryVal = new ArrayList<>(entryVal);
                 }
                 result.put(entry.getKey(), entryVal);
             }
@@ -750,7 +749,7 @@ public class ComponentHelper  {
      */
     public void exitAntLib() {
         antLibStack.pop();
-        antLibCurrentUri = (antLibStack.size() == 0) ? null : (String) antLibStack.peek();
+        antLibCurrentUri = (antLibStack.isEmpty()) ? null : (String) antLibStack.peek();
     }
 
     /**
@@ -759,9 +758,7 @@ public class ComponentHelper  {
     private void initTasks() {
         ClassLoader classLoader = getClassLoader(null);
         Properties props = getDefaultDefinitions(false);
-        Enumeration<?> e = props.propertyNames();
-        while (e.hasMoreElements()) {
-            String name = (String) e.nextElement();
+        for (String name : props.stringPropertyNames()) {
             String className = props.getProperty(name);
             AntTypeDefinition def = new AntTypeDefinition();
             def.setName(name);
@@ -902,7 +899,7 @@ public class ComponentHelper  {
             probablyIDE = true;
             antHomeLib = "ANT_HOME" + File.separatorChar + "lib";
         }
-        StringBuffer dirListingText = new StringBuffer();
+        StringBuilder dirListingText = new StringBuilder();
         final String tab = "        -";
         dirListingText.append(tab);
         dirListingText.append(antHomeLib);
@@ -1026,14 +1023,7 @@ public class ComponentHelper  {
                 + " declarations have taken place.");
         if (uri.length() > 0) {
             final List<AntTypeDefinition> matches = findTypeMatches(uri);
-            if (matches.size() > 0) {
-                out.println();
-                out.println("The definitions in the namespace " + uri + " are:");
-                for (AntTypeDefinition def : matches) {
-                    String local = ProjectHelper.extractNameFromComponentName(def.getName());
-                    out.println("    " + local);
-                }
-            } else {
+            if (matches.isEmpty()) {
                 out.println("No types or tasks have been defined in this namespace yet");
                 if (isAntlib) {
                     out.println();
@@ -1041,6 +1031,13 @@ public class ComponentHelper  {
                     out.println("Action: Check that the implementing library exists in one of:");
                     out.println(dirListing);
                 }
+            } else {
+                out.println();
+                out.println("The definitions in the namespace " + uri + " are:");
+                for (AntTypeDefinition def : matches) {
+                    String local = ProjectHelper.extractNameFromComponentName(def.getName());
+                    out.println("    " + local);
+                }
             }
         }
     }
index 062018d..19b4424 100644 (file)
@@ -66,7 +66,6 @@ public final class DefaultDefinitions {
 
     private void componentDef(String ns, String name, String classname) {
         AntTypeDefinition def = new AntTypeDefinition();
-        String n = ProjectHelper.genComponentName(ns, name);
         def.setName(ProjectHelper.genComponentName(ns, name));
         def.setClassName(classname);
         def.setClassLoader(getClass().getClassLoader());
index e0cd651..8390a64 100644 (file)
@@ -24,9 +24,10 @@ import java.io.PrintStream;
 import java.io.StringReader;
 import java.text.DateFormat;
 import java.util.Date;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
 
 import org.apache.tools.ant.util.DateUtils;
-import org.apache.tools.ant.util.FileUtils;
 import org.apache.tools.ant.util.StringUtils;
 
 /**
@@ -257,48 +258,30 @@ public class DefaultLogger implements BuildLogger {
         // Filter out messages based on priority
         if (priority <= msgOutputLevel) {
 
-            StringBuffer message = new StringBuffer();
-            if (event.getTask() != null && !emacsMode) {
+            StringBuilder message = new StringBuilder();
+            if (event.getTask() == null || emacsMode) {
+                //emacs mode or there is no task
+                message.append(event.getMessage());
+            } else {
                 // Print out the name of the task if we're in one
                 String name = event.getTask().getTaskName();
                 String label = "[" + name + "] ";
                 int size = LEFT_COLUMN_SIZE - label.length();
-                StringBuffer tmp = new StringBuffer();
-                for (int i = 0; i < size; i++) {
-                    tmp.append(" ");
-                }
-                tmp.append(label);
-                label = tmp.toString();
-
-                BufferedReader r = null;
-                try {
-                    r = new BufferedReader(
-                            new StringReader(event.getMessage()));
-                    String line = r.readLine();
-                    boolean first = true;
-                    do {
-                        if (first) {
-                            if (line == null) {
-                                message.append(label);
-                                break;
-                            }
-                        } else {
-                            message.append(StringUtils.LINE_SEP);
-                        }
-                        first = false;
-                        message.append(label).append(line);
-                        line = r.readLine();
-                    } while (line != null);
+                final String prefix = size > 0 ? Stream.generate(() -> " ")
+                    .limit(size).collect(Collectors.joining()) + label : label;
+
+                try (BufferedReader r =
+                    new BufferedReader(new StringReader(event.getMessage()))) {
+
+                    message.append(r.lines().map(line -> prefix + line)
+                        .collect(Collectors.joining(StringUtils.LINE_SEP)));
+                    if (message.length() == 0) {
+                        message.append(prefix);
+                    }
                 } catch (IOException e) {
                     // shouldn't be possible
                     message.append(label).append(event.getMessage());
-                } finally {
-                    FileUtils.close(r);
                 }
-
-            } else {
-                //emacs mode or there is no task
-                message.append(event.getMessage());
             }
             Throwable ex = event.getException();
             if (Project.MSG_DEBUG <= msgOutputLevel && ex != null) {
@@ -361,8 +344,7 @@ public class DefaultLogger implements BuildLogger {
     protected String getTimestamp() {
         Date date = new Date(System.currentTimeMillis());
         DateFormat formatter = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT);
-        String finishTime = formatter.format(date);
-        return finishTime;
+        return formatter.format(date);
     }
 
     /**
index ea263ca..e8c2164 100644 (file)
@@ -50,6 +50,7 @@ public class DemuxInputStream extends InputStream {
      * @return the next byte
      * @throws IOException on error
      */
+    @Override
     public int read() throws IOException {
         byte[] buffer = new byte[1];
         if (project.demuxInput(buffer, 0, 1) == -1) {
@@ -67,6 +68,7 @@ public class DemuxInputStream extends InputStream {
      * @return the number of bytes read
      * @throws IOException on error
      */
+    @Override
     public int read(byte[] buffer, int offset, int length) throws IOException {
         return project.demuxInput(buffer, offset, length);
     }
index e69c3a4..7d08fa8 100644 (file)
@@ -64,7 +64,7 @@ public class DemuxOutputStream extends OutputStream {
     private static final int LF = 0x0a;
 
     /** Mapping from thread to buffer (Thread to BufferInfo). */
-    private WeakHashMap<Thread, BufferInfo> buffers = new WeakHashMap<Thread, BufferInfo>();
+    private WeakHashMap<Thread, BufferInfo> buffers = new WeakHashMap<>();
 
     /**
      * The project to send output to.
@@ -98,14 +98,12 @@ public class DemuxOutputStream extends OutputStream {
      */
     private BufferInfo getBufferInfo() {
         Thread current = Thread.currentThread();
-        BufferInfo bufferInfo = (BufferInfo) buffers.get(current);
-        if (bufferInfo == null) {
-            bufferInfo = new BufferInfo();
+        return buffers.computeIfAbsent(current, x -> {
+            BufferInfo bufferInfo = new BufferInfo();
             bufferInfo.buffer = new ByteArrayOutputStream(INITIAL_SIZE);
             bufferInfo.crSeen = false;
-            buffers.put(current, bufferInfo);
-        }
-        return bufferInfo;
+            return bufferInfo;
+        });
     }
 
     /**
@@ -113,7 +111,7 @@ public class DemuxOutputStream extends OutputStream {
      */
     private void resetBufferInfo() {
         Thread current = Thread.currentThread();
-        BufferInfo bufferInfo = (BufferInfo) buffers.get(current);
+        BufferInfo bufferInfo = buffers.get(current);
         FileUtils.close(bufferInfo.buffer);
         bufferInfo.buffer = new ByteArrayOutputStream();
         bufferInfo.crSeen = false;
@@ -134,6 +132,7 @@ public class DemuxOutputStream extends OutputStream {
      * @param cc data to log (byte).
      * @exception IOException if the data cannot be written to the stream
      */
+    @Override
     public void write(int cc) throws IOException {
         final byte c = (byte) cc;
 
@@ -192,6 +191,7 @@ public class DemuxOutputStream extends OutputStream {
      *
      * @see #flush
      */
+    @Override
     public void close() throws IOException {
         flush();
         removeBuffer();
@@ -203,6 +203,7 @@ public class DemuxOutputStream extends OutputStream {
      *
      * @exception IOException if there is a problem flushing the stream.
      */
+    @Override
     public void flush() throws IOException {
         BufferInfo bufferInfo = getBufferInfo();
         if (bufferInfo.buffer.size() > 0) {
@@ -219,6 +220,7 @@ public class DemuxOutputStream extends OutputStream {
      *
      * @throws IOException if the data cannot be written into the stream.
      */
+    @Override
     public void write(byte[] b, int off, int len) throws IOException {
         // find the line breaks and pass other chars through in blocks
         int offset = off;
index 735b349..f93fd5a 100644 (file)
@@ -54,9 +54,6 @@ import org.xml.sax.XMLReader;
  */
 public final class Diagnostics {
 
-    /** the version number for java 1.5 returned from JavaEnvUtils */
-    private static final int JAVA_1_5_NUMBER = 15;
-
     /**
      * value for which a difference between clock and temp file time triggers
      * a warning.
@@ -113,8 +110,7 @@ public final class Diagnostics {
         if (home == null) {
             return null;
         }
-        File libDir = new File(home, "lib");
-        return listJarFiles(libDir);
+        return listJarFiles(new File(home, "lib"));
 
     }
 
@@ -124,13 +120,8 @@ public final class Diagnostics {
      * @return array of files (or null for no such directory)
      */
     private static File[] listJarFiles(File libDir) {
-        FilenameFilter filter = new FilenameFilter() {
-            public boolean accept(File dir, String name) {
-                return name.endsWith(".jar");
-            }
-        };
-        File[] files  = libDir.listFiles(filter);
-        return files;
+        return libDir
+            .listFiles((FilenameFilter) (dir, name) -> name.endsWith(".jar"));
     }
 
     /**
@@ -173,8 +164,7 @@ public final class Diagnostics {
             return "Could not create an XML Parser";
         }
         // check to what is in the classname
-        String saxParserName = saxParser.getClass().getName();
-        return saxParserName;
+        return saxParser.getClass().getName();
     }
 
     /**
@@ -187,8 +177,7 @@ public final class Diagnostics {
             return "Could not create an XSLT Processor";
         }
         // check to what is in the classname
-        String processorName = transformer.getClass().getName();
-        return processorName;
+        return transformer.getClass().getName();
     }
 
     /**
@@ -216,17 +205,15 @@ public final class Diagnostics {
      */
     private static Transformer getXSLTProcessor() {
         TransformerFactory transformerFactory = TransformerFactory.newInstance();
-        if (transformerFactory == null) {
-            return null;
-        }
-        Transformer transformer = null;
-        try {
-            transformer = transformerFactory.newTransformer();
-        } catch (Exception e) {
-            // ignore
-            ignoreThrowable(e);
+        if (transformerFactory != null) {
+            try {
+                return transformerFactory.newTransformer();
+            } catch (Exception e) {
+                // ignore
+                ignoreThrowable(e);
+            }
         }
-        return transformer;
+        return null;
     }
 
     /**
index 6b52897..f4c26f6 100644 (file)
@@ -22,13 +22,17 @@ import java.io.File;
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.Arrays;
+import java.util.Collections;
+import java.util.Deque;
 import java.util.HashMap;
 import java.util.HashSet;
-import java.util.Iterator;
 import java.util.LinkedList;
+import java.util.List;
 import java.util.Map;
 import java.util.Set;
 import java.util.Vector;
+import java.util.function.Predicate;
+import java.util.stream.Stream;
 
 import org.apache.tools.ant.taskdefs.condition.Os;
 import org.apache.tools.ant.types.Resource;
@@ -39,7 +43,6 @@ import org.apache.tools.ant.types.selectors.SelectorScanner;
 import org.apache.tools.ant.types.selectors.SelectorUtils;
 import org.apache.tools.ant.types.selectors.TokenizedPath;
 import org.apache.tools.ant.types.selectors.TokenizedPattern;
-import org.apache.tools.ant.util.CollectionUtils;
 import org.apache.tools.ant.util.FileUtils;
 import org.apache.tools.ant.util.SymbolicLinkUtils;
 import org.apache.tools.ant.util.VectorSet;
@@ -217,7 +220,7 @@ public class DirectoryScanner
      *
      * @see #addDefaultExcludes()
      */
-    private static final Set<String> defaultExcludes = new HashSet<String>();
+    private static final Set<String> defaultExcludes = new HashSet<>();
     static {
         resetDefaultExcludes();
     }
@@ -310,7 +313,7 @@ public class DirectoryScanner
      *
      * @since Ant 1.6
      */
-    private final Set<String> scannedDirs = new HashSet<String>();
+    private final Set<String> scannedDirs = new HashSet<>();
 
     /**
      * Map of all include patterns that are full file names and don't
@@ -327,7 +330,7 @@ public class DirectoryScanner
      *
      * @since Ant 1.8.0
      */
-    private final Map<String, TokenizedPath> includeNonPatterns = new HashMap<String, TokenizedPath>();
+    private final Map<String, TokenizedPath> includeNonPatterns = new HashMap<>();
 
     /**
      * Map of all exclude patterns that are full file names and don't
@@ -344,7 +347,7 @@ public class DirectoryScanner
      *
      * @since Ant 1.8.0
      */
-    private final Map<String, TokenizedPath> excludeNonPatterns = new HashMap<String, TokenizedPath>();
+    private final Map<String, TokenizedPath> excludeNonPatterns = new HashMap<>();
 
     /**
      * Array of all include patterns that contain wildcards.
@@ -423,13 +426,7 @@ public class DirectoryScanner
      *
      * @since Ant 1.8.0
      */
-    private final Set<String> notFollowedSymlinks = new HashSet<String>();
-
-    /**
-     * Sole constructor.
-     */
-    public DirectoryScanner() {
-    }
+    private final Set<String> notFollowedSymlinks = new HashSet<>();
 
     /**
      * Test whether or not a given path matches the start of a given
@@ -605,8 +602,8 @@ public class DirectoryScanner
     public static void resetDefaultExcludes() {
         synchronized (defaultExcludes) {
             defaultExcludes.clear();
-            for (int i = 0; i < DEFAULTEXCLUDES.length; i++) {
-                defaultExcludes.add(DEFAULTEXCLUDES[i]);
+            for (String element : DEFAULTEXCLUDES) {
+                defaultExcludes.add(element);
             }
         }
     }
@@ -619,8 +616,9 @@ public class DirectoryScanner
      *
      * @param basedir The base directory to scan.
      */
+    @Override
     public void setBasedir(final String basedir) {
-        setBasedir(basedir == null ? (File) null
+        setBasedir(basedir == null ? null
             : new File(basedir.replace('/', File.separatorChar).replace(
             '\\', File.separatorChar)));
     }
@@ -631,6 +629,7 @@ public class DirectoryScanner
      *
      * @param basedir The base directory for scanning.
      */
+    @Override
     public synchronized void setBasedir(final File basedir) {
         this.basedir = basedir;
     }
@@ -641,6 +640,7 @@ public class DirectoryScanner
      *
      * @return the base directory to be scanned.
      */
+    @Override
     public synchronized File getBasedir() {
         return basedir;
     }
@@ -662,6 +662,7 @@ public class DirectoryScanner
      * @param isCaseSensitive whether or not the file system should be
      *                        regarded as a case sensitive one.
      */
+    @Override
     public synchronized void setCaseSensitive(final boolean isCaseSensitive) {
         this.isCaseSensitive = isCaseSensitive;
     }
@@ -720,14 +721,13 @@ public class DirectoryScanner
      *                 list is given, all elements must be
      *                 non-<code>null</code>.
      */
+    @Override
     public synchronized void setIncludes(final String[] includes) {
         if (includes == null) {
             this.includes = null;
         } else {
-            this.includes = new String[includes.length];
-            for (int i = 0; i < includes.length; i++) {
-                this.includes[i] = normalizePattern(includes[i]);
-            }
+            this.includes = Stream.of(includes)
+                .map(DirectoryScanner::normalizePattern).toArray(String[]::new);
         }
     }
 
@@ -743,14 +743,13 @@ public class DirectoryScanner
      *                 should be excluded. If a non-<code>null</code> list is
      *                 given, all elements must be non-<code>null</code>.
      */
+    @Override
     public synchronized void setExcludes(final String[] excludes) {
         if (excludes == null) {
             this.excludes = null;
         } else {
-            this.excludes = new String[excludes.length];
-            for (int i = 0; i < excludes.length; i++) {
-                this.excludes[i] = normalizePattern(excludes[i]);
-            }
+            this.excludes = Stream.of(excludes)
+                .map(DirectoryScanner::normalizePattern).toArray(String[]::new);
         }
     }
 
@@ -769,18 +768,14 @@ public class DirectoryScanner
      */
     public synchronized void addExcludes(final String[] excludes) {
         if (excludes != null && excludes.length > 0) {
-            if (this.excludes != null && this.excludes.length > 0) {
-                final String[] tmp = new String[excludes.length
-                                          + this.excludes.length];
-                System.arraycopy(this.excludes, 0, tmp, 0,
-                                 this.excludes.length);
-                for (int i = 0; i < excludes.length; i++) {
-                    tmp[this.excludes.length + i] =
-                        normalizePattern(excludes[i]);
-                }
-                this.excludes = tmp;
-            } else {
+            if (this.excludes == null || this.excludes.length == 0) {
                 setExcludes(excludes);
+            } else {
+                this.excludes = Stream
+                    .concat(Stream.of(this.excludes),
+                        Stream.of(excludes)
+                            .map(DirectoryScanner::normalizePattern))
+                    .toArray(String[]::new);
             }
         }
     }
@@ -808,6 +803,7 @@ public class DirectoryScanner
      *
      * @param selectors specifies the selectors to be invoked on a scan.
      */
+    @Override
     public synchronized void setSelectors(final FileSelector[] selectors) {
         this.selectors = selectors;
     }
@@ -833,6 +829,7 @@ public class DirectoryScanner
      * @exception IllegalStateException if the base directory was set
      *            incorrectly (i.e. if it doesn't exist or isn't a directory).
      */
+    @Override
     public void scan() throws IllegalStateException {
         synchronized (scanLock) {
             if (scanning) {
@@ -857,10 +854,10 @@ public class DirectoryScanner
                 clearResults();
 
                 // set in/excludes to reasonable defaults if needed:
-                final boolean nullIncludes = (includes == null);
+                final boolean nullIncludes = includes == null;
                 includes = nullIncludes
-                    ? new String[] {SelectorUtils.DEEP_TREE_MATCH} : includes;
-                final boolean nullExcludes = (excludes == null);
+                    ? new String[] { SelectorUtils.DEEP_TREE_MATCH } : includes;
+                final boolean nullExcludes = excludes == null;
                 excludes = nullExcludes ? new String[0] : excludes;
 
                 if (basedir != null && !followSymlinks
@@ -887,22 +884,19 @@ public class DirectoryScanner
                     } else if (!basedir.isDirectory()) {
                         illegal = new IllegalStateException("basedir "
                                                             + basedir
-                                                            + " is not a"
-                                                            + " directory.");
+                                                            + " is not a directory.");
                     }
                     if (illegal != null) {
                         throw illegal;
                     }
                 }
                 if (isIncluded(TokenizedPath.EMPTY_PATH)) {
-                    if (!isExcluded(TokenizedPath.EMPTY_PATH)) {
-                        if (isSelected("", basedir)) {
-                            dirsIncluded.addElement("");
-                        } else {
-                            dirsDeselected.addElement("");
-                        }
-                    } else {
+                    if (isExcluded(TokenizedPath.EMPTY_PATH)) {
                         dirsExcluded.addElement("");
+                    } else if (isSelected("", basedir)) {
+                        dirsIncluded.addElement("");
+                    } else {
+                        dirsDeselected.addElement("");
                     }
                 } else {
                     dirsNotIncluded.addElement("");
@@ -930,18 +924,19 @@ public class DirectoryScanner
      */
     private void checkIncludePatterns() {
         ensureNonPatternSetsReady();
-        final Map<TokenizedPath, String> newroots = new HashMap<TokenizedPath, String>();
+        final Map<TokenizedPath, String> newroots = new HashMap<>();
 
         // put in the newroots map the include patterns without
         // wildcard tokens
-        for (int i = 0; i < includePatterns.length; i++) {
-            final String pattern = includePatterns[i].toString();
+        for (TokenizedPattern includePattern : includePatterns) {
+            final String pattern = includePattern.toString();
             if (!shouldSkipPattern(pattern)) {
-                newroots.put(includePatterns[i].rtrimWildcardTokens(),
+                newroots.put(includePattern.rtrimWildcardTokens(),
                              pattern);
             }
         }
-        for (final Map.Entry<String, TokenizedPath> entry : includeNonPatterns.entrySet()) {
+        for (final Map.Entry<String, TokenizedPath> entry : includeNonPatterns
+            .entrySet()) {
             final String pattern = entry.getKey();
             if (!shouldSkipPattern(pattern)) {
                 newroots.put(entry.getValue(), pattern);
@@ -1046,10 +1041,9 @@ public class DirectoryScanner
     private boolean shouldSkipPattern(final String pattern) {
         if (FileUtils.isAbsolutePath(pattern)) {
             //skip abs. paths not under basedir, if set:
-            if (basedir != null
-                && !SelectorUtils.matchPatternStart(pattern,
-                                                    basedir.getAbsolutePath(),
-                                                    isCaseSensitive())) {
+            if (!(basedir == null || SelectorUtils.matchPatternStart(pattern,
+                                                basedir.getAbsolutePath(),
+                                                isCaseSensitive()))) {
                 return true;
             }
         } else if (basedir == null) {
@@ -1063,14 +1057,14 @@ public class DirectoryScanner
      * Clear the result caches for a scan.
      */
     protected synchronized void clearResults() {
-        filesIncluded    = new VectorSet<String>();
-        filesNotIncluded = new VectorSet<String>();
-        filesExcluded    = new VectorSet<String>();
-        filesDeselected  = new VectorSet<String>();
-        dirsIncluded     = new VectorSet<String>();
-        dirsNotIncluded  = new VectorSet<String>();
-        dirsExcluded     = new VectorSet<String>();
-        dirsDeselected   = new VectorSet<String>();
+        filesIncluded    = new VectorSet<>();
+        filesNotIncluded = new VectorSet<>();
+        filesExcluded    = new VectorSet<>();
+        filesDeselected  = new VectorSet<>();
+        dirsIncluded     = new VectorSet<>();
+        dirsNotIncluded  = new VectorSet<>();
+        dirsExcluded     = new VectorSet<>();
+        dirsDeselected   = new VectorSet<>();
         everythingIncluded = (basedir != null);
         scannedDirs.clear();
         notFollowedSymlinks.clear();
@@ -1135,10 +1129,10 @@ public class DirectoryScanner
     }
 
     private void processSlowScan(final String[] arr) {
-        for (int i = 0; i < arr.length; i++) {
-            final TokenizedPath path  = new TokenizedPath(arr[i]);
+        for (String element : arr) {
+            final TokenizedPath path  = new TokenizedPath(element);
             if (!couldHoldIncluded(path) || contentsExcluded(path)) {
-                scandir(new File(basedir, arr[i]), path, false);
+                scandir(new File(basedir, element), path, false);
             }
         }
     }
@@ -1196,17 +1190,17 @@ public class DirectoryScanner
             if (!dir.exists()) {
                 throw new BuildException(dir + DOES_NOT_EXIST_POSTFIX);
             } else if (!dir.isDirectory()) {
-                throw new BuildException(dir + " is not a directory.");
+                throw new BuildException("%s is not a directory.", dir);
             } else {
-                throw new BuildException("IO error scanning directory '"
-                                         + dir.getAbsolutePath() + "'");
+                throw new BuildException("IO error scanning directory '%s'",
+                    dir.getAbsolutePath());
             }
         }
         scandir(dir, path, fast, newfiles, new LinkedList<String>());
     }
 
     private void scandir(final File dir, final TokenizedPath path, final boolean fast,
-                         String[] newfiles, final LinkedList<String> directoryNamesFollowed) {
+                         String[] newfiles, final Deque<String> directoryNamesFollowed) {
         String vpath = path.toString();
         if (vpath.length() > 0 && !vpath.endsWith(File.separator)) {
             vpath += File.separator;
@@ -1217,12 +1211,12 @@ public class DirectoryScanner
             return;
         }
         if (!followSymlinks) {
-            final ArrayList<String> noLinks = new ArrayList<String>();
-            for (int i = 0; i < newfiles.length; i++) {
+            final ArrayList<String> noLinks = new ArrayList<>();
+            for (String newfile : newfiles) {
                 try {
-                    if (SYMLINK_UTILS.isSymbolicLink(dir, newfiles[i])) {
-                        final String name = vpath + newfiles[i];
-                        final File file = new File(dir, newfiles[i]);
+                    if (SYMLINK_UTILS.isSymbolicLink(dir, newfile)) {
+                        final String name = vpath + newfile;
+                        final File file = new File(dir, newfile);
                         if (file.isDirectory()) {
                             dirsExcluded.addElement(name);
                         } else if (file.isFile()) {
@@ -1230,17 +1224,17 @@ public class DirectoryScanner
                         }
                         accountForNotFollowedSymlink(name, file);
                     } else {
-                        noLinks.add(newfiles[i]);
+                        noLinks.add(newfile);
                     }
                 } catch (final IOException ioe) {
                     final String msg = "IOException caught while checking "
                         + "for links, couldn't get canonical path!";
                     // will be caught and redirected to Ant's logging system
                     System.err.println(msg);
-                    noLinks.add(newfiles[i]);
+                    noLinks.add(newfile);
                 }
             }
-            newfiles = (noLinks.toArray(new String[noLinks.size()]));
+            newfiles = noLinks.toArray(new String[noLinks.size()]);
         } else {
             directoryNamesFollowed.addFirst(dir.getName());
         }
@@ -1322,7 +1316,7 @@ public class DirectoryScanner
     private void accountForIncludedDir(final TokenizedPath name,
                                        final File file, final boolean fast,
                                        final String[] children,
-                                       final LinkedList<String> directoryNamesFollowed) {
+                                       final Deque<String> directoryNamesFollowed) {
         processIncluded(name, file, dirsIncluded, dirsExcluded, dirsDeselected);
         if (fast && couldHoldIncluded(name) && !contentsExcluded(name)) {
             scandir(file, name, fast, children, directoryNamesFollowed);
@@ -1343,13 +1337,12 @@ public class DirectoryScanner
     }
 
     private void processIncluded(final TokenizedPath path,
-                                 final File file, final Vector<String> inc, final Vector<String> exc,
-                                 final Vector<String> des) {
+                                 final File file, final List<String> inc, final List<String> exc,
+                                 final List<String> des) {
         final String name = path.toString();
         if (inc.contains(name) || exc.contains(name) || des.contains(name)) {
             return;
         }
-
         boolean included = false;
         if (isExcluded(path)) {
             exc.add(name);
@@ -1385,17 +1378,13 @@ public class DirectoryScanner
     private boolean isIncluded(final TokenizedPath path) {
         ensureNonPatternSetsReady();
 
-        if (isCaseSensitive()
-            ? includeNonPatterns.containsKey(path.toString())
-            : includeNonPatterns.containsKey(path.toString().toUpperCase())) {
-            return true;
-        }
-        for (int i = 0; i < includePatterns.length; i++) {
-            if (includePatterns[i].matchPath(path, isCaseSensitive())) {
-                return true;
-            }
+        String toMatch = path.toString();
+        if (!isCaseSensitive()) {
+            toMatch = toMatch.toUpperCase();
         }
-        return false;
+        return includeNonPatterns.containsKey(toMatch)
+            || Stream.of(includePatterns)
+                .anyMatch(p -> p.matchPath(path, isCaseSensitive()));
     }
 
     /**
@@ -1419,19 +1408,11 @@ public class DirectoryScanner
      *         least one include pattern, or <code>false</code> otherwise.
      */
     private boolean couldHoldIncluded(final TokenizedPath tokenizedName) {
-        for (int i = 0; i < includePatterns.length; i++) {
-            if (couldHoldIncluded(tokenizedName, includePatterns[i])) {
-                return true;
-            }
-        }
-        for (final Iterator<TokenizedPath> iter = includeNonPatterns.values().iterator();
-             iter.hasNext();) {
-            if (couldHoldIncluded(tokenizedName,
-                                  iter.next().toPattern())) {
-                return true;
-            }
-        }
-        return false;
+        return Stream
+            .concat(Stream.of(includePatterns),
+                includeNonPatterns.values().stream()
+                    .map(TokenizedPath::toPattern))
+            .anyMatch(pat -> couldHoldIncluded(tokenizedName, pat));
     }
 
     /**
@@ -1481,12 +1462,8 @@ public class DirectoryScanner
     private boolean isMorePowerfulThanExcludes(final String name) {
         final String soughtexclude =
             name + File.separatorChar + SelectorUtils.DEEP_TREE_MATCH;
-        for (int counter = 0; counter < excludePatterns.length; counter++) {
-            if (excludePatterns[counter].toString().equals(soughtexclude))  {
-                return false;
-            }
-        }
-        return true;
+        return Stream.of(excludePatterns).map(Object::toString)
+            .noneMatch(Predicate.isEqual(soughtexclude));
     }
 
     /**
@@ -1495,14 +1472,10 @@ public class DirectoryScanner
      * @return whether all the specified directory's contents are excluded.
      */
     /* package */ boolean contentsExcluded(final TokenizedPath path) {
-        for (int i = 0; i < excludePatterns.length; i++) {
-            if (excludePatterns[i].endsWith(SelectorUtils.DEEP_TREE_MATCH)
-                && excludePatterns[i].withoutLastToken()
-                   .matchPath(path, isCaseSensitive())) {
-                return true;
-            }
-        }
-        return false;
+        return Stream.of(excludePatterns)
+            .filter(p -> p.endsWith(SelectorUtils.DEEP_TREE_MATCH))
+            .map(TokenizedPattern::withoutLastToken)
+            .anyMatch(wlt -> wlt.matchPath(path, isCaseSensitive()));
     }
 
     /**
@@ -1528,17 +1501,13 @@ public class DirectoryScanner
     private boolean isExcluded(final TokenizedPath name) {
         ensureNonPatternSetsReady();
 
-        if (isCaseSensitive()
-            ? excludeNonPatterns.containsKey(name.toString())
-            : excludeNonPatterns.containsKey(name.toString().toUpperCase())) {
-            return true;
-        }
-        for (int i = 0; i < excludePatterns.length; i++) {
-            if (excludePatterns[i].matchPath(name, isCaseSensitive())) {
-                return true;
-            }
+        String toMatch = name.toString();
+        if (!isCaseSensitive()) {
+            toMatch = toMatch.toUpperCase();
         }
-        return false;
+        return excludeNonPatterns.containsKey(toMatch)
+            || Stream.of(excludePatterns)
+                .anyMatch(p -> p.matchPath(name, isCaseSensitive()));
     }
 
     /**
@@ -1550,14 +1519,8 @@ public class DirectoryScanner
      *         should not be selected, <code>true</code> otherwise.
      */
     protected boolean isSelected(final String name, final File file) {
-        if (selectors != null) {
-            for (int i = 0; i < selectors.length; i++) {
-                if (!selectors[i].isSelected(basedir, name, file)) {
-                    return false;
-                }
-            }
-        }
-        return true;
+        return selectors == null || Stream.of(selectors)
+            .allMatch(sel -> sel.isSelected(basedir, name, file));
     }
 
     /**
@@ -1568,14 +1531,14 @@ public class DirectoryScanner
      * @return the names of the files which matched at least one of the
      *         include patterns and none of the exclude patterns.
      */
+    @Override
     public String[] getIncludedFiles() {
         String[] files;
         synchronized (this) {
             if (filesIncluded == null) {
                 throw new IllegalStateException("Must call scan() first");
             }
-            files = new String[filesIncluded.size()];
-            filesIncluded.copyInto(files);
+            files = filesIncluded.toArray(new String[filesIncluded.size()]);
         }
         Arrays.sort(files);
         return files;
@@ -1603,11 +1566,10 @@ public class DirectoryScanner
      *
      * @see #slowScan
      */
+    @Override
     public synchronized String[] getNotIncludedFiles() {
         slowScan();
-        final String[] files = new String[filesNotIncluded.size()];
-        filesNotIncluded.copyInto(files);
-        return files;
+        return filesNotIncluded.toArray(new String[filesNotIncluded.size()]);
     }
 
     /**
@@ -1621,11 +1583,10 @@ public class DirectoryScanner
      *
      * @see #slowScan
      */
+    @Override
     public synchronized String[] getExcludedFiles() {
         slowScan();
-        final String[] files = new String[filesExcluded.size()];
-        filesExcluded.copyInto(files);
-        return files;
+        return filesExcluded.toArray(new String[filesExcluded.size()]);
     }
 
     /**
@@ -1639,11 +1600,10 @@ public class DirectoryScanner
      *
      * @see #slowScan
      */
+    @Override
     public synchronized String[] getDeselectedFiles() {
         slowScan();
-        final String[] files = new String[filesDeselected.size()];
-        filesDeselected.copyInto(files);
-        return files;
+        return filesDeselected.toArray(new String[filesDeselected.size()]);
     }
 
     /**
@@ -1654,14 +1614,14 @@ public class DirectoryScanner
      * @return the names of the directories which matched at least one of the
      * include patterns and none of the exclude patterns.
      */
+    @Override
     public String[] getIncludedDirectories() {
         String[] directories;
         synchronized (this) {
             if (dirsIncluded == null) {
                 throw new IllegalStateException("Must call scan() first");
             }
-            directories = new String[dirsIncluded.size()];
-            dirsIncluded.copyInto(directories);
+            directories = dirsIncluded.toArray(new String[dirsIncluded.size()]);
         }
         Arrays.sort(directories);
         return directories;
@@ -1689,11 +1649,10 @@ public class DirectoryScanner
      *
      * @see #slowScan
      */
+    @Override
     public synchronized String[] getNotIncludedDirectories() {
         slowScan();
-        final String[] directories = new String[dirsNotIncluded.size()];
-        dirsNotIncluded.copyInto(directories);
-        return directories;
+        return dirsNotIncluded.toArray(new String[dirsNotIncluded.size()]);
     }
 
     /**
@@ -1707,11 +1666,10 @@ public class DirectoryScanner
      *
      * @see #slowScan
      */
+    @Override
     public synchronized String[] getExcludedDirectories() {
         slowScan();
-        final String[] directories = new String[dirsExcluded.size()];
-        dirsExcluded.copyInto(directories);
-        return directories;
+        return dirsExcluded.toArray(new String[dirsExcluded.size()]);
     }
 
     /**
@@ -1725,11 +1683,10 @@ public class DirectoryScanner
      *
      * @see #slowScan
      */
+    @Override
     public synchronized String[] getDeselectedDirectories() {
         slowScan();
-        final String[] directories = new String[dirsDeselected.size()];
-        dirsDeselected.copyInto(directories);
-        return directories;
+        return dirsDeselected.toArray(new String[dirsDeselected.size()]);
     }
 
     /**
@@ -1754,20 +1711,15 @@ public class DirectoryScanner
     /**
      * Add default exclusions to the current exclusions set.
      */
+    @Override
     public synchronized void addDefaultExcludes() {
-        final int excludesLength = excludes == null ? 0 : excludes.length;
-        String[] newExcludes;
-        final String[] defaultExcludesTemp = getDefaultExcludes();
-        newExcludes = new String[excludesLength + defaultExcludesTemp.length];
-        if (excludesLength > 0) {
-            System.arraycopy(excludes, 0, newExcludes, 0, excludesLength);
-        }
-        for (int i = 0; i < defaultExcludesTemp.length; i++) {
-            newExcludes[i + excludesLength] =
-                defaultExcludesTemp[i].replace('/', File.separatorChar)
-                .replace('\\', File.separatorChar);
+        Stream<String> s = Stream.of(getDefaultExcludes())
+            .map(p -> p.replace('/', File.separatorChar).replace('\\',
+                File.separatorChar));
+        if (excludes != null) {
+            s = Stream.concat(Stream.of(excludes), s);
         }
-        excludes = newExcludes;
+        excludes = s.toArray(String[]::new);
     }
 
     /**
@@ -1777,6 +1729,7 @@ public class DirectoryScanner
      * @return the resource with the given name.
      * @since Ant 1.5.2
      */
+    @Override
     public synchronized Resource getResource(final String name) {
         return new FileResource(basedir, name);
     }
@@ -1838,14 +1791,14 @@ public class DirectoryScanner
      * @since Ant 1.8.0
      */
     private TokenizedPattern[] fillNonPatternSet(final Map<String, TokenizedPath> map, final String[] patterns) {
-        final ArrayList<TokenizedPattern> al = new ArrayList<TokenizedPattern>(patterns.length);
-        for (int i = 0; i < patterns.length; i++) {
-            if (!SelectorUtils.hasWildcards(patterns[i])) {
+        final List<TokenizedPattern> al = new ArrayList<>(patterns.length);
+        for (String pattern : patterns) {
+            if (SelectorUtils.hasWildcards(pattern)) {
+                al.add(new TokenizedPattern(pattern));
+            } else {
                 final String s = isCaseSensitive()
-                    ? patterns[i] : patterns[i].toUpperCase();
+                    ? pattern : pattern.toUpperCase();
                 map.put(s, new TokenizedPath(s));
-            } else {
-                al.add(new TokenizedPattern(patterns[i]));
             }
         }
         return al.toArray(new TokenizedPattern[al.size()]);
@@ -1863,14 +1816,14 @@ public class DirectoryScanner
      * @since Ant 1.8.0
      */
     private boolean causesIllegalSymlinkLoop(final String dirName, final File parent,
-                                             final LinkedList<String> directoryNamesFollowed) {
+                                             final Deque<String> directoryNamesFollowed) {
         try {
             if (directoryNamesFollowed.size() >= maxLevelsOfSymlinks
-                && CollectionUtils.frequency(directoryNamesFollowed, dirName)
+                && Collections.frequency(directoryNamesFollowed, dirName)
                    >= maxLevelsOfSymlinks
                 && SYMLINK_UTILS.isSymbolicLink(parent, dirName)) {
 
-                final ArrayList<String> files = new ArrayList<String>();
+                final List<String> files = new ArrayList<>();
                 File f = FILE_UTILS.resolveFile(parent, dirName);
                 final String target = f.getCanonicalPath();
                 files.add(target);
@@ -1882,18 +1835,17 @@ public class DirectoryScanner
                         f = FILE_UTILS.resolveFile(parent, relPath + dir);
                         files.add(f.getCanonicalPath());
                         if (files.size() > maxLevelsOfSymlinks
-                            && CollectionUtils.frequency(files, target)
+                            && Collections.frequency(files, target)
                                  > maxLevelsOfSymlinks) {
                             return true;
                         }
                     }
                 }
-
             }
             return false;
         } catch (final IOException ex) {
-            throw new BuildException("Caught error while checking for"
-                                     + " symbolic links", ex);
+            throw new BuildException(
+                "Caught error while checking for symbolic links", ex);
         }
     }
 
index e48062b..1eb321e 100644 (file)
@@ -26,4 +26,3 @@ package org.apache.tools.ant;
 public interface DynamicConfigurator
     extends DynamicAttribute, DynamicElement {
 }
-
index 47f09c7..bd0ec7e 100644 (file)
  */
 package org.apache.tools.ant;
 
+import java.util.function.Supplier;
+
 /**
  * Kind of task attribute that can be evaluated before being assigned
+ * @param <T> as {@link Supplier}
  *
  * @see RuntimeConfigurable
  */
-public interface Evaluable {
+public interface Evaluable<T> extends Supplier<T> {
 
-    Object eval();
+    T eval();
 
+    default T get() {
+        return eval();
+    }
 }
index 2b31e43..5368042 100644 (file)
@@ -63,7 +63,7 @@ public final class IntrospectionHelper {
     /**
      * Helper instances we've already created (Class.getName() to IntrospectionHelper).
      */
-    private static final Map<String, IntrospectionHelper> HELPERS = new Hashtable<String, IntrospectionHelper>();
+    private static final Map<String, IntrospectionHelper> HELPERS = new Hashtable<>();
 
     /**
      * Map from primitive types to wrapper classes for use in
@@ -71,7 +71,7 @@ public final class IntrospectionHelper {
      * and boolean are in here even though they get special treatment
      * - this way we only need to test for the wrapper class.
      */
-    private static final Map<Class<?>, Class<?>> PRIMITIVE_TYPE_MAP = new HashMap<Class<?>, Class<?>>(8);
+    private static final Map<Class<?>, Class<?>> PRIMITIVE_TYPE_MAP = new HashMap<>(8);
 
     // Set up PRIMITIVE_TYPE_MAP
     static {
@@ -91,30 +91,30 @@ public final class IntrospectionHelper {
      * Map from attribute names to attribute types
      * (String to Class).
      */
-    private final Hashtable<String, Class<?>> attributeTypes = new Hashtable<String, Class<?>>();
+    private final Map<String, Class<?>> attributeTypes = new Hashtable<>();
 
     /**
      * Map from attribute names to attribute setter methods
      * (String to AttributeSetter).
      */
-    private final Hashtable<String, AttributeSetter> attributeSetters = new Hashtable<String, AttributeSetter>();
+    private final Map<String, AttributeSetter> attributeSetters = new Hashtable<>();
 
     /**
      * Map from attribute names to nested types
      * (String to Class).
      */
-    private final Hashtable<String, Class<?>> nestedTypes = new Hashtable<String, Class<?>>();
+    private final Map<String, Class<?>> nestedTypes = new Hashtable<>();
 
     /**
      * Map from attribute names to methods to create nested types
      * (String to NestedCreator).
      */
-    private final Hashtable<String, NestedCreator> nestedCreators = new Hashtable<String, NestedCreator>();
+    private final Map<String, NestedCreator> nestedCreators = new Hashtable<>();
 
     /**
      * Vector of methods matching add[Configured](Class) pattern.
      */
-    private final List<Method> addTypeMethods = new ArrayList<Method>();
+    private final List<Method> addTypeMethods = new ArrayList<>();
 
     /**
      * The method to invoke to add PCDATA.
@@ -706,7 +706,7 @@ public final class IntrospectionHelper {
      * @return true if the given nested element is supported
      */
     public boolean supportsNestedElement(final String parentUri, final String elementName) {
-        if (isDynamic() || addTypeMethods.size() > 0) {
+        if (isDynamic() || !addTypeMethods.isEmpty()) {
             return true;
         }
         return supportsReflectElement(parentUri, elementName);
@@ -731,7 +731,7 @@ public final class IntrospectionHelper {
      */
     public boolean supportsNestedElement(final String parentUri, final String elementName,
                                          final Project project, final Object parent) {
-        if (addTypeMethods.size() > 0
+        if (!addTypeMethods.isEmpty()
             && createAddTypeCreator(project, parent, elementName) != null) {
             return true;
         }
@@ -944,7 +944,7 @@ public final class IntrospectionHelper {
      * @see #getAttributeMap
      */
     public Enumeration<String> getAttributes() {
-        return attributeSetters.keys();
+        return Collections.enumeration(attributeSetters.keySet());
     }
 
     /**
@@ -968,7 +968,7 @@ public final class IntrospectionHelper {
      * @see #getNestedElementMap
      */
     public Enumeration<String> getNestedElements() {
-        return nestedTypes.keys();
+        return Collections.enumeration(nestedTypes.keySet());
     }
 
     /**
@@ -1533,7 +1533,7 @@ public final class IntrospectionHelper {
      */
     private NestedCreator createAddTypeCreator(
             final Project project, final Object parent, final String elementName) throws BuildException {
-        if (addTypeMethods.size() == 0) {
+        if (addTypeMethods.isEmpty()) {
             return null;
         }
         final ComponentHelper helper = ComponentHelper.getComponentHelper(project);
@@ -1602,7 +1602,7 @@ public final class IntrospectionHelper {
         for (int c = 0; c < size; ++c) {
             final Method current = addTypeMethods.get(c);
             if (current.getParameterTypes()[0].equals(argClass)) {
-                if (method.getName().equals("addConfigured")) {
+                if ("addConfigured".equals(method.getName())) {
                     // add configured replaces the add method
                     addTypeMethods.set(c, method);
                 }
index 8e25d10..0e83760 100644 (file)
@@ -19,6 +19,7 @@
 package org.apache.tools.ant;
 
 import java.io.Serializable;
+import java.util.Objects;
 
 import org.apache.tools.ant.util.FileUtils;
 import org.xml.sax.Locator;
@@ -131,8 +132,9 @@ public class Location implements Serializable {
      *         <code>"fileName: "</code> if only the file name is known,
      *         and the empty string for unknown locations.
      */
+    @Override
     public String toString() {
-        StringBuffer buf = new StringBuffer();
+        StringBuilder buf = new StringBuilder();
 
         if (fileName != null) {
             buf.append(fileName);
@@ -155,6 +157,7 @@ public class Location implements Serializable {
      *              as this object.
      * @since Ant 1.6.3
      */
+    @Override
     public boolean equals(Object other) {
         if (this == other) {
             return true;
@@ -173,7 +176,8 @@ public class Location implements Serializable {
      * @return a hash code value for this location.
      * @since Ant 1.6.3
      */
+    @Override
     public int hashCode() {
-        return toString().hashCode();
+        return Objects.hash(fileName, lineNumber);
     }
 }
index bbaadd0..1ad6277 100644 (file)
@@ -87,16 +87,16 @@ public class Main implements AntMain {
     private PrintStream err = System.err;
 
     /** The build targets. */
-    private final Vector<String> targets = new Vector<String>();
+    private final Vector<String> targets = new Vector<>();
 
     /** Set of properties that can be used by tasks. */
     private final Properties definedProps = new Properties();
 
     /** Names of classes to add as listeners to project. */
-    private final Vector<String> listeners = new Vector<String>(1);
+    private final Vector<String> listeners = new Vector<>(1);
 
     /** File names of property files to load on startup. */
-    private final Vector<String> propertyFiles = new Vector<String>(1);
+    private final Vector<String> propertyFiles = new Vector<>(1);
 
     /** Indicates whether this build is to support interactive input */
     private boolean allowInput = true;
@@ -155,17 +155,9 @@ public class Main implements AntMain {
      */
     private boolean proxy = false;
 
-    private final Map<Class<?>, List<String>> extraArguments = new HashMap<Class<?>, List<String>>();
-
-    private static final GetProperty NOPROPERTIES = new GetProperty() {
-        public Object getProperty(final String aName) {
-            // No existing property takes precedence
-            return null;
-        }
-    };
-
-
+    private final Map<Class<?>, List<String>> extraArguments = new HashMap<>();
 
+    private static final GetProperty NOPROPERTIES = aName -> null;
 
     /**
      * Prints the message of the Throwable if it (the message) is not
@@ -569,8 +561,8 @@ public class Main implements AntMain {
          */
         final String arg = args[argPos];
         String name = arg.substring(2, arg.length());
-        String value = null;
-        final int posEq = name.indexOf("=");
+        String value;
+        final int posEq = name.indexOf('=');
         if (posEq > 0) {
             value = name.substring(posEq + 1);
             name = name.substring(0, posEq);
@@ -1153,7 +1145,7 @@ public class Main implements AntMain {
      * @return the filtered targets.
      */
     private static Map<String, Target> removeDuplicateTargets(final Map<String, Target> targets) {
-        final Map<Location, Target> locationMap = new HashMap<Location, Target>();
+        final Map<Location, Target> locationMap = new HashMap<>();
         for (final Entry<String, Target> entry : targets.entrySet()) {
             final String name = entry.getKey();
             final Target target = entry.getValue();
@@ -1168,7 +1160,7 @@ public class Main implements AntMain {
                     target.getLocation(), target); // Smallest name wins
             }
         }
-        final Map<String, Target> ret = new HashMap<String, Target>();
+        final Map<String, Target> ret = new HashMap<>();
         for (final Target target : locationMap.values()) {
             ret.put(target.getName(), target);
         }
@@ -1191,15 +1183,15 @@ public class Main implements AntMain {
         final Map<String, Target> ptargets = removeDuplicateTargets(project.getTargets());
         // split the targets in top-level and sub-targets depending
         // on the presence of a description
-        final Vector<String> topNames = new Vector<String>();
-        final Vector<String> topDescriptions = new Vector<String>();
-        final Vector<Enumeration<String>> topDependencies = new Vector<Enumeration<String>>();
-        final Vector<String> subNames = new Vector<String>();
-        final Vector<Enumeration<String>> subDependencies = new Vector<Enumeration<String>>();
+        final Vector<String> topNames = new Vector<>();
+        final Vector<String> topDescriptions = new Vector<>();
+        final Vector<Enumeration<String>> topDependencies = new Vector<>();
+        final Vector<String> subNames = new Vector<>();
+        final Vector<Enumeration<String>> subDependencies = new Vector<>();
 
         for (final Target currentTarget : ptargets.values()) {
             final String targetName = currentTarget.getName();
-            if (targetName.equals("")) {
+            if ("".equals(targetName)) {
                 continue;
             }
             final String targetDescription = currentTarget.getDescription();
@@ -1227,7 +1219,7 @@ public class Main implements AntMain {
                 "Main targets:", maxLength);
         //if there were no main targets, we list all subtargets
         //as it means nothing has a description
-        if (topNames.size() == 0) {
+        if (topNames.isEmpty()) {
             printSubTargets = true;
         }
         if (printSubTargets) {
index 6e6bea6..2beb09c 100644 (file)
@@ -127,7 +127,7 @@ public class PathTokenizer {
         } else {
             // we are on NetWare, tokenizing is handled a little differently,
             // due to the fact that NetWare has multiple-character volume names.
-            if (token.equals(File.pathSeparator) || token.equals(":")) {
+            if (token.equals(File.pathSeparator) || ":".equals(token)) {
                 // ignore ";" and get the next token
                 token = tokenizer.nextToken().trim();
             }
@@ -138,7 +138,7 @@ public class PathTokenizer {
 
                 // make sure we aren't going to get the path separator next
                 if (!nextToken.equals(File.pathSeparator)) {
-                    if (nextToken.equals(":")) {
+                    if (":".equals(nextToken)) {
                         if (!token.startsWith("/") && !token.startsWith("\\")
                             && !token.startsWith(".")
                             && !token.startsWith("..")) {
@@ -163,4 +163,3 @@ public class PathTokenizer {
         return token;
     }
 }
-
index 17f2467..23799bc 100644 (file)
@@ -144,13 +144,13 @@ public class Project implements ResourceFactory {
     private final Hashtable<String, Object> references = new AntRefTable();
 
     /** Map of id references - used for indicating broken build files */
-    private final HashMap<String, Object> idReferences = new HashMap<String, Object>();
+    private final HashMap<String, Object> idReferences = new HashMap<>();
 
     /** Name of the project's default target. */
     private String defaultTarget;
 
     /** Map from target names to targets (String to Target). */
-    private final Hashtable<String, Target> targets = new Hashtable<String, Target>();
+    private final Hashtable<String, Target> targets = new Hashtable<>();
 
     /** Set of global filters. */
     private final FilterSet globalFilterSet = new FilterSet();
@@ -193,11 +193,11 @@ public class Project implements ResourceFactory {
 
     /** Records the latest task to be executed on a thread. */
     private final Map<Thread,Task> threadTasks =
-        Collections.synchronizedMap(new WeakHashMap<Thread, Task>());
+        Collections.synchronizedMap(new WeakHashMap<>());
 
     /** Records the latest task to be executed on a thread group. */
     private final Map<ThreadGroup,Task> threadGroupTasks
-        = Collections.synchronizedMap(new WeakHashMap<ThreadGroup,Task>());
+        = Collections.synchronizedMap(new WeakHashMap<>());
 
     /**
      * Called to handle any input requests.
@@ -437,7 +437,7 @@ public class Project implements ResourceFactory {
      */
     public Vector<BuildListener> getBuildListeners() {
         synchronized (listenersLock) {
-            final Vector<BuildListener> r = new Vector<BuildListener>(listeners.length);
+            final Vector<BuildListener> r = new Vector<>(listeners.length);
             for (int i = 0; i < listeners.length; i++) {
                 r.add(listeners[i]);
             }
@@ -1046,7 +1046,7 @@ public class Project implements ResourceFactory {
      * @since Ant 1.8.1
      */
     public Map<String, Class<?>> getCopyOfTaskDefinitions() {
-        return new HashMap<String, Class<?>>(getTaskDefinitions());
+        return new HashMap<>(getTaskDefinitions());
     }
 
     /**
@@ -1088,7 +1088,7 @@ public class Project implements ResourceFactory {
      * @since Ant 1.8.1
      */
     public Map<String, Class<?>> getCopyOfDataTypeDefinitions() {
-        return new HashMap<String, Class<?>>(getDataTypeDefinitions());
+        return new HashMap<>(getDataTypeDefinitions());
     }
 
     /**
@@ -1168,7 +1168,7 @@ public class Project implements ResourceFactory {
      * @since Ant 1.8.1
      */
     public Map<String, Target> getCopyOfTargets() {
-        return new HashMap<String, Target>(targets);
+        return new HashMap<>(targets);
     }
 
     /**
@@ -1273,12 +1273,10 @@ public class Project implements ResourceFactory {
         final Task task = getThreadTask(Thread.currentThread());
         if (task == null) {
             log(output, isWarning ? MSG_WARN : MSG_INFO);
+        } else if (isWarning) {
+            task.handleErrorOutput(output);
         } else {
-            if (isWarning) {
-                task.handleErrorOutput(output);
-            } else {
-                task.handleOutput(output);
-            }
+            task.handleOutput(output);
         }
     }
 
@@ -1297,12 +1295,11 @@ public class Project implements ResourceFactory {
      */
     public int defaultInput(final byte[] buffer, final int offset, final int length)
         throws IOException {
-        if (defaultInputStream != null) {
-            System.out.flush();
-            return defaultInputStream.read(buffer, offset, length);
-        } else {
+        if (defaultInputStream == null) {
             throw new EOFException("No input provided for project");
         }
+        System.out.flush();
+        return defaultInputStream.read(buffer, offset, length);
     }
 
     /**
@@ -1322,9 +1319,8 @@ public class Project implements ResourceFactory {
         final Task task = getThreadTask(Thread.currentThread());
         if (task == null) {
             return defaultInput(buffer, offset, length);
-        } else {
-            return task.handleInput(buffer, offset, length);
         }
+        return task.handleInput(buffer, offset, length);
     }
 
     /**
@@ -1342,12 +1338,10 @@ public class Project implements ResourceFactory {
         final Task task = getThreadTask(Thread.currentThread());
         if (task == null) {
             fireMessageLogged(this, output, isError ? MSG_ERR : MSG_INFO);
+        } else if (isError) {
+            task.handleErrorFlush(output);
         } else {
-            if (isError) {
-                task.handleErrorFlush(output);
-            } else {
-                task.handleFlush(output);
-            }
+            task.handleFlush(output);
         }
     }
 
@@ -1383,7 +1377,7 @@ public class Project implements ResourceFactory {
      */
     public void executeSortedTargets(final Vector<Target> sortedTargets)
         throws BuildException {
-        final Set<String> succeededTargets = new HashSet<String>();
+        final Set<String> succeededTargets = new HashSet<>();
         BuildException buildException = null; // first build exception
         for (final Target curtarget : sortedTargets) {
             boolean canExecute = true;
@@ -1749,9 +1743,9 @@ public class Project implements ResourceFactory {
             return ((ProjectComponent) o).getProject();
         }
         try {
-            final Method m = o.getClass().getMethod("getProject", (Class[]) null);
-            if (Project.class == m.getReturnType()) {
-                return (Project) m.invoke(o, (Object[]) null);
+            final Method m = o.getClass().getMethod("getProject");
+            if (Project.class.equals(m.getReturnType())) {
+                return (Project) m.invoke(o);
             }
         } catch (final Exception e) {
             //too bad
@@ -1819,9 +1813,9 @@ public class Project implements ResourceFactory {
      */
     public final Vector<Target> topoSort(final String[] root, final Hashtable<String, Target> targetTable,
                                  final boolean returnAll) throws BuildException {
-        final Vector<Target> ret = new VectorSet<Target>();
-        final Hashtable<String, String> state = new Hashtable<String, String>();
-        final Stack<String> visiting = new Stack<String>();
+        final Vector<Target> ret = new VectorSet<>();
+        final Hashtable<String, String> state = new Hashtable<>();
+        final Stack<String> visiting = new Stack<>();
 
         // We first run a DFS based sort using each root as a starting node.
         // This creates the minimum sequence of Targets to the root node(s).
@@ -1832,7 +1826,7 @@ public class Project implements ResourceFactory {
         // build Target.
 
         for (int i = 0; i < root.length; i++) {
-            final String st = (state.get(root[i]));
+            final String st = state.get(root[i]);
             if (st == null) {
                 tsort(root[i], targetTable, state, visiting, ret);
             } else if (st == VISITING) {
@@ -1840,7 +1834,7 @@ public class Project implements ResourceFactory {
                     + root[i]);
             }
         }
-        final StringBuffer buf = new StringBuffer("Build sequence for target(s)");
+        final StringBuilder buf = new StringBuilder("Build sequence for target(s)");
 
         for (int j = 0; j < root.length; j++) {
             buf.append((j == 0) ? " `" : ", `").append(root[j]).append('\'');
@@ -1848,7 +1842,7 @@ public class Project implements ResourceFactory {
         buf.append(" is ").append(ret);
         log(buf.toString(), MSG_VERBOSE);
 
-        final Vector<Target> complete = (returnAll) ? ret : new Vector<Target>(ret);
+        final Vector<Target> complete = (returnAll) ? ret : new Vector<>(ret);
         for (final Enumeration<String> en = targetTable.keys(); en.hasMoreElements();) {
             final String curTarget = en.nextElement();
             final String st = state.get(curTarget);
@@ -2035,7 +2029,7 @@ public class Project implements ResourceFactory {
      * @since Ant 1.8.1
      */
     public Map<String, Object> getCopyOfReferences() {
-        return new HashMap<String, Object>(references);
+        return new HashMap<>(references);
     }
 
     /**
@@ -2488,6 +2482,7 @@ public class Project implements ResourceFactory {
      * @return the file resource.
      * @since Ant 1.7
      */
+    @Override
     public Resource getResource(final String name) {
         return new FileResource(getBaseDir(), name);
     }
index ad92a31..451dbed 100644 (file)
@@ -160,6 +160,7 @@ public abstract class ProjectComponent implements Cloneable {
      * @throws CloneNotSupportedException does not happen,
      *                                    but is declared to allow subclasses to do so.
      */
+    @Override
     public Object clone() throws CloneNotSupportedException {
         ProjectComponent pc = (ProjectComponent) super.clone();
         pc.setLocation(getLocation());
index ab39368..0b51946 100644 (file)
@@ -146,16 +146,12 @@ public class ProjectHelper {
         }
     }
 
-    /** Default constructor */
-    public ProjectHelper() {
-    }
-
     // -------------------- Common properties  --------------------
     // The following properties are required by import ( and other tasks
     // that read build files using ProjectHelper ).
 
-    private Vector<Object> importStack = new Vector<Object>();
-    private List<String[]> extensionStack = new LinkedList<String[]>();
+    private Vector<Object> importStack = new Vector<>();
+    private List<String[]> extensionStack = new LinkedList<>();
 
     /**
      *  Import stack.
@@ -181,7 +177,7 @@ public class ProjectHelper {
         return extensionStack;
     }
 
-    private static final ThreadLocal<String> targetPrefix = new ThreadLocal<String>();
+    private static final ThreadLocal<String> targetPrefix = new ThreadLocal<>();
 
     /**
      * The prefix to prepend to imported target names.
@@ -292,7 +288,7 @@ public class ProjectHelper {
      * @see org.apache.tools.ant.ProjectHelperRepository#getHelpers()
      */
     public static ProjectHelper getProjectHelper() {
-        return (ProjectHelper) ProjectHelperRepository.getInstance().getHelpers().next();
+        return ProjectHelperRepository.getInstance().getHelpers().next();
     }
 
     /**
@@ -496,7 +492,7 @@ public class ProjectHelper {
      * @return      The stringified form of the ns name
      */
     public static String genComponentName(String uri, String name) {
-        if (uri == null || uri.equals("") || uri.equals(ANT_CORE_URI)) {
+        if (uri == null || "".equals(uri) || uri.equals(ANT_CORE_URI)) {
             return name;
         }
         return uri + ":" + name;
index e370a54..a11c05a 100644 (file)
@@ -27,6 +27,7 @@ import java.util.ArrayList;
 import java.util.Enumeration;
 import java.util.Iterator;
 import java.util.List;
+import java.util.stream.Stream;
 
 import org.apache.tools.ant.helper.ProjectHelper2;
 import org.apache.tools.ant.types.Resource;
@@ -53,7 +54,7 @@ public class ProjectHelperRepository {
     private static ProjectHelperRepository instance =
         new ProjectHelperRepository();
 
-    private List<Constructor<? extends ProjectHelper>> helpers = new ArrayList<Constructor<? extends ProjectHelper>>();
+    private List<Constructor<? extends ProjectHelper>> helpers = new ArrayList<>();
 
     private static Constructor<ProjectHelper2> PROJECTHELPER2_CONSTRUCTOR;
 
@@ -298,40 +299,15 @@ public class ProjectHelperRepository {
      * @return an iterator of {@link ProjectHelper}
      */
     public Iterator<ProjectHelper> getHelpers() {
-        return new ConstructingIterator(helpers.iterator());
-    }
-
-    private static class ConstructingIterator implements Iterator<ProjectHelper> {
-        private final Iterator<Constructor<? extends ProjectHelper>> nested;
-        private boolean empty = false;
-
-        ConstructingIterator(Iterator<Constructor<? extends ProjectHelper>> nested) {
-            this.nested = nested;
-        }
-
-        public boolean hasNext() {
-            return nested.hasNext() || !empty;
-        }
-
-        public ProjectHelper next() {
-            Constructor<? extends ProjectHelper> c;
-            if (nested.hasNext()) {
-                c = nested.next();
-            } else {
-                // last but not least, ant default project helper
-                empty = true;
-                c = PROJECTHELPER2_CONSTRUCTOR;
-            }
+        Stream.Builder<Constructor<? extends ProjectHelper>> b = Stream.builder();
+        helpers.forEach(b::add);
+        return b.add(PROJECTHELPER2_CONSTRUCTOR).build().map(c -> {
             try {
                 return c.newInstance();
             } catch (Exception e) {
                 throw new BuildException("Failed to invoke no-arg constructor"
-                                         + " on " + c.getName());
+                        + " on " + c.getName());
             }
-        }
-
-        public void remove() {
-            throw new UnsupportedOperationException("remove is not supported");
-        }
+        }).map(ProjectHelper.class::cast).iterator();
     }
 }
index 1dbb280..84121c9 100644 (file)
@@ -17,7 +17,6 @@
  */
 package org.apache.tools.ant;
 
-import java.text.ParsePosition;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
@@ -30,7 +29,6 @@ import java.util.Vector;
 
 import org.apache.tools.ant.property.GetProperty;
 import org.apache.tools.ant.property.NullReturn;
-import org.apache.tools.ant.property.ParseNextProperty;
 import org.apache.tools.ant.property.ParseProperties;
 import org.apache.tools.ant.property.PropertyExpander;
 
@@ -184,52 +182,41 @@ public class PropertyHelper implements GetProperty {
         }
     };
 
-    private static final PropertyExpander DEFAULT_EXPANDER = new PropertyExpander() {
-        public String parsePropertyName(
-            String s, ParsePosition pos, ParseNextProperty notUsed) {
+    private static final PropertyExpander DEFAULT_EXPANDER =
+        (s, pos, notUsed) -> {
             int index = pos.getIndex();
             //directly check near, triggering characters:
-            if (s.length() - index >= 3
-                    && '$' == s.charAt(index) && '{' == s.charAt(index + 1)) {
+            if (s.length() - index >= 3 && '$' == s.charAt(index)
+                && '{' == s.charAt(index + 1)) {
                 int start = index + 2;
                 //defer to String.indexOf() for protracted check:
                 int end = s.indexOf('}', start);
                 if (end < 0) {
-                    throw new BuildException("Syntax error in property: "
-                            + s.substring(index));
+                    throw new BuildException(
+                        "Syntax error in property: " + s.substring(index));
                 }
                 pos.setIndex(end + 1);
-                return start == end ? "" :  s.substring(start, end);
+                return start == end ? "" : s.substring(start, end);
             }
             return null;
-        }
-    };
+        };
 
     /** dummy */
-    private static final PropertyExpander SKIP_DOUBLE_DOLLAR
-        = new PropertyExpander() {
-            // CheckStyle:LineLengthCheck OFF see too long
-            /**
-             * {@inheritDoc}
-             * @see org.apache.tools.ant.property.PropertyExpander#parsePropertyName(java.lang.String, java.text.ParsePosition, org.apache.tools.ant.PropertyHelper)
-             */
-            // CheckStyle:LineLengthCheck ON
-            public String parsePropertyName(
-                String s, ParsePosition pos, ParseNextProperty notUsed) {
-                int index = pos.getIndex();
-                if (s.length() - index >= 2) {
-                    /* check for $$; if found, advance by one--
-                     * this expander is at the bottom of the stack
-                     * and will thus be the last consulted,
-                     * so the next thing that ParseProperties will do
-                     * is advance the parse position beyond the second $
-                     */
-                    if ('$' == s.charAt(index) && '$' == s.charAt(++index)) {
-                        pos.setIndex(index);
-                    }
+    private static final PropertyExpander SKIP_DOUBLE_DOLLAR =
+        (s, pos, notUsed) -> {
+            int index = pos.getIndex();
+            if (s.length() - index >= 2) {
+                /* check for $$; if found, advance by one--
+                 * this expander is at the bottom of the stack
+                 * and will thus be the last consulted,
+                 * so the next thing that ParseProperties will do
+                 * is advance the parse position beyond the second $
+                 */
+                if ('$' == s.charAt(index) && '$' == s.charAt(++index)) {
+                    pos.setIndex(index);
                 }
-                return null;
             }
+            return null;
         };
 
     /**
@@ -248,24 +235,24 @@ public class PropertyHelper implements GetProperty {
 
     private Project project;
     private PropertyHelper next;
-    private final Hashtable<Class<? extends Delegate>, List<Delegate>> delegates = new Hashtable<Class<? extends Delegate>, List<Delegate>>();
+    private final Hashtable<Class<? extends Delegate>, List<Delegate>> delegates = new Hashtable<>();
 
     /** Project properties map (usually String to String). */
-    private Hashtable<String, Object> properties = new Hashtable<String, Object>();
+    private Hashtable<String, Object> properties = new Hashtable<>();
 
     /**
      * Map of "user" properties (as created in the Ant task, for example).
      * Note that these key/value pairs are also always put into the
      * project properties, so only the project properties need to be queried.
      */
-    private Hashtable<String, Object> userProperties = new Hashtable<String, Object>();
+    private Hashtable<String, Object> userProperties = new Hashtable<>();
 
     /**
      * Map of inherited "user" properties - that are those "user"
      * properties that have been created by tasks and not been set
      * from the command line or a GUI tool.
      */
-    private Hashtable<String, Object> inheritedProperties = new Hashtable<String, Object>();
+    private Hashtable<String, Object> inheritedProperties = new Hashtable<>();
 
     /**
      * Default constructor.
@@ -900,7 +887,7 @@ public class PropertyHelper implements GetProperty {
     public Hashtable<String, Object> getProperties() {
         //avoid concurrent modification:
         synchronized (properties) {
-            return new Hashtable<String, Object>(properties);
+            return new Hashtable<>(properties);
         }
         // There is a better way to save the context. This shouldn't
         // delegate to next, it's for backward compatibility only.
@@ -917,7 +904,7 @@ public class PropertyHelper implements GetProperty {
     public Hashtable<String, Object> getUserProperties() {
         //avoid concurrent modification:
         synchronized (userProperties) {
-            return new Hashtable<String, Object>(userProperties);
+            return new Hashtable<>(userProperties);
         }
     }
 
@@ -932,7 +919,7 @@ public class PropertyHelper implements GetProperty {
     public Hashtable<String, Object> getInheritedProperties() {
         //avoid concurrent modification:
         synchronized (inheritedProperties) {
-            return new Hashtable<String, Object>(inheritedProperties);
+            return new Hashtable<>(inheritedProperties);
         }
     }
 
@@ -982,7 +969,7 @@ public class PropertyHelper implements GetProperty {
         synchronized (inheritedProperties) {
             Enumeration<String> e = inheritedProperties.keys();
             while (e.hasMoreElements()) {
-                String arg = e.nextElement().toString();
+                String arg = e.nextElement();
                 if (other.getUserProperty(arg) != null) {
                     continue;
                 }
@@ -1036,7 +1023,7 @@ public class PropertyHelper implements GetProperty {
         int prev = 0;
         int pos;
         //search for the next instance of $ from the 'prev' position
-        while ((pos = value.indexOf("$", prev)) >= 0) {
+        while ((pos = value.indexOf('$', prev)) >= 0) {
 
             //if there was any text before this, add it as a fragment
             //TODO, this check could be modified to go if pos>prev;
@@ -1096,10 +1083,10 @@ public class PropertyHelper implements GetProperty {
             for (Class<? extends Delegate> key : getDelegateInterfaces(delegate)) {
                 List<Delegate> list = delegates.get(key);
                 if (list == null) {
-                    list = new ArrayList<Delegate>();
+                    list = new ArrayList<>();
                 } else {
                     //copy on write, top priority
-                    list = new ArrayList<Delegate>(list);
+                    list = new ArrayList<>(list);
                     list.remove(delegate);
                 }
                 list.add(0, delegate);
@@ -1129,7 +1116,7 @@ public class PropertyHelper implements GetProperty {
      * @since Ant 1.8.0
      */
     protected static Set<Class<? extends Delegate>> getDelegateInterfaces(Delegate d) {
-        final HashSet<Class<? extends Delegate>> result = new HashSet<Class<? extends Delegate>>();
+        final HashSet<Class<? extends Delegate>> result = new HashSet<>();
         Class<?> c = d.getClass();
         while (c != null) {
             Class<?>[] ifs = c.getInterfaces();
index 0aafccb..8e54d8c 100644 (file)
@@ -25,12 +25,11 @@ import java.util.Enumeration;
 import java.util.Hashtable;
 import java.util.LinkedHashMap;
 import java.util.List;
-import java.util.Map.Entry;
+import java.util.Map;
 
 import org.apache.tools.ant.attribute.EnableAttribute;
 import org.apache.tools.ant.taskdefs.MacroDef.Attribute;
 import org.apache.tools.ant.taskdefs.MacroInstance;
-import org.apache.tools.ant.util.CollectionUtils;
 import org.xml.sax.AttributeList;
 import org.xml.sax.helpers.AttributeListImpl;
 
@@ -46,14 +45,14 @@ public class RuntimeConfigurable implements Serializable {
 
     /** Empty Hashtable. */
     private static final Hashtable<String, Object> EMPTY_HASHTABLE =
-            new Hashtable<String, Object>(0);
+            new Hashtable<>(0);
 
     /** Name of the element to configure. */
     private String elementTag = null;
 
     /** List of child element wrappers. */
     // picking ArrayList rather than List as arrayList is Serializable
-    private ArrayList<RuntimeConfigurable> children = null;
+    private List<RuntimeConfigurable> children = null;
 
     /** The element to configure. It is only used during
      * maybeConfigure.
@@ -303,17 +302,17 @@ public class RuntimeConfigurable implements Serializable {
             this.polyType = value == null ? null : value.toString();
         } else {
             if (attributeMap == null) {
-                attributeMap = new LinkedHashMap<String, Object>();
+                attributeMap = new LinkedHashMap<>();
             }
-            if (name.equalsIgnoreCase("refid") && !attributeMap.isEmpty()) {
-                LinkedHashMap<String, Object> newAttributeMap = new LinkedHashMap<String, Object>();
+            if ("refid".equalsIgnoreCase(name) && !attributeMap.isEmpty()) {
+                LinkedHashMap<String, Object> newAttributeMap = new LinkedHashMap<>();
                 newAttributeMap.put(name, value);
                 newAttributeMap.putAll(attributeMap);
                 attributeMap = newAttributeMap;
             } else {
                 attributeMap.put(name, value);
             }
-            if (name.equals("id")) {
+            if ("id".equals(name)) {
                 this.id = value == null ? null : value.toString();
             }
         }
@@ -335,7 +334,7 @@ public class RuntimeConfigurable implements Serializable {
      */
     public synchronized Hashtable<String, Object> getAttributeMap() {
         return (attributeMap == null)
-            ? EMPTY_HASHTABLE : new Hashtable<String, Object>(attributeMap);
+            ? EMPTY_HASHTABLE : new Hashtable<>(attributeMap);
     }
 
     /**
@@ -356,7 +355,7 @@ public class RuntimeConfigurable implements Serializable {
      *              Must not be <code>null</code>.
      */
     public synchronized void addChild(RuntimeConfigurable child) {
-        children = (children == null) ? new ArrayList<RuntimeConfigurable>() : children;
+        children = (children == null) ? new ArrayList<>() : children;
         children.add(child);
     }
 
@@ -378,7 +377,7 @@ public class RuntimeConfigurable implements Serializable {
      * @since Ant 1.6
      */
     public synchronized Enumeration<RuntimeConfigurable> getChildren() {
-        return (children == null) ? new CollectionUtils.EmptyEnumeration<RuntimeConfigurable>()
+        return (children == null) ? Collections.emptyEnumeration()
             : Collections.enumeration(children);
     }
 
@@ -497,7 +496,7 @@ public class RuntimeConfigurable implements Serializable {
             IntrospectionHelper.getHelper(p, target.getClass());
          ComponentHelper componentHelper = ComponentHelper.getComponentHelper(p);
         if (attributeMap != null) {
-            for (Entry<String, Object> entry : attributeMap.entrySet()) {
+            for (Map.Entry<String, Object> entry : attributeMap.entrySet()) {
                 String name = entry.getKey();
                 // skip restricted attributes such as if:set
                 AttributeComponentInformation attributeComponentInformation = isRestrictedAttribute(name, componentHelper);
@@ -509,8 +508,8 @@ public class RuntimeConfigurable implements Serializable {
                 // MacroInstance where properties are expanded for the
                 // nested sequential
                 Object attrValue;
-                if (value instanceof Evaluable) {
-                    attrValue = ((Evaluable) value).eval();
+                if (value instanceof Evaluable<?>) {
+                    attrValue = ((Evaluable<?>) value).eval();
                 } else {
                     attrValue = PropertyHelper.getPropertyHelper(p).parseProperties(value.toString());
                 }
@@ -528,7 +527,7 @@ public class RuntimeConfigurable implements Serializable {
                     ih.setAttribute(p, target, name, attrValue);
                 } catch (UnsupportedAttributeException be) {
                     // id attribute must be set externally
-                    if (name.equals("id")) {
+                    if ("id".equals(name)) {
                         // Do nothing
                     } else if (getElementTag() == null) {
                         throw be;
@@ -538,7 +537,7 @@ public class RuntimeConfigurable implements Serializable {
                             + be.getAttribute() + "\" attribute", be);
                     }
                 } catch (BuildException be) {
-                    if (name.equals("id")) {
+                    if ("id".equals(name)) {
                         // Assume that this is an not supported attribute type
                         // thrown for example by a dymanic attribute task
                         // Do nothing
@@ -590,7 +589,7 @@ public class RuntimeConfigurable implements Serializable {
 
         // Children (this is a shadow of UnknownElement#children)
         if (r.children != null) {
-            ArrayList<RuntimeConfigurable> newChildren = new ArrayList<RuntimeConfigurable>();
+            List<RuntimeConfigurable> newChildren = new ArrayList<>();
             newChildren.addAll(r.children);
             if (children != null) {
                 newChildren.addAll(children);
@@ -601,7 +600,7 @@ public class RuntimeConfigurable implements Serializable {
         // Text
         if (r.characters != null) {
             if (characters == null
-                || characters.toString().trim().length() == 0) {
+                || characters.toString().trim().isEmpty()) {
                 characters = new StringBuffer(r.characters.toString());
             }
         }
index 796b7e1..dba7e25 100644 (file)
@@ -55,7 +55,7 @@ public class Target implements TaskContainer {
     private List<String> dependencies = null;
 
     /** Children of this target (tasks and data types). */
-    private List<Object> children = new ArrayList<Object>();
+    private List<Object> children = new ArrayList<>();
 
     /** Since Ant 1.6.2 */
     private Location location = Location.UNKNOWN_LOCATION;
@@ -145,7 +145,7 @@ public class Target implements TaskContainer {
     public static List<String> parseDepends(String depends,
                                                 String targetName,
                                                 String attributeName) {
-        List<String> list = new ArrayList<String>();
+        List<String> list = new ArrayList<>();
         if (depends.length() > 0) {
             StringTokenizer tok =
                 new StringTokenizer(depends, ",", true);
@@ -225,7 +225,7 @@ public class Target implements TaskContainer {
      * @return an array of the tasks currently within this target
      */
     public Task[] getTasks() {
-        List<Task> tasks = new ArrayList<Task>(children.size());
+        List<Task> tasks = new ArrayList<>(children.size());
         for (Object o : children) {
             if (o instanceof Task) {
                 tasks.add((Task) o);
@@ -242,7 +242,7 @@ public class Target implements TaskContainer {
      */
     public void addDependency(String dependency) {
         if (dependencies == null) {
-            dependencies = new ArrayList<String>(2);
+            dependencies = new ArrayList<>(2);
         }
         dependencies.add(dependency);
     }
@@ -253,8 +253,8 @@ public class Target implements TaskContainer {
      * @return an enumeration of the dependencies of this target (enumeration of String)
      */
     public Enumeration<String> getDependencies() {
-        return Collections
-                .enumeration(dependencies == null ? Collections.<String> emptyList() : dependencies);
+        return dependencies == null ? Collections.emptyEnumeration()
+            : Collections.enumeration(dependencies);
     }
 
     /**
@@ -284,7 +284,12 @@ public class Target implements TaskContainer {
      */
     public void setIf(String property) {
         ifString = property == null ? "" : property;
-        setIf(new IfStringCondition(ifString));
+        setIf(() -> {
+            PropertyHelper propertyHelper =
+                PropertyHelper.getPropertyHelper(getProject());
+            Object o = propertyHelper.parseProperties(ifString);
+            return propertyHelper.testIfCondition(o);
+        });
     }
 
     /**
@@ -331,7 +336,12 @@ public class Target implements TaskContainer {
      */
     public void setUnless(String property) {
         unlessString = property == null ? "" : property;
-        setUnless(new UnlessStringCondition(unlessString));
+        setUnless(() -> {
+            PropertyHelper propertyHelper =
+                PropertyHelper.getPropertyHelper(getProject());
+            Object o = propertyHelper.parseProperties(unlessString);
+            return !propertyHelper.testUnlessCondition(o);
+        });
     }
 
     /**
@@ -390,6 +400,7 @@ public class Target implements TaskContainer {
      * @return the name of this target, or <code>null</code> if the
      *         name has not been set yet.
      */
+    @Override
     public String toString() {
         return name;
     }
@@ -491,42 +502,4 @@ public class Target implements TaskContainer {
             children.set(index, o);
         }
     }
-
-    /**
-     * Condition evaluating the 'if' attribute with the PropertyHelper.
-     */
-    private class IfStringCondition implements Condition {
-
-        private String condition;
-
-        public IfStringCondition(String condition) {
-            this.condition = condition;
-        }
-
-        public boolean eval() throws BuildException {
-            PropertyHelper propertyHelper = PropertyHelper.getPropertyHelper(getProject());
-            Object o = propertyHelper.parseProperties(condition);
-            return propertyHelper.testIfCondition(o);
-        }
-
-    }
-
-    /**
-     * Condition evaluating the 'unless' attribute with the PropertyHelper.
-     */
-    private class UnlessStringCondition implements Condition {
-
-        private String condition;
-
-        public UnlessStringCondition(String condition) {
-            this.condition = condition;
-        }
-
-        public boolean eval() throws BuildException {
-            PropertyHelper propertyHelper = PropertyHelper.getPropertyHelper(getProject());
-            Object o = propertyHelper.parseProperties(condition);
-            return !propertyHelper.testUnlessCondition(o);
-        }
-
-    }
 }
index 0d08eb0..bdd2337 100644 (file)
@@ -81,10 +81,6 @@ public abstract class Task extends ProjectComponent {
      */
     private boolean invalid;
 
-    /** Sole constructor. */
-    public Task() {
-    }
-
     /**
      * Sets the target container of this task.
      *
@@ -197,12 +193,10 @@ public abstract class Task extends ProjectComponent {
      * @exception BuildException if the task cannot be configured.
      */
     public void maybeConfigure() throws BuildException {
-        if (!invalid) {
-            if (wrapper != null) {
-                wrapper.maybeConfigure(getProject());
-            }
-        } else {
+        if (invalid) {
             getReplacement();
+        } else if (wrapper != null) {
+            wrapper.maybeConfigure(getProject());
         }
     }
 
@@ -290,10 +284,10 @@ public abstract class Task extends ProjectComponent {
      *                 be logged.
      */
     public void log(String msg, int msgLevel) {
-        if (getProject() != null) {
-            getProject().log(this, msg, msgLevel);
-        } else {
+        if (getProject() == null) {
             super.log(msg, msgLevel);
+        } else {
+            getProject().log(this, msg, msgLevel);
         }
     }
 
@@ -323,10 +317,10 @@ public abstract class Task extends ProjectComponent {
      * @since 1.7
      */
     public void log(String msg, Throwable t, int msgLevel) {
-        if (getProject() != null) {
-            getProject().log(this, msg, t, msgLevel);
-        } else {
+        if (getProject() == null) {
             super.log(msg, msgLevel);
+        } else {
+            getProject().log(this, msg, t, msgLevel);
         }
     }
 
@@ -340,7 +334,11 @@ public abstract class Task extends ProjectComponent {
      * is still fired, but with the exception as the cause.
      */
     public final void perform() {
-        if (!invalid) {
+        if (invalid) {
+            UnknownElement ue = getReplacement();
+            Task task = ue.getTask();
+            task.perform();
+        } else {
             getProject().fireTaskStarted(this);
             Throwable reason = null;
             try {
@@ -363,10 +361,6 @@ public abstract class Task extends ProjectComponent {
             } finally {
                 getProject().fireTaskFinished(this, reason);
             }
-        } else {
-            UnknownElement ue = getReplacement();
-            Task task = ue.getTask();
-            task.perform();
         }
     }
 
index 3a3001f..8a22f35 100644 (file)
@@ -81,7 +81,7 @@ public class TaskAdapter extends Task implements TypeAdapter {
             // don't have to check for interface, since then
             // taskClass would be abstract too.
             try {
-                final Method executeM = taskClass.getMethod("execute", (Class[]) null);
+                final Method executeM = taskClass.getMethod("execute");
                 // don't have to check for public, since
                 // getMethod finds public method only.
                 // don't have to check for abstract, since then
@@ -122,10 +122,10 @@ public class TaskAdapter extends Task implements TypeAdapter {
      */
     public void execute() throws BuildException {
         try {
-            Method setLocationM = proxy.getClass().getMethod(
-                "setLocation", new Class[] {Location.class});
+            Method setLocationM =
+                proxy.getClass().getMethod("setLocation", Location.class);
             if (setLocationM != null) {
-                setLocationM.invoke(proxy, new Object[] {getLocation()});
+                setLocationM.invoke(proxy, getLocation());
             }
         } catch (NoSuchMethodException e) {
             // ignore this if the class being used as a task does not have
@@ -137,10 +137,10 @@ public class TaskAdapter extends Task implements TypeAdapter {
         }
 
         try {
-            Method setProjectM = proxy.getClass().getMethod(
-                "setProject", new Class[] {Project.class});
+            Method setProjectM =
+                proxy.getClass().getMethod("setProject", Project.class);
             if (setProjectM != null) {
-                setProjectM.invoke(proxy, new Object[] {getProject()});
+                setProjectM.invoke(proxy, getProject());
             }
         } catch (NoSuchMethodException e) {
             // ignore this if the class being used as a task does not have
index e8e7444..70ccd80 100644 (file)
@@ -55,7 +55,7 @@ import java.util.List;
 public class TaskConfigurationChecker {
 
     /** List of all collected error messages. */
-    private List<String> errors = new ArrayList<String>();
+    private List<String> errors = new ArrayList<>();
 
     /** Task for which the configuration should be checked. */
     private final Task task;
@@ -94,8 +94,7 @@ public class TaskConfigurationChecker {
      */
     public void checkErrors() throws BuildException {
         if (!errors.isEmpty()) {
-            StringBuffer sb = new StringBuffer();
-            sb.append("Configurationerror on <");
+            StringBuilder sb = new StringBuilder("Configurationerror on <");
             sb.append(task.getTaskName());
             sb.append(">:");
             sb.append(System.getProperty("line.separator"));
index 15770c2..7a4a60a 100644 (file)
@@ -24,6 +24,7 @@ import java.util.Enumeration;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
+import java.util.Objects;
 
 import org.apache.tools.ant.taskdefs.PreSetDef;
 
@@ -234,10 +235,8 @@ public class UnknownElement extends Task {
         throws IOException {
         if (realThing instanceof Task) {
             return ((Task) realThing).handleInput(buffer, offset, length);
-        } else {
-            return super.handleInput(buffer, offset, length);
         }
-
+        return super.handleInput(buffer, offset, length);
     }
 
     /**
@@ -311,7 +310,7 @@ public class UnknownElement extends Task {
      */
     public void addChild(UnknownElement child) {
         if (children == null) {
-            children = new ArrayList<UnknownElement>();
+            children = new ArrayList<>();
         }
         children.add(child);
     }
@@ -341,7 +340,6 @@ public class UnknownElement extends Task {
         Class<?> parentClass = parent.getClass();
         IntrospectionHelper ih = IntrospectionHelper.getHelper(getProject(), parentClass);
 
-
         if (children != null) {
             Iterator<UnknownElement> it = children.iterator();
             for (int i = 0; it.hasNext(); i++) {
@@ -400,7 +398,7 @@ public class UnknownElement extends Task {
         // Do the runtime
         getWrapper().applyPreSet(u.getWrapper());
         if (u.children != null) {
-            List<UnknownElement> newChildren = new ArrayList<UnknownElement>();
+            List<UnknownElement> newChildren = new ArrayList<>();
             newChildren.addAll(u.children);
             if (children != null) {
                 newChildren.addAll(children);
@@ -506,7 +504,6 @@ public class UnknownElement extends Task {
      * @return the name to use in logging messages.
      */
     public String getTaskName() {
-        //return elementName;
         return realThing == null
             || !(realThing instanceof Task) ? super.getTaskName()
                                             : ((Task) realThing).getTaskName();
@@ -612,7 +609,7 @@ public class UnknownElement extends Task {
         }
         UnknownElement other = (UnknownElement) obj;
         // Are the names the same ?
-        if (!equalsString(elementName, other.elementName)) {
+        if (!Objects.equals(elementName, other.elementName)) {
             return false;
         }
         if (!namespace.equals(other.namespace)) {
@@ -637,7 +634,7 @@ public class UnknownElement extends Task {
         // Are the sub elements the same ?
         final int childrenSize = children == null ? 0 : children.size();
         if (childrenSize == 0) {
-            return other.children == null || other.children.size() == 0;
+            return other.children == null || other.children.isEmpty();
         }
         if (other.children == null) {
             return false;
@@ -655,10 +652,6 @@ public class UnknownElement extends Task {
         return true;
     }
 
-    private static boolean equalsString(String a, String b) {
-        return (a == null) ? (b == null) : a.equals(b);
-    }
-
     /**
      * Make a copy of the unknown element and set it in the new project.
      * @param newProject the project to create the UE in.
index 086123e..3a9848e 100644 (file)
@@ -32,7 +32,6 @@ import javax.xml.parsers.DocumentBuilder;
 import javax.xml.parsers.DocumentBuilderFactory;
 
 import org.apache.tools.ant.util.DOMElementWriter;
-import org.apache.tools.ant.util.FileUtils;
 import org.apache.tools.ant.util.StringUtils;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
@@ -109,16 +108,16 @@ public class XmlLogger implements BuildLogger {
     private Document doc = builder.newDocument();
 
     /** Mapping for when tasks started (Task to TimedElement). */
-    private Hashtable<Task, TimedElement> tasks = new Hashtable<Task, TimedElement>();
+    private Hashtable<Task, TimedElement> tasks = new Hashtable<>();
 
     /** Mapping for when targets started (Target to TimedElement). */
-    private Hashtable<Target, TimedElement> targets = new Hashtable<Target, XmlLogger.TimedElement>();
+    private Hashtable<Target, TimedElement> targets = new Hashtable<>();
 
     /**
      * Mapping of threads to stacks of elements
      * (Thread to Stack of TimedElement).
      */
-    private Hashtable<Thread, Stack<TimedElement>> threadStacks = new Hashtable<Thread, Stack<TimedElement>>();
+    private Hashtable<Thread, Stack<TimedElement>> threadStacks = new Hashtable<>();
 
     /**
      * When the build started.
@@ -134,23 +133,20 @@ public class XmlLogger implements BuildLogger {
         private long startTime;
         /** Element created at the start time. */
         private Element element;
+
+        @Override
         public String toString() {
             return element.getTagName() + ":" + element.getAttribute("name");
         }
     }
 
     /**
-     *  Constructs a new BuildListener that logs build events to an XML file.
-     */
-    public XmlLogger() {
-    }
-
-    /**
      * Fired when the build starts, this builds the top-level element for the
      * document and remembers the time of the start of the build.
      *
      * @param event Ignored.
      */
+    @Override
     public void buildStarted(BuildEvent event) {
         buildElement = new TimedElement();
         buildElement.startTime = System.currentTimeMillis();
@@ -164,6 +160,7 @@ public class XmlLogger implements BuildLogger {
      * @param event An event with any relevant extra information.
      *              Will not be <code>null</code>.
      */
+    @Override
     public void buildFinished(BuildEvent event) {
         long totalTime = System.currentTimeMillis() - buildElement.startTime;
         buildElement.element.setAttribute(TIME_ATTR, DefaultLogger.formatTime(totalTime));
@@ -180,25 +177,19 @@ public class XmlLogger implements BuildLogger {
         }
         String outFilename = getProperty(event, "XmlLogger.file", "log.xml");
         String xslUri = getProperty(event, "ant.XmlLogger.stylesheet.uri", "log.xsl");
-        Writer out = null;
-        try {
-            // specify output in UTF8 otherwise accented characters will blow
-            // up everything
-            OutputStream stream = outStream;
-            if (stream == null) {
-                stream = Files.newOutputStream(Paths.get(outFilename));
-            }
-            out = new OutputStreamWriter(stream, "UTF8");
+        
+        try (OutputStream stream =
+            outStream == null ? Files.newOutputStream(Paths.get(outFilename)) : outStream;
+                Writer out = new OutputStreamWriter(stream, "UTF8")) {
             out.write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
             if (xslUri.length() > 0) {
-                out.write("<?xml-stylesheet type=\"text/xsl\" href=\"" + xslUri + "\"?>\n\n");
+                out.write("<?xml-stylesheet type=\"text/xsl\" href=\"" + xslUri
+                    + "\"?>\n\n");
             }
             new DOMElementWriter().write(buildElement.element, out, 0, "\t");
             out.flush();
         } catch (IOException exc) {
             throw new BuildException("Unable to write log file", exc);
-        } finally {
-            FileUtils.close(out);
         }
         buildElement = null;
     }
@@ -218,7 +209,7 @@ public class XmlLogger implements BuildLogger {
     private Stack<TimedElement> getStack() {
         Stack<TimedElement> threadStack = threadStacks.get(Thread.currentThread());
         if (threadStack == null) {
-            threadStack = new Stack<TimedElement>();
+            threadStack = new Stack<>();
             threadStacks.put(Thread.currentThread(), threadStack);
         }
         /* For debugging purposes uncomment:
@@ -236,6 +227,7 @@ public class XmlLogger implements BuildLogger {
      * @param event An event with any relevant extra information.
      *              Will not be <code>null</code>.
      */
+    @Override
     public void targetStarted(BuildEvent event) {
         Target target = event.getTarget();
         TimedElement targetElement = new TimedElement();
@@ -253,6 +245,7 @@ public class XmlLogger implements BuildLogger {
      * @param event An event with any relevant extra information.
      *              Will not be <code>null</code>.
      */
+    @Override
     public void targetFinished(BuildEvent event) {
         Target target = event.getTarget();
         TimedElement targetElement = targets.get(target);
@@ -290,6 +283,7 @@ public class XmlLogger implements BuildLogger {
      * @param event An event with any relevant extra information.
      *              Will not be <code>null</code>.
      */
+    @Override
     public void taskStarted(BuildEvent event) {
         TimedElement taskElement = new TimedElement();
         taskElement.startTime = System.currentTimeMillis();
@@ -313,6 +307,7 @@ public class XmlLogger implements BuildLogger {
      * @param event An event with any relevant extra information.
      *              Will not be <code>null</code>.
      */
+    @Override
     public void taskFinished(BuildEvent event) {
         Task task = event.getTask();
         TimedElement taskElement = tasks.get(task);
@@ -355,10 +350,9 @@ public class XmlLogger implements BuildLogger {
         }
         for (Enumeration<Task> e = tasks.keys(); e.hasMoreElements();) {
             Task key = e.nextElement();
-            if (key instanceof UnknownElement) {
-                if (((UnknownElement) key).getTask() == task) {
-                    return tasks.get(key);
-                }
+            if (key instanceof UnknownElement
+                && ((UnknownElement) key).getTask() == task) {
+                return tasks.get(key);
             }
         }
         return null;
@@ -372,6 +366,7 @@ public class XmlLogger implements BuildLogger {
      * @param event An event with any relevant extra information.
      *              Will not be <code>null</code>.
      */
+    @Override
     public void messageLogged(BuildEvent event) {
         int priority = event.getPriority();
         if (priority > msgOutputLevel) {
@@ -379,7 +374,7 @@ public class XmlLogger implements BuildLogger {
         }
         Element messageElement = doc.createElement(MESSAGE_TAG);
 
-        String name = "debug";
+        String name;
         switch (priority) {
             case Project.MSG_ERR:
                 name = "error";
@@ -433,6 +428,7 @@ public class XmlLogger implements BuildLogger {
      *        see {@link org.apache.tools.ant.Project#MSG_ERR Project}
      *        class for level definitions
      */
+    @Override
     public void setMessageOutputLevel(int level) {
         msgOutputLevel = level;
     }
@@ -443,6 +439,7 @@ public class XmlLogger implements BuildLogger {
      *
      * @param output the output PrintStream.
      */
+    @Override
     public void setOutputPrintStream(PrintStream output) {
         this.outStream = new PrintStream(output, true);
     }
@@ -453,6 +450,7 @@ public class XmlLogger implements BuildLogger {
      * @param emacsMode true if logger should produce emacs compatible
      *        output
      */
+    @Override
     public void setEmacsMode(boolean emacsMode) {
     }
 
@@ -463,6 +461,7 @@ public class XmlLogger implements BuildLogger {
      *
      * @param err the stream we are going to ignore.
      */
+    @Override
     public void setErrorPrintStream(PrintStream err) {
     }
 
index c2ec08a..f0b03d9 100644 (file)
@@ -19,6 +19,7 @@
 package org.apache.tools.ant.attribute;
 
 import java.util.HashMap;
+import java.util.Hashtable;
 import java.util.Iterator;
 import java.util.Map;
 
@@ -67,18 +68,19 @@ public abstract class BaseIfAttribute
      * @param el the element this attribute is in.
      * @return a map of attributes.
      */
-    protected Map getParams(UnknownElement el) {
-        Map ret = new HashMap();
+    protected Map<String, String> getParams(UnknownElement el) {
+        Map<String, String> ret = new HashMap<>();
         RuntimeConfigurable rc = el.getWrapper();
-        Map attributes = rc.getAttributeMap(); // This does a copy!
-        for (Iterator i = attributes.entrySet().iterator(); i.hasNext();) {
-            Map.Entry entry = (Map.Entry) i.next();
-            String key = (String) entry.getKey();
+        Hashtable<String, Object> attributes = rc.getAttributeMap(); // This does a copy!
+        for (Iterator<Map.Entry<String, Object>> i =
+            attributes.entrySet().iterator(); i.hasNext();) {
+            Map.Entry<String, Object> entry = i.next();
+            String key = entry.getKey();
             String value = (String) entry.getValue();
             if (key.startsWith("ant-attribute:param")) {
                 int pos = key.lastIndexOf(':');
                 ret.put(key.substring(pos + 1),
-                        el.getProject().replaceProperties(value));
+                    el.getProject().replaceProperties(value));
             }
         }
         return ret;
index a848ed1..66eb96f 100644 (file)
@@ -37,6 +37,7 @@ public abstract class DispatchTask extends Task implements Dispatchable {
      * Get the action parameter name.
      * @return the <code>String</code> "action" by default (can be overridden).
      */
+    @Override
     public String getActionParameterName() {
         return "action";
     }
index 1a7c1f9..852a920 100644 (file)
@@ -98,12 +98,12 @@ public class DispatchUtils {
                 }
             } else {
                 Method executeM = null;
-                executeM = task.getClass().getMethod(methodName, new Class[0]);
+                executeM = task.getClass().getMethod(methodName);
                 if (executeM == null) {
                     throw new BuildException("No public " + methodName + "() in "
                         + task.getClass());
                 }
-                executeM.invoke(task, (Object[]) null);
+                executeM.invoke(task);
                 if (task instanceof UnknownElement) {
                     ((UnknownElement) task).setRealThing(null);
                 }
index f176c33..9ad2f3d 100644 (file)
@@ -23,9 +23,13 @@ import java.io.Reader;
 import java.lang.reflect.Constructor;
 import java.lang.reflect.InvocationTargetException;
 import java.util.ArrayList;
-import java.util.Iterator;
+import java.util.Collection;
 import java.util.List;
+import java.util.Optional;
 import java.util.Vector;
+import java.util.function.Consumer;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
 
 import org.apache.tools.ant.AntClassLoader;
 import org.apache.tools.ant.BuildException;
@@ -34,7 +38,6 @@ import org.apache.tools.ant.filters.BaseFilterReader;
 import org.apache.tools.ant.filters.ChainableReader;
 import org.apache.tools.ant.types.AntFilterReader;
 import org.apache.tools.ant.types.FilterChain;
-import org.apache.tools.ant.types.Parameter;
 import org.apache.tools.ant.types.Parameterizable;
 import org.apache.tools.ant.types.Path;
 import org.apache.tools.ant.util.FileUtils;
@@ -44,6 +47,37 @@ import org.apache.tools.ant.util.FileUtils;
  *
  */
 public final class ChainReaderHelper {
+    /**
+     * Created type.
+     */
+    public class ChainReader extends FilterReader {
+
+        private List<AntClassLoader> cleanupLoaders;
+
+        private ChainReader(Reader in, List<AntClassLoader> cleanupLoaders) {
+            super(in);
+            this.cleanupLoaders = cleanupLoaders;
+        }
+
+        public String readFully() throws IOException {
+            return ChainReaderHelper.this.readFully(this);
+        }
+        
+        @Override
+        public void close() throws IOException {
+            cleanUpClassLoaders(cleanupLoaders);
+            super.close();
+        }
+        
+        @Override
+        protected void finalize() throws Throwable {
+            try {
+                close();
+            } finally {
+                super.finalize();
+            }
+        }
+    }
 
     // default buffer size
     private static final int DEFAULT_BUFFER_SIZE = 8192;
@@ -61,7 +95,7 @@ public final class ChainReaderHelper {
     /**
      * Chain of filters
      */
-    public Vector<FilterChain> filterChains = new Vector<FilterChain>();
+    public Vector<FilterChain> filterChains = new Vector<>();
 
     /** The Ant project */
     private Project project = null;
@@ -69,7 +103,25 @@ public final class ChainReaderHelper {
     // CheckStyle:VisibilityModifier ON
 
     /**
-     * Sets the primary reader
+     * Default constructor.
+     */
+    public ChainReaderHelper() {
+    }
+
+    /**
+     * Convenience constructor.
+     * @param project
+     * @param primaryReader
+     * @param filterChains
+     */
+    public ChainReaderHelper(Project project, Reader primaryReader,
+        Iterable<FilterChain> filterChains) {
+        withProject(project).withPrimaryReader(primaryReader)
+            .withFilterChains(filterChains);
+    }
+
+    /**
+     * Sets the primary {@link Reader}
      * @param rdr the reader object
      */
     public void setPrimaryReader(Reader rdr) {
@@ -77,6 +129,16 @@ public final class ChainReaderHelper {
     }
 
     /**
+     * Fluent primary {@link Reader} mutator.
+     * @param rdr
+     * @return {@code this}
+     */
+    public ChainReaderHelper withPrimaryReader(Reader rdr) {
+        setPrimaryReader(rdr);
+        return this;
+    }
+
+    /**
      * Set the project to work with
      * @param project the current project
      */
@@ -85,6 +147,16 @@ public final class ChainReaderHelper {
     }
 
     /**
+     * Fluent {@link Project} mutator.
+     * @param project
+     * @return {@code this}
+     */
+    public ChainReaderHelper withProject(Project project) {
+        setProject(project);
+        return this;
+    }
+
+    /**
      * Get the project
      *
      * @return the current project
@@ -103,6 +175,16 @@ public final class ChainReaderHelper {
     }
 
     /**
+     * Fluent buffer size mutator.
+     * @param size
+     * @return {@code this}
+     */
+    public ChainReaderHelper withBufferSize(int size) {
+        setBufferSize(size);
+        return this;
+    }
+
+    /**
      * Sets the collection of filter reader sets
      *
      * @param fchain the filter chains collection
@@ -112,42 +194,56 @@ public final class ChainReaderHelper {
     }
 
     /**
+     * Fluent {@code filterChains} mutator.
+     * @param filterChains
+     * @return {@code this}
+     */
+    public ChainReaderHelper withFilterChains(Iterable<FilterChain> filterChains) {
+        final Vector<FilterChain> fcs;
+        if (filterChains instanceof Vector<?>) {
+            fcs = (Vector<FilterChain>) filterChains;
+        } else {
+            fcs = new Vector<>();
+            filterChains.forEach(fcs::add);
+        }
+        setFilterChains(fcs);
+        return this;
+    }
+
+    /**
+     * Fluent mechanism to apply some {@link Consumer}.
+     * @param consumer
+     * @return {@code this}
+     */
+    public ChainReaderHelper with(Consumer<ChainReaderHelper> consumer) {
+        consumer.accept(this);
+        return this;
+    }
+
+    /**
      * Assemble the reader
      * @return the assembled reader
      * @exception BuildException if an error occurs
      */
-    public Reader getAssembledReader() throws BuildException {
+    public ChainReader getAssembledReader() throws BuildException {
         if (primaryReader == null) {
             throw new BuildException("primaryReader must not be null.");
         }
 
         Reader instream = primaryReader;
-        final int filterReadersCount = filterChains.size();
-        final Vector<Object> finalFilters = new Vector<Object>();
-        final ArrayList<AntClassLoader> classLoadersToCleanUp =
-            new ArrayList<AntClassLoader>();
-
-        for (int i = 0; i < filterReadersCount; i++) {
-            final FilterChain filterchain =
-                filterChains.elementAt(i);
-            final Vector<Object> filterReaders = filterchain.getFilterReaders();
-            final int readerCount = filterReaders.size();
-            for (int j = 0; j < readerCount; j++) {
-                finalFilters.addElement(filterReaders.elementAt(j));
-            }
-        }
+        final List<AntClassLoader> classLoadersToCleanUp = new ArrayList<>();
 
-        final int filtersCount = finalFilters.size();
-
-        if (filtersCount > 0) {
+        final List<Object> finalFilters =
+            filterChains.stream().map(FilterChain::getFilterReaders)
+                .flatMap(Collection::stream).collect(Collectors.toList());
+        
+        if (!finalFilters.isEmpty()) {
             boolean success = false;
             try {
-                for (int i = 0; i < filtersCount; i++) {
-                    Object o = finalFilters.elementAt(i);
-
+                for (Object o : finalFilters) {
                     if (o instanceof AntFilterReader) {
                         instream =
-                            expandReader((AntFilterReader) finalFilters.elementAt(i),
+                            expandReader((AntFilterReader) o,
                                          instream, classLoadersToCleanUp);
                     } else if (o instanceof ChainableReader) {
                         setProjectOnObject(o);
@@ -157,26 +253,12 @@ public final class ChainReaderHelper {
                 }
                 success = true;
             } finally {
-                if (!success && classLoadersToCleanUp.size() > 0) {
+                if (!(success || classLoadersToCleanUp.isEmpty())) {
                     cleanUpClassLoaders(classLoadersToCleanUp);
                 }
             }
         }
-        final Reader finalReader = instream;
-        return classLoadersToCleanUp.size() == 0 ? finalReader
-            : new FilterReader(finalReader) {
-                    public void close() throws IOException {
-                        FileUtils.close(in);
-                        cleanUpClassLoaders(classLoadersToCleanUp);
-                    }
-                    protected void finalize() throws Throwable {
-                        try {
-                            close();
-                        } finally {
-                            super.finalize();
-                        }
-                    }
-                };
+        return new ChainReader(instream, classLoadersToCleanUp);
     }
 
     /**
@@ -199,9 +281,7 @@ public final class ChainReaderHelper {
      * Deregisters Classloaders from the project so GC can remove them later.
      */
     private static void cleanUpClassLoaders(List<AntClassLoader> loaders) {
-        for (Iterator<AntClassLoader> it = loaders.iterator(); it.hasNext();) {
-            it.next().cleanup();
-        }
+        loaders.forEach(AntClassLoader::cleanup);
     }
 
     /**
@@ -211,8 +291,7 @@ public final class ChainReaderHelper {
      * @return the contents of the file as a string
      * @exception IOException if an error occurs
      */
-    public String readFully(Reader rdr)
-        throws IOException {
+    public String readFully(Reader rdr) throws IOException {
         return FileUtils.readFully(rdr, bufferSize);
     }
 
@@ -227,57 +306,45 @@ public final class ChainReaderHelper {
                                 final List<AntClassLoader> classLoadersToCleanUp) {
         final String className = filter.getClassName();
         final Path classpath = filter.getClasspath();
-        final Project pro = filter.getProject();
         if (className != null) {
             try {
-                Class<?> clazz = null;
-                if (classpath == null) {
-                    clazz = Class.forName(className);
-                } else {
-                    AntClassLoader al = pro.createClassLoader(classpath);
-                    classLoadersToCleanUp.add(al);
-                    clazz = Class.forName(className, true, al);
-                }
-                if (clazz != null) {
-                    if (!FilterReader.class.isAssignableFrom(clazz)) {
-                        throw new BuildException(className + " does not extend"
-                                                 + " java.io.FilterReader");
-                    }
-                    final Constructor<?>[] constructors = clazz.getConstructors();
-                    int j = 0;
-                    boolean consPresent = false;
-                    for (; j < constructors.length; j++) {
-                        Class<?>[] types = constructors[j].getParameterTypes();
-                        if (types.length == 1
-                            && types[0].isAssignableFrom(Reader.class)) {
-                            consPresent = true;
-                            break;
-                        }
-                    }
-                    if (!consPresent) {
-                        throw new BuildException(className + " does not define"
-                                                 + " a public constructor"
-                                                 + " that takes in a Reader"
-                                                 + " as its single argument.");
-                    }
-                    final Reader[] rdr = {ancestor};
-                    Reader instream =
-                        (Reader) constructors[j].newInstance((Object[]) rdr);
-                    setProjectOnObject(instream);
-                    if (Parameterizable.class.isAssignableFrom(clazz)) {
-                        final Parameter[] params = filter.getParams();
-                        ((Parameterizable) instream).setParameters(params);
+                Class<? extends FilterReader> clazz;
+                try {
+                    if (classpath == null) {
+                        clazz = Class.forName(className)
+                            .asSubclass(FilterReader.class);
+                    } else {
+                        AntClassLoader al =
+                            filter.getProject().createClassLoader(classpath);
+                        classLoadersToCleanUp.add(al);
+                        clazz = Class.forName(className, true, al)
+                            .asSubclass(FilterReader.class);
                     }
-                    return instream;
+                } catch (ClassCastException ex) {
+                    throw new BuildException("%s does not extend %s", className,
+                        FilterReader.class.getName());
+                }
+                Optional<Constructor<?>> ctor =
+                    Stream.of(clazz.getConstructors())
+                        .filter(c -> c.getParameterCount() == 1
+                            && c.getParameterTypes()[0]
+