Class InterTypeMethodDeclaration

All Implemented Interfaces:
ReferenceContext, TypeConstants, TypeIds, ProblemSeverities

public class InterTypeMethodDeclaration extends InterTypeDeclaration
An inter-type method declaration.
Author:
Jim Hugunin
  • Constructor Details

  • Method Details

    • parseStatements

      public void parseStatements(Parser parser, CompilationUnitDeclaration unit)
      Description copied from class: AbstractMethodDeclaration
      Fill up the method body with statement
      Overrides:
      parseStatements in class MethodDeclaration
    • getPrefix

      protected char[] getPrefix()
      Specified by:
      getPrefix in class InterTypeDeclaration
    • isFinal

      public boolean isFinal()
    • analyseCode

      public void analyseCode(ClassScope classScope, FlowContext flowContext, FlowInfo flowInfo)
      Overrides:
      analyseCode in class MethodDeclaration
    • resolve

      public void resolve(ClassScope upperScope)
      Overrides:
      resolve in class InterTypeDeclaration
    • resolveStatements

      public void resolveStatements()
      Overrides:
      resolveStatements in class MethodDeclaration
    • build

      public EclipseTypeMunger build(ClassScope classScope)
      Description copied from class: InterTypeDeclaration
      Called from AspectDeclarations.buildInterTypeAndPerClause
      Specified by:
      build in class InterTypeDeclaration
    • generateCode

      public void generateCode(ClassScope classScope, ClassFile classFile)
      Description copied from class: AbstractMethodDeclaration
      Bytecode generation for a method
      Overrides:
      generateCode in class AbstractMethodDeclaration
    • generateDispatchMethod

      public void generateDispatchMethod(ClassScope classScope, ClassFile classFile)
      Generate a dispatch method for the intertype method declaration. Best illustrated by example, the ITD might be:
      
       aspect F {
                      void C.displaySearch(StringBuffer buffer, String name, String prefix, A criteria,B context)
       }
       
      In the class representing the aspect F we will generate the dispatcher:
      
       public static void ajc$interMethodDispatch1$F$C$displaySearch(C, java.lang.StringBuffer, java.lang.String, java.lang.String, A, B) 
       
      and the dispatcher will call the ITD method on the real target:
      
       instanceOfC.displaySearch(java.lang.StringBuffer, java.lang.String, java.lang.String, A, B) 
       
      Example generated code:
      
       public static void ajc$interMethodDispatch1$F$C$displaySearch(C, java.lang.StringBuffer, java.lang.String, java.lang.String, A, B);
         descriptor: (LC;Ljava/lang/StringBuffer;Ljava/lang/String;Ljava/lang/String;LA;LB;)V
         flags: (0x1009) ACC_PUBLIC, ACC_STATIC, ACC_SYNTHETIC
         Code:
         stack=6, locals=6, args_size=6
         0: aload_0
         1: aload_1
         2: aload_2
         3: aload_3
         4: aload         4
         6: aload         5
         8: invokeinterface #28,  6           // InterfaceMethod C.displaySearch:(Ljava/lang/StringBuffer;Ljava/lang/String;Ljava/lang/String;LA;LB;)V
        13: return
       
      Parameters:
      classScope - the aspect containing the ITD
      classFile - the class file to which the dispatch method is being added
    • getSlotSize

      public static int getSlotSize(int typeId)
    • getShadowKindForBody

      protected Shadow.Kind getShadowKindForBody()
      Specified by:
      getShadowKindForBody in class InterTypeDeclaration