Package org.aspectj.bridge

Examples of org.aspectj.bridge.ISourceLocation


   */
  public IProgramElement findNodeForSourceFile(IProgramElement node, String sourcefilePath) {
    // 1. why is <root> a sourcefile node?
    // 2. should isSourceFile() return true for a FILE that is a .class file...?
    if ((node.getKind().isSourceFile() && !node.getName().equals("<root>")) || node.getKind().isFile()) {
      ISourceLocation nodeLoc = node.getSourceLocation();
      if (nodeLoc != null && asm.getCanonicalFilePath(nodeLoc.getSourceFile()).equals(sourcefilePath)) {
        return node;
      }
      return null; // no need to search children of a source file node
    } else {
      // check the children
View Full Code Here


  public IProgramElement findCloserMatchForLineNumber(IProgramElement node, int lineno) {
    if (node == null || node.getChildren() == null) {
      return null;
    }
    for (IProgramElement child : node.getChildren()) {
      ISourceLocation childLoc = child.getSourceLocation();
      if (childLoc != null) {
        if (childLoc.getLine() <= lineno && childLoc.getEndLine() >= lineno) {
          // This child is a better match for that line number
          IProgramElement evenCloserMatch = findCloserMatchForLineNumber(child, lineno);
          if (evenCloserMatch == null) {
            return child;
          } else {
View Full Code Here

    // if (node != null && node.getSourceLocation() != null)
    // System.err.println("====\n1: " +
    // sourceFilePath + "\n2: " +
    // node.getSourceLocation().getSourceFile().getCanonicalPath().equals(sourceFilePath)
    // );
    ISourceLocation nodeSourceLocation = (node != null ? node.getSourceLocation() : null);
    return node != null
        && nodeSourceLocation != null
        && nodeSourceLocation.getSourceFile().getAbsolutePath().equals(sourceFilePath)
        && ((offSet != -1 && nodeSourceLocation.getOffset() == offSet) || offSet == -1)
        && ((nodeSourceLocation.getLine() <= lineNumber && nodeSourceLocation.getEndLine() >= lineNumber) || (lineNumber <= 1 && node
            .getKind().isSourceFile()));
    // } catch (IOException ioe) {
    // return false;
    // }
  }
View Full Code Here

    writeSourceLocation(s);
    writeOutTypeAliases(s);
  }

  public static ResolvedTypeMunger readMethod(VersionedDataInputStream s, ISourceContext context) throws IOException {
    ISourceLocation sloc = null;
    ResolvedMemberImpl rmImpl = ResolvedMemberImpl.readResolvedMember(s, context);
    Set<ResolvedMember> superMethodsCalled = readSuperMethodsCalled(s);
    sloc = readSourceLocation(s);
    List<String> typeVarAliases = readInTypeAliases(s);
View Full Code Here

    } else if (key.equalsIgnoreCase("joinpoint.signature.declaringtype")) {
      return shadow.getSignature().getDeclaringType().toString();
    } else if (key.equalsIgnoreCase("joinpoint.signature.name")) {
      return shadow.getSignature().getName();
    } else if (key.equalsIgnoreCase("joinpoint.sourcelocation.sourcefile")) {
      ISourceLocation loc = shadow.getSourceLocation();
      if ((loc != null) && (loc.getSourceFile() != null)) {
        return loc.getSourceFile().toString();
      } else {
        return "UNKNOWN";
      }
    } else if (key.equalsIgnoreCase("joinpoint.sourcelocation.line")) {
      ISourceLocation loc = shadow.getSourceLocation();
      if (loc != null) {
        return Integer.toString(loc.getLine());
      } else {
        return "-1";
      }
    } else if (key.equalsIgnoreCase("advice.aspecttype")) {
      return getDeclaringType().getName();
    } else if (key.equalsIgnoreCase("advice.sourcelocation.line")) {
      ISourceLocation loc = getSourceLocation();
      if ((loc != null) && (loc.getSourceFile() != null)) {
        return Integer.toString(loc.getLine());
      } else {
        return "-1";
      }
    } else if (key.equalsIgnoreCase("advice.sourcelocation.sourcefile")) {
      ISourceLocation loc = getSourceLocation();
      if ((loc != null) && (loc.getSourceFile() != null)) {
        return loc.getSourceFile().toString();
      } else {
        return "UNKNOWN";
      }
    } else {
      return "UNKNOWN_KEY{" + key + "}";
View Full Code Here

  public static ResolvedTypeMunger readInnerClass(VersionedDataInputStream stream, ISourceContext context) throws IOException {
    /* int version = */stream.readInt();
    UnresolvedType targetType = UnresolvedType.read(stream);
    String memberTypeName = stream.readUTF();
    ISourceLocation sourceLocation = readSourceLocation(stream);
    List<String> typeVarAliases = readInTypeAliases(stream);

    NewMemberClassTypeMunger newInstance = new NewMemberClassTypeMunger(targetType, memberTypeName);
    newInstance.setTypeVariableAliases(typeVarAliases);
    newInstance.setSourceLocation(sourceLocation);
View Full Code Here

    writeSourceLocation(s);
    writeOutTypeAliases(s);
  }

  public static ResolvedTypeMunger readMethod(VersionedDataInputStream s, ISourceContext context) throws IOException {
    ISourceLocation sloc = null;
    ResolvedMemberImpl rmImpl = ResolvedMemberImpl.readResolvedMember(s, context);
    Set superMethodsCalled = readSuperMethodsCalled(s);
    sloc = readSourceLocation(s);
    List typeVarAliases = readInTypeAliases(s);
View Full Code Here

   */
  public IProgramElement findNodeForSourceFile(IProgramElement node, String sourcefilePath) {
    // 1. why is <root> a sourcefile node?
    // 2. should isSourceFile() return true for a FILE that is a .class file...?
    if ((node.getKind().isSourceFile() && !node.getName().equals("<root>")) || node.getKind().isFile()) {
      ISourceLocation nodeLoc = node.getSourceLocation();
      if (nodeLoc != null && asm.getCanonicalFilePath(nodeLoc.getSourceFile()).equals(sourcefilePath)) {
        return node;
      }
      return null; // no need to search children of a source file node
    } else {
      // check the children
View Full Code Here

    if (node == null || node.getChildren() == null) {
      return null;
    }
    for (Iterator childrenIter = node.getChildren().iterator(); childrenIter.hasNext();) {
      IProgramElement child = (IProgramElement) childrenIter.next();
      ISourceLocation childLoc = child.getSourceLocation();
      if (childLoc != null) {
        if (childLoc.getLine() <= lineno && childLoc.getEndLine() >= lineno) {
          // This child is a better match for that line number
          IProgramElement evenCloserMatch = findCloserMatchForLineNumber(child, lineno);
          if (evenCloserMatch == null) {
            return child;
          } else {
View Full Code Here

    // if (node != null && node.getSourceLocation() != null)
    // System.err.println("====\n1: " +
    // sourceFilePath + "\n2: " +
    // node.getSourceLocation().getSourceFile().getCanonicalPath().equals(sourceFilePath)
    // );
    ISourceLocation nodeSourceLocation = (node != null ? node.getSourceLocation() : null);
    return node != null
        && nodeSourceLocation != null
        && nodeSourceLocation.getSourceFile().getAbsolutePath().equals(sourceFilePath)
        && ((offSet != -1 && nodeSourceLocation.getOffset() == offSet) || offSet == -1)
        && ((nodeSourceLocation.getLine() <= lineNumber && nodeSourceLocation.getEndLine() >= lineNumber) || (lineNumber <= 1 && node
            .getKind().isSourceFile()));
    // } catch (IOException ioe) {
    // return false;
    // }
  }
View Full Code Here

TOP

Related Classes of org.aspectj.bridge.ISourceLocation

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.