org.schmant.task.template.jdk.javac
Class AbstractJavacTask<T extends AbstractJavacTask<T>>

java.lang.Object
  extended by org.schmant.support.AbstractArgumentChecker
      extended by org.schmant.task.stub.AbstractTask<T>
          extended by org.schmant.task.stub.AbstractActionTask<T>
              extended by org.schmant.task.stub.AbstractProcessTask<T>
                  extended by org.schmant.task.template.jdk.javac.AbstractJavacTask<T>
All Implemented Interfaces:
TaskDependency, ActionTaskConfigurable<T>, ActionTaskSpec<T>, LoggingConfigurable<T>, OverwriteConfigurable<T>, SourceConfigurable<T>, SourceConfigured, TargetConfigurable<T>, TargetConfigured, GeneratorTaskConfigurable<T>, GeneratorTaskSpec<T>, ProcessTaskConfigurable<T>, ProcessTaskSpec<T>, Task, TaskRunnable, TaskSpecification<T>
Direct Known Subclasses:
ExtJavacTask, Jdk6JavacTask

public abstract class AbstractJavacTask<T extends AbstractJavacTask<T>>
extends AbstractProcessTask<T>

Abstract base class for javac task implementations.

Since:
0.5
Author:
Karl Gustafsson

Field Summary
 
Fields inherited from interface org.schmant.task.confable.OverwriteConfigurable
DEFAULT_OVERWRITE_STRATEGY
 
Constructor Summary
AbstractJavacTask()
           
 
Method Summary
 void copyProperties(T spec)
          Override the implementation from AbstractTask to copy the source properties.
protected  JavacAnnotationProcessingMode getAnnotationProcessingMode()
           
protected  Map<String,String> getAnnotationProcessorOptions()
           
protected  Object getAnnotationProcessorPath()
           
protected  List<String> getAnnotationProcessors()
           
protected  List<String> getArguments()
           
protected  List<PathDecorator<?,?>> getClasspathDecorators()
           
protected  List<Object> getClasspathEntries()
           
protected  List<Object> getClasspathEntriesFromDecorators()
          Get classpath entries from PathDecorator:s.
protected  Collection<JavacDebugKeyword> getDebugOptions()
           
protected  String getEncoding()
           
protected  JavacImplicitClassFileGeneration getImplicitClassFileGeneration()
           
protected  List<String> getOptionsInternal()
          Get the list of options that the compiler will get.
protected  String getSourceCodeVersion()
           
protected  Object getSourceFilesDir()
           
protected  String getTargetVersion()
           
protected abstract  boolean hasSources()
          This is implemented by subclasses to return true if any source file property is set.
protected  boolean isDeprecation()
           
protected  boolean isNowarn()
           
 boolean isSourcesMandatory()
          The sources are not mandatory for Javac tasks.
protected  void runInternal(Report r)
          Subclasses implement this.
protected abstract  void runJavac(Report r)
          This is implemented by subclasses.
protected  Collection<String> validate(Report r)
          Override the method inherited from AbstractTask to give a validation error if no source is set (and AbstractActionTask.isSourcesMandatory() is true).
 
Methods inherited from class org.schmant.task.stub.AbstractProcessTask
getOverwriteStrategy, getTarget, isTargetMandatory, setOverwrite, setOverwriteStrategy, setTarget, toString
 
Methods inherited from class org.schmant.task.stub.AbstractActionTask
addSource, addSources, clearSources, getRelativeToBase, getSource, getSources, isMoreThanOneSourceAllowed, setRelativeToBase, setSource, setSources
 
Methods inherited from class org.schmant.task.stub.AbstractTask
cancel, createTask, getDefaultLogFooter, getDefaultLogHeader, getDependencyForTasksScheduledByThisTask, getDependencyObservable, getFailureCause, getLogFooter, getLogHeader, getSatisfiedStateLock, getThis, isCancelled, isDone, isInterrupted, isRunning, isSatisfied, isSuccessful, run, setLogFooter, setLogHeader, setReportLevel, setTraceLogging
 
Methods inherited from class org.schmant.support.AbstractArgumentChecker
check, check, check, check
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.schmant.task.confable.SourceConfigurable
addSource, addSources, clearSources, setRelativeToBase, setSource, setSources
 
Methods inherited from interface org.schmant.task.confable.SourceConfigured
getSource, getSources
 
Methods inherited from interface org.schmant.task.TaskSpecification
createTask
 
Methods inherited from interface org.schmant.task.confable.LoggingConfigurable
setLogFooter, setLogHeader, setReportLevel, setTraceLogging
 

Constructor Detail

AbstractJavacTask

public AbstractJavacTask()
Method Detail

getTargetVersion

protected final String getTargetVersion()

getSourceCodeVersion

protected final String getSourceCodeVersion()

getClasspathEntries

protected final List<Object> getClasspathEntries()

getClasspathDecorators

protected final List<PathDecorator<?,?>> getClasspathDecorators()

getArguments

protected final List<String> getArguments()

getEncoding

protected final String getEncoding()

getAnnotationProcessorOptions

protected final Map<String,String> getAnnotationProcessorOptions()

isDeprecation

protected final boolean isDeprecation()

getDebugOptions

protected final Collection<JavacDebugKeyword> getDebugOptions()

getImplicitClassFileGeneration

protected final JavacImplicitClassFileGeneration getImplicitClassFileGeneration()

isNowarn

protected final boolean isNowarn()

getAnnotationProcessingMode

protected final JavacAnnotationProcessingMode getAnnotationProcessingMode()

getAnnotationProcessors

protected final List<String> getAnnotationProcessors()

getAnnotationProcessorPath

protected final Object getAnnotationProcessorPath()

getSourceFilesDir

protected final Object getSourceFilesDir()

isSourcesMandatory

public boolean isSourcesMandatory()
The sources are not mandatory for Javac tasks. If no sources are set, it just logs a warning and then does nothing.

Overrides:
isSourcesMandatory in class AbstractActionTask<T extends AbstractJavacTask<T>>
Returns:
true, always.

getOptionsInternal

protected List<String> getOptionsInternal()
Get the list of options that the compiler will get. The options are created from the task factory's configuration.

Returns:
The list of compiler options.

getClasspathEntriesFromDecorators

protected List<Object> getClasspathEntriesFromDecorators()
Get classpath entries from PathDecorator:s.

Returns:
A list of classpath entries from all registered path decorators.

validate

protected Collection<String> validate(Report r)
Description copied from class: AbstractActionTask
Override the method inherited from AbstractTask to give a validation error if no source is set (and AbstractActionTask.isSourcesMandatory() is true).

Subclasses may override this to add their own validations.

Overrides:
validate in class AbstractProcessTask<T extends AbstractJavacTask<T>>
Parameters:
r - A report to log warning and debug messages to. Validation errors should not be logged, though. They are logged later.
Returns:
A collection of error messages.

hasSources

protected abstract boolean hasSources()
This is implemented by subclasses to return true if any source file property is set.


runJavac

protected abstract void runJavac(Report r)
                          throws InterruptedException
This is implemented by subclasses. It is executed when the task is run.

Throws:
InterruptedException

runInternal

protected final void runInternal(Report r)
                          throws InterruptedException
Description copied from class: AbstractTask
Subclasses implement this. The task is AbstractTask.validate(Report):d before this method is called, see AbstractTask.run().

Specified by:
runInternal in class AbstractTask<T extends AbstractJavacTask<T>>
Parameters:
r - The current thread's Report.
Throws:
InterruptedException

copyProperties

public void copyProperties(T spec)
Description copied from class: AbstractActionTask
Override the implementation from AbstractTask to copy the source properties. Subclasses must override this to copy their own properties.

Specified by:
copyProperties in interface TaskSpecification<T extends AbstractJavacTask<T>>
Overrides:
copyProperties in class AbstractProcessTask<T extends AbstractJavacTask<T>>
Parameters:
spec - The specification to copy properties to.