Package org.aspectj.bridge

Examples of org.aspectj.bridge.SourceLocation


  }

  protected static ISourceLocation readSourceLocation(VersionedDataInputStream s) throws IOException {
    // Location persistence for type mungers was added after 1.2.1 was shipped...
    if (s.getMajorVersion()<AjAttribute.WeaverVersionInfo.WEAVER_VERSION_MAJOR_AJ150) return null;
    SourceLocation ret = null;
    ObjectInputStream ois = null;
    try {
      // This logic copes with the location missing from the attribute - an EOFException will
      // occur on the next line and we ignore it.
        ois = new ObjectInputStream(s);
      Boolean validLocation = (Boolean)ois.readObject();
      if (validLocation.booleanValue()) {
        File f      = (File) ois.readObject();
        Integer ii = (Integer)ois.readObject();
        Integer offset = (Integer)ois.readObject();
        ret = new SourceLocation(f,ii.intValue());
        ret.setOffset(offset.intValue());
      }
    } catch (EOFException eof) {
      return null; // This exception occurs if processing an 'old style' file where the
                   // type munger attributes don't include the source location.
    } catch (IOException ioe) {
View Full Code Here


        final IProgramElement cuNode;
        {
            // AMC - use the source start and end from the compilation unit decl
            int startLine = getStartLine(unit);
            int endLine = getEndLine(unit);    
            SourceLocation sourceLocation
                = new SourceLocation(file, startLine, endLine);
            sourceLocation.setOffset(unit.sourceStart);
            cuNode = new ProgramElement(
                new String(file.getName()),
                IProgramElement.Kind.FILE_JAVA,
                sourceLocation,
                0,
View Full Code Here

      fileName = new String(currCompilationResult.getFileName());
    }
    // AMC - different strategies based on node kind
    int startLine = getStartLine(node);
    int endLine = getEndLine(node);
    SourceLocation loc = null;
    if ( startLine <= endLine ) {
      // found a valid end line for this node...
      loc = new SourceLocation(new File(fileName), startLine, endLine)
      loc.setOffset(node.sourceStart);
    } else {
      loc = new SourceLocation(new File(fileName), startLine);
      loc.setOffset(node.sourceStart);
    }
    return loc;
  }
View Full Code Here

      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

    // raise an error against this compilation unit.
    getWorld().showMessage(
        IMessage.ERROR,
        WeaverMessages.format(WeaverMessages.CLASS_TOO_BIG,
                          this.getClassName()),
          new SourceLocation(new File(myGen.getFileName()),0), null
          );
  }
View Full Code Here

TOP

Related Classes of org.aspectj.bridge.SourceLocation

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.