Package org.aspectj.weaver

Examples of org.aspectj.weaver.ResolvedMember


  public static Shadow makeFieldGetShadow(World inWorld, Field forField, java.lang.reflect.Member inMember,
      MatchingContext withContext) {
    Shadow enclosingShadow = makeExecutionShadow(inWorld, inMember, withContext);
    Member signature = ReflectionBasedReferenceTypeDelegateFactory.createResolvedField(forField, inWorld);
    ResolvedMember enclosingMember = ReflectionBasedReferenceTypeDelegateFactory.createResolvedMember(inMember, inWorld);
    ResolvedType enclosingType = enclosingMember.getDeclaringType().resolve(inWorld);
    Kind kind = Shadow.FieldGet;
    return new StandardShadow(inWorld, kind, signature, enclosingShadow, enclosingType, enclosingMember, withContext);
  }
View Full Code Here


  }

  public static Shadow makeFieldSetShadow(World inWorld, Field forField, Class callerType, MatchingContext withContext) {
    Shadow enclosingShadow = makeStaticInitializationShadow(inWorld, callerType, withContext);
    Member signature = ReflectionBasedReferenceTypeDelegateFactory.createResolvedField(forField, inWorld);
    ResolvedMember enclosingMember = ReflectionBasedReferenceTypeDelegateFactory.createStaticInitMember(callerType, inWorld);
    ResolvedType enclosingType = enclosingMember.getDeclaringType().resolve(inWorld);
    Kind kind = Shadow.FieldSet;
    return new StandardShadow(inWorld, kind, signature, enclosingShadow, enclosingType, enclosingMember, withContext);
  }
View Full Code Here

  public static Shadow makeFieldSetShadow(World inWorld, Field forField, java.lang.reflect.Member inMember,
      MatchingContext withContext) {
    Shadow enclosingShadow = makeExecutionShadow(inWorld, inMember, withContext);
    Member signature = ReflectionBasedReferenceTypeDelegateFactory.createResolvedField(forField, inWorld);
    ResolvedMember enclosingMember = ReflectionBasedReferenceTypeDelegateFactory.createResolvedMember(inMember, inWorld);
    ResolvedType enclosingType = enclosingMember.getDeclaringType().resolve(inWorld);
    Kind kind = Shadow.FieldSet;
    return new StandardShadow(inWorld, kind, signature, enclosingShadow, enclosingType, enclosingMember, withContext);
  }
View Full Code Here

  }
 
  public static Shadow makeCallShadow(World inWorld, java.lang.reflect.Member aMember, java.lang.reflect.Member withinCode, MatchingContext withContext) {
    Shadow enclosingShadow = makeExecutionShadow(inWorld,withinCode,withContext);
    Member signature = ReflectionBasedReferenceTypeDelegateFactory.createResolvedMember(aMember, inWorld);
    ResolvedMember enclosingMember = ReflectionBasedReferenceTypeDelegateFactory.createResolvedMember(withinCode, inWorld);
    ResolvedType enclosingType = enclosingMember.getDeclaringType().resolve(inWorld);
    Kind kind = aMember instanceof Method ? Shadow.MethodCall : Shadow.ConstructorCall;
    return new ReflectionShadow(inWorld,kind,signature,enclosingShadow,enclosingType,enclosingMember,withContext);
  }
View Full Code Here

  }

  public static Shadow makeCallShadow(World inWorld, java.lang.reflect.Member aMember, Class thisClass, MatchingContext withContext) {
    Shadow enclosingShadow = makeStaticInitializationShadow(inWorld, thisClass,withContext);
    Member signature = ReflectionBasedReferenceTypeDelegateFactory.createResolvedMember(aMember, inWorld);
    ResolvedMember enclosingMember = ReflectionBasedReferenceTypeDelegateFactory.createStaticInitMember(thisClass, inWorld);
    ResolvedType enclosingType = enclosingMember.getDeclaringType().resolve(inWorld);
    Kind kind = aMember instanceof Method ? Shadow.MethodCall : Shadow.ConstructorCall;
    return new ReflectionShadow(inWorld,kind,signature,enclosingShadow,enclosingType,enclosingMember,withContext);
  }
View Full Code Here

    // must have all abstractions defined
    List elligibleAbstractions = new ArrayList();

    Collection abstractMethods = getOutstandingAbstractMethods(parent);
    for (Iterator iter = abstractMethods.iterator(); iter.hasNext();) {
      ResolvedMember method = (ResolvedMember) iter.next();
      if ("()V".equals(method.getSignature())) {
        String n = method.getName();
        // Allow for the abstract pointcut being from a code style
        // aspect compiled with -1.5 (see test for 128744)
        if (n.startsWith("ajc$pointcut")) {
          n = n.substring(14);
          n = n.substring(0, n.indexOf("$"));
          elligibleAbstractions.add(n);
        } else if (hasPointcutAnnotation(method)) {
          elligibleAbstractions.add(method.getName());
        } else {
          // error, an outstanding abstract method that can't be
          // concretized in XML
          reportError("Abstract method '" + method.toString() + "' cannot be concretized in XML: " + stringify());
          return false;
        }
      } else {
        if (method.getName().startsWith("ajc$pointcut") || hasPointcutAnnotation(method)) {
          // it may be a pointcut but it doesn't meet the requirements
          // for XML concretization
          reportError("Abstract method '"
              + method.toString()
              + "' cannot be concretized as a pointcut (illegal signature, must have no arguments, must return void): "
              + stringify());
          return false;
        } else {
          // error, an outstanding abstract method that can't be
          // concretized in XML
          reportError("Abstract method '" + method.toString() + "' cannot be concretized in XML: " + stringify());
          return false;
        }
      }
    }
    List pointcutNames = new ArrayList();
View Full Code Here

      }
    }
    ResolvedMember[] rms = type.getDeclaredMethods();
    if (rms != null) {
      for (int i = 0; i < rms.length; i++) {
        ResolvedMember member = rms[i];
        String key = member.getName() + member.getSignature();
        if (member.isAbstract()) {
          collector.put(key, member);
        } else {
          collector.remove(key);
        }
      }
View Full Code Here

  }

  private static void addPointcuts(AsmManager model, String sourcefilename, ResolvedType aspect,
      IProgramElement containingAspect, ResolvedMember[] pointcuts) {
    for (int i = 0; i < pointcuts.length; i++) {
      ResolvedMember pointcut = pointcuts[i];
      if (pointcut instanceof ResolvedPointcutDefinition) {
        ResolvedPointcutDefinition rpcd = (ResolvedPointcutDefinition) pointcut;
        Pointcut p = rpcd.getPointcut();
        ISourceLocation sLoc = (p == null ? null : p.getSourceLocation());
        if (sLoc == null) {
          sLoc = rpcd.getSourceLocation();
        }
        ISourceLocation pointcutLocation = (sLoc == null ? null : createSourceLocation(sourcefilename, aspect, sLoc));
        ProgramElement pointcutElement = new ProgramElement(model, pointcut.getName(), IProgramElement.Kind.POINTCUT,
            pointcutLocation, pointcut.getModifiers(), NO_COMMENT, Collections.EMPTY_LIST);
        containingAspect.addChild(pointcutElement);
      }
    }
  }
View Full Code Here

  private static final String NO_COMMENT = null;

  private static void addChildNodes(AsmManager asm, ResolvedType aspect, IProgramElement parent, ResolvedMember[] children) {
    for (int i = 0; i < children.length; i++) {
      ResolvedMember pcd = children[i];
      if (pcd instanceof ResolvedPointcutDefinition) {
        ResolvedPointcutDefinition rpcd = (ResolvedPointcutDefinition) pcd;
        Pointcut p = rpcd.getPointcut();
        ISourceLocation sLoc = (p == null ? null : p.getSourceLocation());
        if (sLoc == null) {
          sLoc = rpcd.getSourceLocation();
        }
        parent.addChild(new ProgramElement(asm, pcd.getName(), IProgramElement.Kind.POINTCUT, getBinarySourceLocation(
            aspect, sLoc), pcd.getModifiers(), null, Collections.EMPTY_LIST));
      }
    }
  }
View Full Code Here

   * member could still be located so they might be retrievable.
   */
  private static IProgramElement createIntertypeDeclaredChild(AsmManager model, ResolvedType aspect, BcelTypeMunger itd) {
    ResolvedTypeMunger rtMunger = itd.getMunger();

    ResolvedMember sig = rtMunger.getSignature();
    Kind kind = rtMunger.getKind();
    if (kind == ResolvedTypeMunger.Field) { // ITD FIELD
      // String name = rtMunger.getSignature().toString();
      String name = sig.getDeclaringType().getClassName() + "." + sig.getName();
      if (name.indexOf("$") != -1) {
        name = name.substring(name.indexOf("$") + 1);
      }
      IProgramElement pe = new ProgramElement(model, name, IProgramElement.Kind.INTER_TYPE_FIELD, getBinarySourceLocation(
          aspect, itd.getSourceLocation()), rtMunger.getSignature().getModifiers(), null, Collections.EMPTY_LIST);
      pe.setCorrespondingType(sig.getReturnType().getName());
      return pe;
    } else if (kind == ResolvedTypeMunger.Method) { // ITD
      // METHOD
      String name = sig.getDeclaringType().getClassName() + "." + sig.getName();
      if (name.indexOf("$") != -1) {
        name = name.substring(name.indexOf("$") + 1);
      }
      IProgramElement pe = new ProgramElement(model, name, IProgramElement.Kind.INTER_TYPE_METHOD, getBinarySourceLocation(
          aspect, itd.getSourceLocation()), rtMunger.getSignature().getModifiers(), null, Collections.EMPTY_LIST);
      setParams(pe, sig);
      return pe;
    } else if (kind == ResolvedTypeMunger.Constructor) {
      String name = sig.getDeclaringType().getClassName() + "." + sig.getDeclaringType().getClassName();
      if (name.indexOf("$") != -1) {
        name = name.substring(name.indexOf("$") + 1);
      }
      IProgramElement pe = new ProgramElement(model, name, IProgramElement.Kind.INTER_TYPE_CONSTRUCTOR,
          getBinarySourceLocation(aspect, itd.getSourceLocation()), rtMunger.getSignature().getModifiers(), null,
View Full Code Here

TOP

Related Classes of org.aspectj.weaver.ResolvedMember

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.