Package org.aspectj.weaver

Examples of org.aspectj.weaver.ReferenceType


      ResolvedType type = null;
      if (upperBound != null) {
        if (upperBound.isIncludeSubtypes()) {
          canBeExact = false;
        } else {
          ReferenceType upper = (ReferenceType) upperBound.getExactType().resolve(scope.getWorld());
          type = new BoundedReferenceType(upper, true, scope.getWorld());
        }
      } else {
        if (lowerBound.isIncludeSubtypes()) {
          canBeExact = false;
        } else {
          ReferenceType lower = (ReferenceType) lowerBound.getExactType().resolve(scope.getWorld());
          type = new BoundedReferenceType(lower, false, scope.getWorld());
        }
      }
      if (canBeExact) {
        // might have changed if we find out include subtypes is set on one of the bounds...
View Full Code Here


      exceptionText.append("Found invalid (not a ReferenceType) entry in the type map. ");
      exceptionText.append("Signature=[" + signature + "] Found=[" + fromTheMap + "] Class=[" + fromTheMap.getClass() + "]");
      throw new BCException(exceptionText.toString());
    }

    ReferenceType nameTypeX = (ReferenceType) fromTheMap;

    if (nameTypeX == null) {
      if (jc.isGeneric() && isInJava5Mode()) {
        nameTypeX = ReferenceType.fromTypeX(UnresolvedType.forRawTypeName(jc.getClassName()), this);
        ret = buildBcelDelegate(nameTypeX, jc, artificial, true);
        ReferenceType genericRefType = new ReferenceType(UnresolvedType.forGenericTypeSignature(signature,
            ret.getDeclaredGenericSignature()), this);
        nameTypeX.setDelegate(ret);
        genericRefType.setDelegate(ret);
        nameTypeX.setGenericType(genericRefType);
        typeMap.put(signature, nameTypeX);
      } else {
        nameTypeX = new ReferenceType(signature, this);
        ret = buildBcelDelegate(nameTypeX, jc, artificial, true);
        typeMap.put(signature, nameTypeX);
      }
    } else {
      ret = buildBcelDelegate(nameTypeX, jc, artificial, true);
View Full Code Here

      exceptionText.append("Found invalid (not a ReferenceType) entry in the type map. ");
      exceptionText.append("Signature=[" + signature + "] Found=[" + fromTheMap + "] Class=[" + fromTheMap.getClass() + "]");
      throw new BCException(exceptionText.toString());
    }

    ReferenceType nameTypeX = (ReferenceType) fromTheMap;

    if (nameTypeX == null) {
      JavaClass jc = Utility.makeJavaClass(classname, bytes);
      if (jc.isGeneric() && isInJava5Mode()) {
        nameTypeX = ReferenceType.fromTypeX(UnresolvedType.forRawTypeName(jc.getClassName()), this);
        ret = buildBcelDelegate(nameTypeX, jc, artificial, true);
        ReferenceType genericRefType = new ReferenceType(UnresolvedType.forGenericTypeSignature(signature,
            ret.getDeclaredGenericSignature()), this);
        nameTypeX.setDelegate(ret);
        genericRefType.setDelegate(ret);
        nameTypeX.setGenericType(genericRefType);
        typeMap.put(signature, nameTypeX);
      } else {
        nameTypeX = new ReferenceType(signature, this);
        ret = buildBcelDelegate(nameTypeX, jc, artificial, true);
        typeMap.put(signature, nameTypeX);
      }
    } else {
      Object o = nameTypeX.getDelegate();
View Full Code Here

    }
    List<ResolvedPointcutDefinition> pointcuts = new ArrayList<ResolvedPointcutDefinition>();
    typeMungers = new ArrayList<ConcreteTypeMunger>();
    declares = new ArrayList<Declare>();
    processAttributes(l, pointcuts, false);
    ReferenceType type = getResolvedTypeX();
    AsmManager asmManager = ((BcelWorld) type.getWorld()).getModelAsAsmManager();
    l = AtAjAttributes.readAj5ClassAttributes(asmManager, javaClass, type, type.getSourceContext(), msgHandler,
        isCodeStyleAspect);
    AjAttribute.Aspect deferredAspectAttribute = processAttributes(l, pointcuts, true);

    if (pointcuts.size() == 0) {
      this.pointcuts = ResolvedPointcutDefinition.NO_POINTCUTS;
View Full Code Here

        }
      }
    }
    if (isGeneric()) {
      // update resolved typex to point at generic type not raw type.
      ReferenceType genericType = (ReferenceType) this.resolvedTypeX.getGenericType();
      // genericType.setSourceContext(this.resolvedTypeX.getSourceContext());
      // Can be null if unpacking whilst building the bcel delegate (in call hierarchy from BcelWorld.addSourceObjectType()
      // line 453) - see 317139
      if (genericType != null) {
        genericType.setStartPos(this.resolvedTypeX.getStartPos());
        this.resolvedTypeX = genericType;
      }
    }
  }
View Full Code Here

    // }
    // }
    //
    if (annotated.hasAnnotation(annotationType)) {
      if (annotationType instanceof ReferenceType) {
        ReferenceType rt = (ReferenceType) annotationType;
        if (rt.getRetentionPolicy() != null && rt.getRetentionPolicy().equals("SOURCE")) {
          rt.getWorld()
              .getMessageHandler()
              .handleMessage(
                  MessageUtil.warn(WeaverMessages.format(WeaverMessages.NO_MATCH_BECAUSE_SOURCE_RETENTION,
                      annotationType, annotated), getSourceLocation()));
          return FuzzyBoolean.NO;
        }
        ResolvedMember[] methods = rt.getDeclaredMethods();
        boolean found = false;
        for (int i = 0; i < methods.length && !found; i++) {
          if (methods[i].getReturnType().equals(formalType)) {
            found = true;
          }
View Full Code Here

        }
      }

      if (annotated.hasAnnotation(annotationType)) {
        if (annotationType instanceof ReferenceType) {
          ReferenceType rt = (ReferenceType) annotationType;
          if (rt.getRetentionPolicy() != null && rt.getRetentionPolicy().equals("SOURCE")) {
            rt.getWorld()
                .getMessageHandler()
                .handleMessage(
                    MessageUtil.warn(WeaverMessages.format(WeaverMessages.NO_MATCH_BECAUSE_SOURCE_RETENTION,
                        annotationType, annotated), getSourceLocation()));
            return FuzzyBoolean.NO;
View Full Code Here

            // System.out.println("? addJarFile() filename='" + filename
            // + "'");
            UnwovenClassFile classFile = new UnwovenClassFile(new File(outDir, filename).getAbsolutePath(), bytes);

            if (filename.endsWith(".class")) {
              ReferenceType type = this.addClassFile(classFile, false);
              StringBuffer sb = new StringBuffer();
              sb.append(inFile.getAbsolutePath());
              sb.append("!");
              sb.append(entry.getName());
              type.setBinaryPath(sb.toString());
              addedClassFiles.add(classFile);
            }
            // else if (!entry.isDirectory()) {
            //
            // /* bug-44190 Copy meta-data */
 
View Full Code Here

  /**
   * Should be addOrReplace
   */
  public ReferenceType addClassFile(UnwovenClassFile classFile, boolean fromInpath) {
    addedClasses.add(classFile);
    ReferenceType type = world.addSourceObjectType(classFile.getJavaClass(), false).getResolvedTypeX();
    if (fromInpath) {
      type.setBinaryPath(classFile.getFilename());
    }
    return type;
  }
View Full Code Here

      // "BCELWeaver: processing class from input directory "+classFile);
      StringBuffer sb = new StringBuffer();
      sb.append(inPathDir.getAbsolutePath());
      sb.append("!");
      sb.append(filename);
      ReferenceType type = this.addClassFile(ucf, false);
      type.setBinaryPath(sb.toString());
    }
    fis.close();
    return ucf;
  }
View Full Code Here

TOP

Related Classes of org.aspectj.weaver.ReferenceType

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.