コード例 #1
0
 public void resolve(int start, int end) {
   try {
     int startingTypeIndex = 0;
     // resolve compilation unit javadoc package if any
     if (this.javadoc != null
         && this.javadoc.sourceStart <= start
         && this.javadoc.sourceEnd >= end) {
       this.javadoc.resolve(this.scope);
     }
     if (types != null) {
       for (int i = startingTypeIndex, count = types.length; i < count; i++) {
         TypeDeclaration typeDeclaration = types[i];
         if (typeDeclaration.sourceStart <= start && typeDeclaration.sourceEnd >= end)
           typeDeclaration.resolve(scope);
       }
     }
     if (statements != null) {
       for (int i = 0, count = statements.length; i < count; i++) {
         ProgramElement programElement = statements[i];
         if (programElement.sourceStart <= start && programElement.sourceEnd >= end)
           programElement.resolve(scope);
       }
     }
     reportNLSProblems();
   } catch (AbortCompilationUnit e) {
     this.ignoreFurtherInvestigation = true;
     return;
   }
 }
コード例 #2
0
 public void resolve() {
   int startingTypeIndex = 0;
   boolean isPackageInfo = isPackageInfo();
   if (this.types != null && isPackageInfo) {
     // resolve synthetic type declaration
     final TypeDeclaration syntheticTypeDeclaration = this.types[0];
     // set empty javadoc to avoid missing warning (see bug
     // https://bugs.eclipse.org/bugs/show_bug.cgi?id=95286)
     if (syntheticTypeDeclaration.javadoc == null) {
       syntheticTypeDeclaration.javadoc =
           new Javadoc(
               syntheticTypeDeclaration.declarationSourceStart,
               syntheticTypeDeclaration.declarationSourceStart);
     }
     syntheticTypeDeclaration.resolve(this.scope);
     /*
      * resolve javadoc package if any, skip this step if we don't have a valid scope due to an earlier error (bug 252555)
      * we do it now as the javadoc in the fake type won't be resolved. The peculiar usage of MethodScope to resolve the
      * package level javadoc is because the CU level resolve method	is a NOP to mimic Javadoc's behavior and can't be used
      * as such.
      */
     if (this.javadoc != null && syntheticTypeDeclaration.staticInitializerScope != null) {
       this.javadoc.resolve(syntheticTypeDeclaration.staticInitializerScope);
     }
     startingTypeIndex = 1;
   } else {
     // resolve compilation unit javadoc package if any
     if (this.javadoc != null) {
       this.javadoc.resolve(this.scope);
     }
   }
   if (this.currentPackage != null && this.currentPackage.annotations != null && !isPackageInfo) {
     this.scope
         .problemReporter()
         .invalidFileNameForPackageAnnotations(this.currentPackage.annotations[0]);
   }
   try {
     if (this.types != null) {
       for (int i = startingTypeIndex, count = this.types.length; i < count; i++) {
         this.types[i].resolve(this.scope);
       }
     }
     if (!this.compilationResult.hasMandatoryErrors()) checkUnusedImports();
     reportNLSProblems();
   } catch (AbortCompilationUnit e) {
     this.ignoreFurtherInvestigation = true;
     return;
   }
 }
コード例 #3
0
  public void resolve() {
    int startingTypeIndex = 0;
    boolean isPackageInfo = false; // isPackageInfo();
    if (this.types != null && isPackageInfo) {
      // resolve synthetic type declaration
      final TypeDeclaration syntheticTypeDeclaration = types[0];
      // set empty javadoc to avoid missing warning (see bug
      // https://bugs.eclipse.org/bugs/show_bug.cgi?id=95286)
      if (syntheticTypeDeclaration.javadoc == null) {
        syntheticTypeDeclaration.javadoc =
            new Javadoc(
                syntheticTypeDeclaration.declarationSourceStart,
                syntheticTypeDeclaration.declarationSourceStart);
      }
      syntheticTypeDeclaration.resolve(this.scope);
      // resolve annotations if any
      //			if (this.currentPackage!= null && this.currentPackage.annotations != null) {
      //				resolveAnnotations(syntheticTypeDeclaration.staticInitializerScope,
      // this.currentPackage.annotations, this.scope.getDefaultPackage());
      //			}
      // resolve javadoc package if any
      if (this.javadoc != null) {
        this.javadoc.resolve(syntheticTypeDeclaration.staticInitializerScope);
      }
      startingTypeIndex = 1;
    } else {
      // resolve compilation unit javadoc package if any
      if (this.javadoc != null) {
        this.javadoc.resolve(this.scope);
      }
    }

    try {
      if (types != null) {
        for (int i = startingTypeIndex, count = types.length; i < count; i++) {
          types[i].resolve(scope);
        }
      }
      if (statements != null) {
        for (int i = 0, count = statements.length; i < count; i++) {
          statements[i].resolve(scope);
        }
      }
      reportNLSProblems();
    } catch (AbortCompilationUnit e) {
      this.ignoreFurtherInvestigation = true;
      return;
    }
  }