Package org.eclipse.jdt.internal.compiler.problem

Examples of org.eclipse.jdt.internal.compiler.problem.ProblemReporter


public HierarchyResolver(INameEnvironment nameEnvironment, Map settings, HierarchyBuilder builder, IProblemFactory problemFactory) {
  // create a problem handler with the 'exit after all problems' handling policy
  this.options = new CompilerOptions(settings);
  IErrorHandlingPolicy policy = DefaultErrorHandlingPolicies.exitAfterAllProblems();
  ProblemReporter problemReporter = new ProblemReporter(policy, this.options, problemFactory);

  setEnvironment(
    new LookupEnvironment(this, this.options, problemReporter, nameEnvironment),
    builder);
}
View Full Code Here


  public static void parse(ICompilationUnit[] compilationUnits, ASTRequestor astRequestor, int apiLevel, Map options, int flags, IProgressMonitor monitor) {
    try {
      CompilerOptions compilerOptions = new CompilerOptions(options);
      compilerOptions.ignoreMethodBodies = (flags & ICompilationUnit.IGNORE_METHOD_BODIES) != 0;
      Parser parser = new CommentRecorderParser(
        new ProblemReporter(
            DefaultErrorHandlingPolicies.proceedWithAllProblems(),
            compilerOptions,
            new DefaultProblemFactory()),
        false);
      int unitLength = compilationUnits.length;
View Full Code Here

      IProgressMonitor monitor) {
    try {
      CompilerOptions compilerOptions = new CompilerOptions(options);
      compilerOptions.ignoreMethodBodies = (flags & ICompilationUnit.IGNORE_METHOD_BODIES) != 0;
      Parser parser = new CommentRecorderParser(
        new ProblemReporter(
            DefaultErrorHandlingPolicies.proceedWithAllProblems(),
            compilerOptions,
            new DefaultProblemFactory()),
        false);
      int unitLength = sourceUnits.length;
View Full Code Here

    boolean statementsRecovery = (flags & ICompilationUnit.ENABLE_STATEMENTS_RECOVERY) != 0;
    compilerOptions.performMethodsFullRecovery = statementsRecovery;
    compilerOptions.performStatementsRecovery = statementsRecovery;
    compilerOptions.ignoreMethodBodies = (flags & ICompilationUnit.IGNORE_METHOD_BODIES) != 0;
    Parser parser = new CommentRecorderParser(
      new ProblemReporter(
          DefaultErrorHandlingPolicies.proceedWithAllProblems(),
          compilerOptions,
          new DefaultProblemFactory()),
      false);
    CompilationResult compilationResult = new CompilationResult(sourceUnit, 0, 0, compilerOptions.maxProblemsPerUnit);
View Full Code Here

* Note that as a side-effect, this updates the current reference context
* (unit, type or method) in case the problem handler decides it is necessary
* to abort.
*/
public ProblemReporter problemReporter() {
  ProblemReporter problemReporter = referenceCompilationUnit().problemReporter;
  problemReporter.referenceContext = this.referenceContext;
  return problemReporter;
}
View Full Code Here

  * to abort.
  */
  public ProblemReporter problemReporter() {
    MethodScope outerMethodScope;
    if ((outerMethodScope = outerMostMethodScope()) == null) {
      ProblemReporter problemReporter = referenceCompilationUnit().problemReporter;
      problemReporter.referenceContext = this.referenceContext;
      return problemReporter;
    }
    return outerMethodScope.problemReporter();
  }
View Full Code Here

* Note that as a side-effect, this updates the current reference context
* (unit, type or method) in case the problem handler decides it is necessary
* to abort.
*/
public ProblemReporter problemReporter() {
  ProblemReporter problemReporter = this.referenceContext.problemReporter;
  problemReporter.referenceContext = this.referenceContext;
  return problemReporter;
}
View Full Code Here

    this.nameEnvironment = nameEnvironment;
    this.typeCache = new HashtableOfObject(5);
    this.openedBinaryTypes = 0;

    this.problemFactory = new CompletionProblemFactory(Locale.getDefault());
    this.problemReporter = new ProblemReporter(
        DefaultErrorHandlingPolicies.proceedWithAllProblems(),
        this.compilerOptions,
        this.problemFactory);
    this.lookupEnvironment =
      new LookupEnvironment(this, this.compilerOptions, this.problemReporter, nameEnvironment);
View Full Code Here

    if (this.javadoc != null) {
      this.javadoc.resolve(initializationScope);
    } else if (this.binding != null && this.binding.declaringClass != null && !this.binding.declaringClass.isLocalType()) {
      // Set javadoc visibility
      int javadocVisibility = this.binding.modifiers & ExtraCompilerModifiers.AccVisibilityMASK;
      ProblemReporter reporter = initializationScope.problemReporter();
      int severity = reporter.computeSeverity(IProblem.JavadocMissing);
      if (severity != ProblemSeverities.Ignore) {
        if (classScope != null) {
          javadocVisibility = Util.computeOuterMostVisibility(classScope.referenceType(), javadocVisibility);
        }
        int javadocModifiers = (this.binding.modifiers & ~ExtraCompilerModifiers.AccVisibilityMASK) | javadocVisibility;
        reporter.javadocMissing(this.sourceStart, this.sourceEnd, severity, javadocModifiers);
      }
    }
  } finally {
    initializationScope.initializedField = previousField;
    initializationScope.lastVisibleFieldID = previousFieldID;
View Full Code Here

  }
  return null;
}

public void checkTypeArgumentRedundancy(ParameterizedTypeBinding allocationType, ReferenceBinding enclosingType, TypeBinding[] argumentTypes, final BlockScope scope) {
  ProblemReporter reporter = scope.problemReporter();
  if ((reporter.computeSeverity(IProblem.RedundantSpecificationOfTypeArguments) == ProblemSeverities.Ignore) || scope.compilerOptions().sourceLevel < ClassFileConstants.JDK1_7) return;
  if (allocationType.arguments == null) return// raw binding
  if (this.genericTypeArguments != null) return; // diamond can't occur with explicit type args for constructor
  if (argumentTypes == Binding.NO_PARAMETERS && this.typeExpected instanceof ParameterizedTypeBinding) {
    ParameterizedTypeBinding expected = (ParameterizedTypeBinding) this.typeExpected;
    if (expected.arguments != null && allocationType.arguments.length == expected.arguments.length) {
      // check the case when no ctor takes no params and inference uses the expected type directly
      // eg. X<String> x = new X<String>()
      int i;
      for (i = 0; i < allocationType.arguments.length; i++) {
        if (allocationType.arguments[i] != expected.arguments[i])
          break;
      }
      if (i == allocationType.arguments.length) {
        reporter.redundantSpecificationOfTypeArguments(this.type, allocationType.arguments);
        return;
     
    }
  }
  TypeBinding [] inferredTypes = inferElidedTypes(allocationType.genericType(), enclosingType, argumentTypes, scope);
  if (inferredTypes == null) {
    return;
  }
  for (int i = 0; i < inferredTypes.length; i++) {
    if (inferredTypes[i] != allocationType.arguments[i])
      return;
  }
  reporter.redundantSpecificationOfTypeArguments(this.type, allocationType.arguments);
}
View Full Code Here

TOP

Related Classes of org.eclipse.jdt.internal.compiler.problem.ProblemReporter

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.