Browse Source

again aligning task with xlint reality

tags/V_1_1_b2
wisberg 21 years ago
parent
commit
476c70c1ad

+ 52
- 43
docs/dist/doc/ant-ajc-task.html View File

<h3> <h3>
Parameters</h3> Parameters</h3>


<h4>Parameters supported by <code>ajc</code></h4>

<p>
<table BORDER CELLSPACING=0 CELLPADDING=2 > <table BORDER CELLSPACING=0 CELLPADDING=2 >
<tr> <tr>
<td VALIGN=TOP><b>Attribute</b></td> <td VALIGN=TOP><b>Attribute</b></td>
<th colspan="3">Specifying source and destination files</th> <th colspan="3">Specifying source and destination files</th>
</tr> </tr>


<td VALIGN=TOP>sourceroots</td>
<td VALIGN=TOP>sourceRoots</td>


<td VALIGN=TOP>a list of base directories of the source files.
<td VALIGN=TOP>Base directory of the source files.
All source files (.java and .aj) in the base directories are compiled. All source files (.java and .aj) in the base directories are compiled.
May also be specified as a <a href="nestedElements">nested element</a>. May also be specified as a <a href="nestedElements">nested element</a>.
</td> </td>
<td rowspan="2" ALIGN=CENTER VALIGN=TOP>Yes, in incremental mode.</td>
</tr>

<td VALIGN=TOP>sourceRootsList</td>

<td VALIGN=TOP>Comma-delimited list of base directories source root
directories.
May also be specified as a <a href="nestedElements">nested element</a>.
</td>


<td ALIGN=CENTER VALIGN=TOP>Yes, in incremental mode.</td>
</tr> </tr>


<tr> <tr>


<tr> <tr>
<td VALIGN=TOP>classpath</td> <td VALIGN=TOP>classpath</td>
<td VALIGN=TOP>the classpath required by the source files to compile.
<td VALIGN=TOP>The classpath required by the source files to compile.
May also be specified as a <a href="nestedElements">nested element</a>. May also be specified as a <a href="nestedElements">nested element</a>.
</td> </td>
<td ALIGN=CENTER VALIGN=TOP>No</td> <td ALIGN=CENTER VALIGN=TOP>No</td>


<tr> <tr>
<td VALIGN=TOP>srcdir</td> <td VALIGN=TOP>srcdir</td>
<td VALIGN=TOP>the nested source base directory to compile,
<td VALIGN=TOP>The nested source base directory to compile,
specified as a <a href="nestedElements">nested element</a>. specified as a <a href="nestedElements">nested element</a>.
</td> </td>
<td ALIGN=CENTER VALIGN=TOP>No</td> <td ALIGN=CENTER VALIGN=TOP>No</td>


<tr> <tr>
<td VALIGN=TOP>aspectpath</td> <td VALIGN=TOP>aspectpath</td>
<td VALIGN=TOP>the aspectpath to use -- like classpath, only for
<td VALIGN=TOP>The aspectpath to use -- like classpath, only for
read-only, binary aspect libraries (only accepts jar/zip files, no directories). read-only, binary aspect libraries (only accepts jar/zip files, no directories).
May also be specified as a <a href="nestedElements">nested element</a>. May also be specified as a <a href="nestedElements">nested element</a>.
</td> </td>


<tr> <tr>
<td VALIGN=TOP>bootclasspath</td> <td VALIGN=TOP>bootclasspath</td>
<td VALIGN=TOP>location of bootstrap class files.</td>
<td VALIGN=TOP>Location of bootstrap class files.</td>
<td ALIGN=CENTER VALIGN=TOP>No</td> <td ALIGN=CENTER VALIGN=TOP>No</td>
</tr> </tr>


<tr> <tr>
<td VALIGN=TOP>classpathref</td> <td VALIGN=TOP>classpathref</td>
<td VALIGN=TOP>the classpath to use, given as a<a href="http://jakarta.apache.org/ant/manual/using.html#references">
<td VALIGN=TOP>The classpath to use, given as a<a href="http://jakarta.apache.org/ant/manual/using.html#references">
reference</a> to a PATH defined elsewhere.</td> reference</a> to a PATH defined elsewhere.</td>
<td ALIGN=CENTER VALIGN=TOP>No</td> <td ALIGN=CENTER VALIGN=TOP>No</td>
</tr> </tr>


<tr> <tr>
<td VALIGN=TOP>bootclasspathref</td> <td VALIGN=TOP>bootclasspathref</td>
<td VALIGN=TOP>location of bootstrap class files, given as a <a href="http://jakarta.apache.org/ant/manual/using.html#references">reference</a>
<td VALIGN=TOP>Location of bootstrap class files, given as a <a href="http://jakarta.apache.org/ant/manual/using.html#references">reference</a>
to a PATH defined elsewhere.</td> to a PATH defined elsewhere.</td>
<td ALIGN=CENTER VALIGN=TOP>No</td> <td ALIGN=CENTER VALIGN=TOP>No</td>
</tr> </tr>


<tr> <tr>
<td VALIGN=TOP>incremental</td> <td VALIGN=TOP>incremental</td>
<td VALIGN=TOP>build once, then recompile on demand only required files;
<td VALIGN=TOP>Build once, then recompile on demand only required files;
defaults to <tt>false</tt>. defaults to <tt>false</tt>.
By default, files are recompiled based on input passed to stdin By default, files are recompiled based on input passed to stdin
(see tagfile)</td> (see tagfile)</td>


<tr> <tr>
<td VALIGN=TOP>emacssym</td> <td VALIGN=TOP>emacssym</td>
<td VALIGN=TOP>whether to emit <tt>.ajesym</tt> symbol files for Emacs support;
<td VALIGN=TOP>Whether to emit <tt>.ajesym</tt> symbol files for Emacs support;
defaults to <tt>false</tt>.</td> defaults to <tt>false</tt>.</td>
<td ALIGN=CENTER VALIGN=TOP>No</td> <td ALIGN=CENTER VALIGN=TOP>No</td>
</tr> </tr>


<tr> <tr>
<td VALIGN=TOP>verbose</td> <td VALIGN=TOP>verbose</td>
<td VALIGN=TOP>whether to emit compiler status messages during the compile;
<td VALIGN=TOP>Whether to emit compiler status messages during the compile;
defaults to <tt>false</tt>.</td> defaults to <tt>false</tt>.</td>
<td ALIGN=CENTER VALIGN=TOP>No</td> <td ALIGN=CENTER VALIGN=TOP>No</td>
</tr> </tr>


<tr> <tr>
<td VALIGN=TOP>version</td> <td VALIGN=TOP>version</td>
<td VALIGN=TOP>if true, do not compile - just print AspectJ version;
<td VALIGN=TOP>If true, do not compile - just print AspectJ version;
defaults to <tt>false</tt>.</td> defaults to <tt>false</tt>.</td>
<td ALIGN=CENTER VALIGN=TOP>No</td> <td ALIGN=CENTER VALIGN=TOP>No</td>
</tr> </tr>


<tr> <tr>
<td VALIGN=TOP>help</td> <td VALIGN=TOP>help</td>
<td VALIGN=TOP>if true, just print help for the command-line compiler;
<td VALIGN=TOP>If true, just print help for the command-line compiler;
defaults to <tt>false</tt>.</td> defaults to <tt>false</tt>.</td>
<td ALIGN=CENTER VALIGN=TOP>No</td> <td ALIGN=CENTER VALIGN=TOP>No</td>
</tr> </tr>


<tr> <tr>
<td VALIGN=TOP>Xlintenabled</td>
<td VALIGN=TOP>same as <tt>xlint:all</tt>,
whether to emit language usage messages during the compile;
<td VALIGN=TOP>Xlintwarnings</td>
<td VALIGN=TOP>Same as <tt>xlint:warning</tt> -
if enabled, set default level of all language usage messages to warning;
defaults to <tt>false</tt>.</td> defaults to <tt>false</tt>.</td>
<td ALIGN=CENTER VALIGN=TOP>No</td> <td ALIGN=CENTER VALIGN=TOP>No</td>
</tr> </tr>


<tr> <tr>
<td VALIGN=TOP>Xlintfile</td>
<td VALIGN=TOP>specify property file containing name:level associations
for any overrides to the default associations for language usage
messaged emitted during the compile.</td>
<td VALIGN=TOP>Xlint</td>
<td VALIGN=TOP>Specify default level of all language usage messages
to one of (error, warning, ignore).
<td ALIGN=CENTER VALIGN=TOP>No</td> <td ALIGN=CENTER VALIGN=TOP>No</td>
</tr> </tr>


<!--
<tr> <tr>
<td VALIGN=TOP>Xlint</td>
<td VALIGN=TOP>Specify which language usage messages to emit
during compile, using comma-separated list of entries.
<td VALIGN=TOP>Xlintfile</td>
<td VALIGN=TOP>Specify property file containing name:level
associations setting level for language messages emitted
during compilation. Any levels set override the default
associations in
<code>org/aspectj/weaver/XLintDefault.properties</code>.
</td>
<td ALIGN=CENTER VALIGN=TOP>No</td> <td ALIGN=CENTER VALIGN=TOP>No</td>
</tr> </tr>
-->


<tr> <tr>
<td VALIGN=TOP>failonerror</td> <td VALIGN=TOP>failonerror</td>
<td VALIGN=TOP>whether the build continues notwithstanding compile errors;
<td VALIGN=TOP>Whether the build continues notwithstanding compile errors;
defaults to <tt>true</tt>.&nbsp;</td> defaults to <tt>true</tt>.&nbsp;</td>
<td ALIGN=CENTER VALIGN=TOP>No</td> <td ALIGN=CENTER VALIGN=TOP>No</td>
</tr> </tr>


<tr> <tr>
<td VALIGN=TOP>nowarn</td> <td VALIGN=TOP>nowarn</td>
<td VALIGN=TOP>same as <tt>warn:none</tt>;
<td VALIGN=TOP>Same as <tt>warn:none</tt>;
defaults to <tt>false</tt>.&nbsp;</td> defaults to <tt>false</tt>.&nbsp;</td>
<td ALIGN=CENTER VALIGN=TOP>No</td> <td ALIGN=CENTER VALIGN=TOP>No</td>
</tr> </tr>


<tr> <tr>
<td VALIGN=TOP>deprecation</td> <td VALIGN=TOP>deprecation</td>
<td VALIGN=TOP>same as <tt>warn:deprecation</tt>;
<td VALIGN=TOP>Same as <tt>warn:deprecation</tt>;
defaults to <tt>false</tt>.&nbsp;</td> defaults to <tt>false</tt>.&nbsp;</td>
<td ALIGN=CENTER VALIGN=TOP>No</td> <td ALIGN=CENTER VALIGN=TOP>No</td>
</tr> </tr>


<tr> <tr>
<td VALIGN=TOP>warn</td> <td VALIGN=TOP>warn</td>
<td VALIGN=TOP>one or more comma-separated warning specifications:
<td VALIGN=TOP>One or more comma-separated warning specifications:
<tt>constructorName</tt>, <tt>constructorName</tt>,
<tt>packageDefaultMethod</tt>, <tt>packageDefaultMethod</tt>,
<tt>deprecation</tt>, <tt>deprecation</tt>,


<tr> <tr>
<td VALIGN=TOP>debug</td> <td VALIGN=TOP>debug</td>
<td VALIGN=TOP>same as <tt>debug:lines,vars,source</tt></td>
<td VALIGN=TOP>Same as <tt>debug:lines,vars,source</tt></td>
<td ALIGN=CENTER VALIGN=TOP>No</td> <td ALIGN=CENTER VALIGN=TOP>No</td>
</tr> </tr>


<tr> <tr>
<td VALIGN=TOP>debuglevel</td> <td VALIGN=TOP>debuglevel</td>
<td VALIGN=TOP>one or more comma-separated debug specifications:
<td VALIGN=TOP>One or more comma-separated debug specifications:
<tt>lines</tt>, <tt>lines</tt>,
<tt>vars</tt>, or <tt>vars</tt>, or
<tt>source</tt>. <tt>source</tt>.


<tr> <tr>
<td VALIGN=TOP>PreserveAllLocals</td> <td VALIGN=TOP>PreserveAllLocals</td>
<td VALIGN=TOP>code gen preserves all local variables (for debug purposes);
<td VALIGN=TOP>Code gen preserves all local variables (for debug purposes);
defaults to <tt>false</tt>.&nbsp;</td> defaults to <tt>false</tt>.&nbsp;</td>
<td ALIGN=CENTER VALIGN=TOP>No</td> <td ALIGN=CENTER VALIGN=TOP>No</td>
</tr> </tr>


<tr> <tr>
<td VALIGN=TOP>noimporterror</td> <td VALIGN=TOP>noimporterror</td>
<td VALIGN=TOP>no errors for unresolved imports;
<td VALIGN=TOP>No errors for unresolved imports;
defaults to <tt>false</tt>.&nbsp;</td> defaults to <tt>false</tt>.&nbsp;</td>
<td ALIGN=CENTER VALIGN=TOP>No</td> <td ALIGN=CENTER VALIGN=TOP>No</td>
</tr> </tr>


<tr> <tr>
<td VALIGN=TOP>referenceinfo</td> <td VALIGN=TOP>referenceinfo</td>
<td VALIGN=TOP>compute reference info;
<td VALIGN=TOP>Compute reference info;
defaults to <tt>false</tt>.&nbsp;</td> defaults to <tt>false</tt>.&nbsp;</td>
<td ALIGN=CENTER VALIGN=TOP>No</td> <td ALIGN=CENTER VALIGN=TOP>No</td>
</tr> </tr>


<tr> <tr>
<td VALIGN=TOP>encoding</td> <td VALIGN=TOP>encoding</td>
<td VALIGN=TOP>default source encoding format</td>
<td VALIGN=TOP>Default source encoding format</td>
<td ALIGN=CENTER VALIGN=TOP>No</td> <td ALIGN=CENTER VALIGN=TOP>No</td>
</tr> </tr>


<tr> <tr>
<td VALIGN=TOP>proceedonerror</td> <td VALIGN=TOP>proceedonerror</td>
<td VALIGN=TOP>keep compiling when error, dumping class files with problem methods;
<td VALIGN=TOP>Keep compiling when error, dumping class files with problem methods;
defaults to <tt>false</tt>.&nbsp;</td> defaults to <tt>false</tt>.&nbsp;</td>
<td ALIGN=CENTER VALIGN=TOP>No</td> <td ALIGN=CENTER VALIGN=TOP>No</td>
</tr> </tr>


<tr> <tr>
<td VALIGN=TOP>progress</td> <td VALIGN=TOP>progress</td>
<td VALIGN=TOP>show progress (requires log);
<td VALIGN=TOP>Show progress (requires log);
defaults to <tt>false</tt>.&nbsp;</td> defaults to <tt>false</tt>.&nbsp;</td>
<td ALIGN=CENTER VALIGN=TOP>No</td> <td ALIGN=CENTER VALIGN=TOP>No</td>
</tr> </tr>


<tr> <tr>
<td VALIGN=TOP>time</td> <td VALIGN=TOP>time</td>
<td VALIGN=TOP>display speed information;
<td VALIGN=TOP>Display speed information;
defaults to <tt>false</tt>.&nbsp;</td> defaults to <tt>false</tt>.&nbsp;</td>
<td ALIGN=CENTER VALIGN=TOP>No</td> <td ALIGN=CENTER VALIGN=TOP>No</td>
</tr> </tr>
<!-- <!--
<tr> <tr>
<td VALIGN=TOP>noexit</td> <td VALIGN=TOP>noexit</td>
<td VALIGN=TOP>disable System.exit; defaults to <tt>true</tt>.
<td VALIGN=TOP>Disable System.exit; defaults to <tt>true</tt>.
(<em>If false, this kills the Ant process</em>; (<em>If false, this kills the Ant process</em>;
to halt compile gracefully, use <tt>failonerror</tt>); to halt compile gracefully, use <tt>failonerror</tt>);
&nbsp;</td> &nbsp;</td>


<tr> <tr>
<td VALIGN=TOP>source</td> <td VALIGN=TOP>source</td>
<td VALIGN=TOP>source assertion mode ("1.3" or "1.4");
<td VALIGN=TOP>Source assertion mode ("1.3" or "1.4");
default depends on compliance mode.&nbsp;</td> default depends on compliance mode.&nbsp;</td>
<td ALIGN=CENTER VALIGN=TOP>No</td> <td ALIGN=CENTER VALIGN=TOP>No</td>
</tr> </tr>

+ 72
- 26
taskdefs/src/org/aspectj/tools/ant/taskdefs/AjcTask.java View File

/** valid debugging (-g:[...]) variants */ /** valid debugging (-g:[...]) variants */
private static final List VALID_DEBUG; private static final List VALID_DEBUG;


/** -Xlint variants
/**
* -Xlint variants (error, warning, ignore)
* @see org.aspectj.weaver.Lint * @see org.aspectj.weaver.Lint
*/ */
private static final List VALID_XLINT; private static final List VALID_XLINT;
// /** -Xlint variants
// * @see org.aspectj.weaver.Lint
// */
// private static final List VALID_XLINT_TAGS;
static { static {
String[] xs = new String[] String[] xs = new String[]
{ "serializableAspects", "incrementalFile" { "serializableAspects", "incrementalFile"
VALID_DEBUG = Collections.unmodifiableList(Arrays.asList(xs)); VALID_DEBUG = Collections.unmodifiableList(Arrays.asList(xs));
xs = new String[]
{ "invalidAbsoluteTypeName", "invalidWildcardTypeName",
"unresolvableMember" };
xs = new String[] { "error", "warning", "ignore"};
VALID_XLINT = Collections.unmodifiableList(Arrays.asList(xs)); VALID_XLINT = Collections.unmodifiableList(Arrays.asList(xs));
// xs = new String[]
// { "invalidAbsoluteTypeName", "invalidWildcardTypeName",
// "unresolvableMember" };
// VALID_XLINT_TAGS = Collections.unmodifiableList(Arrays.asList(xs));
} }
// ---------------------------- state and Ant interface thereto // ---------------------------- state and Ant interface thereto
} }
protected void ignore(String ignored) { protected void ignore(String ignored) {
this.ignored.add(ignored);
this.ignored.add(ignored + " at " + getLocation());
} }
protected void addFlagged(String flag, String argument) { protected void addFlagged(String flag, String argument) {
cmd.addArguments(new String[] {flag, argument}); cmd.addArguments(new String[] {flag, argument});
} }


protected String validCommaList(String list, List valid) {
protected String validCommaList(String list, List valid, String label) {
return validCommaList(list, valid, label, valid.size());
}
protected String validCommaList(String list, List valid, String label, int max) {
StringBuffer result = new StringBuffer(); StringBuffer result = new StringBuffer();
StringTokenizer st = new StringTokenizer(list, ","); StringTokenizer st = new StringTokenizer(list, ",");
int num = 0;
while (st.hasMoreTokens()) { while (st.hasMoreTokens()) {
String token = st.nextToken().trim(); String token = st.nextToken().trim();
num++;
if (num > max) {
ignore("too many entries for -"
+ label
+ ": "
+ token);
break;
}
if (!valid.contains(token)) { if (!valid.contains(token)) {
ignore("commaList entry: " + token); // XXX weak message
ignore("bad commaList entry for -"
+ label
+ ": "
+ token);
} else { } else {
if (0 < result.length()) { if (0 < result.length()) {
result.append(","); result.append(",");
} }


public void setWarn(String warnings) { public void setWarn(String warnings) {
warnings = validCommaList(warnings, VALID_WARNINGS);
addFlag("-g:" + warnings, (null != warnings));
warnings = validCommaList(warnings, VALID_WARNINGS, "warn");
addFlag("-warn:" + warnings, (null != warnings));
} }


public void setDebug(boolean debug) { public void setDebug(boolean debug) {
addFlag("-g", debug); addFlag("-g", debug);
} }
public void setEmacssym(boolean emacssym) {
addFlag("-emacssym", emacssym);
}

public void setDebugLevel(String level) { public void setDebugLevel(String level) {
level = validCommaList(level, VALID_DEBUG);
level = validCommaList(level, VALID_DEBUG, "g");
addFlag("-g:" + level, (null != level)); addFlag("-g:" + level, (null != level));
} }


/** -Xlint - enable or disable all forms of -Xlint messages */
public void setXlintenabled(boolean xlintenabled) {
addFlag("-Xlint", xlintenabled);
public void setEmacssym(boolean emacssym) {
addFlag("-emacssym", emacssym);
}

/**
* -Xlint - set default level of -Xlint messages to warning
* (same as </code>-Xlint:warning</code>)
*/
public void setXlintwarnings(boolean xlintwarnings) {
addFlag("-Xlint", xlintwarnings);
} }
/** -Xlint:{xlint} - enable or disable specific forms of -Xlint messages
* @param xlint the String with comma-delimited lint
/** -Xlint:{error|warning|info} - set default level for -Xlint messages
* @param xlint the String with one of error, warning, ignored
*/ */
public void setXlint(String xlint) { // XXX confirm form supported
xlint = validCommaList(xlint, VALID_XLINT);
public void setXlint(String xlint) {
xlint = validCommaList(xlint, VALID_XLINT, "Xlint", 1);
addFlag("-Xlint:" + xlint, (null != xlint)); addFlag("-Xlint:" + xlint, (null != xlint));
} }


/** /**
* -Xlint:file={xlintFile} - enable or disable specific forms
* -Xlint:file={lint.properties} - enable or disable specific forms
* of -Xlint messages based on a lint properties file * of -Xlint messages based on a lint properties file
* (default is
* <code>org/aspectj/weaver/XLintDefault.properties</code>)
* @param xlintFile the File with lint properties * @param xlintFile the File with lint properties
*/ */
public void setXlintFile(File xlintFile) {
String flag = "-Xlint:file=" + xlintFile.getAbsolutePath();
//addFlag(flag);
ignore(flag + "[XXX unimplemented in compiler]");
public void setXlintfile(File xlintFile) {
String flag = "-Xlintfile:" + xlintFile.getAbsolutePath();
addFlag(flag, true);
} }


public void setPreserveAllLocals(boolean preserveAllLocals) { public void setPreserveAllLocals(boolean preserveAllLocals) {
} }
} }
//---------------------- accumulate these lists //---------------------- accumulate these lists
public void setSourceRootsList(String commaList) {
StringTokenizer st = new StringTokenizer(commaList, ",");
while (st.hasMoreTokens()) {
String token = st.nextToken().trim();
if (0 == token.length()) {
ignore("empty source root found");
}
File srcRoot = new File(token);
if (srcRoot.canRead() && srcRoot.isDirectory()) {
Path path = new Path(getProject(), srcRoot.getPath());
setSourceRoots(path);
} else {
ignore("source root not found: " + srcRoot);
}
}
}

public void setSourceRoots(Path roots) { public void setSourceRoots(Path roots) {
if (this.sourceRoots == null) { if (this.sourceRoots == null) {
this.sourceRoots = roots; this.sourceRoots = roots;

Loading…
Cancel
Save