Package org.aspectj.weaver

Examples of org.aspectj.weaver.World$AspectPrecedenceCalculator$PrecedenceCacheKey


  private final static String declareAtPrefix = "ajc$declare_at";

  private boolean hasField(ResolvedType type) {
    // TODO what about ITDs
    World world = type.getWorld();
    for (Iterator iter = type.getFields(); iter.hasNext();) {
      Member field = (Member) iter.next();
      if (field.getName().startsWith(declareAtPrefix)) {
        continue;
      }
View Full Code Here


    return false;
  }

  private boolean hasMethod(ResolvedType type) {
    // TODO what about ITDs
    World world = type.getWorld();
    for (Iterator iter = type.getMethods(true, true); iter.hasNext();) {
      Member method = (Member) iter.next();
      if (method.getName().startsWith(declareAtPrefix)) {
        continue;
      }
View Full Code Here

    }

  }

  public void warnOnAddedInterface(ResolvedType type, ResolvedType parent) {
    World world = factory.getWorld();
    ResolvedType serializable = world.getCoreType(UnresolvedType.SERIALIZABLE);
    if (serializable.isAssignableFrom(type) && !serializable.isAssignableFrom(parent)
        && !LazyClassGen.hasSerialVersionUIDField(type)) {
      world.getLint().needsSerialVersionUIDField.signal(new String[] { type.getName().toString(),
          "added interface " + parent.getName().toString() }, null, null);
    }
  }
View Full Code Here

    Options.WeaverOption weaverOption = Options.parse(allOptions.toString(), loader, getMessageHandler());

    // configure the weaver and world
    // AV - code duplicates AspectJBuilder.initWorldAndWeaver()
    World world = weaver.getWorld();
    setMessageHandler(weaverOption.messageHandler);
    world.setXlazyTjp(weaverOption.lazyTjp);
    world.setXHasMemberSupportEnabled(weaverOption.hasMember);
    world.setTiming(weaverOption.timers, true);
    world.setOptionalJoinpoints(weaverOption.optionalJoinpoints);
    world.setPinpointMode(weaverOption.pinpoint);
    weaver.setReweavableMode(weaverOption.notReWeavable);
    world.performExtraConfiguration(weaverOption.xSet);
    world.setXnoInline(weaverOption.noInline);
    // AMC - autodetect as per line below, needed for AtAjLTWTests.testLTWUnweavable
    world.setBehaveInJava5Way(LangUtil.is15VMOrGreater());
    world.setAddSerialVerUID(weaverOption.addSerialVersionUID);

    /* First load defaults */
    bcelWorld.getLint().loadDefaultProperties();

    /* Second overlay LTW defaults */
    bcelWorld.getLint().adviceDidNotMatch.setKind(null);

    /* Third load user file using -Xlintfile so that -Xlint wins */
    if (weaverOption.lintFile != null) {
      InputStream resource = null;
      try {
        resource = loader.getResourceAsStream(weaverOption.lintFile);
        Exception failure = null;
        if (resource != null) {
          try {
            Properties properties = new Properties();
            properties.load(resource);
            world.getLint().setFromProperties(properties);
          } catch (IOException e) {
            failure = e;
          }
        }
        if (failure != null || resource == null) {
View Full Code Here

    // no warnings for declare error/warning
    if (munger instanceof Checker) {
      return;
    }

    World world = shadow.getIWorld();

    // warning never needed if the declaring type is any
    UnresolvedType exactDeclaringType = signature.getDeclaringType().getExactType();

    ResolvedType shadowDeclaringType = shadow.getSignature().getDeclaringType().resolve(world);

    if (signature.getDeclaringType().isStar() || ResolvedType.isMissing(exactDeclaringType)
        || exactDeclaringType.resolve(world).isMissing()) {
      return;
    }

    // warning not needed if match type couldn't ever be the declaring type
    if (!shadowDeclaringType.isAssignableFrom(exactDeclaringType.resolve(world))) {
      return;
    }

    // if the method in the declaring type is *not* visible to the
    // exact declaring type then warning not needed.
    ResolvedMember rm = shadow.getSignature().resolve(world);
    // rm can be null in the case where we are binary weaving, and looking at a class with a call to a method in another class,
    // but because of class incompatibilities, the method does not exist on the target class anymore.
    // this will be reported elsewhere.
    if (rm == null) {
      return;
    }

    int shadowModifiers = rm.getModifiers();
    if (!ResolvedType.isVisible(shadowModifiers, shadowDeclaringType, exactDeclaringType.resolve(world))) {
      return;
    }

    if (!signature.getReturnType().matchesStatically(shadow.getSignature().getReturnType().resolve(world))) {
      // Covariance issue...
      // The reason we didn't match is that the type pattern for the pointcut (Car) doesn't match the
      // return type for the specific declaration at the shadow. (FastCar Sub.getCar())
      // XXX Put out another XLINT in this case?
      return;
    }
    // PR60015 - Don't report the warning if the declaring type is object and 'this' is an interface
    if (exactDeclaringType.resolve(world).isInterface() && shadowDeclaringType.equals(world.resolve("java.lang.Object"))) {
      return;
    }

    SignaturePattern nonConfusingPattern = new SignaturePattern(signature.getKind(), signature.getModifiers(), signature
        .getReturnType(), TypePattern.ANY, signature.getName(), signature.getParameterTypes(),
View Full Code Here

    }
    signature = signature.resolveBindings(scope, bindings);

    if (kind == Shadow.ConstructorExecution) { // Bug fix 60936
      if (signature.getDeclaringType() != null) {
        World world = scope.getWorld();
        UnresolvedType exactType = signature.getDeclaringType().getExactType();
        if (signature.getKind() == Member.CONSTRUCTOR && !ResolvedType.isMissing(exactType)
            && exactType.resolve(world).isInterface() && !signature.getDeclaringType().isIncludeSubtypes()) {
          world.getLint().noInterfaceCtorJoinpoint.signal(exactType.toString(), getSourceLocation());
        }
      }
    }

    // no parameterized types
View Full Code Here

      // No annotation found
      return false;
    }

    Method annotatedMethod = struct.method;
    World world = struct.enclosingType.getWorld();
    NameValuePair declareMixinPatternNameValuePair = getAnnotationElement(declareMixinAnnotation, VALUE);

    // declareMixinPattern could be of the form "Bar*" or "A || B" or "Foo+"
    String declareMixinPattern = declareMixinPatternNameValuePair.getValue().stringifyValue();
    TypePattern targetTypePattern = parseTypePattern(declareMixinPattern, struct);
View Full Code Here

  // }
  // }

  private ResolvedMember getPointcutDeclaration(ReferencePointcut rp, MethodDeclaration declaration) {
    EclipseFactory factory = ((AjLookupEnvironment) declaration.scope.environment()).factory;
    World world = factory.getWorld();
    UnresolvedType onType = rp.onType;
    if (onType == null) {
      if (declaration.binding != null) {
        Member member = factory.makeResolvedMember(declaration.binding);
        onType = member.getDeclaringType();
View Full Code Here

    checkWeaveAccess(key.getDeclaringType(), location);
    accessors.put(key, key);
  }

  private void checkWeaveAccess(UnresolvedType typeX, ASTNode location) {
    World world = inAspect.factory.getWorld();
    Lint.Kind check = world.getLint().typeNotExposedToWeaver;
    if (check.isEnabled()) {
      if (!world.resolve(typeX).isExposedToWeaver()) {
        ISourceLocation loc = null;
        if (location != null) {
          loc = new EclipseSourceLocation(inAspect.compilationResult, location.sourceStart, location.sourceEnd);
        }
        check.signal(typeX.getName() + " (needed for privileged access)", loc);
View Full Code Here

    }

    Member cflowStackField = new ResolvedMemberImpl(Member.FIELD, inAspect, Modifier.STATIC | Modifier.PUBLIC | Modifier.FINAL,
        UnresolvedType.forName(NameMangler.CFLOW_STACK_TYPE), NameMangler.PERCFLOW_FIELD_NAME, UnresolvedType.NONE);

    World world = inAspect.getWorld();

    CrosscuttingMembers xcut = inAspect.crosscuttingMembers;

    Collection<ShadowMunger> previousCflowEntries = xcut.getCflowEntries();
    Pointcut concreteEntry = entry.concretize(inAspect, inAspect, 0, null); // IntMap
View Full Code Here

TOP

Related Classes of org.aspectj.weaver.World$AspectPrecedenceCalculator$PrecedenceCacheKey

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.