You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by ma...@apache.org on 2008/05/21 15:27:19 UTC

svn commit: r658677 - in /maven/shared/trunk/maven-runtime/src: main/java/org/apache/maven/shared/runtime/ test/java/org/apache/maven/shared/runtime/

Author: markh
Date: Wed May 21 06:27:18 2008
New Revision: 658677

URL: http://svn.apache.org/viewvc?rev=658677&view=rev
Log:
Tidied javadoc and some code

Modified:
    maven/shared/trunk/maven-runtime/src/main/java/org/apache/maven/shared/runtime/ClassUtils.java
    maven/shared/trunk/maven-runtime/src/main/java/org/apache/maven/shared/runtime/DefaultMavenRuntime.java
    maven/shared/trunk/maven-runtime/src/main/java/org/apache/maven/shared/runtime/MavenProjectProperties.java
    maven/shared/trunk/maven-runtime/src/main/java/org/apache/maven/shared/runtime/MavenRuntime.java
    maven/shared/trunk/maven-runtime/src/main/java/org/apache/maven/shared/runtime/MavenRuntimeException.java
    maven/shared/trunk/maven-runtime/src/main/java/org/apache/maven/shared/runtime/MavenRuntimeVisitorUtils.java
    maven/shared/trunk/maven-runtime/src/main/java/org/apache/maven/shared/runtime/PropertiesMavenRuntimeVisitor.java
    maven/shared/trunk/maven-runtime/src/main/java/org/apache/maven/shared/runtime/XMLMavenRuntimeVisitor.java
    maven/shared/trunk/maven-runtime/src/test/java/org/apache/maven/shared/runtime/DefaultMavenRuntimeTest.java
    maven/shared/trunk/maven-runtime/src/test/java/org/apache/maven/shared/runtime/MavenProjectPropertiesTest.java
    maven/shared/trunk/maven-runtime/src/test/java/org/apache/maven/shared/runtime/MavenRuntimeVisitorUtilsTest.java

Modified: maven/shared/trunk/maven-runtime/src/main/java/org/apache/maven/shared/runtime/ClassUtils.java
URL: http://svn.apache.org/viewvc/maven/shared/trunk/maven-runtime/src/main/java/org/apache/maven/shared/runtime/ClassUtils.java?rev=658677&r1=658676&r2=658677&view=diff
==============================================================================
--- maven/shared/trunk/maven-runtime/src/main/java/org/apache/maven/shared/runtime/ClassUtils.java (original)
+++ maven/shared/trunk/maven-runtime/src/main/java/org/apache/maven/shared/runtime/ClassUtils.java Wed May 21 06:27:18 2008
@@ -34,16 +34,19 @@
 {
     // constructors -----------------------------------------------------------
 
+    /**
+     * {@code ClassUtils} is not intended to be instantiated.
+     */
     private ClassUtils()
     {
-        // private constructor for utility class
+        throw new AssertionError();
     }
 
     // public methods ---------------------------------------------------------
 
     /**
-     * Gets a URL to the specified class's default package. For example, if the class <code>foo.Bar</code> is
-     * supplied, then a URL to the directory above <code>foo</code> is returned.
+     * Gets a URL to the specified class's default package. For example, if the class {@code foo.Bar} is supplied, then
+     * a URL to the directory above {@code foo} is returned.
      * 
      * @param klass
      *            the class to obtain the base URL for
@@ -69,7 +72,7 @@
      * 
      * @param klass
      *            the class to obtain the URL for
-     * @return a URL to the class, or <code>null</code> if it cannot be found
+     * @return a URL to the class, or {@code null} if it cannot be found
      */
     public static URL getURL( Class<?> klass )
     {

Modified: maven/shared/trunk/maven-runtime/src/main/java/org/apache/maven/shared/runtime/DefaultMavenRuntime.java
URL: http://svn.apache.org/viewvc/maven/shared/trunk/maven-runtime/src/main/java/org/apache/maven/shared/runtime/DefaultMavenRuntime.java?rev=658677&r1=658676&r2=658677&view=diff
==============================================================================
--- maven/shared/trunk/maven-runtime/src/main/java/org/apache/maven/shared/runtime/DefaultMavenRuntime.java (original)
+++ maven/shared/trunk/maven-runtime/src/main/java/org/apache/maven/shared/runtime/DefaultMavenRuntime.java Wed May 21 06:27:18 2008
@@ -24,7 +24,7 @@
 import org.apache.maven.project.MavenProject;
 
 /**
- * Default implementation of <code>MavenRuntime</code>.
+ * Default implementation of {@code MavenRuntime}.
  * 
  * @author <a href="mailto:markhobson@gmail.com">Mark Hobson</a>
  * @version $Id$
@@ -98,13 +98,13 @@
     // private methods --------------------------------------------------------
 
     /**
-     * Gets the first element in the specified list or <code>null</code> if it is empty.
+     * Gets the first element in the specified list or {@code null} if it is empty.
      * 
      * @param <T>
      *            the type of the specified list
      * @param list
      *            the list to examine
-     * @return the first item in the list, or <code>null</code> if it is empty
+     * @return the first item in the list, or {@code null} if it is empty
      */
     private static <T> T first( List<T> list )
     {

Modified: maven/shared/trunk/maven-runtime/src/main/java/org/apache/maven/shared/runtime/MavenProjectProperties.java
URL: http://svn.apache.org/viewvc/maven/shared/trunk/maven-runtime/src/main/java/org/apache/maven/shared/runtime/MavenProjectProperties.java?rev=658677&r1=658676&r2=658677&view=diff
==============================================================================
--- maven/shared/trunk/maven-runtime/src/main/java/org/apache/maven/shared/runtime/MavenProjectProperties.java (original)
+++ maven/shared/trunk/maven-runtime/src/main/java/org/apache/maven/shared/runtime/MavenProjectProperties.java Wed May 21 06:27:18 2008
@@ -26,7 +26,7 @@
  * <p>
  * More specifically, this object holds a project's group id, artifact id and version. This information is typically
  * generated by Maven and stored within the file
- * <code>/META-INF/maven/&lt;groupId&gt;/&lt;artifactId&gt;/pom.properties</code> in the packaged project.
+ * {@code META-INF/maven/&lt;groupId&gt;/&lt;artifactId&gt;/pom.properties} in the packaged project.
  * </p>
  * 
  * @author <a href="mailto:markhobson@gmail.com">Mark Hobson</a>
@@ -61,8 +61,8 @@
     // constructors -----------------------------------------------------------
 
     /**
-     * Creates a new <code>MavenProjectProperties</code> with the specified Maven project group id, artifact id and
-     * version properties.
+     * Creates a new {@code MavenProjectProperties} with the specified Maven project group id, artifact id and version 
+     * properties.
      * 
      * @param groupId
      *            the group id, not null
@@ -133,11 +133,13 @@
     @Override
     public int hashCode()
     {
-        int hashCode = groupId.hashCode();
+        int hashCode = 17;
+        
+        hashCode = ( hashCode * 37 ) + groupId.hashCode();
 
-        hashCode = ( hashCode * 31 ) + artifactId.hashCode();
+        hashCode = ( hashCode * 37 ) + artifactId.hashCode();
 
-        hashCode = ( hashCode * 31 ) + version.hashCode();
+        hashCode = ( hashCode * 37 ) + version.hashCode();
 
         return hashCode;
     }
@@ -148,6 +150,11 @@
     @Override
     public boolean equals( Object object )
     {
+        if ( object == this )
+        {
+            return true;
+        }
+        
         if ( !( object instanceof MavenProjectProperties ) )
         {
             return false;

Modified: maven/shared/trunk/maven-runtime/src/main/java/org/apache/maven/shared/runtime/MavenRuntime.java
URL: http://svn.apache.org/viewvc/maven/shared/trunk/maven-runtime/src/main/java/org/apache/maven/shared/runtime/MavenRuntime.java?rev=658677&r1=658676&r2=658677&view=diff
==============================================================================
--- maven/shared/trunk/maven-runtime/src/main/java/org/apache/maven/shared/runtime/MavenRuntime.java (original)
+++ maven/shared/trunk/maven-runtime/src/main/java/org/apache/maven/shared/runtime/MavenRuntime.java Wed May 21 06:27:18 2008
@@ -45,19 +45,18 @@
      * 
      * @param klass
      *            the class to introspect
-     * @return the properties for the specified class's Maven project
+     * @return the project properties for the specified class's Maven project
      * @throws MavenRuntimeException
      *             if an error occurred introspecting the Maven runtime environment
      */
     MavenProjectProperties getProjectProperties( Class<?> klass ) throws MavenRuntimeException;
 
     /**
-     * Obtains a list of simple properties for each Maven project running within the specified class loader.
+     * Obtains a list of basic properties for each Maven project accessible from the specified class loader.
      * 
      * @param classLoader
      *            the class loader to introspect
-     * @return a list of <code>MavenProjectProperties</code> objects for each Maven project found within the class
-     *         path
+     * @return a list of project properties for each Maven project found within the class path
      * @throws MavenRuntimeException
      *             if an error occurred introspecting the Maven runtime environment
      */
@@ -75,23 +74,22 @@
     MavenProject getProject( Class<?> klass ) throws MavenRuntimeException;
 
     /**
-     * Obtains a list of Maven projects running within the specified class loader.
+     * Obtains a list of Maven projects accessible from the specified class loader.
      * 
      * @param classLoader
      *            the class loader to introspect
-     * @return a list of <code>MavenProject</code> objects for each Maven project found within the class path
+     * @return a list of projects for each Maven project found within the class path
      * @throws MavenRuntimeException
      *             if an error occurred introspecting the Maven runtime environment
      */
     List<MavenProject> getProjects( ClassLoader classLoader ) throws MavenRuntimeException;
 
     /**
-     * Obtains a list of Maven projects running within the specified class loader ordered by their dependencies.
+     * Obtains a list of Maven projects accessible from the specified class loader ordered by their dependencies.
      * 
      * @param classLoader
      *            the class loader to introspect
-     * @return a list of <code>MavenProject</code> objects for each Maven project found within the class path ordered
-     *         by their dependencies
+     * @return a list of projects for each Maven project found within the class path ordered by their dependencies
      * @throws MavenRuntimeException
      *             if an error occurred introspecting the Maven runtime environment
      */

Modified: maven/shared/trunk/maven-runtime/src/main/java/org/apache/maven/shared/runtime/MavenRuntimeException.java
URL: http://svn.apache.org/viewvc/maven/shared/trunk/maven-runtime/src/main/java/org/apache/maven/shared/runtime/MavenRuntimeException.java?rev=658677&r1=658676&r2=658677&view=diff
==============================================================================
--- maven/shared/trunk/maven-runtime/src/main/java/org/apache/maven/shared/runtime/MavenRuntimeException.java (original)
+++ maven/shared/trunk/maven-runtime/src/main/java/org/apache/maven/shared/runtime/MavenRuntimeException.java Wed May 21 06:27:18 2008
@@ -37,7 +37,7 @@
     // constructors -----------------------------------------------------------
 
     /**
-     * Creates a new <code>MavenRuntimeException</code> with the specified detail message.
+     * Creates a new {@code MavenRuntimeException} with the specified detail message.
      * 
      * @param message
      *            the detail message
@@ -48,7 +48,7 @@
     }
 
     /**
-     * Creates a new <code>MavenRuntimeException</code> with the specified detail message and cause.
+     * Creates a new {@code MavenRuntimeException} with the specified detail message and cause.
      * 
      * @param message
      *            the detail message

Modified: maven/shared/trunk/maven-runtime/src/main/java/org/apache/maven/shared/runtime/MavenRuntimeVisitorUtils.java
URL: http://svn.apache.org/viewvc/maven/shared/trunk/maven-runtime/src/main/java/org/apache/maven/shared/runtime/MavenRuntimeVisitorUtils.java?rev=658677&r1=658676&r2=658677&view=diff
==============================================================================
--- maven/shared/trunk/maven-runtime/src/main/java/org/apache/maven/shared/runtime/MavenRuntimeVisitorUtils.java (original)
+++ maven/shared/trunk/maven-runtime/src/main/java/org/apache/maven/shared/runtime/MavenRuntimeVisitorUtils.java Wed May 21 06:27:18 2008
@@ -48,13 +48,13 @@
     private static final String MAVEN_PATH = "META-INF/maven";
 
     /**
-     * The path elements of a Maven project properties file, where <code>null</code> is a wildcard.
+     * The path elements of a Maven project properties file, where {@code null} is a wildcard.
      */
     private static final String[] PROPERTIES_PATH_TOKENS =
         new String[] { "META-INF", "maven", null, null, "pom.properties" };
 
     /**
-     * The path elements of a Maven project XML file, where <code>null</code> is a wildcard.
+     * The path elements of a Maven project XML file, where {@code null} is a wildcard.
      */
     private static final String[] XML_PATH_TOKENS = new String[] { "META-INF", "maven", null, null, "pom.xml" };
 
@@ -71,11 +71,11 @@
     // constructors -----------------------------------------------------------
 
     /**
-     * <code>MavenRuntimeVisitorUtils</code> is not intended to be instantiated.
+     * {@code MavenRuntimeVisitorUtils} is not intended to be instantiated.
      */
     private MavenRuntimeVisitorUtils()
     {
-        // private constructor for utility class
+        throw new AssertionError();
     }
 
     // public methods ---------------------------------------------------------
@@ -327,7 +327,7 @@
      * 
      * @param path
      *            the path to examine
-     * @return <code>true</code> if the specified path represents a Maven project properties file
+     * @return {@code true} if the specified path represents a Maven project properties file
      */
     private static boolean isProjectPropertiesPath( String path )
     {
@@ -339,7 +339,7 @@
      * 
      * @param path
      *            the path to examine
-     * @return <code>true</code> if the specified path represents a Maven project XML file
+     * @return {@code true} if the specified path represents a Maven project XML file
      */
     private static boolean isProjectXMLPath( String path )
     {
@@ -350,11 +350,11 @@
      * Gets whether the specified string arrays are equal, with wildcard support.
      * 
      * @param matchTokens
-     *            the string tokens to match, where <code>null</code> represents a wildcard
+     *            the string tokens to match, where {@code null} represents a wildcard
      * @param tokens
      *            the string tokens to test
-     * @return <code>true</code> if the <code>tokens</code> array equals the <code>matchTokens</code>, treating
-     *         any <code>null</code> <code>matchTokens</code> values as wildcards
+     * @return {@code true} if the {@code tokens} array equals the {@code matchTokens}, treating any {@code null}
+     *         {@code matchTokens} values as wildcards
      */
     private static boolean matches( String[] matchTokens, String[] tokens )
     {

Modified: maven/shared/trunk/maven-runtime/src/main/java/org/apache/maven/shared/runtime/PropertiesMavenRuntimeVisitor.java
URL: http://svn.apache.org/viewvc/maven/shared/trunk/maven-runtime/src/main/java/org/apache/maven/shared/runtime/PropertiesMavenRuntimeVisitor.java?rev=658677&r1=658676&r2=658677&view=diff
==============================================================================
--- maven/shared/trunk/maven-runtime/src/main/java/org/apache/maven/shared/runtime/PropertiesMavenRuntimeVisitor.java (original)
+++ maven/shared/trunk/maven-runtime/src/main/java/org/apache/maven/shared/runtime/PropertiesMavenRuntimeVisitor.java Wed May 21 06:27:18 2008
@@ -58,14 +58,14 @@
     // fields -----------------------------------------------------------------
 
     /**
-     * A list of the collected <code>MavenProjectProperties</code>.
+     * A list of the collected project properties.
      */
     private final List<MavenProjectProperties> projects;
 
     // constructors -----------------------------------------------------------
 
     /**
-     * Creates a new <code>PropertiesMavenRuntimeVisitor</code>.
+     * Creates a new {@code PropertiesMavenRuntimeVisitor}.
      */
     public PropertiesMavenRuntimeVisitor()
     {
@@ -97,7 +97,7 @@
     /**
      * Gets the collected Maven project properties.
      * 
-     * @return a list of the collected <code>MavenProjectProperties</code>
+     * @return a list of the collected project properties
      */
     public List<MavenProjectProperties> getProjects()
     {
@@ -107,11 +107,11 @@
     // private methods --------------------------------------------------------
 
     /**
-     * Parses the specified Maven project properties into a <code>MavenProjectProperties</code> object.
+     * Parses the specified Maven project properties into a {@code MavenProjectProperties} object.
      * 
      * @param url
      *            a URL to the Maven project properties
-     * @return a <code>MavenProjectProperties</code> object that represents the properties
+     * @return a {@code MavenProjectProperties} object that represents the properties
      * @throws MavenRuntimeException
      *             if an error occurs parsing the properties
      */

Modified: maven/shared/trunk/maven-runtime/src/main/java/org/apache/maven/shared/runtime/XMLMavenRuntimeVisitor.java
URL: http://svn.apache.org/viewvc/maven/shared/trunk/maven-runtime/src/main/java/org/apache/maven/shared/runtime/XMLMavenRuntimeVisitor.java?rev=658677&r1=658676&r2=658677&view=diff
==============================================================================
--- maven/shared/trunk/maven-runtime/src/main/java/org/apache/maven/shared/runtime/XMLMavenRuntimeVisitor.java (original)
+++ maven/shared/trunk/maven-runtime/src/main/java/org/apache/maven/shared/runtime/XMLMavenRuntimeVisitor.java Wed May 21 06:27:18 2008
@@ -48,14 +48,14 @@
     // fields -----------------------------------------------------------------
 
     /**
-     * A list of the collected <code>MavenProject</code>s.
+     * A list of the collected Maven projects.
      */
     private final List<MavenProject> projects;
 
     // constructors -----------------------------------------------------------
 
     /**
-     * Creates a new <code>XMLMavenRuntimeVisitor</code>.
+     * Creates a new {@code XMLMavenRuntimeVisitor}.
      */
     public XMLMavenRuntimeVisitor()
     {
@@ -87,7 +87,7 @@
     /**
      * Gets the collected Maven projects.
      * 
-     * @return an unmodifiable list of the collected <code>MavenProject</code>s
+     * @return an unmodifiable list of the collected Maven projects
      */
     public List<MavenProject> getProjects()
     {
@@ -97,7 +97,7 @@
     /**
      * Gets the collected Maven projects ordered by dependencies.
      * 
-     * @return an unmodifiable list of the collected <code>MavenProject</code>s ordered by dependencies
+     * @return an unmodifiable list of the collected Maven projects ordered by dependencies
      * @throws MavenRuntimeException
      *             if an error occurred ordering the projects
      */
@@ -122,11 +122,11 @@
     // private methods --------------------------------------------------------
 
     /**
-     * Parses the specified Maven project XML into a <code>MavenProject</code> object.
+     * Parses the specified Maven project XML into a {@code MavenProject} object.
      * 
      * @param url
      *            a URL to the Maven project XML
-     * @return a <code>MavenProject</code> object that represents the XML
+     * @return a {@code MavenProject} object that represents the XML
      * @throws MavenRuntimeException
      *             if an error occurs parsing the XML
      */
@@ -172,15 +172,15 @@
      *            the class that represents the type of the required generic list
      * @return the generic list
      */
-    private static <T> List<T> genericList(List<?> list, Class<T> type)
+    private static <T> List<T> genericList( List<?> list, Class<T> type )
     {
         List<T> genericList = new ArrayList<T>();
-        
-        for (Object element : list)
+
+        for ( Object element : list )
         {
             genericList.add( type.cast( element ) );
         }
-        
+
         return genericList;
     }
 }

Modified: maven/shared/trunk/maven-runtime/src/test/java/org/apache/maven/shared/runtime/DefaultMavenRuntimeTest.java
URL: http://svn.apache.org/viewvc/maven/shared/trunk/maven-runtime/src/test/java/org/apache/maven/shared/runtime/DefaultMavenRuntimeTest.java?rev=658677&r1=658676&r2=658677&view=diff
==============================================================================
--- maven/shared/trunk/maven-runtime/src/test/java/org/apache/maven/shared/runtime/DefaultMavenRuntimeTest.java (original)
+++ maven/shared/trunk/maven-runtime/src/test/java/org/apache/maven/shared/runtime/DefaultMavenRuntimeTest.java Wed May 21 06:27:18 2008
@@ -40,7 +40,7 @@
 import com.sun.appserv.ClassLoaderUtil;
 
 /**
- * Tests <code>DefaultMavenRuntime</code>.
+ * Tests {@code DefaultMavenRuntime}.
  * 
  * @author <a href="mailto:markhobson@gmail.com">Mark Hobson</a>
  * @version $Id$

Modified: maven/shared/trunk/maven-runtime/src/test/java/org/apache/maven/shared/runtime/MavenProjectPropertiesTest.java
URL: http://svn.apache.org/viewvc/maven/shared/trunk/maven-runtime/src/test/java/org/apache/maven/shared/runtime/MavenProjectPropertiesTest.java?rev=658677&r1=658676&r2=658677&view=diff
==============================================================================
--- maven/shared/trunk/maven-runtime/src/test/java/org/apache/maven/shared/runtime/MavenProjectPropertiesTest.java (original)
+++ maven/shared/trunk/maven-runtime/src/test/java/org/apache/maven/shared/runtime/MavenProjectPropertiesTest.java Wed May 21 06:27:18 2008
@@ -22,7 +22,7 @@
 import junit.framework.TestCase;
 
 /**
- * Tests <code>MavenProjectProperties</code>.
+ * Tests {@code MavenProjectProperties}.
  * 
  * @author <a href="mailto:markhobson@gmail.com">Mark Hobson</a>
  * @version $Id$

Modified: maven/shared/trunk/maven-runtime/src/test/java/org/apache/maven/shared/runtime/MavenRuntimeVisitorUtilsTest.java
URL: http://svn.apache.org/viewvc/maven/shared/trunk/maven-runtime/src/test/java/org/apache/maven/shared/runtime/MavenRuntimeVisitorUtilsTest.java?rev=658677&r1=658676&r2=658677&view=diff
==============================================================================
--- maven/shared/trunk/maven-runtime/src/test/java/org/apache/maven/shared/runtime/MavenRuntimeVisitorUtilsTest.java (original)
+++ maven/shared/trunk/maven-runtime/src/test/java/org/apache/maven/shared/runtime/MavenRuntimeVisitorUtilsTest.java Wed May 21 06:27:18 2008
@@ -30,7 +30,7 @@
 import org.easymock.IMocksControl;
 
 /**
- * Tests <code>MavenRuntimeVisitorUtils</code>.
+ * Tests {@code MavenRuntimeVisitorUtils}.
  * 
  * @author <a href="mailto:markhobson@gmail.com">Mark Hobson</a>
  * @version $Id$