Examples of SourceLocation


Examples of org.aspectj.bridge.SourceLocation

    try {
      OutputStream os = FileUtil.makeOutputStream(buildConfig.getOutputJar());
      zos = new JarOutputStream(os, getWeaver().getManifest(true));
    } catch (IOException ex) {
      IMessage message = new Message("Unable to open outjar " + outJar.getPath() + "(" + ex.getMessage() + ")",
          new SourceLocation(outJar, 0), true);
      handler.handleMessage(message);
      return false;
    }
    return true;
  }
View Full Code Here

Examples of org.aspectj.bridge.SourceLocation

              CompilationResultDestinationManager.FILETYPE_OUTJAR);
        }
      }
    } catch (IOException ex) {
      IMessage message = new Message("Unable to write outjar " + outJar.getPath() + "(" + ex.getMessage() + ")",
          new SourceLocation(outJar, 0), true);
      handler.handleMessage(message);
    }
  }
View Full Code Here

Examples of org.aspectj.bridge.SourceLocation

   * @param srcloc the src of the directory entry, for use when creating a warning message
   * @throws IOException if something goes wrong creating the new zip entry
   */
  private void writeDirectory(String directory, File srcloc) throws IOException {
    if (state.hasResource(directory)) {
      IMessage msg = new Message("duplicate resource: '" + directory + "'", IMessage.WARNING, null, new SourceLocation(
          srcloc, 0));
      handler.handleMessage(msg);
      return;
    }
    if (zos != null) {
View Full Code Here

Examples of org.aspectj.bridge.SourceLocation

    // Nothing to do if not writing to a zip file
  }

  private void writeResource(String filename, byte[] content, File srcLocation) throws IOException {
    if (state.hasResource(filename)) {
      IMessage msg = new Message("duplicate resource: '" + filename + "'", IMessage.WARNING, null, new SourceLocation(
          srcLocation, 0));
      handler.handleMessage(msg);
      return;
    }
    if (filename.equals(buildConfig.getOutxmlName())) {
      ignoreOutxml = true;
      IMessage msg = new Message("-outxml/-outxmlfile option ignored because resource already exists: '" + filename + "'",
          IMessage.WARNING, null, new SourceLocation(srcLocation, 0));
      handler.handleMessage(msg);
    }
    if (zos != null) {
      ZipEntry newEntry = new ZipEntry(filename); // ??? get compression scheme right
      zos.putNextEntry(newEntry);
      zos.write(content);
      zos.closeEntry();
    } else {
      File destDir = buildConfig.getOutputDir();
      if (buildConfig.getCompilationResultDestinationManager() != null) {
        destDir = buildConfig.getCompilationResultDestinationManager().getOutputLocationForResource(srcLocation);
      }
      try {
        File outputLocation = new File(destDir, filename);
        OutputStream fos = FileUtil.makeOutputStream(outputLocation);
        fos.write(content);
        fos.close();
        if (buildConfig.getCompilationResultDestinationManager() != null) {
          buildConfig.getCompilationResultDestinationManager().reportFileWrite(outputLocation.getPath(),
              CompilationResultDestinationManager.FILETYPE_RESOURCE);
        }
      } catch (FileNotFoundException fnfe) {
        IMessage msg = new Message("unable to copy resource to output folder: '" + filename + "' - reason: "
            + fnfe.getMessage(), IMessage.ERROR, null, new SourceLocation(srcLocation, 0));
        handler.handleMessage(msg);
      }
    }
    state.recordResource(filename, srcLocation);
  }
View Full Code Here

Examples of org.aspectj.bridge.SourceLocation

          BufferedOutputStream os = FileUtil.makeOutputStream(new File(outFile));
          os.write(classFile.getBytes());
          os.close();
        } catch (FileNotFoundException fnfe) {
          IMessage msg = new Message("unable to write out class file: '" + filename + "' - reason: " + fnfe.getMessage(),
              IMessage.ERROR, null, new SourceLocation(new File(outFile), 0));
          handler.handleMessage(msg);
        }

        if (buildConfig.getCompilationResultDestinationManager() != null) {
          buildConfig.getCompilationResultDestinationManager().reportFileWrite(outFile,
View Full Code Here

Examples of org.aspectj.bridge.SourceLocation

    if (i > lastSlash && i != -1 && j != -1) {
      // we are a binary aspect in the default package
      lastSlash = i;
    }
    String fileName = sourceFilePath.substring(lastSlash + 1);
    IProgramElement fileNode = new ProgramElement(asm, fileName, IProgramElement.Kind.FILE_JAVA, new SourceLocation(new File(
        sourceFilePath), 1, 1), 0, null, null);
    // fileNode.setSourceLocation();
    fileNode.addChild(NO_STRUCTURE);
    return fileNode;
  }
View Full Code Here

Examples of org.aspectj.bridge.SourceLocation

      setDebugOptions();
      buildConfig.getOptions().set(options);
    } catch (InvalidInputException iie) {
      ISourceLocation location = null;
      if (buildConfig.getConfigFile() != null) {
        location = new SourceLocation(buildConfig.getConfigFile(), 0);
      }
      IMessage m = new Message(iie.getMessage(), IMessage.ERROR, null, location);
      handler.handleMessage(m);
    }
    return buildConfig;
View Full Code Here

Examples of org.aspectj.bridge.SourceLocation

  public ISourceLocation makeSourceLocation(IHasPosition position) {
    return new EclipseSourceLocation(result, position.getStart(), position.getEnd());
  }

    public ISourceLocation makeSourceLocation(int line, int offset) {
    SourceLocation sl = new SourceLocation(getSourceFile(), line);

        if (offset > 0) {
            sl.setOffset(offset);
        } else {
            // compute the offset
            //TODO AV - should we do it lazily?
            int[] offsets = result.lineSeparatorPositions;
            int likelyOffset = 0;
            if (line > 0 && line < offsets.length) {
                //1st char of given line is next char after previous end of line
                likelyOffset = offsets[line-1];//FIXME may be need -2
            }
            sl.setOffset(likelyOffset);
        }
        return sl;
  }
View Full Code Here

Examples of org.aspectj.bridge.SourceLocation

    // rest of the process.
    myGen = new ClassGen(myGen.getClassName(), myGen.getSuperclassName(), myGen.getFileName(), myGen.getModifiers(),
        myGen.getInterfaceNames());
    // 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

Examples of org.aspectj.bridge.SourceLocation

        // this is the output dir
        outputDir = buildConfig.getCompilationResultDestinationManager().getDefaultOutputLocation();
      }
      ucf = weaver.addClassFile(bsf.binSrc, bsf.fromInPathDirectory, outputDir);
    } catch (IOException ex) {
      IMessage msg = new Message("can't read class file " + bsf.binSrc.getPath(), new SourceLocation(bsf.binSrc, 0), false);
      buildManager.handler.handleMessage(msg);
    }
    return ucf;
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.