Package org.eclipse.jdt.internal.compiler.env

Examples of org.eclipse.jdt.internal.compiler.env.ICompilationUnit


               
                private NameEnvironmentAnswer findType(String className) {

                    try {
                        if (className.equals(targetClassName)) {
                            ICompilationUnit compilationUnit =
                                new CompilationUnit(sourceFile, className);
                            return
                                new NameEnvironmentAnswer(compilationUnit);
                        }
                        String resourceName =
View Full Code Here


                private NameEnvironmentAnswer findType(String className) {

                    InputStream is = null;
                    try {
                        if (className.equals(targetClassName)) {
                            ICompilationUnit compilationUnit =
                                new CompilationUnit(sourceFile, className);
                            return
                                new NameEnvironmentAnswer(compilationUnit, null);
                        }
                        String resourceName =
View Full Code Here

                        if (applicationClass.javaByteCode != null) {
                            ClassFileReader classFileReader = new ClassFileReader(applicationClass.javaByteCode, fileName, true);
                            return new NameEnvironmentAnswer(classFileReader, null);
                        }
                        // Cascade compilation
                        ICompilationUnit compilationUnit = new CompilationUnit(name);
                        return new NameEnvironmentAnswer(compilationUnit, null);
                    }

                    // So it's a standard class
                    byte[] bytes = Play.classloader.getClassDefinition(name);
View Full Code Here

          // will not parse the method statements if ASTNode.HasAllMethodBodies is set.
          if (containsLocalType)   parsedUnit.bits |= ASTNode.HasAllMethodBodies;
        } else {
          // create parsed unit from file
          IFile file = (IFile) cu.getResource();
          ICompilationUnit sourceUnit = this.builder.createCompilationUnitFromPath(openable, file);
          CompilationResult unitResult = new CompilationResult(sourceUnit, i, openablesLength, this.options.maxProblemsPerUnit);
          parsedUnit = parser.dietParse(sourceUnit, unitResult);
        }

        if (parsedUnit != null) {
View Full Code Here

  }

  // Compile compilation unit
  CompilerRequestor compilerRequestor = new CompilerRequestor();
  Compiler compiler = getCompiler(compilerRequestor);
  compiler.compile(new ICompilationUnit[] {new ICompilationUnit() {
    public char[] getFileName() {
       // Name of class is name of CU
      return CharOperation.concat(Evaluator.this.getClassName(), Util.defaultJavaExtension().toCharArray());
    }
    public char[] getContents() {
View Full Code Here

  } finally {
    if (monitor != null) monitor.done();
  }
}
protected ICompilationUnit createCompilationUnitFromPath(Openable handle, IFile file) {
  ICompilationUnit unit = super.createCompilationUnitFromPath(handle, file);
  this.cuToHandle.put(unit, handle);
  return unit;
}
View Full Code Here

      this.options.put(entry.getKey(), CompilerOptions.IGNORE);
    }
  }
}
public String extractDestinationPathFromSourceFile(CompilationResult result) {
  ICompilationUnit compilationUnit = result.compilationUnit;
  if (compilationUnit != null) {
    char[] fileName = compilationUnit.getFileName();
    int lastIndex = CharOperation.lastIndexOf(java.io.File.separatorChar, fileName);
    if (lastIndex != -1) {
      final String outputPathName = new String(fileName, 0, lastIndex);
      final File output = new File(outputPathName);
      if (output.exists() && output.isDirectory()) {
View Full Code Here

      printTag(Logger.PROBLEMS, this.parameters, true, false);
    }

    public void startLoggingSource(CompilationResult compilationResult) {
      if ((this.tagBits & Logger.XML) != 0) {
        ICompilationUnit compilationUnit = compilationResult.compilationUnit;
        if (compilationUnit != null) {
            char[] fileName = compilationUnit.getFileName();
            File f = new File(new String(fileName));
            if (fileName != null) {
              this.parameters.put(Logger.PATH, f.getAbsolutePath());
            }
            char[][] packageName = compilationResult.packageName;
View Full Code Here

       referenceContext.tagAsHavingIgnoredMandatoryErrors(problemId);
     return;
   }

  if ((severity & ProblemSeverities.Optional) != 0 && problemId != IProblem.Task  && !this.options.ignoreSourceFolderWarningOption) {
    ICompilationUnit cu = unitResult.getCompilationUnit();
    try{
      if (cu != null && cu.ignoreOptionalProblems())
        return;
    // workaround for illegal implementation of ICompilationUnit, see https://bugs.eclipse.org/372351
    } catch (AbstractMethodError ex) {
      // continue
    }
View Full Code Here

}

public void run() {
  try {
    while (this.readingThreads != null && this.nextFileToRead < this.units.length) {
      ICompilationUnit unit = null;
      int position = -1;
      synchronized (this) {
        if (this.readingThreads == null) return;

        while (this.filesRead[this.nextAvailablePosition] != null) {
          this.sleepingThreadCount++;
          try {
            wait(250); // wait until a spot in contents is available
          } catch (InterruptedException e) { // ignore
          }
          this.sleepingThreadCount--;
          if (this.readingThreads == null) return;
        }

        if (this.nextFileToRead >= this.units.length) return;
        unit = this.units[this.nextFileToRead++];
        position = this.nextAvailablePosition;
        if (++this.nextAvailablePosition >= this.contentsRead.length)
          this.nextAvailablePosition = 0;
        this.filesRead[position] = unit;
        this.contentsRead[position] = this.readInProcessMarker; // mark the spot so we know its being read
      }
      char[] result = unit.getContents();
      synchronized (this) {
        if (this.filesRead[position] == unit) {
          if (this.contentsRead[position] == null) // wake up main thread which is waiting for this file
            notifyAll();
          this.contentsRead[position] = result;
View Full Code Here

TOP

Related Classes of org.eclipse.jdt.internal.compiler.env.ICompilationUnit

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.