DoctorJ
Usage
The general format is:
% doctorj [ options ] files ...
files may be either Java source files, or directories. In the case of a directory, it is treated as the top of a project; therefore, the directory is processed recursively for all files ending in .java.
default usage
This will use all defaults, checking documentation for errors:
% doctorj /home/me/projects/project
or
% doctorj MyJavaFile.java
documentation
The man page, as HTML, may be viewed here.
emacs integration
DoctorJ is "Emacs-aware", that is, when in Emacs, its output mode switches to one compliant with the format Emacs expects.
examples
The following is an example of the output from the documentation analyzer, the statistics generator, and the syntax analyzer.
input code
package com.foobar.Graphics;
import java.lang.String;
import java.util.*;
/**
* An example program for the DoctorJ application suitte.
*
* @since 1.2.3
* @author Carl Gustav
* @author
* @throws NullPointerExceptions These are thrown throughout the code.
* @see other classes in this project.
*/
public class Example extends Object {
static final transient public int ZERO = 0;
/**
* The constructor.
*
* @return quits if the value is already set.
*/
public Example() {
super();
}
/**
* <description>
*
* @param
* @author
* @since
* @version
*/
public void skeletal() {
int hashCode = super.hashCode();
int a = -1;
switch (hashCode) {
case 0:
a = 14;
case 1:
a = 23;
break;
}
if (a > 4);
System.out.println("a is greater than 4");
}
/**
* A function in which there is confusion between types and names.
*
* @param Object The first value.
* @param String The second value.
* @return int What is returned.
*/
public int mixed(Object one, String str) {
return 0;
}
/**
* A test function that takes 4 arguments and sums them.
*
* @param first The first value.
* @param third The third value.
* @param secodn The second value.
* @param fourth The fourth value.
* @returns the sum of the values.
*/
public int sum(int first, int second, int third) throws Exception {
return first + second + third;
}
/**
* The main program.
*
* @author Robin Steele
* @param argv The list of arguments.
*/
public static void main(String[] args) {
}
}
documentation check
In Example.java:
8. * An example program for the DoctorJ application suitte.
<---->
*** Word 'suitte' appears to be misspelled. Closest matches: suite, site, sitter
11. * @author Carl Gustav
<----->
*** Tag in improper order
12. * @author
<----->
*** @author without name text
13. * @throws NullPointerExceptions These are thrown throughout the code.
<----->
*** Tag not valid for class
18. static final transient public int ZERO = 0;
<-->
*** Undocumented public field
21. * The constructor.
<-------------->
*** Summary sentence too short
23. * @return quits if the value is already set.
<----->
*** Tag not valid for constructor
30. * <description>
<----------->
*** Summary sentence does not end with period
32. * @param
<---->
*** Parameters documented but no code parameters
33. * @author
<----->
*** Tag in improper order
34. * @since
<---->
*** @since without text
35. * @version
<------>
*** Tag not valid for method
54. * @param Object The first value.
<---->
*** Parameter refers to type, not name
55. * @param String The second value.
<---->
*** Parameter refers to type, not name
56. * @return int What is returned.
<->
*** @return refers to method return type
67. * @param secodn The second value.
<---->
*** Parameter misspelled
68. * @param fourth The fourth value.
<---->
*** Parameter not in code
69. * @returns the sum of the values.
<------>
*** Tag in improper order
71. public int sum(int first, int second, int third) throws Exception {
<------->
*** Exception not documented
76. * The main program.
<--------------->
*** Summary sentence too short
78. * @author Robin Steele
<----->
*** Tag not valid for method
79. * @param argv The list of arguments.
<-->
*** Parameter misspelled
Releases
| version | date | changes |
|---|---|---|
| 5.0.0 | DoctorJ has been rewritten in Java. Errors and warnings have been simplified, so that there are now errors, and four levels of warnings, roughly arrayed by accessibility (public, protected, package, and private) of an item, such as a class, method, or field. Initial version. | |
| 5.1.0 | 2006-09-18 | DoctorJ has been rewritten (again), using the Java parser and AST from PMD. This adds support for Java 1.5. This version also includes improvements in performance and memory consumption. Despite changes in the size of word lists in GNU/Linux distributions, DoctorJ still uses its own word list of 140,000 words. |
| 5.1.1 | 2006-09-21 | By default, all errors and warnings are now reported. In previous versions, only errors were reported by default. The --warning option has been replaced with the --level option. |
| 5.1.2 | Detection of run-time exceptions and errors has been improved, which reduces the number of reported @throws for exceptions not declared. Note that DoctorJ uses the current JVM (not source code) to determine which exceptions are run-time or errors, so users should set their classpath to include the class or jar files for the project being analyzed. | |
| 5.2.0 | 2011-11-13 | This version adds the feature to spell-check strings of a minimal length in words. Much of the code has been rewritten. |