|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.aspectj.tools.ajc.Main
public class Main
Programmatic and command-line interface to AspectJ compiler. The compiler is an ICommand obtained by reflection. Not thread-safe. By default, messages are printed as they are emitted; info messages go to the output stream, and warnings and errors go to the error stream.
Clients can handle all messages by registering a holder:
Main main = new Main(); IMessageHolder holder = new MessageHandler(); main.setHolder(holder);Clients can get control after each command completes by installing a Runnable:
main.setCompletionRunner(new Runnable() {..});
| Nested Class Summary | |
|---|---|
static class |
Main.CommandController
controller for repeatable command delays until input or file changed or removed |
static class |
Main.LogModeMessagePrinter
|
static class |
Main.MessagePrinter
interceptor IMessageHandler to print as we go. |
| Field Summary | |
|---|---|
static java.lang.String |
THROWN_PREFIX
Header used when rendering exceptions for users |
| Constructor Summary | |
|---|---|
Main()
|
|
| Method Summary | |
|---|---|
static int |
bareMain(java.lang.String[] args,
boolean useSystemExit,
java.util.List fails,
java.util.List errors,
java.util.List warnings,
java.util.List infos)
Convenience method to run ajc and collect String lists of messages. |
IMessageHolder |
getHolder()
|
MessageHandler |
getMessageHandler()
|
static void |
main(java.lang.String[] args)
|
void |
quit()
call this to stop after the next iteration of incremental compile |
static java.lang.String |
renderExceptionForUser(java.lang.Throwable thrown)
|
void |
run(java.lang.String[] args,
IMessageHolder holder)
Run without using System.exit(..), putting all messages in holder: ERROR: compiler error WARNING: compiler warning FAIL: command error (bad arguments, exception thrown) This handles incremental behavior: If args include "-incremental", repeat for every input char until 'q' is entered. |
void |
runMain(java.lang.String[] args,
boolean useSystemExit)
Run without throwing exceptions but optionally using System.exit(..). |
void |
setCommand(ICommand command)
|
void |
setCompletionRunner(java.lang.Runnable runner)
Install a Runnable to be invoked synchronously after each compile completes. |
void |
setHolder(IMessageHolder holder)
Set holder to be passed all messages. |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final java.lang.String THROWN_PREFIX
| Constructor Detail |
|---|
public Main()
| Method Detail |
|---|
public static void main(java.lang.String[] args)
throws java.io.IOException
args - the String[] of command-line arguments
java.io.IOException
public static int bareMain(java.lang.String[] args,
boolean useSystemExit,
java.util.List fails,
java.util.List errors,
java.util.List warnings,
java.util.List infos)
args - the String[] args to pass to the compileruseSystemExit - if true and errors, return System.exit(errs)fails - the List sink, if any, for String failure (or worse) messageserrors - the List sink, if any, for String error messageswarnings - the List sink, if any, for String warning messagesinfo - the List sink, if any, for String info messages
any - unchecked exceptions the compiler doespublic static java.lang.String renderExceptionForUser(java.lang.Throwable thrown)
java.lang.NullPointerException - if thrown is nullpublic MessageHandler getMessageHandler()
public void setCommand(ICommand command)
public void runMain(java.lang.String[] args,
boolean useSystemExit)
args - the String[] command line for the compileruseSystemExit - if true, use System.exit(int) to complete unless one of the args is -noExit. and signal result (0 no
exceptions/error, <0 exceptions, >0 compiler errors).
public void run(java.lang.String[] args,
IMessageHolder holder)
args - the String[] command line for the compilerholder - the MessageHandler sink for messages.public void quit()
public void setHolder(IMessageHolder holder)
holder - the IMessageHolder sink for all messages (use null to restore default behavior)public IMessageHolder getHolder()
public void setCompletionRunner(java.lang.Runnable runner)
runner - the Runnable to invoke - null to disable
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||