org.aspectj.tools.ajc
Class CompilationResult

java.lang.Object
  extended byorg.aspectj.tools.ajc.CompilationResult

public class CompilationResult
extends java.lang.Object

Utility class that makes the results of a compiler run available.

Instances of this class are returned by the Ajc.compile() and doIncrementalCompile() methods (and the AjcTestCase.ajc() wrapper).

This class provides a useful toString() method that is very helpful when debugging or creating messages for assert statements.

Note that the stdOut and stdErr captured from the compiler run do not contain any rendered messages - these are in the messages lists instead. Therefore for many compiler runs, they will be empty.


Constructor Summary
protected CompilationResult(java.lang.String[] args, java.lang.String stdOut, java.lang.String stdErr, java.util.List infoMessages, java.util.List errorMessages, java.util.List warningMessages, java.util.List failMessages)
          Build a compilation result - called by the Ajc.compile and Ajc.doIncrementalCompile methods.
 
Method Summary
 java.lang.String[] getArgs()
          The arguments that were passed to the compiler.
 java.util.List getErrorMessages()
          The error messages produced by the compiler.
 java.util.List getFailMessages()
          The fail or abort messages produced by the compiler.
 java.util.List getInfoMessages()
          The informational messages produced by the compiler.
 java.lang.String getStandardError()
          The standard error written by the compiler, excluding any messages.
 java.lang.String getStandardOutput()
          The standard output written by the compiler, excluding any messages.
 java.util.List getWarningMessages()
          The warning messages produced by the compiler.
 boolean hasErrorMessages()
          True if the compiler issued one or more error messages.
 boolean hasFailMessages()
          True if the compiler issued one or more fail or abort messages.
 boolean hasInfoMessages()
          True if the compiler issued one or more informational messages.
 boolean hasMessages()
          True if the compiler issued any messages of any kind.
 boolean hasWarningMessages()
          True if the compiler issued one or more warning messages.
 java.lang.String toString()
          Returns string containing message count summary, list of messages by type, and the actual ajc compilation command that was issued.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CompilationResult

protected CompilationResult(java.lang.String[] args,
                            java.lang.String stdOut,
                            java.lang.String stdErr,
                            java.util.List infoMessages,
                            java.util.List errorMessages,
                            java.util.List warningMessages,
                            java.util.List failMessages)
Build a compilation result - called by the Ajc.compile and Ajc.doIncrementalCompile methods. Should be no need for you to construct an instance yourself.

Method Detail

getArgs

public java.lang.String[] getArgs()
The arguments that were passed to the compiler.


getStandardOutput

public java.lang.String getStandardOutput()
The standard output written by the compiler, excluding any messages.


getStandardError

public java.lang.String getStandardError()
The standard error written by the compiler, excluding any messages.


hasMessages

public boolean hasMessages()
True if the compiler issued any messages of any kind.


hasInfoMessages

public boolean hasInfoMessages()
True if the compiler issued one or more informational messages.


hasErrorMessages

public boolean hasErrorMessages()
True if the compiler issued one or more error messages.


hasWarningMessages

public boolean hasWarningMessages()
True if the compiler issued one or more warning messages.


hasFailMessages

public boolean hasFailMessages()
True if the compiler issued one or more fail or abort messages.


getInfoMessages

public java.util.List getInfoMessages()
The informational messages produced by the compiler. The list entries are the IMessage objects created during the compile - so that you can programmatically test source locations etc. etc.. It may often be easier to use the assertMessages helper methods defined in the AjcTestCase class to test for messages though.

See Also:
AjcTestCase

getErrorMessages

public java.util.List getErrorMessages()
The error messages produced by the compiler. The list entries are the IMessage objects created during the compile - so that you can programmatically test source locations etc. etc.. It may often be easier to use the assertMessages helper methods defined in the AjcTestCase class to test for messages though.

See Also:
AjcTestCase

getWarningMessages

public java.util.List getWarningMessages()
The warning messages produced by the compiler. The list entries are the IMessage objects created during the compile - so that you can programmatically test source locations etc. etc.. It may often be easier to use the assertMessages helper methods defined in the AjcTestCase class to test for messages though.

See Also:
AjcTestCase

getFailMessages

public java.util.List getFailMessages()
The fail or abort messages produced by the compiler. The list entries are the IMessage objects created during the compile - so that you can programmatically test source locations etc. etc.. It may often be easier to use the assertMessages helper methods defined in the AjcTestCase class to test for messages though.

See Also:
AjcTestCase

toString

public java.lang.String toString()
Returns string containing message count summary, list of messages by type, and the actual ajc compilation command that was issued.