You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by rf...@apache.org on 2019/04/17 21:00:45 UTC
[maven-archetype] branch master updated: Fix Javadoc Use
StringBuilder instead of StringBuffer where possible Apply generic diamonds
This is an automated email from the ASF dual-hosted git repository.
rfscholte pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven-archetype.git
The following commit(s) were added to refs/heads/master by this push:
new 0fd806f Fix Javadoc Use StringBuilder instead of StringBuffer where possible Apply generic diamonds
0fd806f is described below
commit 0fd806f773354ec62c8eb40f624d78a218815506
Author: rfscholte <rf...@apache.org>
AuthorDate: Wed Apr 17 23:00:37 2019 +0200
Fix Javadoc
Use StringBuilder instead of StringBuffer where possible
Apply generic diamonds
---
.../maven/archetype/ArchetypeCreationRequest.java | 4 +-
.../archetype/ArchetypeGenerationRequest.java | 4 +-
.../common/DefaultArchetypeArtifactManager.java | 2 +-
.../common/DefaultArchetypeFilesResolver.java | 12 ++--
.../maven/archetype/common/DefaultPomManager.java | 6 +-
.../maven/archetype/common/MavenJDOMWriter.java | 6 +-
.../apache/maven/archetype/common/util/Format.java | 67 +++++++++-----------
.../maven/archetype/common/util/ListScanner.java | 64 +++++++++----------
.../archetype/common/util/NamespaceStack.java | 19 ++----
.../maven/archetype/common/util/PathUtils.java | 2 +-
.../maven/archetype/common/util/XMLOutputter.java | 71 ++++++++++------------
.../archetype/creator/FilesetArchetypeCreator.java | 34 +++++------
.../archetype/downloader/DefaultDownloader.java | 2 +-
.../generator/DefaultArchetypeGenerator.java | 2 +-
.../DefaultFilesetArchetypeGenerator.java | 4 +-
.../maven/archetype/old/DefaultOldArchetype.java | 2 +-
.../old/descriptor/ArchetypeDescriptor.java | 20 +++---
.../old/descriptor/TemplateDescriptor.java | 2 +-
.../common/TestDefaultArchetypeFilesResolver.java | 2 +-
.../archetype/common/util/TestListScanner.java | 4 +-
.../generator/DefaultArchetypeGeneratorTest.java | 1 -
.../apache/maven/archetype/old/ArchetypeTest.java | 4 +-
.../mojos/CreateArchetypeFromProjectMojo.java | 4 +-
.../maven/archetype/mojos/IntegrationTestMojo.java | 41 ++++++-------
.../maven/archetype/ui/ArchetypeConfiguration.java | 4 +-
.../maven/archetype/ui/ArchetypePrompter.java | 2 +-
.../ui/creation/ArchetypeCreationQueryer.java | 4 +-
.../ui/generation/ArchetypeGenerationQueryer.java | 4 +-
.../ui/generation/ArchetypeSelectionQueryer.java | 4 +-
.../ui/generation/ArchetypeSelectorUtils.java | 4 +-
.../DefaultArchetypeGenerationConfigurator.java | 6 +-
.../DefaultArchetypeSelectionQueryer.java | 12 ++--
.../ui/generation/DefaultArchetypeSelector.java | 4 +-
...DefaultArchetypeGenerationConfiguratorTest.java | 2 +-
.../DefaultArchetypeSelectionQueryerTest.java | 2 +-
35 files changed, 199 insertions(+), 228 deletions(-)
diff --git a/archetype-common/src/main/java/org/apache/maven/archetype/ArchetypeCreationRequest.java b/archetype-common/src/main/java/org/apache/maven/archetype/ArchetypeCreationRequest.java
index ae88355..c24b1b6 100644
--- a/archetype-common/src/main/java/org/apache/maven/archetype/ArchetypeCreationRequest.java
+++ b/archetype-common/src/main/java/org/apache/maven/archetype/ArchetypeCreationRequest.java
@@ -39,9 +39,9 @@ public class ArchetypeCreationRequest
// private File propertyFile;
- private List<String> languages = new ArrayList<String>();
+ private List<String> languages = new ArrayList<>();
- private List<String> filtereds = new ArrayList<String>();
+ private List<String> filtereds = new ArrayList<>();
private String defaultEncoding = "UTF-8";
diff --git a/archetype-common/src/main/java/org/apache/maven/archetype/ArchetypeGenerationRequest.java b/archetype-common/src/main/java/org/apache/maven/archetype/ArchetypeGenerationRequest.java
index 03e060f..2f3d124 100644
--- a/archetype-common/src/main/java/org/apache/maven/archetype/ArchetypeGenerationRequest.java
+++ b/archetype-common/src/main/java/org/apache/maven/archetype/ArchetypeGenerationRequest.java
@@ -50,9 +50,9 @@ public class ArchetypeGenerationRequest
private Proxy activeProxy;
- private List<Server> servers = new ArrayList<Server>();
+ private List<Server> servers = new ArrayList<>();
- private List<Mirror> mirrors = new ArrayList<Mirror>();
+ private List<Mirror> mirrors = new ArrayList<>();
// Archetype definition
private String archetypeName;
diff --git a/archetype-common/src/main/java/org/apache/maven/archetype/common/DefaultArchetypeArtifactManager.java b/archetype-common/src/main/java/org/apache/maven/archetype/common/DefaultArchetypeArtifactManager.java
index 9cbdbc6..fe9f7da 100644
--- a/archetype-common/src/main/java/org/apache/maven/archetype/common/DefaultArchetypeArtifactManager.java
+++ b/archetype-common/src/main/java/org/apache/maven/archetype/common/DefaultArchetypeArtifactManager.java
@@ -64,7 +64,7 @@ public class DefaultArchetypeArtifactManager
@Requirement
private PomManager pomManager;
- private Map<String, File> archetypeCache = new TreeMap<String, File>();
+ private Map<String, File> archetypeCache = new TreeMap<>();
@Override
public File getArchetypeFile( final String groupId, final String artifactId, final String version,
diff --git a/archetype-common/src/main/java/org/apache/maven/archetype/common/DefaultArchetypeFilesResolver.java b/archetype-common/src/main/java/org/apache/maven/archetype/common/DefaultArchetypeFilesResolver.java
index 8843d67..a0ed651 100644
--- a/archetype-common/src/main/java/org/apache/maven/archetype/common/DefaultArchetypeFilesResolver.java
+++ b/archetype-common/src/main/java/org/apache/maven/archetype/common/DefaultArchetypeFilesResolver.java
@@ -111,9 +111,9 @@ public class DefaultArchetypeFilesResolver
scanner.setBasedir( "" );
- Set<String> selectedDirectories = new HashSet<String>();
+ Set<String> selectedDirectories = new HashSet<>();
- List<String> includes = new ArrayList<String>();
+ List<String> includes = new ArrayList<>();
for ( String sourcesFile : sourcesFiles )
{
@@ -239,7 +239,7 @@ public class DefaultArchetypeFilesResolver
@Override
public List<String> getPackagedFiles( List<String> files, String packageName )
{
- List<String> packagedFiles = new ArrayList<String>();
+ List<String> packagedFiles = new ArrayList<>();
for ( String file : files )
{
if ( file.startsWith( packageName ) )
@@ -265,7 +265,7 @@ public class DefaultArchetypeFilesResolver
@Override
public List<String> getUnpackagedFiles( List<String> files, String packageName )
{
- List<String> unpackagedFiles = new ArrayList<String>();
+ List<String> unpackagedFiles = new ArrayList<>();
for ( String file : files )
{
if ( !file.startsWith( packageName ) )
@@ -319,12 +319,12 @@ public class DefaultArchetypeFilesResolver
excludes += "," + defaultExclude + "/**";
}
- @SuppressWarnings( "unchecked" ) List<File> absoluteFiles =
+ List<File> absoluteFiles =
FileUtils.getFiles( basedir, StringUtils.join( languagesPathesArray, "," ), excludes );
getLogger().debug( "Found " + absoluteFiles.size() + " potential archetype files" );
- List<String> files = new ArrayList<String>( absoluteFiles.size() );
+ List<String> files = new ArrayList<>( absoluteFiles.size() );
for ( File file : absoluteFiles )
{
diff --git a/archetype-common/src/main/java/org/apache/maven/archetype/common/DefaultPomManager.java b/archetype-common/src/main/java/org/apache/maven/archetype/common/DefaultPomManager.java
index e4380cc..1de3629 100644
--- a/archetype-common/src/main/java/org/apache/maven/archetype/common/DefaultPomManager.java
+++ b/archetype-common/src/main/java/org/apache/maven/archetype/common/DefaultPomManager.java
@@ -326,7 +326,7 @@ public class DefaultPomManager
private Map<String, Dependency> createDependencyMap( List<Dependency> dependencies )
{
- Map<String, Dependency> dependencyMap = new HashMap<String, Dependency>();
+ Map<String, Dependency> dependencyMap = new HashMap<>();
for ( Dependency dependency : dependencies )
{
dependencyMap.put( dependency.getManagementKey(), dependency );
@@ -354,10 +354,10 @@ public class DefaultPomManager
if ( generatedProfiles != null && generatedProfiles.size() > 0 )
{
List<Profile> modelProfiles = model.getProfiles();
- Map<String, Profile> modelProfileIdMap = new HashMap<String, Profile>();
+ Map<String, Profile> modelProfileIdMap = new HashMap<>();
if ( modelProfiles == null )
{
- modelProfiles = new ArrayList<Profile>();
+ modelProfiles = new ArrayList<>();
model.setProfiles( modelProfiles );
}
else if ( modelProfiles.size() > 0 )
diff --git a/archetype-common/src/main/java/org/apache/maven/archetype/common/MavenJDOMWriter.java b/archetype-common/src/main/java/org/apache/maven/archetype/common/MavenJDOMWriter.java
index 1ddbdfc..e541c89 100644
--- a/archetype-common/src/main/java/org/apache/maven/archetype/common/MavenJDOMWriter.java
+++ b/archetype-common/src/main/java/org/apache/maven/archetype/common/MavenJDOMWriter.java
@@ -91,8 +91,6 @@ import java.util.Map;
/**
* Class MavenJDOMWriter.
- *
- * @version $Revision$ $Date$
*/
public class MavenJDOMWriter
{
@@ -199,7 +197,7 @@ public class MavenJDOMWriter
findAndReplaceSimpleElement( innerCounter, element, key, (String) props.get( key ), null );
}
- List<String> lst = new ArrayList<String>( props.keySet() );
+ List<String> lst = new ArrayList<>( props.keySet() );
it = element.getChildren().iterator();
while ( it.hasNext() )
{
@@ -2290,8 +2288,6 @@ public class MavenJDOMWriter
/**
* Class Counter.
- *
- * @version $Revision$ $Date$
*/
public class Counter
{
diff --git a/archetype-common/src/main/java/org/apache/maven/archetype/common/util/Format.java b/archetype-common/src/main/java/org/apache/maven/archetype/common/util/Format.java
index 18dce66..aad60f5 100644
--- a/archetype-common/src/main/java/org/apache/maven/archetype/common/util/Format.java
+++ b/archetype-common/src/main/java/org/apache/maven/archetype/common/util/Format.java
@@ -57,17 +57,16 @@ import org.jdom.output.EscapeStrategy;
import java.lang.reflect.Method;
/**
- * Class to encapsulate XMLOutputter format options.
+ * <p>Class to encapsulate XMLOutputter format options.
* Typical users can use the standard format configurations obtained by
* {@link #getRawFormat} (no whitespace changes),
* {@link #getPrettyFormat} (whitespace beautification), and
- * {@link #getCompactFormat} (whitespace normalization).
- * <p/>
- * Several modes are available to effect the way textual content is printed.
- * See the documentation for {@link TextMode} for details.
+ * {@link #getCompactFormat} (whitespace normalization).</p>
+ *
+ * <p>Several modes are available to effect the way textual content is printed.
+ * See the documentation for {@link TextMode} for details.</p>
*
* @author Jason Hunter
- * @version $Revision: 1.10 $, $Date: 2004/09/07 06:37:20 $
*/
public class Format
implements Cloneable
@@ -198,21 +197,18 @@ public class Format
}
/**
- * This will set the newline separator (<code>lineSeparator</code>).
+ * <p>This will set the newline separator (<code>lineSeparator</code>).
* The default is <code>\r\n</code>. Note that if the "newlines"
* property is false, this value is irrelevant. To make it output
* the system default line ending string, call
- * <code>setLineSeparator(System.getProperty("line.separator"))</code>
- * <p/>
- * <p/>
- * To output "UNIX-style" documents, call
+ * <code>setLineSeparator(System.getProperty("line.separator"))</code></p>
+ *
+ * <p>To output "UNIX-style" documents, call
* <code>setLineSeparator("\n")</code>. To output "Mac-style"
* documents, call <code>setLineSeparator("\r")</code>. DOS-style
- * documents use CR-LF ("\r\n"), which is the default.
- * </p>
- * <p/>
- * <p/>
- * Note that this only applies to newlines generated by the
+ * documents use CR-LF ("\r\n"), which is the default.</p>
+ *
+ * <p>Note that this only applies to newlines generated by the
* outputter. If you parse an XML document that contains newlines
* embedded inside a text node, and you do not set TextMode.NORMALIZE,
* then the newlines will be output
@@ -318,12 +314,12 @@ public class Format
}
/**
- * This will set whether JAXP TrAX processing instructions for
+ * <p>This will set whether JAXP TrAX processing instructions for
* disabling/enabling output escaping are ignored. Disabling
* output escaping allows using XML text as element content and
- * outputing it verbatim, i.e. as element children would be.
- * <p/>
- * When processed, these processing instructions are removed from
+ * outputing it verbatim, i.e. as element children would be.</p>
+ *
+ * <p>When processed, these processing instructions are removed from
* the generated XML text and control whether the element text
* content is output verbatim or with escaping of the pre-defined
* entities in XML 1.0. The text to be output verbatim shall be
@@ -331,12 +327,12 @@ public class Format
* <code><?javax.xml.transform.disable-output-escaping ?></code>
* and <code><?javax.xml.transform.enable-output-escaping ?></code>
* PIs.</p>
- * <p/>
- * When ignored, the processing instructions are present in the
+ *
+ * <p>When ignored, the processing instructions are present in the
* generated XML text and the pre-defined entities in XML 1.0 are
- * escaped.
- * <p/>
- * Default: <code>false</code>.</p>
+ * escaped.</p>
+ *
+ * Default: <code>false</code>.
*
* @param ignoreTrAXEscapingPIs <code>boolean</code> indicating
* whether or not TrAX ouput escaping PIs are ignored.
@@ -542,10 +538,11 @@ public class Format
/**
+ * <p>
* Class to signify how text should be handled on output. The following
- * table provides details.
- * <p/>
+ * table provides details.</p>
* <table>
+ * <caption>TextMode details</caption>
* <tr>
* <th align="left">
* Text Mode
@@ -554,7 +551,6 @@ public class Format
* Resulting behavior.
* </th>
* </tr>
- * <p/>
* <tr valign="top">
* <td>
* <i>PRESERVE (Default)</i>
@@ -564,7 +560,6 @@ public class Format
* or line separators are are added or removed.
* </td>
* </tr>
- * <p/>
* <tr valign="top">
* <td>
* TRIM_FULL_WHITE
@@ -575,7 +570,6 @@ public class Format
* printed verbatim, whitespace and all.
* </td>
* </tr>
- * <p/>
* <tr valign="top">
* <td>
* TRIM
@@ -585,7 +579,6 @@ public class Format
* trimmed.
* </td>
* </tr>
- * <p/>
* <tr valign="top">
* <td>
* NORMALIZE
@@ -596,20 +589,20 @@ public class Format
* </td>
* </tr>
* </table>
- * <p/>
- * In most cases textual content is aligned with the surrounding tags
+ *
+ * <p>In most cases textual content is aligned with the surrounding tags
* (after the appropriate text mode is applied). In the case where the only
* content between the start and end tags is textual, the start tag, text,
* and end tag are all printed on the same line. If the document being
* output already has whitespace, it's wise to turn on TRIM mode so the
- * pre-existing whitespace can be trimmed before adding new whitespace.
- * <p/>
- * When a element has a xml:space attribute with the value of "preserve",
+ * pre-existing whitespace can be trimmed before adding new whitespace.</p>
+ *
+ * <p>When a element has a xml:space attribute with the value of "preserve",
* all formating is turned off and reverts back to the default until the
* element and its contents have been printed. If a nested element contains
* another xml:space with the value "default" formatting is turned back on
* for the child element and then off for the remainder of the parent
- * element.
+ * element.</p>
*/
public static class TextMode
{
diff --git a/archetype-common/src/main/java/org/apache/maven/archetype/common/util/ListScanner.java b/archetype-common/src/main/java/org/apache/maven/archetype/common/util/ListScanner.java
index d0da46b..3cb04e1 100644
--- a/archetype-common/src/main/java/org/apache/maven/archetype/common/util/ListScanner.java
+++ b/archetype-common/src/main/java/org/apache/maven/archetype/common/util/ListScanner.java
@@ -27,60 +27,60 @@ import java.util.ArrayList;
import java.util.List;
/**
- * Class for scanning a directory for files/directories which match certain criteria.
- * <p/>
+ * <p>Class for scanning a directory for files/directories which match certain criteria.</p>
+ *
* <p>These criteria consist of selectors and patterns which have been specified. With the selectors
* you can select which files you want to have included. Files which are not selected are excluded.
* With patterns you can include or exclude files based on their filename.</p>
- * <p/>
+ *
* <p>The idea is simple. A given directory is recursively scanned for all files and directories.
* Each file/directory is matched against a set of selectors, including special support for matching
* against filenames with include and and exclude patterns. Only files/directories which match at
* least one pattern of the include pattern list or other file selector, and don't match any pattern
* of the exclude pattern list or fail to match against a required selector will be placed in the
* list of files/directories found.</p>
- * <p/>
+ *
* <p>When no list of include patterns is supplied, "**" will be used, which means that everything
* will be matched. When no list of exclude patterns is supplied, an empty list is used, such that
* nothing will be excluded. When no selectors are supplied, none are applied.</p>
- * <p/>
+ *
* <p>The filename pattern matching is done as follows: The name to be matched is split up in path
* segments. A path segment is the name of a directory or file, which is bounded by <code>
* File.separator</code> ('/' under UNIX, '\' under Windows). For example, "abc/def/ghi/xyz.java" is
* split up in the segments "abc", "def","ghi" and "xyz.java". The same is done for the pattern
* against which should be matched.</p>
- * <p/>
+ *
* <p>The segments of the name and the pattern are then matched against each other. When '**' is
* used for a path segment in the pattern, it matches zero or more path segments of the name.</p>
- * <p/>
+ *
* <p>There is a special case regarding the use of <code>File.separator</code>s at the beginning of
* the pattern and the string to match:<br>
* When a pattern starts with a <code>File.separator</code>, the string to match must also start
* with a <code>File.separator</code>. When a pattern does not start with a <code>
* File.separator</code>, the string to match may not start with a <code>File.separator</code>. When
* one of these rules is not obeyed, the string will not match.</p>
- * <p/>
+ *
* <p>When a name path segment is matched against a pattern path segment, the following special
* characters can be used:<br>
* '*' matches zero or more characters<br>
* '?' matches one character.</p>
- * <p/>
+ *
* <p>Examples:</p>
- * <p/>
+ *
* <p>"**\*.class" matches all .class files/dirs in a directory tree.</p>
- * <p/>
+ *
* <p>"test\a??.java" matches all files/dirs which start with an 'a', then two more characters and
* then ".java", in a directory called test.</p>
- * <p/>
+ *
* <p>"**" matches everything in a directory tree.</p>
- * <p/>
+ *
* <p>"**\test\**\XYZ*" matches all files/dirs which start with "XYZ" and where there is a parent
* directory called test (e.g. "abc\test\def\ghi\XYZ123").</p>
- * <p/>
+ *
* <p>Case sensitivity may be turned off if necessary. By default, it is turned on.</p>
- * <p/>
+ *
* <p>Example of usage:</p>
- * <p/>
+ *
* <pre>
* String[] includes = {"**\\*.class"};
* String[] excludes = {"modules\\*\\**"};
@@ -89,19 +89,19 @@ import java.util.List;
* ds.setBasedir(new File("test"));
* ds.setCaseSensitive(true);
* ds.scan();
- * <p/>
+ *
* System.out.println("FILES:");
* String[] files = ds.getIncludedFiles();
- * for (int i = 0; i < files.length; i++) {
+ * for (int i = 0; i < files.length; i++) {
* System.out.println(files[i]);
* }
* </pre>
- * <p/>
+ *
* <p>This will scan a directory called test for .class files, but excludes all files in all proper
* subdirectories of a directory called "modules"</p>
- * <p/>
+ *
* <p>This class was stealed from rg.coudehaus.plexus.util.DirectoryScanner and adapted to search
- * from a List<String></p>
+ * from a List<String></p>
*
* @author Arnout J. Kuiper <a href="mailto:ajkuiper@wxs.nl">ajkuiper@wxs.nl</a>
* @author Magesh Umasankar
@@ -241,8 +241,8 @@ public class ListScanner
}
/**
- * Tests whether or not a given path matches the start of a given pattern up to the first "**".
- * <p/>
+ * <p>Tests whether or not a given path matches the start of a given pattern up to the first "**".<p>
+ *
* <p>This is not a general purpose test and should only be used if you can live with false
* positives. For example, <code>pattern=**\a</code> and <code>str=b</code> will yield <code>
* true</code>.</p>
@@ -259,8 +259,8 @@ public class ListScanner
}
/**
- * Tests whether or not a given path matches the start of a given pattern up to the first "**".
- * <p/>
+ * <p>Tests whether or not a given path matches the start of a given pattern up to the first "**".</p>
+ *
* <p>This is not a general purpose test and should only be used if you can live with false
* positives. For example, <code>pattern=**\a</code> and <code>str=b</code> will yield <code>
* true</code>.</p>
@@ -329,10 +329,10 @@ public class ListScanner
}
/**
- * Sets the list of exclude patterns to use. All '/' and '\' characters are replaced by <code>
+ * <p>Sets the list of exclude patterns to use. All '/' and '\' characters are replaced by <code>
* File.separatorChar</code>, so the separator used need not match <code>
- * File.separatorChar</code>.
- * <p/>
+ * File.separatorChar</code>.</p>
+ *
* <p>When a pattern ends with a '/' or '\', "**" is appended.</p>
*
* @param excludesList A list of exclude patterns. May be <code>null</code>, indicating that no
@@ -365,10 +365,10 @@ public class ListScanner
}
/**
- * Sets the list of include patterns to use. All '/' and '\' characters are replaced by <code>
+ * <p>Sets the list of include patterns to use. All '/' and '\' characters are replaced by <code>
* File.separatorChar</code>, so the separator used need not match <code>
- * File.separatorChar</code>.
- * <p/>
+ * File.separatorChar</code>.</p>
+ *
* <p>When a pattern ends with a '/' or '\', "**" is appended.</p>
*
* @param includesList A list of include patterns. May be <code>null</code>, indicating that all
@@ -431,7 +431,7 @@ public class ListScanner
excludes = new String[0];
}
- List<String> result = new ArrayList<String>();
+ List<String> result = new ArrayList<>();
for ( String fileName : files )
{
diff --git a/archetype-common/src/main/java/org/apache/maven/archetype/common/util/NamespaceStack.java b/archetype-common/src/main/java/org/apache/maven/archetype/common/util/NamespaceStack.java
index c0e02f8..0ae8556 100644
--- a/archetype-common/src/main/java/org/apache/maven/archetype/common/util/NamespaceStack.java
+++ b/archetype-common/src/main/java/org/apache/maven/archetype/common/util/NamespaceStack.java
@@ -57,22 +57,15 @@ import org.jdom.Namespace;
import java.util.Stack;
/**
- * A non-public utility class used by both <code>{@link XMLOutputter}</code> and
- * <code>{@link SAXOutputter}</code> to manage namespaces in a JDOM Document
- * during output.
+ * A non-public utility class used by <code>{@link XMLOutputter}</code>
+ * to manage namespaces in a JDOM Document during output.
*
* @author Elliotte Rusty Harolde
* @author Fred Trimble
* @author Brett McLaughlin
- * @version $Revision: 1.13 $, $Date: 2004/02/06 09:28:32 $
*/
class NamespaceStack
{
-
- @SuppressWarnings( "unused" )
- private static final String CVS_ID =
- "@(#) $RCSfile: NamespaceStack.java,v $ $Revision: 1.13 $ $Date: 2004/02/06 09:28:32 $ $Name: jdom_1_0 $";
-
/** The prefixes available */
private Stack<String> prefixes;
@@ -82,8 +75,8 @@ class NamespaceStack
/** This creates the needed storage. */
NamespaceStack()
{
- prefixes = new Stack<String>();
- uris = new Stack<String>();
+ prefixes = new Stack<>();
+ uris = new Stack<>();
}
/**
@@ -148,8 +141,8 @@ class NamespaceStack
@Override
public String toString()
{
- StringBuffer buf = new StringBuffer();
- String sep = System.getProperty( "line.separator" );
+ StringBuilder buf = new StringBuilder();
+ String sep = System.lineSeparator();
buf.append( "Stack: " + prefixes.size() + sep );
for ( int i = 0; i < prefixes.size(); i++ )
{
diff --git a/archetype-common/src/main/java/org/apache/maven/archetype/common/util/PathUtils.java b/archetype-common/src/main/java/org/apache/maven/archetype/common/util/PathUtils.java
index 14dbcbf..5e5caae 100644
--- a/archetype-common/src/main/java/org/apache/maven/archetype/common/util/PathUtils.java
+++ b/archetype-common/src/main/java/org/apache/maven/archetype/common/util/PathUtils.java
@@ -45,7 +45,7 @@ public class PathUtils
file = convertPathForOS( file );
String[] fileAsArray = StringUtils.split( file, File.separator );
- List<String> directoryAsArray = new ArrayList<String>();
+ List<String> directoryAsArray = new ArrayList<>();
for ( int i = 0; ( i < level ) && ( i < ( fileAsArray.length - 1 ) ); i++ )
{
diff --git a/archetype-common/src/main/java/org/apache/maven/archetype/common/util/XMLOutputter.java b/archetype-common/src/main/java/org/apache/maven/archetype/common/util/XMLOutputter.java
index fc7b79b..58e00d1 100644
--- a/archetype-common/src/main/java/org/apache/maven/archetype/common/util/XMLOutputter.java
+++ b/archetype-common/src/main/java/org/apache/maven/archetype/common/util/XMLOutputter.java
@@ -76,16 +76,17 @@ import java.io.Writer;
import java.util.List;
/**
- * This class is a fork from jdom 1.0 modified to preserve CData and comments parts.
- * <p/>
- * Outputs a JDOM document as a stream of bytes. The outputter can manage many
+ * <p>This class is a fork from jdom 1.0 modified to preserve CData and
+ * comments parts.</p>
+ *
+ * <p>Outputs a JDOM document as a stream of bytes. The outputter can manage many
* styles of document formatting, from untouched to pretty printed. The default
* is to output the document content exactly as created, but this can be changed
* by setting a new Format object. For pretty-print output, use
* <code>{@link Format#getPrettyFormat()}</code>. For whitespace-normalized
- * output, use <code>{@link Format#getCompactFormat()}</code>.
- * <p/>
- * There are <code>{@link #output output(...)}</code> methods to print any of
+ * output, use <code>{@link Format#getCompactFormat()}</code>.</p>
+ *
+ * <p>There are <code>{@link #output output(...)}</code> methods to print any of
* the standard JDOM classes, including Document and Element, to either a Writer
* or an OutputStream. <b>Warning</b>: When outputting to a Writer, make sure
* the writer's encoding matches the encoding setting in the Format object. This
@@ -95,24 +96,24 @@ import java.util.List;
* queried for its encoding, the information must be passed to the Format
* manually in its constructor or via the
* <code>{@link Format#setEncoding}</code> method. The default encoding is
- * UTF-8.
- * <p/>
- * The methods <code>{@link #outputString outputString(...)}</code> are for
+ * UTF-8.</p>
+ *
+ * <p>The methods <code>{@link #outputString outputString(...)}</code> are for
* convenience only; for top performance you should call one of the <code>{@link
* #output output(...)}</code> methods and pass in your own Writer or
- * OutputStream if possible.
- * <p/>
- * XML declarations are always printed on their own line followed by a line
+ * OutputStream if possible.</p>
+ *
+ * <p>XML declarations are always printed on their own line followed by a line
* seperator (this doesn't change the semantics of the document). To omit
* printing of the declaration use
* <code>{@link Format#setOmitDeclaration}</code>. To omit printing of the
* encoding in the declaration use <code>{@link Format#setOmitEncoding}</code>.
* Unfortunatly there is currently no way to know the original encoding of the
- * document.
- * <p/>
- * Empty elements are by default printed as <empty/>, but this can be
+ * document.</p>
+ *
+ * <p>Empty elements are by default printed as <empty/>, but this can be
* configured with <code>{@link Format#setExpandEmptyElements}</code> to cause
- * them to be expanded to <empty></empty>.
+ * them to be expanded to <empty></empty>.</p>
*
* @author Brett McLaughlin
* @author Jason Hunter
@@ -123,17 +124,11 @@ import java.util.List;
* @author Dan Schaffer
* @author Alex Chaffee
* @author Bradley S. Huffman
- * @version $Revision: 1.112 $, $Date: 2004/09/01 06:08:18 $
*/
public class XMLOutputter
implements Cloneable
{
-
- @SuppressWarnings( "unused" )
- private static final String CVS_ID =
- "@(#) $RCSfile: XMLOutputter.java,v $ $Revision: 1.112 $ $Date: 2004/09/01 06:08:18 $ $Name: jdom_1_0 $";
-
// For normal output
private Format userFormat = Format.getRawFormat();
@@ -384,14 +379,12 @@ public class XMLOutputter
// * * * * * * * * * * Output to a Writer * * * * * * * * * *
/**
- * This will print the <code>Document</code> to the given Writer.
- * <p/>
- * <p/>
- * Warning: using your own Writer may cause the outputter's
+ * <p>This will print the <code>Document</code> to the given Writer.</p>
+ *
+ * <p>Warning: using your own Writer may cause the outputter's
* preferred character encoding to be ignored. If you use
* encodings other than UTF-8, we recommend using the method that
- * takes an OutputStream instead.
- * </p>
+ * takes an OutputStream instead.</p>
*
* @param doc <code>Document</code> to format.
* @param out <code>Writer</code> to use.
@@ -1541,7 +1534,7 @@ public class XMLOutputter
*/
public String escapeAttributeEntities( String str )
{
- StringBuffer buffer;
+ StringBuilder buffer;
char ch;
String entity;
EscapeStrategy strategy = currentFormat.escapeStrategy;
@@ -1593,9 +1586,9 @@ public class XMLOutputter
{
if ( entity != null )
{
- // An entity occurred, so we'll have to use StringBuffer
+ // An entity occurred, so we'll have to use StringBuilder
// (allocate room for it plus a few more entities).
- buffer = new StringBuffer( str.length() + 20 );
+ buffer = new StringBuilder( str.length() + 20 );
// Copy previous skipped characters and fall through
// to pickup current character
buffer.append( str.substring( 0, i ) );
@@ -1616,7 +1609,7 @@ public class XMLOutputter
}
// If there were any entities, return the escaped characters
- // that we put in the StringBuffer. Otherwise, just return
+ // that we put in the StringBuilder. Otherwise, just return
// the unmodified input string.
return ( buffer == null ) ? str : buffer.toString();
}
@@ -1638,7 +1631,7 @@ public class XMLOutputter
return str;
}
- StringBuffer buffer;
+ StringBuilder buffer;
char ch;
String entity;
EscapeStrategy strategy = currentFormat.escapeStrategy;
@@ -1679,9 +1672,9 @@ public class XMLOutputter
{
if ( entity != null )
{
- // An entity occurred, so we'll have to use StringBuffer
+ // An entity occurred, so we'll have to use StringBuilder
// (allocate room for it plus a few more entities).
- buffer = new StringBuffer( str.length() + 20 );
+ buffer = new StringBuilder( str.length() + 20 );
// Copy previous skipped characters and fall through
// to pickup current character
buffer.append( str.substring( 0, i ) );
@@ -1702,7 +1695,7 @@ public class XMLOutputter
}
// If there were any entities, return the escaped characters
- // that we put in the StringBuffer. Otherwise, just return
+ // that we put in the StringBuilder. Otherwise, just return
// the unmodified input string.
return ( buffer == null ) ? str : buffer.toString();
}
@@ -1739,7 +1732,7 @@ public class XMLOutputter
@Override
public String toString()
{
- StringBuffer buffer = new StringBuffer();
+ StringBuilder buffer = new StringBuilder();
for ( int i = 0; i < userFormat.lineSeparator.length(); i++ )
{
char ch = userFormat.lineSeparator.charAt( i );
@@ -1796,7 +1789,7 @@ public class XMLOutputter
}
// Support method to print a name without using elt.getQualifiedName()
- // and thus avoiding a StringBuffer creation and memory churn
+ // and thus avoiding a StringBuilder creation and memory churn
private void printQualifiedName( Writer out, Element e )
throws IOException
{
@@ -1813,7 +1806,7 @@ public class XMLOutputter
}
// Support method to print a name without using att.getQualifiedName()
- // and thus avoiding a StringBuffer creation and memory churn
+ // and thus avoiding a StringBuilder creation and memory churn
private void printQualifiedName( Writer out, Attribute a )
throws IOException
{
diff --git a/archetype-common/src/main/java/org/apache/maven/archetype/creator/FilesetArchetypeCreator.java b/archetype-common/src/main/java/org/apache/maven/archetype/creator/FilesetArchetypeCreator.java
index 7d511bc..f499d03 100644
--- a/archetype-common/src/main/java/org/apache/maven/archetype/creator/FilesetArchetypeCreator.java
+++ b/archetype-common/src/main/java/org/apache/maven/archetype/creator/FilesetArchetypeCreator.java
@@ -752,7 +752,7 @@ public class FilesetArchetypeCreator
private List<String> concatenateToList( List<String> toConcatenate, String with )
{
- List<String> result = new ArrayList<String>( toConcatenate.size() );
+ List<String> result = new ArrayList<>( toConcatenate.size() );
for ( String concatenate : toConcatenate )
{
@@ -764,7 +764,7 @@ public class FilesetArchetypeCreator
private List<String> addLists( List<String> list, List<String> other )
{
- List<String> result = new ArrayList<String>( list.size() + other.size() );
+ List<String> result = new ArrayList<>( list.size() + other.size() );
result.addAll( list );
result.addAll( other );
return result;
@@ -924,7 +924,7 @@ public class FilesetArchetypeCreator
private List<FileSet> createFileSets( List<String> files, int level, boolean packaged, String packageName,
boolean filtered, String defaultEncoding )
{
- List<FileSet> fileSets = new ArrayList<FileSet>();
+ List<FileSet> fileSets = new ArrayList<>();
if ( !files.isEmpty() )
{
@@ -934,8 +934,8 @@ public class FilesetArchetypeCreator
: "" ) + " at level " + level );
if ( level == 0 )
{
- List<String> includes = new ArrayList<String>( files );
- List<String> excludes = new ArrayList<String>();
+ List<String> includes = new ArrayList<>( files );
+ List<String> excludes = new ArrayList<>();
if ( !includes.isEmpty() )
{
@@ -1141,7 +1141,7 @@ public class FilesetArchetypeCreator
private Set<String> getExtensions( List<String> files )
{
- Set<String> extensions = new HashSet<String>();
+ Set<String> extensions = new HashSet<>();
for ( String file : files )
{
@@ -1153,7 +1153,7 @@ public class FilesetArchetypeCreator
private Map<String, List<String>> getGroupsMap( final List<String> files, final int level )
{
- Map<String, List<String>> groups = new HashMap<String, List<String>>();
+ Map<String, List<String>> groups = new HashMap<>();
for ( String file : files )
{
@@ -1185,8 +1185,8 @@ public class FilesetArchetypeCreator
final String group, final Set<String> unpackagedExtensions,
final List<String> unpackagedFiles, String defaultEncoding )
{
- List<String> includes = new ArrayList<String>();
- List<String> excludes = new ArrayList<String>();
+ List<String> includes = new ArrayList<>();
+ List<String> excludes = new ArrayList<>();
for ( String extension : packagedExtensions )
{
@@ -1207,7 +1207,7 @@ public class FilesetArchetypeCreator
{
String packageAsDir = StringUtils.replace( packageName, ".", "/" );
- List<FileSet> packagedFileSets = new ArrayList<FileSet>();
+ List<FileSet> packagedFileSets = new ArrayList<>();
List<String> packagedFiles = archetypeFilesResolver.getPackagedFiles( groupFiles, packageAsDir );
getLogger().debug( "Found packaged Files:" + packagedFiles );
@@ -1319,7 +1319,7 @@ public class FilesetArchetypeCreator
{
getLogger().debug( "Resolving files for " + pom.getId() + " in " + basedir );
- StringBuffer buff = new StringBuffer( "pom.xml*,archetype.properties*,target/**," );
+ StringBuilder buff = new StringBuilder( "pom.xml*,archetype.properties*,target/**," );
for ( String module : pom.getModules() )
{
buff.append( ',' ).append( module ).append( "/**" );
@@ -1348,12 +1348,12 @@ public class FilesetArchetypeCreator
private List<FileSet> resolveFileSets( String packageName, List<String> fileNames, List<String> languages,
List<String> filtereds, String defaultEncoding )
{
- List<FileSet> resolvedFileSets = new ArrayList<FileSet>();
+ List<FileSet> resolvedFileSets = new ArrayList<>();
getLogger().debug(
"Resolving filesets with package=" + packageName + ", languages=" + languages + " and extentions="
+ filtereds );
- List<String> files = new ArrayList<String>( fileNames );
+ List<String> files = new ArrayList<>( fileNames );
StringBuilder languageIncludes = new StringBuilder();
@@ -1690,8 +1690,8 @@ public class FilesetArchetypeCreator
{
Set<String> extensions = getExtensions( groupFiles );
- List<String> includes = new ArrayList<String>();
- List<String> excludes = new ArrayList<String>();
+ List<String> includes = new ArrayList<>();
+ List<String> excludes = new ArrayList<>();
for ( String extension : extensions )
{
@@ -1705,8 +1705,8 @@ public class FilesetArchetypeCreator
final List<String> unpackagedFiles, final String group,
final Set<String> packagedExtensions, String defaultEncoding )
{
- List<String> includes = new ArrayList<String>();
- List<String> excludes = new ArrayList<String>();
+ List<String> includes = new ArrayList<>();
+ List<String> excludes = new ArrayList<>();
for ( String extension : unpackagedExtensions )
{
diff --git a/archetype-common/src/main/java/org/apache/maven/archetype/downloader/DefaultDownloader.java b/archetype-common/src/main/java/org/apache/maven/archetype/downloader/DefaultDownloader.java
index 66e0ea5..b7517cd 100644
--- a/archetype-common/src/main/java/org/apache/maven/archetype/downloader/DefaultDownloader.java
+++ b/archetype-common/src/main/java/org/apache/maven/archetype/downloader/DefaultDownloader.java
@@ -59,7 +59,7 @@ public class DefaultDownloader
pomCoordinate.setVersion( version );
pomCoordinate.setExtension( "pom" );
- List<ArtifactRepository> repositories = new ArrayList<ArtifactRepository>( remoteRepositories );
+ List<ArtifactRepository> repositories = new ArrayList<>( remoteRepositories );
if ( repositories.isEmpty() && archetypeRepository != null )
{
repositories.add( archetypeRepository );
diff --git a/archetype-common/src/main/java/org/apache/maven/archetype/generator/DefaultArchetypeGenerator.java b/archetype-common/src/main/java/org/apache/maven/archetype/generator/DefaultArchetypeGenerator.java
index 3d47d45..c00cbd7 100644
--- a/archetype-common/src/main/java/org/apache/maven/archetype/generator/DefaultArchetypeGenerator.java
+++ b/archetype-common/src/main/java/org/apache/maven/archetype/generator/DefaultArchetypeGenerator.java
@@ -71,7 +71,7 @@ public class DefaultArchetypeGenerator
throw new ArchetypeNotDefined( "The archetype is not defined" );
}
- List<ArtifactRepository> repos = new ArrayList<ArtifactRepository>();
+ List<ArtifactRepository> repos = new ArrayList<>();
ArtifactRepository remoteRepo = null;
if ( request != null && request.getArchetypeRepository() != null )
diff --git a/archetype-common/src/main/java/org/apache/maven/archetype/generator/DefaultFilesetArchetypeGenerator.java b/archetype-common/src/main/java/org/apache/maven/archetype/generator/DefaultFilesetArchetypeGenerator.java
index 2e8d203..0f08bad 100644
--- a/archetype-common/src/main/java/org/apache/maven/archetype/generator/DefaultFilesetArchetypeGenerator.java
+++ b/archetype-common/src/main/java/org/apache/maven/archetype/generator/DefaultFilesetArchetypeGenerator.java
@@ -112,11 +112,11 @@ public class DefaultFilesetArchetypeGenerator
throw new ArchetypeNotConfigured( "No archetype was chosen.", null );
}
- StringBuffer exceptionMessage = new StringBuffer(
+ StringBuilder exceptionMessage = new StringBuilder(
"Archetype " + request.getArchetypeGroupId() + ":" + request.getArchetypeArtifactId() + ":"
+ request.getArchetypeVersion() + " is not configured" );
- List<String> missingProperties = new ArrayList<String>( 0 );
+ List<String> missingProperties = new ArrayList<>( 0 );
for ( RequiredProperty requiredProperty : archetypeDescriptor.getRequiredProperties() )
{
if ( StringUtils.isEmpty( request.getProperties().getProperty( requiredProperty.getKey() ) ) )
diff --git a/archetype-common/src/main/java/org/apache/maven/archetype/old/DefaultOldArchetype.java b/archetype-common/src/main/java/org/apache/maven/archetype/old/DefaultOldArchetype.java
index bfc207b..f39c58d 100644
--- a/archetype-common/src/main/java/org/apache/maven/archetype/old/DefaultOldArchetype.java
+++ b/archetype-common/src/main/java/org/apache/maven/archetype/old/DefaultOldArchetype.java
@@ -127,7 +127,7 @@ public class DefaultOldArchetype
public void createArchetype( ArchetypeGenerationRequest request, File archetypeFile )
throws ArchetypeDescriptorException, ArchetypeTemplateProcessingException
{
- Map<String, String> parameters = new HashMap<String, String>();
+ Map<String, String> parameters = new HashMap<>();
parameters.put( "basedir", request.getOutputDirectory() );
diff --git a/archetype-common/src/main/java/org/apache/maven/archetype/old/descriptor/ArchetypeDescriptor.java b/archetype-common/src/main/java/org/apache/maven/archetype/old/descriptor/ArchetypeDescriptor.java
index 61d65c6..7ae874f 100644
--- a/archetype-common/src/main/java/org/apache/maven/archetype/old/descriptor/ArchetypeDescriptor.java
+++ b/archetype-common/src/main/java/org/apache/maven/archetype/old/descriptor/ArchetypeDescriptor.java
@@ -83,25 +83,25 @@ public class ArchetypeDescriptor
public ArchetypeDescriptor()
{
- sources = new ArrayList<String>();
+ sources = new ArrayList<>();
- resources = new ArrayList<String>();
+ resources = new ArrayList<>();
- testSources = new ArrayList<String>();
+ testSources = new ArrayList<>();
- testResources = new ArrayList<String>();
+ testResources = new ArrayList<>();
- siteResources = new ArrayList<String>();
+ siteResources = new ArrayList<>();
- sourcesDescriptors = new HashMap<String, TemplateDescriptor>();
+ sourcesDescriptors = new HashMap<>();
- testSourcesDescriptors = new HashMap<String, TemplateDescriptor>();
+ testSourcesDescriptors = new HashMap<>();
- resourcesDescriptors = new HashMap<String, TemplateDescriptor>();
+ resourcesDescriptors = new HashMap<>();
- testResourcesDescriptors = new HashMap<String, TemplateDescriptor>();
+ testResourcesDescriptors = new HashMap<>();
- siteResourcesDescriptors = new HashMap<String, TemplateDescriptor>();
+ siteResourcesDescriptors = new HashMap<>();
}
// ----------------------------------------------------------------------
diff --git a/archetype-common/src/main/java/org/apache/maven/archetype/old/descriptor/TemplateDescriptor.java b/archetype-common/src/main/java/org/apache/maven/archetype/old/descriptor/TemplateDescriptor.java
index 1ec5f80..0b1eb73 100644
--- a/archetype-common/src/main/java/org/apache/maven/archetype/old/descriptor/TemplateDescriptor.java
+++ b/archetype-common/src/main/java/org/apache/maven/archetype/old/descriptor/TemplateDescriptor.java
@@ -42,7 +42,7 @@ public class TemplateDescriptor
private String encoding;
/**
- * Creates a new instance of <code>TemplateDescriptor<code> that should be filtered
+ * Creates a new instance of <code>TemplateDescriptor</code> that should be filtered
* and has the default encoding.
*/
public TemplateDescriptor()
diff --git a/archetype-common/src/test/java/org/apache/maven/archetype/common/TestDefaultArchetypeFilesResolver.java b/archetype-common/src/test/java/org/apache/maven/archetype/common/TestDefaultArchetypeFilesResolver.java
index 40a8fba..ca53006 100644
--- a/archetype-common/src/test/java/org/apache/maven/archetype/common/TestDefaultArchetypeFilesResolver.java
+++ b/archetype-common/src/test/java/org/apache/maven/archetype/common/TestDefaultArchetypeFilesResolver.java
@@ -41,7 +41,7 @@ public class TestDefaultArchetypeFilesResolver
fileSet.setPackaged( true );
fileSet.setFiltered( true );
- List<String> archetypeResources = new ArrayList<String>();
+ List<String> archetypeResources = new ArrayList<>();
archetypeResources.add( "pom.xml" );
archetypeResources.add( "App.java" );
diff --git a/archetype-common/src/test/java/org/apache/maven/archetype/common/util/TestListScanner.java b/archetype-common/src/test/java/org/apache/maven/archetype/common/util/TestListScanner.java
index 861e8d4..2337ae9 100644
--- a/archetype-common/src/test/java/org/apache/maven/archetype/common/util/TestListScanner.java
+++ b/archetype-common/src/test/java/org/apache/maven/archetype/common/util/TestListScanner.java
@@ -30,7 +30,7 @@ public class TestListScanner
{
public void testUnixPaths()
{
- List<String> archetypeResources = new ArrayList<String>();
+ List<String> archetypeResources = new ArrayList<>();
archetypeResources.add( "pom.xml" );
archetypeResources.add( "App.java" );
@@ -59,7 +59,7 @@ public class TestListScanner
public void testWindowsPaths()
{
- List<String> archetypeResources = new ArrayList<String>();
+ List<String> archetypeResources = new ArrayList<>();
archetypeResources.add( "pom.xml" );
archetypeResources.add( "App.java" );
diff --git a/archetype-common/src/test/java/org/apache/maven/archetype/generator/DefaultArchetypeGeneratorTest.java b/archetype-common/src/test/java/org/apache/maven/archetype/generator/DefaultArchetypeGeneratorTest.java
index ecfba5c..ef99de0 100644
--- a/archetype-common/src/test/java/org/apache/maven/archetype/generator/DefaultArchetypeGeneratorTest.java
+++ b/archetype-common/src/test/java/org/apache/maven/archetype/generator/DefaultArchetypeGeneratorTest.java
@@ -39,7 +39,6 @@ import org.apache.maven.project.DefaultProjectBuildingRequest;
import org.apache.maven.project.ProjectBuildingRequest;
import org.apache.maven.repository.internal.MavenRepositorySystemSession;
import org.codehaus.plexus.util.FileUtils;
-import org.codehaus.plexus.util.IOUtil;
import org.codehaus.plexus.util.ReaderFactory;
import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
import org.sonatype.aether.impl.internal.SimpleLocalRepositoryManager;
diff --git a/archetype-common/src/test/java/org/apache/maven/archetype/old/ArchetypeTest.java b/archetype-common/src/test/java/org/apache/maven/archetype/old/ArchetypeTest.java
index 391cccb..d89c7d8 100644
--- a/archetype-common/src/test/java/org/apache/maven/archetype/old/ArchetypeTest.java
+++ b/archetype-common/src/test/java/org/apache/maven/archetype/old/ArchetypeTest.java
@@ -76,7 +76,7 @@ public class ArchetypeTest
ArtifactRepository localRepository = new DefaultArtifactRepository( "local", mavenRepoLocal, layout );
- List<ArtifactRepository> remoteRepositories = new ArrayList<ArtifactRepository>();
+ List<ArtifactRepository> remoteRepositories = new ArrayList<>();
String mavenRepoRemote = getTestFile( "src/test/repository" ).toURI().toURL().toString();
@@ -110,7 +110,7 @@ public class ArchetypeTest
// Set up the Velocity context
// ----------------------------------------------------------------------
- Map<String, Object> parameters = new HashMap<String, Object>();
+ Map<String, Object> parameters = new HashMap<>();
parameters.put( "basedir", request.getOutputDirectory() );
parameters.put( "package", request.getPackage() );
parameters.put( "packageName", request.getPackage() );
diff --git a/maven-archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/CreateArchetypeFromProjectMojo.java b/maven-archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/CreateArchetypeFromProjectMojo.java
index 877ed89..0971525 100644
--- a/maven-archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/CreateArchetypeFromProjectMojo.java
+++ b/maven-archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/CreateArchetypeFromProjectMojo.java
@@ -294,7 +294,7 @@ public class CreateArchetypeFromProjectMojo
private List<String> getFilteredExtensions( String archetypeFilteredExtentions, File propertyFile )
{
- List<String> filteredExtensions = new ArrayList<String>();
+ List<String> filteredExtensions = new ArrayList<>();
if ( StringUtils.isNotEmpty( archetypeFilteredExtentions ) )
{
@@ -328,7 +328,7 @@ public class CreateArchetypeFromProjectMojo
private List<String> getLanguages( String archetypeLanguages, File propertyFile )
{
- List<String> resultingLanguages = new ArrayList<String>();
+ List<String> resultingLanguages = new ArrayList<>();
if ( StringUtils.isNotEmpty( archetypeLanguages ) )
{
diff --git a/maven-archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/IntegrationTestMojo.java b/maven-archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/IntegrationTestMojo.java
index 2f57b21..7e7d435 100644
--- a/maven-archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/IntegrationTestMojo.java
+++ b/maven-archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/IntegrationTestMojo.java
@@ -74,14 +74,11 @@ import org.codehaus.plexus.util.WriterFactory;
import org.codehaus.plexus.util.introspection.ReflectionValueExtractor;
/**
- * <p>
- * Execute the archetype integration tests, consisting in generating projects from the current archetype and optionally
- * comparing generated projects with reference copy.
- * </p>
- * <p/>
- * <p>
- * Each IT consists of a sub-directory in <code>src/test/resources/projects</code> containing:
- * </p>
+ * <p>Execute the archetype integration tests, consisting in generating projects from the current archetype and optionally
+ * comparing generated projects with reference copy.</p>
+ *
+ * <p>Each IT consists of a sub-directory in <code>src/test/resources/projects</code> containing:</p>
+ *
* <ul>
* <li>a <code>goal.txt</code> file, containing a list of goals to run against the generated project (can be empty,
* content ignored before maven-archetype-plugin 2.1),</li>
@@ -89,17 +86,17 @@ import org.codehaus.plexus.util.introspection.ReflectionValueExtractor;
* <li>an optional <code>reference/</code> directory containing a reference copy of the expected project created from
* the IT.</li>
* </ul>
- * <p/>
- * To let the IT create a Maven module below some other Maven project (being generated from another archetype)
+ * <p>To let the IT create a Maven module below some other Maven project (being generated from another archetype)
* one can additionally specify an optional <code>archetype.pom.properties</code> file in the parent directory,
* specifying the archetype's <code>groupId</code>, <code>artifactId</code> and <code>version</code> along with its
* <code>archetype.properties</code> file, containing properties for project generation. Both files are leveraged
- * to create the parent project for this IT. Parent projects can be nested.
- * An example structure for such an integration test looks like this
- * <table>
+ * to create the parent project for this IT. Parent projects can be nested.</p>
+ *
+ * <p>An example structure for such an integration test looks like this</p>
+ * <table summary="integration test folder structure">
* <tr>
- * <th>File/Directory</code></td>
- * <th>Description</td>
+ * <th>File/Directory</th>
+ * <th>Description</th>
* </tr>
* <tr>
* <td><code>src/test/resources/projects/it1</code></td>
@@ -125,10 +122,10 @@ import org.codehaus.plexus.util.introspection.ReflectionValueExtractor;
* <td><code>src/test/resources/projects/it1/child/archetype.properties</code></td>
* <td>All required properties for this project's archetype</td>
* </tr>
- * </table>
- * <p/>
- * Notice that it is expected to be run as part as of a build after the <code>package</code> phase and not directly as a
- * goal from CLI.
+ * </table>
+ *
+ * <p>Notice that it is expected to be run as part as of a build after the <code>package</code> phase and not directly as a
+ * goal from CLI.</p>
*
* @author rafale
*/
@@ -275,7 +272,7 @@ public class IntegrationTestMojo
* @since 3.0.2
*/
@Parameter
- private Map<String, String> properties = new HashMap<String, String>();
+ private Map<String, String> properties = new HashMap<>();
@Override
public void execute()
@@ -706,7 +703,7 @@ public class IntegrationTestMojo
ScriptRunner scriptRunner = new ScriptRunner( getLog() );
scriptRunner.setScriptEncoding( encoding );
- Map<String, Object> context = new LinkedHashMap<String, Object>();
+ Map<String, Object> context = new LinkedHashMap<>();
context.put( "projectDir", basedir );
try
@@ -776,7 +773,7 @@ public class IntegrationTestMojo
*/
private Map<String, Object> getInterpolationValueSource()
{
- Map<String, Object> props = new HashMap<String, Object>();
+ Map<String, Object> props = new HashMap<>();
if ( filterProperties != null )
{
props.putAll( filterProperties );
diff --git a/maven-archetype-plugin/src/main/java/org/apache/maven/archetype/ui/ArchetypeConfiguration.java b/maven-archetype-plugin/src/main/java/org/apache/maven/archetype/ui/ArchetypeConfiguration.java
index 62be9c2..f4eee26 100644
--- a/maven-archetype-plugin/src/main/java/org/apache/maven/archetype/ui/ArchetypeConfiguration.java
+++ b/maven-archetype-plugin/src/main/java/org/apache/maven/archetype/ui/ArchetypeConfiguration.java
@@ -96,7 +96,7 @@ public class ArchetypeConfiguration
{
if ( requiredProperties == null )
{
- requiredProperties = new ArrayList<String>();
+ requiredProperties = new ArrayList<>();
}
return requiredProperties;
@@ -218,7 +218,7 @@ public class ArchetypeConfiguration
return defaultProperties;
}
- Map<String, Pattern> propertiesValidationPatterns = new HashMap<String, Pattern>();
+ Map<String, Pattern> propertiesValidationPatterns = new HashMap<>();
public void setPropertyValidationRegex( String requiredProperty, String regex )
{
diff --git a/maven-archetype-plugin/src/main/java/org/apache/maven/archetype/ui/ArchetypePrompter.java b/maven-archetype-plugin/src/main/java/org/apache/maven/archetype/ui/ArchetypePrompter.java
index b014fb6..f1d16ea 100644
--- a/maven-archetype-plugin/src/main/java/org/apache/maven/archetype/ui/ArchetypePrompter.java
+++ b/maven-archetype-plugin/src/main/java/org/apache/maven/archetype/ui/ArchetypePrompter.java
@@ -132,7 +132,7 @@ public class ArchetypePrompter
private String formatMessage( String message, List<String> possibleValues, String defaultReply )
{
- StringBuffer formatted = new StringBuffer( message.length() * 2 );
+ StringBuilder formatted = new StringBuilder( message.length() * 2 );
formatted.append( message );
/*
diff --git a/maven-archetype-plugin/src/main/java/org/apache/maven/archetype/ui/creation/ArchetypeCreationQueryer.java b/maven-archetype-plugin/src/main/java/org/apache/maven/archetype/ui/creation/ArchetypeCreationQueryer.java
index f58a9e4..4951596 100644
--- a/maven-archetype-plugin/src/main/java/org/apache/maven/archetype/ui/creation/ArchetypeCreationQueryer.java
+++ b/maven-archetype-plugin/src/main/java/org/apache/maven/archetype/ui/creation/ArchetypeCreationQueryer.java
@@ -23,9 +23,9 @@ import org.apache.maven.archetype.ui.ArchetypeConfiguration;
import org.codehaus.plexus.components.interactivity.PrompterException;
/**
- * User interaction component to query informations necessary for an archetype creation from a project.
+ * <p>User interaction component to query informations necessary for an archetype creation from a project.</p>
*
- * @todo this interface is bound to its implementation through the prompter exception
+ * TODO this interface is bound to its implementation through the prompter exception
*/
public interface ArchetypeCreationQueryer
{
diff --git a/maven-archetype-plugin/src/main/java/org/apache/maven/archetype/ui/generation/ArchetypeGenerationQueryer.java b/maven-archetype-plugin/src/main/java/org/apache/maven/archetype/ui/generation/ArchetypeGenerationQueryer.java
index a432df6..45e821f 100644
--- a/maven-archetype-plugin/src/main/java/org/apache/maven/archetype/ui/generation/ArchetypeGenerationQueryer.java
+++ b/maven-archetype-plugin/src/main/java/org/apache/maven/archetype/ui/generation/ArchetypeGenerationQueryer.java
@@ -25,9 +25,9 @@ import org.codehaus.plexus.components.interactivity.PrompterException;
import java.util.regex.Pattern;
/**
- * User interaction component to query informations necessary for a project generation from an archetype.
+ * <p>User interaction component to query informations necessary for a project generation from an archetype.</p>
*
- * @todo this interface is bound to its implementation through the prompter exception
+ * TODO this interface is bound to its implementation through the prompter exception
*/
public interface ArchetypeGenerationQueryer
{
diff --git a/maven-archetype-plugin/src/main/java/org/apache/maven/archetype/ui/generation/ArchetypeSelectionQueryer.java b/maven-archetype-plugin/src/main/java/org/apache/maven/archetype/ui/generation/ArchetypeSelectionQueryer.java
index 1c25a0f..9e28129 100644
--- a/maven-archetype-plugin/src/main/java/org/apache/maven/archetype/ui/generation/ArchetypeSelectionQueryer.java
+++ b/maven-archetype-plugin/src/main/java/org/apache/maven/archetype/ui/generation/ArchetypeSelectionQueryer.java
@@ -27,9 +27,9 @@ import java.util.List;
import java.util.Map;
/**
- * User interaction component for archetype selection.
+ * <p>User interaction component for archetype selection.</p>
*
- * @todo this interface is bound to its implementation through the prompter exception
+ * TODO this interface is bound to its implementation through the prompter exception
*/
public interface ArchetypeSelectionQueryer
{
diff --git a/maven-archetype-plugin/src/main/java/org/apache/maven/archetype/ui/generation/ArchetypeSelectorUtils.java b/maven-archetype-plugin/src/main/java/org/apache/maven/archetype/ui/generation/ArchetypeSelectorUtils.java
index 650a448..584622c 100644
--- a/maven-archetype-plugin/src/main/java/org/apache/maven/archetype/ui/generation/ArchetypeSelectorUtils.java
+++ b/maven-archetype-plugin/src/main/java/org/apache/maven/archetype/ui/generation/ArchetypeSelectorUtils.java
@@ -65,11 +65,11 @@ public class ArchetypeSelectorUtils
return Collections.emptyMap();
}
Map<String, List<Archetype>> filtered =
- new LinkedHashMap<String, List<Archetype>>( archetypesPerCatalog.size() );
+ new LinkedHashMap<>( archetypesPerCatalog.size() );
for ( Map.Entry<String, List<Archetype>> entry : archetypesPerCatalog.entrySet() )
{
- List<Archetype> archetypes = new ArrayList<Archetype>();
+ List<Archetype> archetypes = new ArrayList<>();
for ( Archetype archetype : entry.getValue() )
{
diff --git a/maven-archetype-plugin/src/main/java/org/apache/maven/archetype/ui/generation/DefaultArchetypeGenerationConfigurator.java b/maven-archetype-plugin/src/main/java/org/apache/maven/archetype/ui/generation/DefaultArchetypeGenerationConfigurator.java
index 2de9bb1..3720ef0 100644
--- a/maven-archetype-plugin/src/main/java/org/apache/maven/archetype/ui/generation/DefaultArchetypeGenerationConfigurator.java
+++ b/maven-archetype-plugin/src/main/java/org/apache/maven/archetype/ui/generation/DefaultArchetypeGenerationConfigurator.java
@@ -90,7 +90,7 @@ public class DefaultArchetypeGenerationConfigurator
ArtifactRepository archetypeRepository = null;
- List<ArtifactRepository> repositories = new ArrayList<ArtifactRepository>();
+ List<ArtifactRepository> repositories = new ArrayList<>();
Properties properties = new Properties( executionProperties );
@@ -272,7 +272,7 @@ public class DefaultArchetypeGenerationConfigurator
// in batch mode, we assume the defaults, and if still not configured fail
if ( !archetypeConfiguration.isConfigured() )
{
- StringBuffer exceptionMessage = new StringBuffer();
+ StringBuilder exceptionMessage = new StringBuilder();
exceptionMessage.append( "Archetype " );
exceptionMessage.append( request.getArchetypeGroupId() );
exceptionMessage.append( ":" );
@@ -281,7 +281,7 @@ public class DefaultArchetypeGenerationConfigurator
exceptionMessage.append( request.getArchetypeVersion() );
exceptionMessage.append( " is not configured" );
- List<String> missingProperties = new ArrayList<String>( 0 );
+ List<String> missingProperties = new ArrayList<>( 0 );
for ( String requiredProperty : archetypeConfiguration.getRequiredProperties() )
{
if ( !archetypeConfiguration.isConfigured( requiredProperty ) )
diff --git a/maven-archetype-plugin/src/main/java/org/apache/maven/archetype/ui/generation/DefaultArchetypeSelectionQueryer.java b/maven-archetype-plugin/src/main/java/org/apache/maven/archetype/ui/generation/DefaultArchetypeSelectionQueryer.java
index d4c8b42..ae49008 100644
--- a/maven-archetype-plugin/src/main/java/org/apache/maven/archetype/ui/generation/DefaultArchetypeSelectionQueryer.java
+++ b/maven-archetype-plugin/src/main/java/org/apache/maven/archetype/ui/generation/DefaultArchetypeSelectionQueryer.java
@@ -79,9 +79,9 @@ public class DefaultArchetypeSelectionQueryer
{
StringBuilder query = new StringBuilder( "Choose archetype:\n" );
- Set<String> archetypeKeys = new HashSet<String>();
- List<String> answers = new ArrayList<String>();
- Map<String, Archetype> archetypeAnswerMap = new HashMap<String, Archetype>();
+ Set<String> archetypeKeys = new HashSet<>();
+ List<String> answers = new ArrayList<>();
+ Map<String, Archetype> archetypeAnswerMap = new HashMap<>();
int counter = 0;
int defaultSelection = 0;
@@ -160,7 +160,7 @@ public class DefaultArchetypeSelectionQueryer
private Archetype selectVersion( Map<String, List<Archetype>> catalogs, String groupId, String artifactId )
throws PrompterException
{
- SortedMap<ArtifactVersion, Archetype> archetypeVersionsMap = new TreeMap<ArtifactVersion, Archetype>();
+ SortedMap<ArtifactVersion, Archetype> archetypeVersionsMap = new TreeMap<>();
for ( Map.Entry<String, List<Archetype>> entry : catalogs.entrySet() )
{
@@ -189,8 +189,8 @@ public class DefaultArchetypeSelectionQueryer
// let the user choose between available versions
StringBuilder query = new StringBuilder( "Choose " + groupId + ":" + artifactId + " version: \n" );
- List<String> answers = new ArrayList<String>();
- Map<String, Archetype> answerMap = new HashMap<String, Archetype>();
+ List<String> answers = new ArrayList<>();
+ Map<String, Archetype> answerMap = new HashMap<>();
int counter = 1;
String mapKey = null;
diff --git a/maven-archetype-plugin/src/main/java/org/apache/maven/archetype/ui/generation/DefaultArchetypeSelector.java b/maven-archetype-plugin/src/main/java/org/apache/maven/archetype/ui/generation/DefaultArchetypeSelector.java
index a6e35eb..0f748f0 100644
--- a/maven-archetype-plugin/src/main/java/org/apache/maven/archetype/ui/generation/DefaultArchetypeSelector.java
+++ b/maven-archetype-plugin/src/main/java/org/apache/maven/archetype/ui/generation/DefaultArchetypeSelector.java
@@ -180,7 +180,7 @@ public class DefaultArchetypeSelector
throw new NullPointerException( "Catalogs cannot be null" );
}
- Map<String, List<Archetype>> archetypes = new LinkedHashMap<String, List<Archetype>>();
+ Map<String, List<Archetype>> archetypes = new LinkedHashMap<>();
for ( String catalog : StringUtils.split( catalogs, "," ) )
{
@@ -271,7 +271,7 @@ public class DefaultArchetypeSelector
private static <K, V> Map.Entry<K, V> newMapEntry( K key, V value )
{
- Map<K, V> map = new HashMap<K, V>( 1 );
+ Map<K, V> map = new HashMap<>( 1 );
map.put( key, value );
return map.entrySet().iterator().next();
diff --git a/maven-archetype-plugin/src/test/java/org/apache/maven/archetype/ui/generation/DefaultArchetypeGenerationConfiguratorTest.java b/maven-archetype-plugin/src/test/java/org/apache/maven/archetype/ui/generation/DefaultArchetypeGenerationConfiguratorTest.java
index 57bd985..e9ace68 100644
--- a/maven-archetype-plugin/src/test/java/org/apache/maven/archetype/ui/generation/DefaultArchetypeGenerationConfiguratorTest.java
+++ b/maven-archetype-plugin/src/test/java/org/apache/maven/archetype/ui/generation/DefaultArchetypeGenerationConfiguratorTest.java
@@ -37,7 +37,7 @@ import java.io.IOException;
import java.util.Properties;
/**
- * @todo probably testing a little deep, could just test ArchetypeConfiguration
+ * TODO probably testing a little deep, could just test ArchetypeConfiguration
*/
public class DefaultArchetypeGenerationConfiguratorTest
extends PlexusTestCase
diff --git a/maven-archetype-plugin/src/test/java/org/apache/maven/archetype/ui/generation/DefaultArchetypeSelectionQueryerTest.java b/maven-archetype-plugin/src/test/java/org/apache/maven/archetype/ui/generation/DefaultArchetypeSelectionQueryerTest.java
index 2856b06..1fbef30 100644
--- a/maven-archetype-plugin/src/test/java/org/apache/maven/archetype/ui/generation/DefaultArchetypeSelectionQueryerTest.java
+++ b/maven-archetype-plugin/src/test/java/org/apache/maven/archetype/ui/generation/DefaultArchetypeSelectionQueryerTest.java
@@ -178,7 +178,7 @@ public class DefaultArchetypeSelectionQueryerTest
private static Map<String, List<Archetype>> createDefaultArchetypeCatalog()
{
- List<Archetype> list = new ArrayList<Archetype>();
+ List<Archetype> list = new ArrayList<>();
list.add( createArchetype( "set-groupId", "set-artifactId", "set-version" ) );
list.add( createArchetype( "default-groupId", "default-artifactId", "default-version" ) );
return Collections.singletonMap( "internal", list );