Class LazyClassGen

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

public final class LazyClassGen extends 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 Details

    • 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 Details

    • LazyClassGen

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

      public LazyClassGen(BcelObjectType myType)
  • Method Details

    • disassemble

      public static void disassemble(String path, String name, PrintStream out) throws IOException
      Emit disassembled class and newline to out
      Throws:
      IOException
    • getNewGeneratedNameTag

      public String getNewGeneratedNameTag()
    • setMajorMinor

      public void setMajorMinor(int major, int minor)
    • getMajor

      public int getMajor()
    • getMinor

      public int getMinor()
    • hasSerialVersionUIDField

      public static boolean hasSerialVersionUIDField(ResolvedType type)
    • getInternalClassName

      public String getInternalClassName()
    • getInternalFileName

      public String getInternalFileName()
    • getPackageName

      public 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(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, String reason)
    • getWorld

      public World getWorld()
    • getMethodGens

      public List<LazyMethodGen> getMethodGens()
    • getFieldGens

      public List<org.aspectj.weaver.bcel.BcelField> getFieldGens()
    • fieldExists

      public boolean fieldExists(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 String[] getInterfaceNames()
    • getChildClasses

      public List<UnwovenClassFile.ChildClass> getChildClasses(BcelWorld world)
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • toShortString

      public String toShortString()
    • toLongString

      public String toLongString()
    • print

      public void print()
    • print

      public void print(PrintStream out)
    • getConstantPool

      public ConstantPool getConstantPool()
    • getName

      public String getName()
    • isWoven

      public boolean isWoven()
    • isReweavable

      public boolean isReweavable()
    • getAspectsAffectingType

      public Set<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
    • getFactoryMethod

      public String getFactoryMethod(Field field, BcelShadow shadow)
    • makeString

      protected String makeString(int i)
    • makeString

      protected String makeString(UnresolvedType t)
    • makeLdcClassString

      protected String makeLdcClassString(UnresolvedType type)
    • makeString

      protected String makeString(UnresolvedType[] types)
    • makeString

      protected String makeString(String[] names)
    • getType

      public ResolvedType getType()
    • getBcelObjectType

      public BcelObjectType getBcelObjectType()
    • getFileName

      public String getFileName()
    • addField

      public void addField(FieldGen field, ISourceLocation sourceLocation)
    • getClassName

      public String getClassName()
    • isInterface

      public boolean isInterface()
    • isAbstract

      public boolean isAbstract()
    • getLazyMethodGen

      public LazyMethodGen getLazyMethodGen(Member m)
    • getLazyMethodGen

      public LazyMethodGen getLazyMethodGen(String name, String signature)
    • getLazyMethodGen

      public LazyMethodGen getLazyMethodGen(String name, 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)
    • addAttribute

      public void addAttribute(Attribute attribute)
    • getAttributes

      public Collection<Attribute> getAttributes()
    • isAtLeastJava5

      public boolean isAtLeastJava5()
    • allocateField

      public String allocateField(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