Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Small fixes #56

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions src/main/java/org/umlgraph/doclet/ClassGraph.java
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ private Align() {

protected Map<String, ClassInfo> classnames = new HashMap<String, ClassInfo>();
protected Set<String> rootClasses;
protected Map<String, ClassDoc> rootClassdocs = new HashMap<String, ClassDoc>();
protected Map<String, ClassDoc> rootClassdocs = new HashMap<String, ClassDoc>();
protected OptionProvider optionProvider;
protected PrintWriter w;
protected ClassDoc collectionClassDoc;
Expand Down Expand Up @@ -200,7 +200,7 @@ private String type(Options opt, Type t, boolean generics) {
private String typeParameters(Options opt, ParameterizedType t) {
if (t == null)
return "";
StringBuffer tp = new StringBuffer(1000).append("&lt;");
StringBuilder tp = new StringBuilder(1000).append("&lt;");
Type args[] = t.typeArguments();
for (int i = 0; i < args.length; i++) {
tp.append(type(opt, args[i], true));
Expand Down Expand Up @@ -439,7 +439,7 @@ else if (opt.postfixPackage && idx > 0 && idx < (qualifiedName.length() - 1)) {
if (ecs.length == 0) {
tableLine(Align.LEFT, "");
} else {
for (FieldDoc fd : c.enumConstants()) {
for (FieldDoc fd : ecs) {
tableLine(Align.LEFT, fd.name());
}
}
Expand Down Expand Up @@ -673,7 +673,8 @@ public void printInferredRelations(ClassDoc c) {
}
}

/** Returns an array representing the imported classes of c.
/**
* Returns an array representing the imported classes of c.
* Disables the deprecation warning, which is output, because the
* imported classed are an implementation detail.
*/
Expand Down Expand Up @@ -848,8 +849,10 @@ public String classToUrl(String className) {
.append(".html").toString();
}

/** Dot prologue
* @throws IOException */
/**
* Dot prologue
* @throws IOException
*/
public void prologue() throws IOException {
Options opt = optionProvider.getGlobalOptions();
OutputStream os;
Expand Down
2 changes: 0 additions & 2 deletions src/main/java/org/umlgraph/doclet/ClassInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,5 @@ public RelationPattern getRelation(String dest) {
public static void reset() {
classNumber = 0;
}


}

1 change: 0 additions & 1 deletion src/main/java/org/umlgraph/doclet/ContextMatcher.java
Original file line number Diff line number Diff line change
Expand Up @@ -192,5 +192,4 @@ public void close() throws IOException {
}

}

}
1 change: 0 additions & 1 deletion src/main/java/org/umlgraph/doclet/ContextView.java
Original file line number Diff line number Diff line change
Expand Up @@ -116,5 +116,4 @@ public void overrideForClass(Options opt, String className) {
if (!(matcher.matches(className) || opt.matchesIncludeExpression(className)))
opt.setOption(HIDE_OPTIONS);
}

}
1 change: 0 additions & 1 deletion src/main/java/org/umlgraph/doclet/InterfaceMatcher.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,4 @@ public boolean matches(String name) {
ClassDoc cd = root.classNamed(name);
return cd == null ? false : matches(cd);
}

}
3 changes: 1 addition & 2 deletions src/main/java/org/umlgraph/doclet/Options.java
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ public class Options implements Cloneable, OptionProvider {
}

@Override
public Object clone() {
public Object clone() {
Options clone = null;
try {
clone = (Options) super.clone();
Expand Down Expand Up @@ -680,5 +680,4 @@ public String toString() {
}
return sb.toString();
}

}
2 changes: 0 additions & 2 deletions src/main/java/org/umlgraph/doclet/PackageMatcher.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ public class PackageMatcher implements ClassMatcher {
protected PackageDoc packageDoc;

public PackageMatcher(PackageDoc packageDoc) {
super();
this.packageDoc = packageDoc;
}

Expand All @@ -21,5 +20,4 @@ public boolean matches(String name) {
return true;
return false;
}

}
1 change: 0 additions & 1 deletion src/main/java/org/umlgraph/doclet/PackageView.java
Original file line number Diff line number Diff line change
Expand Up @@ -77,5 +77,4 @@ public void overrideForClass(Options opt, String className) {
if (!included || this.opt.matchesHideExpression(className))
opt.setOption(HIDE);
}

}
2 changes: 1 addition & 1 deletion src/main/java/org/umlgraph/doclet/PatternMatcher.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
*
*
*/

package org.umlgraph.doclet;

import java.util.regex.Pattern;
Expand All @@ -39,5 +40,4 @@ public boolean matches(ClassDoc cd) {
public boolean matches(String name) {
return pattern.matcher(name).matches();
}

}
3 changes: 1 addition & 2 deletions src/main/java/org/umlgraph/doclet/RelationDirection.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,4 @@ public boolean contains(RelationDirection d) {
public RelationDirection inverse() {
return this == IN ? OUT : this == OUT ? IN : this;
}

};
}
1 change: 0 additions & 1 deletion src/main/java/org/umlgraph/doclet/RelationPattern.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,5 +46,4 @@ public boolean matchesOne(RelationPattern relationPattern) {
}
return false;
}

}
1 change: 0 additions & 1 deletion src/main/java/org/umlgraph/doclet/SubclassMatcher.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,4 @@ public boolean matches(String name) {
ClassDoc cd = root.classNamed(name);
return cd == null ? false : matches(cd);
}

}
4 changes: 2 additions & 2 deletions src/main/java/org/umlgraph/doclet/UmlGraphDoc.java
Original file line number Diff line number Diff line change
Expand Up @@ -138,12 +138,12 @@ private static void runGraphviz(String dotExecutable, String outputFolder, Strin
dotExecutable = "dot";
}
File dotFile = new File(outputFolder, packageName.replace(".", "/") + "/" + name + ".dot");
File svgFile = new File(outputFolder, packageName.replace(".", "/") + "/" + name + ".svg");
File svgFile = new File(outputFolder, packageName.replace(".", "/") + "/" + name + ".svg");

try {
Process p = Runtime.getRuntime().exec(new String [] {
dotExecutable,
"-Tsvg",
"-Tsvg",
"-o",
svgFile.getAbsolutePath(),
dotFile.getAbsolutePath()
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/umlgraph/doclet/Version.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Automatically generated file */
package org.umlgraph.doclet;
class Version { public static String VERSION = "R5_7_2-60-g0e99a6";}
class Version { public static String VERSION = "281411";}

2 changes: 1 addition & 1 deletion src/main/java/org/umlgraph/doclet/View.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
*
*
*/

package org.umlgraph.doclet;

import java.util.ArrayList;
Expand Down Expand Up @@ -169,5 +170,4 @@ public void overrideForClass(Options opt, String className) {
public String getDisplayName() {
return "view " + viewDoc.name();
}

}
1 change: 1 addition & 0 deletions src/main/java/org/umlgraph/doclet/Visibility.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
*
*
*/

package org.umlgraph.doclet;

import com.sun.javadoc.ProgramElementDoc;
Expand Down
5 changes: 2 additions & 3 deletions src/test/java/org/umlgraph/test/BasicTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,13 @@ public static void main(String[] args) throws IOException {
for (String className : differences) {
pw.println(className);
}
System.exit(1);
} else {
pw.println("GOOD, all files are structurally equal");
}
pw.println();
pw.println();
pw.flush();
System.exit(differences.size() > 0 ? 1 : 0);
}

private static void performViewTests(List<String> differences, File outFolder)
Expand Down Expand Up @@ -98,7 +98,7 @@ private static void performViewTests(List<String> differences, File outFolder)
private static List<String> getViewList(File viewFolder) {
if (!viewFolder.exists())
throw new RuntimeException("The folder " + viewFolder.getAbsolutePath()
+ " does not exists.");
+ " does not exist.");
else if (!viewFolder.isDirectory())
throw new RuntimeException(viewFolder.getAbsolutePath() + " is not a folder!.");
else if (!viewFolder.canRead())
Expand Down Expand Up @@ -145,5 +145,4 @@ private static void compare(List<String> differences, File dotFile, File refFile
differences.add(dotFile.getName() + " is different from the reference");
}
}

}
1 change: 0 additions & 1 deletion src/test/java/org/umlgraph/test/DotDiff.java
Original file line number Diff line number Diff line change
Expand Up @@ -304,5 +304,4 @@ public String toString() {
return "Arc: " + from.label + " -> " + to.label + "; " + line;
}
}

}
1 change: 0 additions & 1 deletion src/test/java/org/umlgraph/test/RunDoc.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,4 @@ private static void runDoclet(String[] options) {
com.sun.tools.javadoc.Main.execute("UMLGraph test", pw, pw, pw,
"org.umlgraph.doclet.UmlGraphDoc", options);
}

}
2 changes: 0 additions & 2 deletions src/test/java/org/umlgraph/test/RunOne.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,4 @@ public static void runSingleClass(String className) {
private static void runDoclet(String[] options) {
com.sun.tools.javadoc.Main.execute("UMLGraph test", pw, pw, pw, "org.umlgraph.doclet.UmlGraph", options);
}


}
3 changes: 2 additions & 1 deletion src/test/java/org/umlgraph/test/SimpleFileFilter.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
*
*
*/

package org.umlgraph.test;

import java.io.File;
Expand All @@ -31,4 +32,4 @@ public SimpleFileFilter(String ext) {
public boolean accept(File dir, String name) {
return name.endsWith(extension);
}
}
}
19 changes: 8 additions & 11 deletions src/test/java/org/umlgraph/test/TestUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@
public class TestUtils {

/**
* Simple text file diffing: will tell you if two text files are line by
* line equals, and will stop at the first difference found.
* @throws IOException
*/
* Simple text file diffing: will tell you if two text files are line by
* line equals, and will stop at the first difference found.
* @throws IOException
*/
public static boolean textFilesEquals(PrintWriter pw, File refTextFile, File outTextFile)
throws IOException {
BufferedReader refReader = null, outReader = null;
Expand Down Expand Up @@ -123,23 +123,20 @@ public static void printList(PrintWriter pw, String message, List<?> extraOut) {
}

/**
* Deletes the content of the folder, eventually in a recursive way (but
* avoids deleting eventual .cvsignore files and CVS folders)
*/
* Deletes the content of the folder, eventually in a recursive way
*/
public static void cleanFolder(File folder, boolean recurse) {
for (File f : folder.listFiles()) {
if (f.isDirectory() && !f.getName().equals("CVS")) {
if (f.isDirectory()) {
if (recurse) {
cleanFolder(f, true);
if (f.list().length == 0)
f.delete();
}
} else if (!f.getName().equals(".cvsignore")) {
} else {
f.delete();
}

}

}

}
34 changes: 15 additions & 19 deletions src/test/java/org/umlgraph/test/UmlDocTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
*
*
*/

package org.umlgraph.test;

import java.io.File;
Expand Down Expand Up @@ -78,24 +79,21 @@ private static void runTest(List<String> differences) throws IOException {
}

/**
* Ensures that reference and output have the same contents in terms of:
* <ul>
* <li> html files </li>
* <li> dot files </li>
* <li> folders </li>
* </ul>
* @throws IOException
*/
* Ensures that reference and output have the same contents in terms of:
* <ul>
* <li> html files </li>
* <li> dot files </li>
* <li> folders </li>
* </ul>
* @throws IOException
*/
private static void compareDocletOutputs(List<String> differences, File refFolder,
File outFolder) throws IOException {
if(refFolder.getName().equals("CVS"))
return;

if (!refFolder.exists() || !refFolder.isDirectory())
throw new IllegalArgumentException("Reference does not exists or is not a folder: "
throw new IllegalArgumentException("Reference does not exist or is not a folder: "
+ refFolder.getAbsolutePath());
if (!outFolder.exists() || !outFolder.isDirectory())
throw new IllegalArgumentException("Output does not exists or is not a folder: "
throw new IllegalArgumentException("Output does not exist or is not a folder: "
+ outFolder.getAbsolutePath());

// get elements and sort
Expand Down Expand Up @@ -142,17 +140,15 @@ private static void compareDocletOutputs(List<String> differences, File refFolde
}

/**
* Runs the UmlGraphDoc doclet
* @param options
*/
* Runs the UmlGraphDoc doclet
* @param options
*/
private static void runDoclet(String[] options) {
pw.print("Run javadoc -doclet " + doclet);
for (String o : options)
pw.print(" " + o);
pw.print(o + " ");
pw.println();
com.sun.tools.javadoc.Main.execute("UMLDoc test", pw, pw, pw,
doclet, options);
System.exit(0);
}

}
Loading