Package org.aspectj.bridge

Examples of org.aspectj.bridge.ISourceLocation


          if (!superReturnTypeSig.equals(subReturnTypeSig)) {
            // Allow for covariance - wish I could test this (need Java5...)
            ResolvedType subType   = weaver.getWorld().resolve(subMethod.getReturnType());
            ResolvedType superType = weaver.getWorld().resolve(superMethod.getReturnType());
            if (!superType.isAssignableFrom(subType)) {
                ISourceLocation sloc = subMethod.getSourceLocation();
                weaver.getWorld().getMessageHandler().handleMessage(MessageUtil.error(
                        "The return type is incompatible with "+superMethod.getDeclaringType()+"."+superMethod.getName()+superMethod.getParameterSignature(),
                        subMethod.getSourceLocation()));
                 cont=false;
            }
View Full Code Here


      // - if it is *not* then something went wrong after we worked
      // out that it was the top most implementor (see pr49657)
        if (!gen.getType().isTopmostImplementor(onType)) {
          ResolvedType rtx = gen.getType().getTopmostImplementor(onType);
          if (!rtx.isExposedToWeaver()) {
            ISourceLocation sLoc = munger.getSourceLocation();
              weaver.getWorld().getMessageHandler().handleMessage(MessageUtil.error(
                  WeaverMessages.format(WeaverMessages.ITD_NON_EXPOSED_IMPLEMENTOR,rtx,getAspectType().getName()),
              (sLoc==null?getAspectType().getSourceLocation():sLoc)));
          } else {
            // XXX what does this state mean?
View Full Code Here

    writeSourceLocation(s);
    writeOutTypeAliases(s);
  }
 
  public static ResolvedTypeMunger readConstructor(VersionedDataInputStream s, ISourceContext context) throws IOException {
    ISourceLocation sloc = null;
    ResolvedMember sig           = ResolvedMemberImpl.readResolvedMember(s, context);
    ResolvedMember syntheticCtor = ResolvedMemberImpl.readResolvedMember(s, context);
    ResolvedMember explicitCtor  = ResolvedMemberImpl.readResolvedMember(s, context);
    Set superMethodsCalled       = readSuperMethodsCalled(s);
    sloc                         = readSourceLocation(s);
View Full Code Here

     * Until intertype mungers remember where they came from, the source location
     * for the munger itself is null.  In these cases use the
     * source location for the aspect containing the ITD.
     */
    private ISourceLocation getMungerLocation(ConcreteTypeMunger munger) {
      ISourceLocation sloc = munger.getSourceLocation();
      if (sloc == null) {
        sloc = munger.getAspectType().getSourceLocation();
      }
      return sloc;
    }
View Full Code Here

  }

  public boolean handleMessage(IMessage message) throws AbortException {
    if (! (message.isError() || message.isWarning()) ) return sink.handleMessage(message);
    // we only care about warnings and errors here...
    ISourceLocation sLoc = message.getSourceLocation();
   
    // See bug 62073.  We should assert that the caller pass the correct primary source location.
    // But for AJ1.2 final we will simply do less processing of the locations if that is not the
    // case (By calling sink.handleMessage()) - this ensures we don't put out bogus source context info.
    if (sLoc instanceof EclipseSourceLocation) {
      EclipseSourceLocation esLoc = (EclipseSourceLocation)sLoc;
      if (currentlyWeaving!=null && esLoc.getCompilationResult()!=null) {
        if (!currentlyWeaving.equals(((EclipseSourceLocation)sLoc).getCompilationResult()))
        return sink.handleMessage(message);
        //  throw new RuntimeException("Primary source location must match the file we are currently processing!");
      }
    }
   
    CompilationResult problemSource = currentlyWeaving;
    if (problemSource == null) {
      // must be a problem found during completeTypeBindings phase of begin to compile
      if (sLoc instanceof EclipseSourceLocation) {
        problemSource = ((EclipseSourceLocation)sLoc).getCompilationResult();
      }
      if (problemSource == null) {
        // XXX this is ok for ajc, will have to do better for AJDT in time...
        return sink.handleMessage(message);
      }
    }
    int startPos = getStartPos(sLoc,problemSource);
    int endPos = getEndPos(sLoc,problemSource);
    int severity = message.isError() ? ProblemSeverities.Error : ProblemSeverities.Warning;
    char[] filename = problemSource.fileName;
    boolean usedBinarySourceFileName = false;
    if (problemSource.isFromBinarySource()) {
      if (sLoc != null) {
        filename = sLoc.getSourceFile().getPath().toCharArray();
        usedBinarySourceFileName = true;
      }
    }
    ReferenceContext referenceContext = findReferenceContextFor(problemSource);
    IProblem problem = compiler.problemReporter.createProblem(
                filename,
                IProblem.Unclassified,
                new String[0],
                new String[] {message.getMessage()},
                severity,
                startPos,
                endPos,
                sLoc != null ? sLoc.getLine() : 0
                );
    IProblem[] seeAlso = buildSeeAlsoProblems(problem,message.getExtraSourceLocations(),
                          problemSource, 
                          usedBinarySourceFileName);
    problem.setSeeAlsoProblems(seeAlso);
View Full Code Here

                      CompilationResult problemSource,
                      boolean usedBinarySourceFileName) {
    List ret = new ArrayList();

    for (int i = 0; i < sourceLocations.size(); i++) {
      ISourceLocation loc = (ISourceLocation) sourceLocations.get(i);
      if (loc != null ) {
          DefaultProblem dp =
            new DefaultProblem( loc.getSourceFile().getPath().toCharArray(),
                    "see also",
                    0,
                    new String[] {},
                    ProblemSeverities.Ignore,
                    getStartPos(loc,null),
                    getEndPos(loc,null),
                    loc.getLine());
        ret.add(dp);
      } else {
        System.err.println("About to abort due to null location, dumping state:");
        System.err.println("> Original Problem="+problemSource.toString());
        throw new RuntimeException("Internal Compiler Error: Unexpected null source location passed as 'see also' location.");
View Full Code Here

            getAllStructureChildren(fileNode, peNodes, showSubMember, showMemberAndType);
            for (Iterator it = peNodes.iterator(); it.hasNext(); ) {
                IProgramElement peNode = (IProgramElement)it.next();
                List entries = new ArrayList();
                entries.add(peNode);
                ISourceLocation sourceLoc = peNode.getSourceLocation();
                if (null != sourceLoc) {
                    Integer hash = new Integer(sourceLoc.getLine());
                    List existingEntry = (List)annotations.get(hash);
                    if (existingEntry != null) {
                        entries.addAll(existingEntry);
                    }
                    annotations.put(hash, entries);
View Full Code Here

      return sourceLocation;
    }

  public String getHandle() {
    if (null == handle) {
      ISourceLocation sl = getSourceLocation();
      if (sl != null) {
        handle = AsmManager.getDefault().getHandleProvider().createHandleIdentifier(
                    sl.getSourceFile(),
                    sl.getLine(),
                    sl.getColumn(),
              sl.getOffset());
      }
    }
    return handle;
  }
View Full Code Here

    /**
     * Extract message text and source location, including context.
     */
    public static IMessage makeMessage(ICompilationUnit unit, IProblem problem) {
        ISourceLocation sourceLocation = makeSourceLocation(unit, problem);
        IProblem[] seeAlso = problem.seeAlso();
        ISourceLocation[] seeAlsoLocations = new ISourceLocation[seeAlso.length];
        for (int i = 0; i < seeAlso.length; i++) {
          seeAlsoLocations[i] = new SourceLocation(new File(new String(seeAlso[i].getOriginatingFileName())),
                               seeAlso[i].getSourceLineNumber());
View Full Code Here

                   problem.getSourceStart(),problem.getSourceEnd());
        return msg;
    }              

    public static IMessage makeErrorMessage(ICompilationUnit unit, String text, Exception ex) {
      ISourceLocation loc = new SourceLocation(new File(new String(unit.getFileName())),
                            0,0,0,"");
      IMessage msg = new Message(text,IMessage.ERROR,ex,loc);
      return msg;
    }
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.