Package org.aspectj.org.eclipse.jdt.internal.compiler

Examples of org.aspectj.org.eclipse.jdt.internal.compiler.CompilationResult


  ISourceType sourceType = sourceTypes[0];
  while (sourceType.getEnclosingType() != null)
    sourceType = sourceType.getEnclosingType();
 
  // build corresponding compilation unit
  CompilationResult result = new CompilationResult(sourceType.getFileName(), 1, 1, this.options.maxProblemsPerUnit);
  CompilationUnitDeclaration unit =
    SourceTypeConverter.buildCompilationUnit(
      new ISourceType[] {sourceType}, // ignore secondary types, to improve laziness
      SourceTypeConverter.MEMBER_TYPE, // need member types
      // no need for field initialization
View Full Code Here


       
        // build parsed unit
        CompilationUnitDeclaration parsedUnit = null;
        if (cu.isOpen()) {
          // create parsed unit from source element infos
          CompilationResult result = new CompilationResult(((ICompilationUnit)cu).getFileName(), i, openablesLength, this.options.maxProblemsPerUnit);
          SourceTypeElementInfo[] typeInfos = null;
          try {
            IType[] topLevelTypes = cu.getTypes();
            int topLevelLength = topLevelTypes.length;
            if (topLevelLength == 0) continue; // empty cu: no need to parse (see https://bugs.eclipse.org/bugs/show_bug.cgi?id=65677)
            typeInfos = new SourceTypeElementInfo[topLevelLength];
            for (int j = 0; j < topLevelLength; j++) {
              IType topLevelType = topLevelTypes[j];
              typeInfos[j] = (SourceTypeElementInfo)((JavaElement)topLevelType).getElementInfo();
            }
          } catch (JavaModelException e) {
            // types/cu exist since cu is opened
          }
          int flags = !containsLocalType
            ? SourceTypeConverter.MEMBER_TYPE
            : SourceTypeConverter.FIELD_AND_METHOD | SourceTypeConverter.MEMBER_TYPE | SourceTypeConverter.LOCAL_TYPE;
          parsedUnit =
            SourceTypeConverter.buildCompilationUnit(
              typeInfos,
              flags,
              this.lookupEnvironment.problemReporter,
              result);
          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) {
          hasLocalType[unitsIndex] = containsLocalType;
View Full Code Here

    if (!maybeIncremental()) {
      return;
    }

    File sourceFile = new File(result.fileName());
    CompilationResult cr = result.result();

    references.put(sourceFile, new ReferenceCollection(cr.qualifiedReferences, cr.simpleNameReferences));

    UnwovenClassFile[] unwovenClassFiles = result.unwovenClassFiles();
    for (int i = 0; i < unwovenClassFiles.length; i++) {
View Full Code Here

    while(topLevelType.getDeclaringType() != null) {
      topLevelType = topLevelType.getDeclaringType();
    }
   
    this.fileName = topLevelType.getParent().getElementName().toCharArray();
    CompilationResult compilationResult = new CompilationResult(this.fileName, 1, 1, this.compilerOptions.maxProblemsPerUnit);
 
    CompilationUnitDeclaration compilationUnit = null;
 
    try {
      // TypeConverter is used instead of SourceTypeConverter because the type
View Full Code Here

      "FakeType.java", //$NON-NLS-1$
      encoding);
     
    this.actualCompletionPosition = prefix.length() + position - 1;
     
    CompilationResult fakeResult = new CompilationResult(fakeUnit, 1, 1, this.compilerOptions.maxProblemsPerUnit);
    CompilationUnitDeclaration fakeAST = this.parser.dietParse(fakeUnit, fakeResult, this.actualCompletionPosition);
   
    parseBlockStatements(fakeAST, this.actualCompletionPosition);
   
    return (Initializer)fakeAST.types[0].fields[0];
View Full Code Here

    try {
      this.fileName = sourceUnit.getFileName();
      this.actualCompletionPosition = completionPosition - 1;
      this.offset = pos;
      // for now until we can change the UI.
      CompilationResult result = new CompilationResult(sourceUnit, 1, 1, this.compilerOptions.maxProblemsPerUnit);
      CompilationUnitDeclaration parsedUnit = this.parser.dietParse(sourceUnit, result, this.actualCompletionPosition);

      //    boolean completionNodeFound = false;
      if (parsedUnit != null) {
        if(DEBUG) {
View Full Code Here

* Add an additional compilation unit into the loop
*  ->  build compilation unit declarations, their bindings and record their results.
*/
public void accept(ICompilationUnit sourceUnit, AccessRestriction accessRestriction) {
  // Switch the current policy and compilation result for this unit to the requested one.
  CompilationResult unitResult = new CompilationResult(sourceUnit, 1, 1, this.options.maxProblemsPerUnit);
  try {
    CompilationUnitDeclaration parsedUnit = basicParser().dietParse(sourceUnit, unitResult);
    this.lookupEnvironment.buildTypeBindings(parsedUnit, accessRestriction);
    this.lookupEnvironment.completeTypeBindings(parsedUnit, true);
  } catch (AbortCompilationUnit e) {
View Full Code Here

    SourceTypeElementInfo elementInfo = (SourceTypeElementInfo) sourceType;
    IType type = elementInfo.getHandle();
    ICompilationUnit sourceUnit = (ICompilationUnit) type.getCompilationUnit();
    accept(sourceUnit, accessRestriction);
  } else {
    CompilationResult result = new CompilationResult(sourceType.getFileName(), 1, 1, 0);
    CompilationUnitDeclaration unit =
      SourceTypeConverter.buildCompilationUnit(
        sourceTypes,
        SourceTypeConverter.FIELD_AND_METHOD // need field and methods
        | SourceTypeConverter.MEMBER_TYPE, // need member types
View Full Code Here

  // see bug 47079 for more details
  int[] oldLineEnds = this.parser.scanner.lineEnds;
  int oldLinePtr = this.parser.scanner.linePtr;
 
  try {
    CompilationResult compilationResult = unit.compilationResult;
    this.parser.scanner.setSource(compilationResult);

    if (this.parser.javadocParser.checkDocComment) {
      char[] contents = compilationResult.compilationUnit.getContents();
      this.parser.javadocParser.scanner.setSource(contents);
View Full Code Here

  }
  this.bindings.put(methodPattern, new ProblemMethodBinding(methodPattern.selector, null, ProblemReasons.NotFound));
  return null;
}
protected boolean hasAlreadyDefinedType(CompilationUnitDeclaration parsedUnit) {
  CompilationResult result = parsedUnit.compilationResult;
  if (result == null) return false;
  for (int i = 0; i < result.problemCount; i++)
    if (result.problems[i].getID() == IProblem.DuplicateTypes)
      return true;
  return false;
View Full Code Here

TOP

Related Classes of org.aspectj.org.eclipse.jdt.internal.compiler.CompilationResult

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.