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

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


      IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(path.segment(0));
      JavaModel model = JavaModelManager.getJavaModelManager().getJavaModel();
      JavaProject javaProject = (JavaProject) model.getJavaProject(project);

      this.options = new CompilerOptions(javaProject.getOptions(true));
      ProblemReporter problemReporter =
          new ProblemReporter(
              DefaultErrorHandlingPolicies.proceedWithAllProblems(),
              this.options,
              new DefaultProblemFactory());

      // Re-parse using normal parser, IndexingParser swallows several nodes, see comment above class.
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

  }

  private Parser getParser() {
    if (this.parser == null) {
      this.compilerOptions = new CompilerOptions(JavaCore.getOptions());
      ProblemReporter problemReporter =
        new ProblemReporter(
          DefaultErrorHandlingPolicies.proceedWithAllProblems(),
          this.compilerOptions,
          new DefaultProblemFactory());
      this.parser = new Parser(problemReporter, true);
    }
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

    }

    private Parser getParser() {
        if (mParser == null) {
            CompilerOptions options = createCompilerOptions();
            ProblemReporter problemReporter = new ProblemReporter(
                    DefaultErrorHandlingPolicies.exitOnFirstError(),
                    options,
                    new DefaultProblemFactory());
            mParser = new Parser(problemReporter,
                    options.parseLiteralExpressionsAsConstants);
View Full Code Here

        // AST that is as tolerant as possible.
        options.complianceLevel = ClassFileConstants.JDK1_7;
        options.sourceLevel = ClassFileConstants.JDK1_7;
        options.targetJDK = ClassFileConstants.JDK1_7;
        options.parseLiteralExpressionsAsConstants = true;
        ProblemReporter problemReporter = new ProblemReporter(
                DefaultErrorHandlingPolicies.exitOnFirstError(),
                options,
                new DefaultProblemFactory());
        mParser = new Parser(problemReporter, options.parseLiteralExpressionsAsConstants);
        mParser.javadocParser.checkDocComment = false;
View Full Code Here

    }

    private Parser getParser() {
        if (mParser == null) {
            CompilerOptions options = createCompilerOptions();
            ProblemReporter problemReporter = new ProblemReporter(
                    DefaultErrorHandlingPolicies.exitOnFirstError(),
                    options,
                    new DefaultProblemFactory());
            mParser = new Parser(problemReporter,
                    options.parseLiteralExpressionsAsConstants);
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

* 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

  }
  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.