Class LazyMethodGen

java.lang.Object
org.aspectj.weaver.bcel.LazyMethodGen
All Implemented Interfaces:
Traceable

public final class LazyMethodGen extends Object implements Traceable
A LazyMethodGen should be treated as a MethodGen. It's our way of abstracting over the low-level Method objects. It converts through MethodGen to create and to serialize, but that's it.

At any rate, there are two ways to create LazyMethodGens. One is from a method, which does work through MethodGen to do the correct thing. The other is the creation of a completely empty LazyMethodGen, and it is used when we're constructing code from scratch.

We stay away from targeters for rangey things like Shadows and Exceptions.

  • Field Details

  • Constructor Details

    • LazyMethodGen

      public LazyMethodGen(int modifiers, Type returnType, String name, Type[] paramTypes, String[] declaredExceptions, LazyClassGen enclosingClass)
    • LazyMethodGen

      public LazyMethodGen(Method m, LazyClassGen enclosingClass)
    • LazyMethodGen

      public LazyMethodGen(org.aspectj.weaver.bcel.BcelMethod m, LazyClassGen enclosingClass)
  • Method Details

    • hasDeclaredLineNumberInfo

      public boolean hasDeclaredLineNumberInfo()
    • getDeclarationLineNumber

      public int getDeclarationLineNumber()
    • getDeclarationOffset

      public int getDeclarationOffset()
    • addAnnotation

      public void addAnnotation(AnnotationAJ ax)
    • removeAnnotation

      public void removeAnnotation(ResolvedType annotationType)
    • addParameterAnnotation

      public void addParameterAnnotation(int parameterNumber, AnnotationAJ anno)
    • getAnnotationTypes

      public ResolvedType[] getAnnotationTypes()
    • getAnnotations

      public AnnotationAJ[] getAnnotations()
    • hasAnnotation

      public boolean hasAnnotation(UnresolvedType annotationType)
    • ensureAllLineNumberSetup

      public void ensureAllLineNumberSetup()
      On entry to this method we have a method whose instruction stream contains a few instructions that have line numbers assigned to them (LineNumberTags). The aim is to ensure every instruction has the right line number. This is necessary because some of them may be extracted out into other methods - and it'd be useful for them to maintain the source line number for debugging.
    • allocateLocal

      public int allocateLocal(Type type)
    • allocateLocal

      public int allocateLocal(int slots)
    • getMethod

      public Method getMethod()
    • markAsChanged

      public void markAsChanged()
    • toString

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

      public String toShortString()
    • toLongString

      public String toLongString(AjAttribute.WeaverVersionInfo weaverVersion)
    • print

      public void print(AjAttribute.WeaverVersionInfo weaverVersion)
    • print

      public void print(PrintStream out, AjAttribute.WeaverVersionInfo weaverVersion)
    • isStatic

      public boolean isStatic()
    • isAbstract

      public boolean isAbstract()
    • isBridgeMethod

      public boolean isBridgeMethod()
    • addExceptionHandler

      public void addExceptionHandler(InstructionHandle start, InstructionHandle end, InstructionHandle handlerStart, ObjectType catchType, boolean highPriority)
    • getAccessFlags

      public int getAccessFlags()
    • getAccessFlagsWithoutSynchronized

      public int getAccessFlagsWithoutSynchronized()
    • isSynchronized

      public boolean isSynchronized()
    • setAccessFlags

      public void setAccessFlags(int newFlags)
    • getArgumentTypes

      public Type[] getArgumentTypes()
    • getEnclosingClass

      public LazyClassGen getEnclosingClass()
    • getMaxLocals

      public int getMaxLocals()
    • getName

      public String getName()
    • getGenericReturnTypeSignature

      public String getGenericReturnTypeSignature()
    • getReturnType

      public Type getReturnType()
    • setMaxLocals

      public void setMaxLocals(int maxLocals)
    • getBody

      public InstructionList getBody()
    • getBodyForPrint

      public InstructionList getBodyForPrint()
    • hasBody

      public boolean hasBody()
    • getAttributes

      public List<Attribute> getAttributes()
    • getDeclaredExceptions

      public String[] getDeclaredExceptions()
    • getClassName

      public String getClassName()
    • pack

      public MethodGen pack()
    • makeSynthetic

      public void makeSynthetic()
    • packBody

      public void packBody(MethodGen gen)
      fill the newly created method gen with our body, inspired by InstructionList.copy()
    • optimizedPackBody

      public void optimizedPackBody(MethodGen gen)
    • isPrivate

      public boolean isPrivate()
    • isProtected

      public boolean isProtected()
    • isDefault

      public boolean isDefault()
    • isPublic

      public boolean isPublic()
    • assertGoodBody

      public void assertGoodBody()
      A good body is a body with the following properties:
      • For each branch instruction S in body, target T of S is in body.
      • For each branch instruction S in body, target T of S has S as a targeter.
      • For each instruction T in body, for each branch instruction S that is a targeter of T, S is in body.
      • For each non-range-handle instruction T in body, for each instruction S that is a targeter of T, S is either a branch instruction, an exception range or a tag
      • For each range-handle instruction T in body, there is exactly one targeter S that is a range.
      • For each range-handle instruction T in body, the range R targeting T is in body.
      • For each instruction T in body, for each exception range R targeting T, R is in body.
      • For each exception range R in body, let T := R.handler. T is in body, and R is one of T's targeters
      • All ranges are properly nested: For all ranges Q and R, if Q.start preceeds R.start, then R.end preceeds Q.end.
      Where the shorthand "R is in body" means "R.start is in body, R.end is in body, and any InstructionHandle stored in a field of R (such as an exception handle) is in body".
    • assertGoodBody

      public static void assertGoodBody(InstructionList il, String from)
    • getSourceLocation

      public ISourceLocation getSourceLocation()
    • getEffectiveSignature

      public AjAttribute.EffectiveSignatureAttribute getEffectiveSignature()
    • setEffectiveSignature

      public void setEffectiveSignature(ResolvedMember member, Shadow.Kind kind, boolean shouldWeave)
    • getSignature

      public String getSignature()
    • getParameterSignature

      public String getParameterSignature()
    • getMemberView

      public org.aspectj.weaver.bcel.BcelMethod getMemberView()
    • forcePublic

      public void forcePublic()
    • getCanInline

      public boolean getCanInline()
    • setCanInline

      public void setCanInline(boolean canInline)
    • addAttribute

      public void addAttribute(Attribute attribute)
    • toTraceString

      public String toTraceString()
      Specified by:
      toTraceString in interface Traceable
    • getConstantPool

      public ConstantPool getConstantPool()
    • isConstructor

      public static boolean isConstructor(LazyMethodGen aMethod)