aboutsummaryrefslogtreecommitdiffstats
path: root/ajdoc/src
diff options
context:
space:
mode:
authoraclement <aclement>2006-10-23 12:49:11 +0000
committeraclement <aclement>2006-10-23 12:49:11 +0000
commit70dda814951a9cf2f79e958b2bd93f66f390b6da (patch)
treea440fce9ef278cc2bf3b32272622d62b9d371dce /ajdoc/src
parent757004ca6702a97369aac2ba62532f13ac5ced36 (diff)
downloadaspectj-70dda814951a9cf2f79e958b2bd93f66f390b6da.tar.gz
aspectj-70dda814951a9cf2f79e958b2bd93f66f390b6da.zip
tests and fixes for 148906: Support -Xlintfile for ajdoc
Diffstat (limited to 'ajdoc/src')
-rw-r--r--ajdoc/src/org/aspectj/tools/ajdoc/CompilerWrapper.java6
-rw-r--r--ajdoc/src/org/aspectj/tools/ajdoc/Config.java6
-rw-r--r--ajdoc/src/org/aspectj/tools/ajdoc/HtmlDecorator.java24
-rw-r--r--ajdoc/src/org/aspectj/tools/ajdoc/Main.java42
4 files changed, 62 insertions, 16 deletions
diff --git a/ajdoc/src/org/aspectj/tools/ajdoc/CompilerWrapper.java b/ajdoc/src/org/aspectj/tools/ajdoc/CompilerWrapper.java
index 8c4e90d5b..cf8c15edf 100644
--- a/ajdoc/src/org/aspectj/tools/ajdoc/CompilerWrapper.java
+++ b/ajdoc/src/org/aspectj/tools/ajdoc/CompilerWrapper.java
@@ -11,6 +11,8 @@
* ******************************************************************/
package org.aspectj.tools.ajdoc;
+import org.aspectj.bridge.IMessage;
+
/**
* Wrapper for ajdoc's use of the AspectJ compiler.
*
@@ -29,4 +31,8 @@ public class CompilerWrapper extends org.aspectj.tools.ajc.Main {
public static boolean hasErrors() {
return INSTANCE.ourHandler.getErrors().length > 0;
}
+
+ public static IMessage[] getErrors() {
+ return INSTANCE.ourHandler.getErrors();
+ }
}
diff --git a/ajdoc/src/org/aspectj/tools/ajdoc/Config.java b/ajdoc/src/org/aspectj/tools/ajdoc/Config.java
index aaa214fcf..eeea9d9c9 100644
--- a/ajdoc/src/org/aspectj/tools/ajdoc/Config.java
+++ b/ajdoc/src/org/aspectj/tools/ajdoc/Config.java
@@ -36,9 +36,11 @@ interface Config {
" -argfile <file> Build config file (wildcards not supported)\n" +
" -verbose Output messages about what Javadoc is doing\n" +
" -v Print out the version of ajdoc\n" +
- " -source <version> set source level (1.3, 1.4 or 1.5)" +
+ " -source <version> set source level (1.3, 1.4 or 1.5)\n" +
+ "\n" +
+ "as well as the AspectJ Compiler options.\n" +
"\n"+
"If an argument is of the form @<filename>, the file will be interpreted as\n"+
- "a line delimited set of arguments to insert into the argument list.";
+ "a line delimited set of arguments to insert into the argument list.\n";
}
diff --git a/ajdoc/src/org/aspectj/tools/ajdoc/HtmlDecorator.java b/ajdoc/src/org/aspectj/tools/ajdoc/HtmlDecorator.java
index e4225caf5..fd9821f92 100644
--- a/ajdoc/src/org/aspectj/tools/ajdoc/HtmlDecorator.java
+++ b/ajdoc/src/org/aspectj/tools/ajdoc/HtmlDecorator.java
@@ -431,12 +431,24 @@ class HtmlDecorator {
}
private static boolean isAboveVisibility(IProgramElement element) {
- return
- (docVisibilityModifier.equals("private")) || // everything
- (docVisibilityModifier.equals("package") && element.getAccessibility().equals(IProgramElement.Accessibility.PACKAGE)) || // package
- (docVisibilityModifier.equals("protected") && (element.getAccessibility().equals(IProgramElement.Accessibility.PROTECTED) ||
- element.getAccessibility().equals(IProgramElement.Accessibility.PUBLIC))) ||
- (docVisibilityModifier.equals("public") && element.getAccessibility().equals(IProgramElement.Accessibility.PUBLIC));
+ IProgramElement.Accessibility acc = element.getAccessibility();
+ if (docVisibilityModifier.equals("private")) {
+ // show all classes and members
+ return true;
+ } else if (docVisibilityModifier.equals("package")) {
+ // show package, protected and public classes and members
+ return acc.equals(IProgramElement.Accessibility.PACKAGE)
+ || acc.equals(IProgramElement.Accessibility.PROTECTED)
+ || acc.equals(IProgramElement.Accessibility.PUBLIC);
+ } else if (docVisibilityModifier.equals("protected")) {
+ // show protected and public classes and members
+ return acc.equals(IProgramElement.Accessibility.PROTECTED)
+ || acc.equals(IProgramElement.Accessibility.PUBLIC);
+ } else if (docVisibilityModifier.equals("public")){
+ // show public classes and members
+ return acc.equals(IProgramElement.Accessibility.PUBLIC);
+ }
+ return false;
}
private static String genAccessibility(IProgramElement decl) {
diff --git a/ajdoc/src/org/aspectj/tools/ajdoc/Main.java b/ajdoc/src/org/aspectj/tools/ajdoc/Main.java
index c6e1dcb77..913e07992 100644
--- a/ajdoc/src/org/aspectj/tools/ajdoc/Main.java
+++ b/ajdoc/src/org/aspectj/tools/ajdoc/Main.java
@@ -19,6 +19,7 @@ import java.util.*;
import java.io.FileFilter;
+import org.aspectj.bridge.IMessage;
import org.aspectj.bridge.Version;
import org.aspectj.util.FileUtil;
@@ -64,6 +65,8 @@ public class Main implements Config {
private static boolean deleteTempFilesOnExit = true;
private static boolean aborted = false;
+ private static IMessage[] errors;
+ private static boolean shownAjdocUsageMessage = false;
// creating a local variable to enable us to create the ajdocworkingdir
// in a local sandbox during testing
@@ -117,6 +120,7 @@ public class Main implements Config {
if (CompilerWrapper.hasErrors()) {
System.out.println(FAIL_MESSAGE);
aborted = true;
+ errors = CompilerWrapper.getErrors();
return;
}
@@ -454,11 +458,7 @@ public class Main implements Config {
for (int i = 0; i < vargs.size() ; i++) {
String arg = (String)vargs.get(i);
ignoreArg = false;
- if ( addNextToAJCOptions ) {
- ajcOptions.addElement( arg );
- addNextToAJCOptions = false;
- }
- if ( addNextAsDocDir ) {
+ if (addNextAsDocDir) {
docDir = arg;
addNextAsDocDir = false;
}
@@ -521,7 +521,7 @@ public class Main implements Config {
System.out.println("> Ignoring unsupported option: -use");
} else if (arg.equals("-splitindex")) {
// passed to javadoc
- } else if (arg.startsWith("-") || addNextAsOption) {
+ } else if (arg.startsWith("-") || addNextAsOption || addNextToAJCOptions) {
if ( arg.equals( "-private" ) ) {
docModifier = "private";
} else if ( arg.equals( "-package" ) ) {
@@ -553,8 +553,25 @@ public class Main implements Config {
|| arg.equals("-noindex")) {
// pass through
//System.err.println("> ignoring unsupported option: " + arg);
- } else if ( addNextAsOption ) {
- // pass through
+ } else if (addNextToAJCOptions || addNextAsOption) {
+ // deal with these two options together even though effectively
+ // just falling through if addNextAsOption is true. Otherwise
+ // will have to ensure check "addNextToAJCOptions" before
+ // "addNextAsOption" so as the options are added to the
+ // correct lists.
+ if (addNextToAJCOptions) {
+ ajcOptions.addElement(arg);
+ if (!arg.startsWith("-")) {
+ addNextToAJCOptions = false;
+ }
+ if (!addNextAsOption) {
+ continue;
+ }
+ }
+ } else if (arg.startsWith("-")) {
+ ajcOptions.addElement(arg);
+ addNextToAJCOptions = true;
+ continue;
} else {
System.err.println("> unrecognized argument: " + arg);
displayHelpAndExit( null );
@@ -672,6 +689,7 @@ public class Main implements Config {
static void displayHelpAndExit(String message) {
+ shownAjdocUsageMessage = true;
if (message != null) {
System.err.println(message);
System.err.println();
@@ -712,6 +730,14 @@ public class Main implements Config {
return aborted;
}
+ public static IMessage[] getErrors() {
+ return errors;
+ }
+
+ public static boolean hasShownAjdocUsageMessage() {
+ return shownAjdocUsageMessage;
+ }
+
/**
* Sets the output working dir to be <fullyQualifiedOutputDir>\ajdocworkingdir
* Useful in testing to redirect the ajdocworkingdir to the sandbox