org.aspectj.weaver.bcel
Class LazyClassGen

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

public final class LazyClassGen
extends java.lang.Object

Lazy lazy lazy. We don't unpack the underlying class unless necessary. Things like new methods and annotations accumulate in here until they must be written out, don't add them to the underlying MethodGen! Things are slightly different if this represents an Aspect.


Field Summary
static ObjectType enclosingStaticTjpType
           
static ObjectType proceedingTjpType
           
static ObjectType staticTjpType
           
static ObjectType tjpType
           
static ObjectType typeForAnnotation
           
 
Constructor Summary
LazyClassGen(BcelObjectType myType)
           
LazyClassGen(java.lang.String class_name, java.lang.String super_class_name, java.lang.String file_name, int access_flags, java.lang.String[] interfaces, World world)
           
 
Method Summary
 void addAnnotation(AnnotationGen a)
           
 void addAttribute(AjAttribute attribute)
           
 void addField(FieldGen field, ISourceLocation sourceLocation)
           
 void addGeneratedInner(LazyClassGen newClass)
           
 void addInterface(ResolvedType newInterface, ISourceLocation sourceLocation)
           
 void addMethodGen(LazyMethodGen gen)
           
 void addMethodGen(LazyMethodGen gen, ISourceLocation sourceLocation)
           
 java.lang.String allocateField(java.lang.String prefix)
          Return the next available field name with the specified 'prefix', e.g.
 LazyMethodGen createExtendedAjcPreClinit(LazyMethodGen previousPreClinit, int i)
          factory method for building multiple extended clinit methods.
static void disassemble(java.lang.String path, java.lang.String name, java.io.PrintStream out)
          Emit disassembled class and newline to out
 void errorOnAddedField(FieldGen field, ISourceLocation sourceLocation)
           
 boolean fieldExists(java.lang.String name)
           
 void forcePublic()
           
 LazyMethodGen getAjcPreClinit()
          Retrieve the ajc$preClinit method - this method captures any initialization AspectJ wants to ensure happens in a class.
 Field getAnnotationCachingField(BcelShadow shadow, ResolvedType toType, boolean isWithin)
          Create a field in the type containing the shadow where the annotation retrieved during binding can be stored - for later fast access.
 java.util.Set<java.lang.String> getAspectsAffectingType()
           
 BcelObjectType getBcelObjectType()
           
 java.util.List<UnwovenClassFile.ChildClass> getChildClasses(BcelWorld world)
           
 java.lang.String getClassName()
           
 ConstantPool getConstantPool()
           
 InstructionFactory getFactory()
           
 java.util.List<org.aspectj.weaver.bcel.BcelField> getFieldGens()
           
 java.lang.String getFileName()
           
 java.lang.String[] getInterfaceNames()
           
 java.lang.String getInternalClassName()
           
 java.lang.String getInternalFileName()
           
 JavaClass getJavaClass(BcelWorld world)
           
 byte[] getJavaClassBytesIncludingReweavable(BcelWorld world)
           
 LazyMethodGen getLazyMethodGen(Member m)
           
 LazyMethodGen getLazyMethodGen(java.lang.String name, java.lang.String signature)
           
 LazyMethodGen getLazyMethodGen(java.lang.String name, java.lang.String signature, boolean allowMissing)
           
 java.util.List<LazyMethodGen> getMethodGens()
           
 java.lang.String getName()
           
 java.lang.String getNewGeneratedNameTag()
           
 WeaverStateInfo getOrCreateWeaverStateInfo(boolean inReweavableMode)
           
 java.lang.String getPackageName()
          Returns the packagename - if its the default package we return an empty string
 LazyMethodGen getStaticInitializer()
           
 ResolvedType getSuperClass()
           
 Field getTjpField(BcelShadow shadow, boolean isEnclosingJp)
           
 ResolvedType getType()
           
 World getWorld()
           
 boolean hasAnnotation(UnresolvedType t)
           
static boolean hasSerialVersionUIDField(ResolvedType type)
           
 boolean isAbstract()
           
 boolean isAtLeastJava5()
           
 boolean isInterface()
           
 boolean isReweavable()
           
 boolean isWoven()
           
protected  java.lang.String makeString(int i)
           
protected  java.lang.String makeString(java.lang.String[] names)
           
protected  java.lang.String makeString(UnresolvedType t)
           
protected  java.lang.String makeString(UnresolvedType[] types)
           
 void print()
           
 void print(java.io.PrintStream out)
           
 boolean removeMethodGen(LazyMethodGen gen)
           
 void setSuperClass(ResolvedType newSuperclass)
           
 java.lang.String toLongString()
           
 java.lang.String toShortString()
           
 java.lang.String toString()
           
 void warnOnAddedInterface(java.lang.String name, ISourceLocation sourceLocation)
           
 void warnOnAddedMethod(Method method, ISourceLocation sourceLocation)
           
 void warnOnAddedStaticInitializer(Shadow shadow, ISourceLocation sourceLocation)
           
 void warnOnModifiedSerialVersionUID(ISourceLocation sourceLocation, java.lang.String reason)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

proceedingTjpType

public static final ObjectType proceedingTjpType

tjpType

public static final ObjectType tjpType

staticTjpType

public static final ObjectType staticTjpType

typeForAnnotation

public static final ObjectType typeForAnnotation

enclosingStaticTjpType

public static final ObjectType enclosingStaticTjpType
Constructor Detail

LazyClassGen

public LazyClassGen(java.lang.String class_name,
                    java.lang.String super_class_name,
                    java.lang.String file_name,
                    int access_flags,
                    java.lang.String[] interfaces,
                    World world)

LazyClassGen

public LazyClassGen(BcelObjectType myType)
Method Detail

disassemble

public static void disassemble(java.lang.String path,
                               java.lang.String name,
                               java.io.PrintStream out)
                        throws java.io.IOException
Emit disassembled class and newline to out

Throws:
java.io.IOException

getNewGeneratedNameTag

public java.lang.String getNewGeneratedNameTag()

hasSerialVersionUIDField

public static boolean hasSerialVersionUIDField(ResolvedType type)

getInternalClassName

public java.lang.String getInternalClassName()

getInternalFileName

public java.lang.String getInternalFileName()

getPackageName

public java.lang.String getPackageName()
Returns the packagename - if its the default package we return an empty string


addMethodGen

public void addMethodGen(LazyMethodGen gen)

removeMethodGen

public boolean removeMethodGen(LazyMethodGen gen)

addMethodGen

public void addMethodGen(LazyMethodGen gen,
                         ISourceLocation sourceLocation)

errorOnAddedField

public void errorOnAddedField(FieldGen field,
                              ISourceLocation sourceLocation)

warnOnAddedInterface

public void warnOnAddedInterface(java.lang.String name,
                                 ISourceLocation sourceLocation)

warnOnAddedMethod

public void warnOnAddedMethod(Method method,
                              ISourceLocation sourceLocation)

warnOnAddedStaticInitializer

public void warnOnAddedStaticInitializer(Shadow shadow,
                                         ISourceLocation sourceLocation)

warnOnModifiedSerialVersionUID

public void warnOnModifiedSerialVersionUID(ISourceLocation sourceLocation,
                                           java.lang.String reason)

getWorld

public World getWorld()

getMethodGens

public java.util.List<LazyMethodGen> getMethodGens()

getFieldGens

public java.util.List<org.aspectj.weaver.bcel.BcelField> getFieldGens()

fieldExists

public boolean fieldExists(java.lang.String name)

getJavaClass

public JavaClass getJavaClass(BcelWorld world)

getJavaClassBytesIncludingReweavable

public byte[] getJavaClassBytesIncludingReweavable(BcelWorld world)

addGeneratedInner

public void addGeneratedInner(LazyClassGen newClass)

addInterface

public void addInterface(ResolvedType newInterface,
                         ISourceLocation sourceLocation)

setSuperClass

public void setSuperClass(ResolvedType newSuperclass)

getSuperClass

public ResolvedType getSuperClass()

getInterfaceNames

public java.lang.String[] getInterfaceNames()

getChildClasses

public java.util.List<UnwovenClassFile.ChildClass> getChildClasses(BcelWorld world)

toString

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

toShortString

public java.lang.String toShortString()

toLongString

public java.lang.String toLongString()

print

public void print()

print

public void print(java.io.PrintStream out)

getConstantPool

public ConstantPool getConstantPool()

getName

public java.lang.String getName()

isWoven

public boolean isWoven()

isReweavable

public boolean isReweavable()

getAspectsAffectingType

public java.util.Set<java.lang.String> getAspectsAffectingType()

getOrCreateWeaverStateInfo

public WeaverStateInfo getOrCreateWeaverStateInfo(boolean inReweavableMode)

getFactory

public InstructionFactory getFactory()

getStaticInitializer

public LazyMethodGen getStaticInitializer()

getAjcPreClinit

public LazyMethodGen getAjcPreClinit()
Retrieve the ajc$preClinit method - this method captures any initialization AspectJ wants to ensure happens in a class. It is called from the static initializer. Maintaining this separation enables overweaving to ignore join points added due to earlier weaves. If the ajc$preClinit method cannot be found, it is created and a call to it is placed in the real static initializer (the call is placed at the start of the static initializer).

Returns:
the LazyMethodGen representing the ajc$ clinit

createExtendedAjcPreClinit

public LazyMethodGen createExtendedAjcPreClinit(LazyMethodGen previousPreClinit,
                                                int i)
factory method for building multiple extended clinit methods. Constructs a new clinit method that invokes the previous one and then returns it. The index is used as a name suffix.

Parameters:
previousPreClinit -
i -

getTjpField

public Field getTjpField(BcelShadow shadow,
                         boolean isEnclosingJp)

getAnnotationCachingField

public Field getAnnotationCachingField(BcelShadow shadow,
                                       ResolvedType toType,
                                       boolean isWithin)
Create a field in the type containing the shadow where the annotation retrieved during binding can be stored - for later fast access.

Parameters:
shadow - the shadow at which the @annotation result is being cached
Returns:
a field

makeString

protected java.lang.String makeString(int i)

makeString

protected java.lang.String makeString(UnresolvedType t)

makeString

protected java.lang.String makeString(UnresolvedType[] types)

makeString

protected java.lang.String makeString(java.lang.String[] names)

getType

public ResolvedType getType()

getBcelObjectType

public BcelObjectType getBcelObjectType()

getFileName

public java.lang.String getFileName()

addField

public void addField(FieldGen field,
                     ISourceLocation sourceLocation)

getClassName

public java.lang.String getClassName()

isInterface

public boolean isInterface()

isAbstract

public boolean isAbstract()

getLazyMethodGen

public LazyMethodGen getLazyMethodGen(Member m)

getLazyMethodGen

public LazyMethodGen getLazyMethodGen(java.lang.String name,
                                      java.lang.String signature)

getLazyMethodGen

public LazyMethodGen getLazyMethodGen(java.lang.String name,
                                      java.lang.String signature,
                                      boolean allowMissing)

forcePublic

public void forcePublic()

hasAnnotation

public boolean hasAnnotation(UnresolvedType t)

addAnnotation

public void addAnnotation(AnnotationGen a)

addAttribute

public void addAttribute(AjAttribute attribute)

isAtLeastJava5

public boolean isAtLeastJava5()

allocateField

public java.lang.String allocateField(java.lang.String prefix)
Return the next available field name with the specified 'prefix', e.g. for prefix 'class$' where class$0, class$1 exist then return class$2