Package org.aspectj.weaver

Examples of org.aspectj.weaver.ISourceContext


  }

  private void unpackAttributes(World world) {
    Attribute[] attrs = field.getAttributes();
    if (attrs != null && attrs.length > 0) {
      ISourceContext sourceContext = getSourceContext(world);
      List<AjAttribute> as = Utility.readAjAttributes(getDeclaringType().getClassName(), attrs, sourceContext, world,
          (bcelObjectType != null ? bcelObjectType.getWeaverVersionAttribute() : WeaverVersionInfo.CURRENT),
          new BcelConstantPoolReader(field.getConstantPool()));
      as.addAll(AtAjAttributes.readAj5FieldAttributes(field, this, world.resolve(getDeclaringType()), sourceContext,
          world.getMessageHandler()));
View Full Code Here


    new BodyPrinter(out).run();
    out.println("  end " + toShortString());
  }

  private void printAspectAttributes(PrintStream out, WeaverVersionInfo weaverVersion) {
    ISourceContext context = null;
    if (enclosingClass != null && enclosingClass.getType() != null) {
      context = enclosingClass.getType().getSourceContext();
    }
    List as = Utility.readAjAttributes(getClassName(), attributes.toArray(new Attribute[] {}), context, null, weaverVersion,
        new BcelConstantPoolReader(this.enclosingClass.getConstantPool()));
View Full Code Here

    new BodyPrinter(out).run();
    out.println("  end " + toShortString());
  }

  private void printAspectAttributes(PrintStream out, WeaverVersionInfo weaverVersion) {
    ISourceContext context = null;
    if (enclosingClass != null && enclosingClass.getType() != null) {
      context = enclosingClass.getType().getSourceContext();
    }
    List as = Utility.readAjAttributes(getClassName(), attributes.toArray(new Attribute[] {}), context, null, weaverVersion,
        new BcelConstantPoolReader(this.enclosingClass.getConstantPool()));
View Full Code Here

    // ATAJ: set the delegate right now for @AJ pointcut, else it is done
    // too late to lookup
    // @AJ pc refs annotation in class hierarchy
    resolvedTypeX.setDelegate(this);

    ISourceContext sourceContext = resolvedTypeX.getSourceContext();
    if (sourceContext == SourceContextImpl.UNKNOWN_SOURCE_CONTEXT) {
      sourceContext = new SourceContextImpl(this);
      setSourceContext(sourceContext);
    }
View Full Code Here

  // ----

  private void unpackAttributes(World world) {
    Attribute[] attrs = field.getAttributes();
    if (attrs != null && attrs.length > 0) {
      ISourceContext sourceContext = getSourceContext(world);
      List<AjAttribute> as = Utility.readAjAttributes(getDeclaringType().getClassName(), attrs, sourceContext, world,
          (bcelObjectType != null ? bcelObjectType.getWeaverVersionAttribute() : WeaverVersionInfo.CURRENT),
          new BcelConstantPoolReader(field.getConstantPool()));
      as.addAll(AtAjAttributes.readAj5FieldAttributes(field, this, world.resolve(getDeclaringType()), sourceContext, world
          .getMessageHandler()));
View Full Code Here

  @Override
  public ISourceLocation getSourceLocation() {
    ISourceLocation ret = super.getSourceLocation();
    if ((ret == null || ret.getLine() == 0) && hasDeclarationLineNumberInfo()) {
      // lets see if we can do better
      ISourceContext isc = getSourceContext();
      if (isc != null) {
        ret = isc.makeSourceLocation(getDeclarationLineNumber(), getDeclarationOffset());
      } else {
        ret = new SourceLocation(null, getDeclarationLineNumber());
      }
    }
    return ret;
View Full Code Here

    }
      if (inScope == null) {
        return new SimpleScope(getWorld(),formalBindings);
      } else {
        ResolvedType inType = getWorld().resolve(inScope.getName());
        ISourceContext sourceContext = new ISourceContext() {
          public ISourceLocation makeSourceLocation(IHasPosition position) {
            return new SourceLocation(new File(""),0);
          }
          public ISourceLocation makeSourceLocation(int line, int offset) {
            return new SourceLocation(new File(""),line);
View Full Code Here

    String perClause = getStringLiteralFor("value", aspectAnnotation, pcLoc);
    AspectDeclaration aspectDecl = new AspectDeclaration(typeDecl.compilationResult);

    try {
      if (perClause != null && !perClause.equals("")) {
        ISourceContext context = new EclipseSourceContext(unit.compilationResult,pcLoc[0]);
        Pointcut pc = new PatternParser(perClause,context).maybeParsePerClause();
          FormalBinding[] bindings = new FormalBinding[0];
        if (pc != null) pc.resolve(new EclipseScope(bindings,typeDecl.scope));
      }
    } catch(ParserException pEx) {
View Full Code Here

    private void resolveAndSetPointcut(MethodDeclaration methodDeclaration, Annotation adviceAnn) {
    int[] pcLocation = new int[2];
    String pointcutExpression = getStringLiteralFor("pointcut",adviceAnn,pcLocation);
    if (pointcutExpression == null) pointcutExpression = getStringLiteralFor("value",adviceAnn,pcLocation);
    try {
      ISourceContext context = new EclipseSourceContext(unit.compilationResult,pcLocation[0]);
      Pointcut pc = new PatternParser(pointcutExpression,context).parsePointcut();
      FormalBinding[] bindings = buildFormalAdviceBindingsFrom(methodDeclaration);
      pc.resolve(new EclipseScope(bindings,methodDeclaration.scope));
      EclipseFactory factory = EclipseFactory.fromScopeLookupEnvironment(methodDeclaration.scope);
      // now create a ResolvedPointcutDefinition,make an attribute out of it, and add it to the method
View Full Code Here

 
    boolean containsIfPcd = false;
    int[] pcLocation = new int[2];
    String pointcutExpression = getStringLiteralFor("value",ajAnnotations.pointcutAnnotation,pcLocation);
    try {
      ISourceContext context = new EclipseSourceContext(unit.compilationResult,pcLocation[0]);
            Pointcut pc = null;//abstract
            if (pointcutExpression == null  || pointcutExpression.length() == 0) {
                ;//will have to ensure abstract ()V method
            } else {
                pc = new PatternParser(pointcutExpression,context).parsePointcut();
View Full Code Here

TOP

Related Classes of org.aspectj.weaver.ISourceContext

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.