JavaDoc Problems

From Jaxen's BaseXPath class:

Are these methods too simple to fail?

    /** Return the original expression text.
     *
     *  @return the normalized XPath expression string
     */
    public String toString()
    {
        return this.exprText;
    }

    /** Returns the string version of this xpath.
     *
     *  @return the normalized XPath expression string
     *
     *  @see #toString
     */
    public String debug()
    {
        return this.xpath.toString();
    }

The second one wasn't tested. Testing revealed that it didn't return what the JavaDoc said it did. In this case, the JavaDoc was incorrect and needed to be repaired.


    /** Returns a string representation of the parse tree.
     *
     *  @return a string representation of the parse tree.
     */
    public String debug()
    {
        return this.xpath.toString();
    }
    

Further testing revealed a problem in the toString() method in DefaultNameStep that was implicitly invoked by this method.

http://cvs.jaxen.codehaus.org/viewrep/jaxen/jaxen/src/java/main/org/jaxen/expr/DefaultNameStep.java?r1=1.46&r2=1.47
Previous | Next | Top | Cafe con Leche

Copyright 2005 Elliotte Rusty Harold
elharo@metalab.unc.edu
Last Modified October 3, 2005