org.aspectj.weaver.bcel
Class BcelWeaver

java.lang.Object
  extended by org.aspectj.weaver.bcel.BcelWeaver

public class BcelWeaver
extends java.lang.Object


Field Summary
static java.lang.String CLOSURE_CLASS_PREFIX
           
static java.lang.String SYNTHETIC_CLASS_POSTFIX
           
 
Constructor Summary
BcelWeaver(BcelWorld world)
           
 
Method Summary
 UnwovenClassFile addClassFile(java.io.File classFile, java.io.File inPathDir, java.io.File outDir)
           
 ReferenceType addClassFile(UnwovenClassFile classFile, boolean fromInpath)
          Should be addOrReplace
 java.util.List<UnwovenClassFile> addDirectoryContents(java.io.File inFile, java.io.File outDir)
          Add any .class files in the directory to the outdir.
 java.util.List<UnwovenClassFile> addJarFile(java.io.File inFile, java.io.File outDir, boolean canBeDirectory)
          Adds all class files in the jar
 ResolvedType addLibraryAspect(java.lang.String aspectName)
          Add the given aspect to the weaver.
 void addLibraryJarFile(java.io.File inFile)
           
 void addManifest(java.util.jar.Manifest newManifest)
           
 void addNormalTypeMungers(java.lang.String typeName)
           
 void addParentTypeMungers(java.lang.String typeName)
           
 void allWeavingComplete()
           
 void deleteClassFile(java.lang.String typename)
           
 UnwovenClassFile[] getClassFilesFor(LazyClassGen clazz)
           
 BcelObjectType getClassType(java.lang.String forClass)
          helper method - will return NULL if the underlying delegate is an EclipseSourceType and not a BcelObjectType
 java.util.jar.Manifest getManifest(boolean shouldCreate)
           
 World getWorld()
           
 boolean isReweavable()
           
 boolean needToReweaveWorld()
           
 void prepareForWeave()
           
 void prepareToProcessReweavableState()
           
 void processReweavableStateIfPresent(java.lang.String className, BcelObjectType classType)
           
 void setCustomMungerFactory(CustomMungerFactory factory)
           
 void setIsBatchWeave(boolean b)
           
 void setReweavableMode(boolean xNotReweavable)
           
 void setShadowMungers(java.util.List<ShadowMunger> shadowMungers)
           
 void tidyUp()
           
 java.util.Collection<java.lang.String> weave(java.io.File file)
           
 java.util.Collection<java.lang.String> weave(IClassFileProvider input)
           
 void weaveNormalTypeMungers(ResolvedType onType)
           
 void weaveParentTypeMungers(ResolvedType onType)
          Weaves new parents and annotations onto a type ("declare parents" and "declare @type") Algorithm: 1.
 LazyClassGen weaveWithoutDump(UnwovenClassFile classFile, BcelObjectType classType)
           
 void write(CompressingDataOutputStream dos)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CLOSURE_CLASS_PREFIX

public static final java.lang.String CLOSURE_CLASS_PREFIX
See Also:
Constant Field Values

SYNTHETIC_CLASS_POSTFIX

public static final java.lang.String SYNTHETIC_CLASS_POSTFIX
See Also:
Constant Field Values
Constructor Detail

BcelWeaver

public BcelWeaver(BcelWorld world)
Method Detail

addLibraryAspect

public ResolvedType addLibraryAspect(java.lang.String aspectName)
Add the given aspect to the weaver. The type is resolved to support DOT for static inner classes as well as DOLLAR

Parameters:
aspectName -
Returns:
aspect

addLibraryJarFile

public void addLibraryJarFile(java.io.File inFile)
                       throws java.io.IOException
Parameters:
inFile - directory containing classes or zip/jar class archive
Throws:
java.io.IOException

addDirectoryContents

public java.util.List<UnwovenClassFile> addDirectoryContents(java.io.File inFile,
                                                             java.io.File outDir)
                                                      throws java.io.IOException
Add any .class files in the directory to the outdir. Anything other than .class files in the directory (or its subdirectories) are considered resources and are also copied.

Throws:
java.io.IOException

addJarFile

public java.util.List<UnwovenClassFile> addJarFile(java.io.File inFile,
                                                   java.io.File outDir,
                                                   boolean canBeDirectory)
Adds all class files in the jar


needToReweaveWorld

public boolean needToReweaveWorld()

addClassFile

public ReferenceType addClassFile(UnwovenClassFile classFile,
                                  boolean fromInpath)
Should be addOrReplace


addClassFile

public UnwovenClassFile addClassFile(java.io.File classFile,
                                     java.io.File inPathDir,
                                     java.io.File outDir)
                              throws java.io.IOException
Throws:
java.io.IOException

deleteClassFile

public void deleteClassFile(java.lang.String typename)

setIsBatchWeave

public void setIsBatchWeave(boolean b)

prepareForWeave

public void prepareForWeave()

setCustomMungerFactory

public void setCustomMungerFactory(CustomMungerFactory factory)

addManifest

public void addManifest(java.util.jar.Manifest newManifest)

getManifest

public java.util.jar.Manifest getManifest(boolean shouldCreate)

weave

public java.util.Collection<java.lang.String> weave(java.io.File file)
                                             throws java.io.IOException
Throws:
java.io.IOException

weave

public java.util.Collection<java.lang.String> weave(IClassFileProvider input)
                                             throws java.io.IOException
Throws:
java.io.IOException

allWeavingComplete

public void allWeavingComplete()

prepareToProcessReweavableState

public void prepareToProcessReweavableState()

processReweavableStateIfPresent

public void processReweavableStateIfPresent(java.lang.String className,
                                            BcelObjectType classType)

getClassType

public BcelObjectType getClassType(java.lang.String forClass)
helper method - will return NULL if the underlying delegate is an EclipseSourceType and not a BcelObjectType


addParentTypeMungers

public void addParentTypeMungers(java.lang.String typeName)

addNormalTypeMungers

public void addNormalTypeMungers(java.lang.String typeName)

getClassFilesFor

public UnwovenClassFile[] getClassFilesFor(LazyClassGen clazz)

weaveParentTypeMungers

public void weaveParentTypeMungers(ResolvedType onType)
Weaves new parents and annotations onto a type ("declare parents" and "declare @type") Algorithm: 1. First pass, do parents then do annotations. During this pass record: - any parent mungers that don't match but have a non-wild annotation type pattern - any annotation mungers that don't match 2. Multiple subsequent passes which go over the munger lists constructed in the first pass, repeatedly applying them until nothing changes. FIXME asc confirm that algorithm is optimal ??


weaveNormalTypeMungers

public void weaveNormalTypeMungers(ResolvedType onType)

weaveWithoutDump

public LazyClassGen weaveWithoutDump(UnwovenClassFile classFile,
                                     BcelObjectType classType)
                              throws java.io.IOException
Throws:
java.io.IOException

setReweavableMode

public void setReweavableMode(boolean xNotReweavable)

isReweavable

public boolean isReweavable()

getWorld

public World getWorld()

tidyUp

public void tidyUp()

write

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

setShadowMungers

public void setShadowMungers(java.util.List<ShadowMunger> shadowMungers)