Package org.aspectj.weaver

Examples of org.aspectj.weaver.ResolvedMember


    // check the ITD'd dooberries
    List<ConcreteTypeMunger> mungers = relevantType.resolve(world).getInterTypeMungers();
    for (ConcreteTypeMunger typeMunger : mungers) {
      if (typeMunger.getMunger() instanceof NewMethodTypeMunger || typeMunger.getMunger() instanceof NewConstructorTypeMunger) {
        ResolvedMember fakerm = typeMunger.getSignature();
        if (fakerm.getName().equals(getSignature().getName())
            && fakerm.getParameterSignature().equals(getSignature().getParameterSignature())) {
          if (foundMember.getKind() == ResolvedMember.CONSTRUCTOR) {
            foundMember = AjcMemberMaker.interConstructor(relevantType, foundMember, typeMunger.getAspectType());
          } else {
            foundMember = AjcMemberMaker.interMethod(foundMember, typeMunger.getAspectType(), false);
            // ResolvedMember o = AjcMemberMaker.interMethodBody(fakerm, typeMunger.getAspectType());
View Full Code Here


      for (Iterator<ConcreteTypeMunger> iter = mungers.iterator(); iter.hasNext();) {
        Object munger = iter.next();
        ConcreteTypeMunger typeMunger = (ConcreteTypeMunger) munger;
        if (typeMunger.getMunger() instanceof NewMethodTypeMunger
            || typeMunger.getMunger() instanceof NewConstructorTypeMunger) {
          ResolvedMember fakerm = typeMunger.getSignature();
          // if (fakerm.hasAnnotations())

          ResolvedMember ajcMethod = (getSignature().getKind() == ResolvedMember.CONSTRUCTOR ? AjcMemberMaker
              .postIntroducedConstructor(typeMunger.getAspectType(), fakerm.getDeclaringType(), fakerm
                  .getParameterTypes()) : AjcMemberMaker
              .interMethodDispatcher(fakerm, typeMunger.getAspectType()));
          // AjcMemberMaker.interMethodBody(fakerm,typeMunger.getAspectType()));
          ResolvedMember rmm = findMethod(typeMunger.getAspectType(), ajcMethod);
          if (fakerm.getName().equals(getSignature().getName())
              && fakerm.getParameterSignature().equals(getSignature().getParameterSignature())) {
            relevantType = typeMunger.getAspectType();
            foundMember = rmm;
            return foundMember.getAnnotationTypes();
View Full Code Here

    // Determine the annotations that are of interest
    if (getKind() == Shadow.StaticInitialization) {
      annotations = relevantType.resolve(world).getAnnotationTypes();
    } else if (getKind() == Shadow.MethodCall || getKind() == Shadow.ConstructorCall) {
      ResolvedMember foundMember = findMethod2(relevantType.resolve(world).getDeclaredMethods(), getSignature());
      annotations = getAnnotations(foundMember, shadowSignature, relevantType);
      annotationHolder = getRelevantMember(foundMember, shadowSignature, relevantType);
      relevantType = annotationHolder.getDeclaringType().resolve(world);
    } else if (getKind() == Shadow.FieldSet || getKind() == Shadow.FieldGet) {
      annotationHolder = findField(relevantType.getDeclaredFields(), getSignature());

      if (annotationHolder == null) {
        // check the ITD'd dooberries
        List<ConcreteTypeMunger> mungers = relevantType.resolve(world).getInterTypeMungers();
        for (ConcreteTypeMunger typeMunger : mungers) {
          if (typeMunger.getMunger() instanceof NewFieldTypeMunger) {
            ResolvedMember fakerm = typeMunger.getSignature();
            // if (fakerm.hasAnnotations())
            ResolvedMember ajcMethod = AjcMemberMaker.interFieldInitializer(fakerm, typeMunger.getAspectType());
            ResolvedMember rmm = findMethod(typeMunger.getAspectType(), ajcMethod);
            if (fakerm.equals(getSignature())) {
              relevantType = typeMunger.getAspectType();
              annotationHolder = rmm;
            }
          }
        }
      }
      annotations = ((ResolvedMember) annotationHolder).getAnnotationTypes();

    } else if (getKind() == Shadow.MethodExecution || getKind() == Shadow.ConstructorExecution
        || getKind() == Shadow.AdviceExecution) {

      ResolvedMember foundMember = findMethod2(relevantType.getDeclaredMethods(), getSignature());
      annotations = getAnnotations(foundMember, shadowSignature, relevantType);
      annotationHolder = getRelevantMember(foundMember, annotationHolder, relevantType);
      UnresolvedType ut = annotationHolder.getDeclaringType();
      relevantType = ut.resolve(world);

    } else if (getKind() == Shadow.ExceptionHandler) {
      relevantType = getSignature().getParameterTypes()[0].resolve(world);
      annotations = relevantType.getAnnotationTypes();

    } else if (getKind() == Shadow.PreInitialization || getKind() == Shadow.Initialization) {
      ResolvedMember found = findMethod2(relevantType.getDeclaredMethods(), getSignature());
      annotations = found.getAnnotationTypes();
    }

    if (annotations == null) {
      // We can't have recognized the shadow - should blow up now to be on the safe side
      throw new BCException("Could not discover annotations for shadow: " + getKind());
View Full Code Here

    }
    return null;
  }

  private ResolvedMember findMethod(ResolvedType aspectType, ResolvedMember ajcMethod) {
    ResolvedMember decMethods[] = aspectType.getDeclaredMethods();
    for (int i = 0; i < decMethods.length; i++) {
      ResolvedMember member = decMethods[i];
      if (member.equals(ajcMethod)) {
        return member;
      }
    }
    return null;
  }
View Full Code Here

    return null;
  }

  private ResolvedMember findField(ResolvedMember[] members, Member lookingFor) {
    for (int i = 0; i < members.length; i++) {
      ResolvedMember member = members[i];
      if (member.getName().equals(getSignature().getName()) && member.getType().equals(getSignature().getType())) {
        return member;
      }
    }
    return null;
  }
View Full Code Here

  public void weaveAroundInline(BcelAdvice munger, boolean hasDynamicTest) {
    // !!! THIS BLOCK OF CODE SHOULD BE IN A METHOD CALLED weaveAround(...);
    Member mungerSig = munger.getSignature();
    // Member originalSig = mungerSig; // If mungerSig is on a parameterized type, originalSig is the member on the generic type
    if (mungerSig instanceof ResolvedMember) {
      ResolvedMember rm = (ResolvedMember) mungerSig;
      if (rm.hasBackingGenericMember()) {
        mungerSig = rm.getBackingGenericMember();
      }
    }
    ResolvedType declaringAspectType = world.resolve(mungerSig.getDeclaringType(), true);
    if (declaringAspectType.isMissing()) {
      world.getLint().cantFindType.signal(new String[] { WeaverMessages.format(
View Full Code Here

      // they will still refer to the subtype.
      if ((getKind() == FieldGet || getKind() == FieldSet) && getActualTargetType() != null
          && !getActualTargetType().equals(targetType.getName())) {
        targetType = UnresolvedType.forName(getActualTargetType()).resolve(world);
      }
      ResolvedMember resolvedMember = getSignature().resolve(world);

      // pr230075, pr197719
      if (resolvedMember != null && Modifier.isProtected(resolvedMember.getModifiers())
          && !samePackage(resolvedMember.getDeclaringType().getPackageName(), getEnclosingType().getPackageName())
          && !resolvedMember.getName().equals("clone")) {
        if (!hasThis()) { // pr197719 - static accessor has been created to handle the call
          if (Modifier.isStatic(enclosingMethod.getAccessFlags()) && enclosingMethod.getName().startsWith("access$")) {
            targetType = BcelWorld.fromBcel(enclosingMethod.getArgumentTypes()[0]);
          }
        } else {
View Full Code Here

          }
        } else {
          if (amd.binding == null || !amd.binding.isValidBinding()) {
            continue;
          }
          ResolvedMember member = factory.makeResolvedMember(amd.binding);
          if (unit != null) {
            boolean positionKnown = true;
            if (amd.binding.sourceMethod() == null) {
              if (amd.binding.declaringClass instanceof SourceTypeBinding) {
                SourceTypeBinding stb = ((SourceTypeBinding) amd.binding.declaringClass);
                if (stb.scope == null || stb.scope.referenceContext == null) {
                  positionKnown = false;
                }
              }
            }
            if (positionKnown) { // pr229829
              member.setSourceContext(new EclipseSourceContext(unit.compilationResult, amd.binding.sourceStart()));
              member.setPosition(amd.binding.sourceStart(), amd.binding.sourceEnd());
            } else {
              member.setSourceContext(new EclipseSourceContext(unit.compilationResult, 0));
              member.setPosition(0, 0);
            }
          }
          declaredMethods.add(member);
        }
      }
View Full Code Here

    // see #104212
    if (ii.opcode == Constants.INVOKESTATIC) {
      ResolvedType appearsDeclaredBy = resolve(declaring);
      // look for the method there
      for (Iterator<ResolvedMember> iterator = appearsDeclaredBy.getMethods(true, true); iterator.hasNext();) {
        ResolvedMember method = iterator.next();
        if (Modifier.isStatic(method.getModifiers())) {
          if (name.equals(method.getName()) && signature.equals(method.getSignature())) {
            // we found it
            declaringType = method.getDeclaringType();
            break;
          }
        }
      }
    }
View Full Code Here

      AstUtil.replaceMethodBinding(call, superAccessBinding);
    } else {
      return;
    }
    ResolvedMember targetMember = null;
    if (superBinding.declaringClass.isParameterizedType()) { // pr206911
      targetMember = factory.makeResolvedMember(superBinding, ((ParameterizedTypeBinding) superBinding.declaringClass)
          .genericType());
    } else {
      targetMember = factory.makeResolvedMember(superBinding);
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.