Package org.aspectj.weaver

Examples of org.aspectj.weaver.ResolvedType


  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


   * (non-Javadoc)
   *
   * @see org.aspectj.weaver.Shadow#getKindedAnnotationVar(org.aspectj.weaver.UnresolvedType)
   */
  public Var getKindedAnnotationVar(UnresolvedType forAnnotationType) {
    ResolvedType annType = forAnnotationType.resolve(world);
    if (annotationVar.get(annType) == null) {
      Var v = ReflectionVar.createAtAnnotationVar(annType, this.annotationFinder);
      annotationVar.put(annType, v);
    }
    return (Var) annotationVar.get(annType);
View Full Code Here

   * (non-Javadoc)
   *
   * @see org.aspectj.weaver.Shadow#getWithinAnnotationVar(org.aspectj.weaver.UnresolvedType)
   */
  public Var getWithinAnnotationVar(UnresolvedType forAnnotationType) {
    ResolvedType annType = forAnnotationType.resolve(world);
    if (withinAnnotationVar.get(annType) == null) {
      Var v = ReflectionVar.createWithinAnnotationVar(annType, this.annotationFinder);
      withinAnnotationVar.put(annType, v);
    }
    return (Var) withinAnnotationVar.get(annType);
View Full Code Here

   * (non-Javadoc)
   *
   * @see org.aspectj.weaver.Shadow#getWithinCodeAnnotationVar(org.aspectj.weaver.UnresolvedType)
   */
  public Var getWithinCodeAnnotationVar(UnresolvedType forAnnotationType) {
    ResolvedType annType = forAnnotationType.resolve(world);
    if (withinCodeAnnotationVar.get(annType) == null) {
      Var v = ReflectionVar.createWithinCodeAnnotationVar(annType, this.annotationFinder);
      withinCodeAnnotationVar.put(annType, v);
    }
    return (Var) withinCodeAnnotationVar.get(annType);
View Full Code Here

   * (non-Javadoc)
   *
   * @see org.aspectj.weaver.Shadow#getArgAnnotationVar(int, org.aspectj.weaver.UnresolvedType)
   */
  public Var getArgAnnotationVar(int i, UnresolvedType forAnnotationType) {
    ResolvedType annType = forAnnotationType.resolve(world);
    if (atArgsVars.get(annType) == null) {
      Var[] vars = new Var[getArgCount()];
      atArgsVars.put(annType, vars);
    }
    Var[] vars = (Var[]) atArgsVars.get(annType);
View Full Code Here

      } else {
        return getWorld().resolve(name);
      }
    } else if (aType instanceof ParameterizedType) {
      ParameterizedType pt = (ParameterizedType) aType;
      ResolvedType baseType = fromType(pt.getRawType());
      Type[] args = pt.getActualTypeArguments();
      ResolvedType[] resolvedArgs = fromTypes(args);
/*      StringBuilder sb = new StringBuilder();
      for (int i = 0; i < resolvedArgs.length; i++) {
        sb.append(resolvedArgs[i]).append(" ");
      }
      for (int i = 0; i < resolvedArgs.length; i++) {
        if (resolvedArgs[i] == null) {
          String ss = "";
          try {
            ss = aType.toString();
          } catch (Exception e) {
          }
          throw new IllegalStateException("Parameterized type problem.  basetype=" + baseType + " arguments="
              + sb.toString() + " ss=" + ss);
        }
      }
*/
      return TypeFactory.createParameterizedType(baseType, resolvedArgs, getWorld());
    } else if (aType instanceof java.lang.reflect.TypeVariable) {
      if (typeVariablesInProgress.get(aType) != null) {
        return typeVariablesInProgress.get(aType);
      }

      java.lang.reflect.TypeVariable tv = (java.lang.reflect.TypeVariable) aType;
      TypeVariable rt_tv = new TypeVariable(tv.getName());
      TypeVariableReferenceType tvrt = new TypeVariableReferenceType(rt_tv, getWorld());

      typeVariablesInProgress.put(aType, tvrt); // record what we are working on, for recursion case

      Type[] bounds = tv.getBounds();
      ResolvedType[] resBounds = fromTypes(bounds);
      ResolvedType upperBound = resBounds[0];
      ResolvedType[] additionalBounds = new ResolvedType[0];
      if (resBounds.length > 1) {
        additionalBounds = new ResolvedType[resBounds.length - 1];
        System.arraycopy(resBounds, 1, additionalBounds, 0, additionalBounds.length);
      }
      rt_tv.setUpperBound(upperBound);
      rt_tv.setAdditionalInterfaceBounds(additionalBounds);

      typeVariablesInProgress.remove(aType); // we have finished working on it

      return tvrt;
    } else if (aType instanceof WildcardType) {
      WildcardType wildType = (WildcardType) aType;
      Type[] lowerBounds = wildType.getLowerBounds();
      Type[] upperBounds = wildType.getUpperBounds();
      ResolvedType bound = null;
      boolean isExtends = lowerBounds.length == 0;
      if (isExtends) {
        bound = fromType(upperBounds[0]);
      } else {
        bound = fromType(lowerBounds[0]);
View Full Code Here

      LazyMethodGen enclosingMethod) {
    int len = proceedParamTypes.length;
    BcelVar[] ret = new BcelVar[len];

    for (int i = len - 1; i >= 0; i--) {
      ResolvedType typeX = proceedParamTypes[i];
      Type type = BcelWorld.makeBcelType(typeX);
      int local = enclosingMethod.allocateLocal(type);

      il.append(InstructionFactory.createStore(type, local));
      ret[i] = new BcelVar(typeX, local);
View Full Code Here

    }

    // name must be undefined so far
    // TODO only convert the name to signature once, probably earlier than
    // this
    ResolvedType current = world.lookupBySignature(UnresolvedType.forName(concreteAspect.name).getSignature());

    if (current != null && !current.isMissing()) {
      reportError("Attempt to concretize but chosen aspect name already defined: " + stringify());
      return false;
    }

    // it can happen that extends is null, for precedence only declaration
View Full Code Here

    // continue to fault in the model.
    if (!sourceFileNode.getKind().equals(IProgramElement.Kind.FILE_JAVA)) {
      return;
    }

    ResolvedType aspect = munger.getDeclaringType();

    // create the class file node
    IProgramElement classFileNode = new ProgramElement(asm, sourceFileNode.getName(), IProgramElement.Kind.FILE,
        munger.getBinarySourceLocation(aspect.getSourceLocation()), 0, null, null);

    // create package ipe if one exists....
    IProgramElement root = asm.getHierarchy().getRoot();
    IProgramElement binaries = asm.getHierarchy().findElementForLabel(root, IProgramElement.Kind.SOURCE_FOLDER, "binaries");
    if (binaries == null) {
      binaries = new ProgramElement(asm, "binaries", IProgramElement.Kind.SOURCE_FOLDER, new ArrayList());
      root.addChild(binaries);
    }
    // if (aspect.getPackageName() != null) {
    String packagename = aspect.getPackageName() == null ? "" : aspect.getPackageName();
    // check that there doesn't already exist a node with this name
    IProgramElement pkgNode = asm.getHierarchy().findElementForLabel(binaries, IProgramElement.Kind.PACKAGE, packagename);
    // note packages themselves have no source location
    if (pkgNode == null) {
      pkgNode = new ProgramElement(asm, packagename, IProgramElement.Kind.PACKAGE, new ArrayList());
      binaries.addChild(pkgNode);
      pkgNode.addChild(classFileNode);
    } else {
      // need to add it first otherwise the handle for classFileNode
      // may not be generated correctly if it uses information from
      // it's parent node
      pkgNode.addChild(classFileNode);
      for (Iterator iter = pkgNode.getChildren().iterator(); iter.hasNext();) {
        IProgramElement element = (IProgramElement) iter.next();
        if (!element.equals(classFileNode) && element.getHandleIdentifier().equals(classFileNode.getHandleIdentifier())) {
          // already added the classfile so have already
          // added the structure for this aspect
          pkgNode.removeChild(classFileNode);
          return;
        }
      }
    }
    // } else {
    // // need to add it first otherwise the handle for classFileNode
    // // may not be generated correctly if it uses information from
    // // it's parent node
    // root.addChild(classFileNode);
    // for (Iterator iter = root.getChildren().iterator(); iter.hasNext();)
    // {
    // IProgramElement element = (IProgramElement) iter.next();
    // if (!element.equals(classFileNode) &&
    // element.getHandleIdentifier().equals
    // (classFileNode.getHandleIdentifier())) {
    // // already added the sourcefile so have already
    // // added the structure for this aspect
    // root.removeChild(classFileNode);
    // return;
    // }
    // }
    // }

    // add and create empty import declaration ipe
    // classFileNode.addChild(new ProgramElement(asm, "import declarations", IProgramElement.Kind.IMPORT_REFERENCE, null, 0,
    // null,
    // null));

    // add and create aspect ipe
    IProgramElement aspectNode = new ProgramElement(asm, aspect.getSimpleName(), IProgramElement.Kind.ASPECT,
        munger.getBinarySourceLocation(aspect.getSourceLocation()), aspect.getModifiers(), null, null);
    classFileNode.addChild(aspectNode);

    String sourcefilename = getSourceFileName(aspect);
    addPointcuts(asm, sourcefilename, aspect, aspectNode, aspect.getDeclaredPointcuts());
    addChildNodes(asm, aspect, aspectNode, aspect.getDeclaredAdvice());
    addChildNodes(asm, aspect, aspectNode, aspect.getDeclares());
    addChildNodes(asm, aspect, aspectNode, aspect.getTypeMungers());

  }
View Full Code Here

   * @return
   */
  public BcelVar getThisJoinPointStaticPartBcelVar(final boolean isEnclosingJp) {
    if (thisJoinPointStaticPartVar == null) {
      Field field = getEnclosingClass().getTjpField(this, isEnclosingJp);
      ResolvedType sjpType = null;
      if (world.isTargettingAspectJRuntime12()) { // TAG:SUPPORTING12: We didn't have different jpsp types in 1.2
        sjpType = world.getCoreType(UnresolvedType.JOINPOINT_STATICPART);
      } else {
        sjpType = isEnclosingJp ? world.getCoreType(UnresolvedType.JOINPOINT_ENCLOSINGSTATICPART) : world
            .getCoreType(UnresolvedType.JOINPOINT_STATICPART);
View Full Code Here

TOP

Related Classes of org.aspectj.weaver.ResolvedType

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.