/*******************************************************************************
- * Copyright (c) 2000, 2001, 2002 International Business Machines Corp. and others.
+ * Copyright (c) 2000, 2003 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v0.5
+ * are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v05.html
+ * http://www.eclipse.org/legal/cpl-v10.html
*
* Contributors:
* IBM Corporation - initial API and implementation
- ******************************************************************************/
+ *******************************************************************************/
package net.sourceforge.phpdt.internal.compiler.problem;
import net.sourceforge.phpdt.core.compiler.IProblem;
import net.sourceforge.phpdt.internal.compiler.CompilationResult;
import net.sourceforge.phpdt.internal.compiler.IErrorHandlingPolicy;
import net.sourceforge.phpdt.internal.compiler.IProblemFactory;
-import net.sourceforge.phpdt.internal.compiler.impl.CompilerOptions;
import net.sourceforge.phpdt.internal.compiler.impl.ReferenceContext;
+
/*
* Compiler error handler, responsible to determine whether
* a problem is actually a warning or an error; also will
public class ProblemHandler implements ProblemSeverities {
+ public final static String[] NoArgument = new String[0];
+
final public IErrorHandlingPolicy policy;
public final IProblemFactory problemFactory;
- public final CompilerOptions options;
+// public final CompilerOptions options;
/*
* Problem handler can be supplied with a policy to specify
* its behavior in error handling. Also see static methods for
* built-in policies.
*
*/
-public ProblemHandler(IErrorHandlingPolicy policy, CompilerOptions options, IProblemFactory problemFactory) {
+public ProblemHandler(IErrorHandlingPolicy policy, IProblemFactory problemFactory) {
+//CompilerOptions options, IProblemFactory problemFactory) {
this.policy = policy;
this.problemFactory = problemFactory;
- this.options = options;
+// this.options = options;
}
/*
* Given the current configuration, answers which category the problem
* Error | Warning | Ignore
*/
public int computeSeverity(int problemId){
-
+ if (problemId==IProblem.PHPParsingWarning ||
+ problemId==IProblem.PHPVarDeprecatedWarning) {
+ return Warning;
+ }
return Error; // by default all problems are errors
}
public IProblem createProblem(
char[] fileName,
int problemId,
String[] problemArguments,
+ String[] messageArguments,
int severity,
int problemStartPosition,
int problemEndPosition,
fileName,
problemId,
problemArguments,
+ messageArguments,
severity,
problemStartPosition,
problemEndPosition,
public void handle(
int problemId,
String[] problemArguments,
+ String[] messageArguments,
int severity,
int problemStartPosition,
int problemEndPosition,
// if no reference context, we need to abort from the current compilation process
if (referenceContext == null) {
if ((severity & Error) != 0) { // non reportable error is fatal
- throw new AbortCompilation(problemId, problemArguments);
+ throw new AbortCompilation(problemId, problemArguments, messageArguments);
} else {
return; // ignore non reportable warning
}
unitResult.getFileName(),
problemId,
problemArguments,
+ messageArguments,
severity,
problemStartPosition,
problemEndPosition,
public void handle(
int problemId,
String[] problemArguments,
+ String[] messageArguments,
int problemStartPosition,
int problemEndPosition,
ReferenceContext referenceContext,
this.handle(
problemId,
problemArguments,
+ messageArguments,
this.computeSeverity(problemId), // severity inferred using the ID
problemStartPosition,
problemEndPosition,