Example usage for org.eclipse.jdt.internal.compiler.problem ProblemSeverities Ignore

List of usage examples for org.eclipse.jdt.internal.compiler.problem ProblemSeverities Ignore

Introduction

In this page you can find the example usage for org.eclipse.jdt.internal.compiler.problem ProblemSeverities Ignore.

Prototype

int Ignore

To view the source code for org.eclipse.jdt.internal.compiler.problem ProblemSeverities Ignore.

Click Source Link

Usage

From source file:ch.uzh.ifi.seal.changedistiller.ast.java.CommentRecorderParser.java

License:Open Source License

@Override
public void initializeScanner() {
    scanner = new Scanner(false /*comment*/, false /*whitespace*/,
            options.getSeverity(CompilerOptions.NonExternalizedString) != ProblemSeverities.Ignore /*nls*/,
            options.sourceLevel /*sourceLevel*/, options.taskTags/*taskTags*/,
            options.taskPriorities/*taskPriorities*/, options.isTaskCaseSensitive/*taskCaseSensitive*/);
}

From source file:org.eclipse.jdt.internal.compiler.lookup.MethodVerifier15.java

License:Open Source License

void reportRawReferences() {
    CompilerOptions compilerOptions = this.type.scope.compilerOptions();
    if (compilerOptions.sourceLevel < ClassFileConstants.JDK1_5 // shouldn't whine at all
            || compilerOptions.reportUnavoidableGenericTypeProblems) { // must have already whined 
        return;/*  w w w.  ja va2 s . c  om*/
    }
    /* Code below is only for a method that does not override/implement a super type method. If it were to,
       it would have been handled in checkAgainstInheritedMethods.
    */
    Object[] methodArray = this.currentMethods.valueTable;
    for (int s = methodArray.length; --s >= 0;) {
        if (methodArray[s] == null)
            continue;
        MethodBinding[] current = (MethodBinding[]) methodArray[s];
        for (int i = 0, length = current.length; i < length; i++) {
            MethodBinding currentMethod = current[i];
            if ((currentMethod.modifiers
                    & (ExtraCompilerModifiers.AccImplementing | ExtraCompilerModifiers.AccOverriding)) == 0) {
                AbstractMethodDeclaration methodDecl = currentMethod.sourceMethod();
                if (methodDecl == null)
                    return;
                TypeBinding[] parameterTypes = currentMethod.parameters;
                Argument[] arguments = methodDecl.arguments;
                for (int j = 0, size = currentMethod.parameters.length; j < size; j++) {
                    TypeBinding parameterType = parameterTypes[j];
                    Argument arg = arguments[j];
                    if (parameterType.leafComponentType().isRawType()
                            && compilerOptions
                                    .getSeverity(CompilerOptions.RawTypeReference) != ProblemSeverities.Ignore
                            && (arg.type.bits & ASTNode.IgnoreRawTypeCheck) == 0) {
                        methodDecl.scope.problemReporter().rawTypeReference(arg.type, parameterType);
                    }
                }
                if (!methodDecl.isConstructor() && methodDecl instanceof MethodDeclaration) {
                    TypeReference returnType = ((MethodDeclaration) methodDecl).returnType;
                    TypeBinding methodType = currentMethod.returnType;
                    if (returnType != null) {
                        if (methodType.leafComponentType().isRawType()
                                && compilerOptions.getSeverity(
                                        CompilerOptions.RawTypeReference) != ProblemSeverities.Ignore
                                && (returnType.bits & ASTNode.IgnoreRawTypeCheck) == 0) {
                            methodDecl.scope.problemReporter().rawTypeReference(returnType, methodType);
                        }
                    }
                }
            }
        }
    }
}

From source file:org.eclipse.jdt.internal.compiler.lookup.MethodVerifier15.java

License:Open Source License

public void reportRawReferences(MethodBinding currentMethod, MethodBinding inheritedMethod) {
    CompilerOptions compilerOptions = this.type.scope.compilerOptions();
    if (compilerOptions.sourceLevel < ClassFileConstants.JDK1_5 // shouldn't whine at all
            || compilerOptions.reportUnavoidableGenericTypeProblems) { // must have already whined 
        return;//from  w  w w  .j a v  a 2s .  c om
    }
    AbstractMethodDeclaration methodDecl = currentMethod.sourceMethod();
    if (methodDecl == null)
        return;
    TypeBinding[] parameterTypes = currentMethod.parameters;
    TypeBinding[] inheritedParameterTypes = inheritedMethod.parameters;
    Argument[] arguments = methodDecl.arguments;
    for (int j = 0, size = currentMethod.parameters.length; j < size; j++) {
        TypeBinding parameterType = parameterTypes[j];
        TypeBinding inheritedParameterType = inheritedParameterTypes[j];
        Argument arg = arguments[j];
        if (parameterType.leafComponentType().isRawType()) {
            if (inheritedParameterType.leafComponentType().isRawType()) {
                arg.binding.tagBits |= TagBits.ForcedToBeRawType;
            } else {
                if (compilerOptions.getSeverity(CompilerOptions.RawTypeReference) != ProblemSeverities.Ignore
                        && (arg.type.bits & ASTNode.IgnoreRawTypeCheck) == 0) {
                    methodDecl.scope.problemReporter().rawTypeReference(arg.type, parameterType);
                }
            }
        }
    }
    TypeReference returnType = null;
    if (!methodDecl.isConstructor() && methodDecl instanceof MethodDeclaration
            && (returnType = ((MethodDeclaration) methodDecl).returnType) != null) {
        final TypeBinding inheritedMethodType = inheritedMethod.returnType;
        final TypeBinding methodType = currentMethod.returnType;
        if (methodType.leafComponentType().isRawType()) {
            if (inheritedMethodType.leafComponentType().isRawType()) {
                // 
            } else {
                if ((returnType.bits & ASTNode.IgnoreRawTypeCheck) == 0 && compilerOptions
                        .getSeverity(CompilerOptions.RawTypeReference) != ProblemSeverities.Ignore) {
                    methodDecl.scope.problemReporter().rawTypeReference(returnType, methodType);
                }
            }
        }
    }
}

From source file:org.eclipse.jdt.internal.compiler.parser.Parser.java

License:Open Source License

public void initialize(boolean initializeNLS) {
    //positionning the parser for a new compilation unit
    //avoiding stack reallocation and all that....
    this.astPtr = -1;
    this.astLengthPtr = -1;
    this.expressionPtr = -1;
    this.expressionLengthPtr = -1;
    this.identifierPtr = -1;
    this.identifierLengthPtr = -1;
    this.intPtr = -1;
    this.nestedMethod[this.nestedType = 0] = 0; // need to reset for further reuse
    this.variablesCounter[this.nestedType] = 0;
    this.dimensions = 0;
    this.realBlockPtr = -1;
    this.compilationUnit = null;
    this.referenceContext = null;
    this.endStatementPosition = 0;

    //remove objects from stack too, while the same parser/compiler couple is
    //re-used between two compilations ....

    int astLength = this.astStack.length;
    if (this.noAstNodes.length < astLength) {
        this.noAstNodes = new ASTNode[astLength];
        //System.out.println("Resized AST stacks : "+ astLength);

    }/*  w w  w  .  j  a va2 s  .  c o m*/
    System.arraycopy(this.noAstNodes, 0, this.astStack, 0, astLength);

    int expressionLength = this.expressionStack.length;
    if (this.noExpressions.length < expressionLength) {
        this.noExpressions = new Expression[expressionLength];
        //System.out.println("Resized EXPR stacks : "+ expressionLength);
    }
    System.arraycopy(this.noExpressions, 0, this.expressionStack, 0, expressionLength);

    // reset this.scanner state
    this.scanner.commentPtr = -1;
    this.scanner.foundTaskCount = 0;
    this.scanner.eofPosition = Integer.MAX_VALUE;
    this.recordStringLiterals = true;
    final boolean checkNLS = this.options
            .getSeverity(CompilerOptions.NonExternalizedString) != ProblemSeverities.Ignore;
    this.checkExternalizeStrings = checkNLS;
    this.scanner.checkNonExternalizedStringLiterals = initializeNLS && checkNLS;
    this.scanner.lastPosition = -1;

    resetModifiers();

    // recovery
    this.lastCheckPoint = -1;
    this.currentElement = null;
    this.restartRecovery = false;
    this.hasReportedError = false;
    this.recoveredStaticInitializerStart = 0;
    this.lastIgnoredToken = -1;
    this.lastErrorEndPosition = -1;
    this.lastErrorEndPositionBeforeRecovery = -1;
    this.lastJavadocEnd = -1;
    this.listLength = 0;
    this.listTypeParameterLength = 0;
    this.lastPosistion = -1;

    this.rBraceStart = 0;
    this.rBraceEnd = 0;
    this.rBraceSuccessorStart = 0;

    this.genericsIdentifiersLengthPtr = -1;
    this.genericsLengthPtr = -1;
    this.genericsPtr = -1;
}

From source file:org.eclipse.jdt.internal.compiler.problem.ProblemHandler.java

License:Open Source License

public void handle(int problemId, String[] problemArguments, int elaborationId, String[] messageArguments,
        int severity, int problemStartPosition, int problemEndPosition, ReferenceContext referenceContext,
        CompilationResult unitResult) {//from  w ww.  j  a va 2 s  .  c  o m

    if (severity == ProblemSeverities.Ignore)
        return;

    // if no reference context, we need to abort from the current compilation process
    if (referenceContext == null) {
        if ((severity & ProblemSeverities.Error) != 0) { // non reportable error is fatal
            CategorizedProblem problem = this.createProblem(null, problemId, problemArguments, elaborationId,
                    messageArguments, severity, 0, 0, 0, 0);
            throw new AbortCompilation(null, problem);
        } else {
            return; // ignore non reportable warning
        }
    }

    int[] lineEnds;
    int lineNumber = problemStartPosition >= 0 ? Util.getLineNumber(problemStartPosition,
            lineEnds = unitResult.getLineSeparatorPositions(), 0, lineEnds.length - 1) : 0;
    int columnNumber = problemStartPosition >= 0
            ? Util.searchColumnNumber(unitResult.getLineSeparatorPositions(), lineNumber, problemStartPosition)
            : 0;
    CategorizedProblem problem = this.createProblem(unitResult.getFileName(), problemId, problemArguments,
            elaborationId, messageArguments, severity, problemStartPosition, problemEndPosition, lineNumber,
            columnNumber);

    if (problem == null)
        return; // problem couldn't be created, ignore

    switch (severity & ProblemSeverities.Error) {
    case ProblemSeverities.Error:
        record(problem, unitResult, referenceContext);
        if ((severity & ProblemSeverities.Fatal) != 0) {
            referenceContext.tagAsHavingErrors();
            // should abort ?
            int abortLevel;
            if ((abortLevel = this.policy.stopOnFirstError() ? ProblemSeverities.AbortCompilation
                    : severity & ProblemSeverities.Abort) != 0) {
                referenceContext.abort(abortLevel, problem);
            }
        }
        break;
    case ProblemSeverities.Warning:
        // GROOVY start - still required?
        if ((this.options.groovyFlags & 0x01) != 0) {
            if ((unitResult.compilationUnit instanceof SourceFile)
                    && ((SourceFile) unitResult.compilationUnit).isInLinkedSourceFolder()) {
                return;
            }
        }
        // GROOVY end
        record(problem, unitResult, referenceContext);
        break;
    }
}