org.aspectj.ajdt.internal.core.builder
Class AjState

java.lang.Object
  extended by org.aspectj.ajdt.internal.core.builder.AjState
All Implemented Interfaces:
CompilerConfigurationChangeFlags, TypeDelegateResolver

public class AjState
extends java.lang.Object
implements CompilerConfigurationChangeFlags, TypeDelegateResolver

Maintains state needed for incremental compilation


Nested Class Summary
static class AjState.SoftHashMap
           
 
Field Summary
static boolean CHECK_STATE_FIRST
           
 java.util.Set<java.lang.String> deltaAddedClasses
           
static boolean FORCE_INCREMENTAL_DURING_TESTING
           
static IStateListener stateListener
           
 
Fields inherited from interface org.aspectj.ajdt.internal.core.builder.CompilerConfigurationChangeFlags
ASPECTPATH_CHANGED, CLASSPATH_CHANGED, EVERYTHING, INJARS_CHANGED, INPATH_CHANGED, JAVAOPTIONS_CHANGED, NO_CHANGES, NONSTANDARDOPTIONS_CHANGED, OUTJAR_CHANGED, OUTPUTDESTINATIONS_CHANGED, PROJECTSOURCEFILES_CHANGED, PROJECTSOURCERESOURCES_CHANGED, XMLCONFIG_CHANGED
 
Constructor Summary
AjState(AjBuildManager buildManager)
           
 
Method Summary
protected  void addAffectedSourceFiles(java.util.Set<java.io.File> addTo, java.util.Set<java.io.File> lastTimeSources)
           
protected  void addDependentsOf(java.io.File sourceFile)
           
 IBinaryType checkPreviousBuild(java.lang.String name)
           
 void clearBinarySourceFiles()
           
 void forceBatchBuildNextTimeAround()
           
 java.util.Set<java.io.File> getAddedFiles()
           
 AjBuildManager getAjBuildManager()
           
 java.util.Map<java.lang.String,char[]> getAspectNamesToFileNameMap()
           
 BcelWorld getBcelWorld()
           
 java.util.Map<java.lang.String,java.util.List<UnwovenClassFile>> getBinaryFilesToCompile(boolean firstTime)
           
 java.util.Map<java.lang.String,java.util.List<UnwovenClassFile>> getBinarySourceMap()
           
 AjBuildConfig getBuildConfig()
           
 java.util.Map<java.lang.String,java.io.File> getClassNameToFileMap()
           
 ReferenceTypeDelegate getDelegate(ReferenceType referenceType)
          See if we can create a delegate from a CompactTypeStructure - TODO better comment
 java.util.Set<java.io.File> getDeletedFiles()
           
 java.util.Set<java.io.File> getFilesToCompile(boolean firstPass)
           
 long getLastBuildTime()
          Returns last time we did a full or incremental build.
 long getLastFullBuildTime()
          Returns last time we did a full build
 IStateListener getListener()
           
 INameEnvironment getNameEnvironment()
           
 int getNumberOfStructuralChangesSinceLastFullBuild()
           
 AsmManager getStructureModel()
           
 BcelWeaver getWeaver()
           
 boolean hasResource(java.lang.String resourceName)
           
 void initializeAspectNamesToFileNameMap()
           
 boolean listenerDefined()
           
 void noteNewResult(CompilationResult cr)
           
 void noteResult(InterimCompilationResult result)
           
 boolean prepareForNextBuild(AjBuildConfig newBuildConfig)
          Returns false if a batch build is needed.
 void recordAspectClassFile(java.lang.String aspectFile)
          Record an aspect that came in on the aspect path.
 void recordBinarySource(java.lang.String fromPathName, java.util.List<UnwovenClassFile> unwovenClassFiles)
           
 boolean recordDependencies(java.io.File file, java.lang.String[] typeNameDependencies)
          Record some additional dependencies between types.
 void recordResource(java.lang.String resourceName, java.io.File resourceSourceLocation)
           
protected  void recordTypeChanged(java.lang.String typename)
          Record that a particular type has been touched during a compilation run.
 boolean requiresFullBatchBuild()
           
 void setCouldBeSubsequentIncrementalBuild(boolean yesThereCould)
           
 void setNameEnvironment(INameEnvironment nameEnvironment)
           
 void setStructureModel(AsmManager structureModel)
           
 void setWeaver(BcelWeaver bw)
           
 void setWorld(BcelWorld bw)
           
 java.lang.String toString()
           
 void wipeAllKnowledge()
           
 void write(CompressingDataOutputStream dos)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

CHECK_STATE_FIRST

public static boolean CHECK_STATE_FIRST

stateListener

public static IStateListener stateListener

FORCE_INCREMENTAL_DURING_TESTING

public static boolean FORCE_INCREMENTAL_DURING_TESTING

deltaAddedClasses

public final java.util.Set<java.lang.String> deltaAddedClasses
Constructor Detail

AjState

public AjState(AjBuildManager buildManager)
Method Detail

setCouldBeSubsequentIncrementalBuild

public void setCouldBeSubsequentIncrementalBuild(boolean yesThereCould)

prepareForNextBuild

public boolean prepareForNextBuild(AjBuildConfig newBuildConfig)
Returns false if a batch build is needed.


toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getFilesToCompile

public java.util.Set<java.io.File> getFilesToCompile(boolean firstPass)

getBinaryFilesToCompile

public java.util.Map<java.lang.String,java.util.List<UnwovenClassFile>> getBinaryFilesToCompile(boolean firstTime)

noteResult

public void noteResult(InterimCompilationResult result)

noteNewResult

public void noteNewResult(CompilationResult cr)

addAffectedSourceFiles

protected void addAffectedSourceFiles(java.util.Set<java.io.File> addTo,
                                      java.util.Set<java.io.File> lastTimeSources)

recordTypeChanged

protected void recordTypeChanged(java.lang.String typename)
Record that a particular type has been touched during a compilation run. Information is used to ensure any types depending upon this one are also recompiled.

Parameters:
typename - (possibly qualified) type name

recordDependencies

public boolean recordDependencies(java.io.File file,
                                  java.lang.String[] typeNameDependencies)
Record some additional dependencies between types. When any of the types specified in fullyQualifiedTypeNames changes, we need to recompile the file named in the CompilationResult. This method patches that information into the existing data structures.


addDependentsOf

protected void addDependentsOf(java.io.File sourceFile)

setStructureModel

public void setStructureModel(AsmManager structureModel)

getStructureModel

public AsmManager getStructureModel()

setWeaver

public void setWeaver(BcelWeaver bw)

getWeaver

public BcelWeaver getWeaver()

setWorld

public void setWorld(BcelWorld bw)

getBcelWorld

public BcelWorld getBcelWorld()

getNumberOfStructuralChangesSinceLastFullBuild

public int getNumberOfStructuralChangesSinceLastFullBuild()

getLastBuildTime

public long getLastBuildTime()
Returns last time we did a full or incremental build.


getLastFullBuildTime

public long getLastFullBuildTime()
Returns last time we did a full build


getBuildConfig

public AjBuildConfig getBuildConfig()
Returns:
Returns the buildConfig.

clearBinarySourceFiles

public void clearBinarySourceFiles()

recordBinarySource

public void recordBinarySource(java.lang.String fromPathName,
                               java.util.List<UnwovenClassFile> unwovenClassFiles)

getBinarySourceMap

public java.util.Map<java.lang.String,java.util.List<UnwovenClassFile>> getBinarySourceMap()

getClassNameToFileMap

public java.util.Map<java.lang.String,java.io.File> getClassNameToFileMap()

hasResource

public boolean hasResource(java.lang.String resourceName)

recordResource

public void recordResource(java.lang.String resourceName,
                           java.io.File resourceSourceLocation)

getAddedFiles

public java.util.Set<java.io.File> getAddedFiles()
Returns:
Returns the addedFiles.

getDeletedFiles

public java.util.Set<java.io.File> getDeletedFiles()
Returns:
Returns the deletedFiles.

forceBatchBuildNextTimeAround

public void forceBatchBuildNextTimeAround()

requiresFullBatchBuild

public boolean requiresFullBatchBuild()

wipeAllKnowledge

public void wipeAllKnowledge()

getAspectNamesToFileNameMap

public java.util.Map<java.lang.String,char[]> getAspectNamesToFileNameMap()

initializeAspectNamesToFileNameMap

public void initializeAspectNamesToFileNameMap()

listenerDefined

public boolean listenerDefined()

getListener

public IStateListener getListener()

checkPreviousBuild

public IBinaryType checkPreviousBuild(java.lang.String name)

getAjBuildManager

public AjBuildManager getAjBuildManager()

getNameEnvironment

public INameEnvironment getNameEnvironment()

setNameEnvironment

public void setNameEnvironment(INameEnvironment nameEnvironment)

recordAspectClassFile

public void recordAspectClassFile(java.lang.String aspectFile)
Record an aspect that came in on the aspect path. When a .class file changes on the aspect path we can then recognize it as an aspect and know to do more than just a tiny incremental build.
TODO but this doesn't allow for a new aspect created on the aspectpath?

Parameters:
aspectFile - path to the file, eg. c:/temp/foo/Fred.class

write

public void write(CompressingDataOutputStream dos)
           throws java.io.IOException
Throws:
java.io.IOException

getDelegate

public ReferenceTypeDelegate getDelegate(ReferenceType referenceType)
See if we can create a delegate from a CompactTypeStructure - TODO better comment

Specified by:
getDelegate in interface TypeDelegateResolver