improved PHP parser
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpdt / internal / compiler / problem / ProblemHandler.java
index 9295af1..f29e11d 100644 (file)
@@ -1,13 +1,13 @@
 /*******************************************************************************
- * 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;
@@ -17,6 +17,7 @@ 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
@@ -28,9 +29,11 @@ import net.sourceforge.phpdt.internal.compiler.impl.ReferenceContext;
 
 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
@@ -48,13 +51,13 @@ public ProblemHandler(IErrorHandlingPolicy policy, CompilerOptions options, IPro
  *             Error | Warning | Ignore
  */
 public int computeSeverity(int problemId){
-       
        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, 
@@ -66,6 +69,7 @@ public IProblem createProblem(
                fileName, 
                problemId, 
                problemArguments, 
+               messageArguments,
                severity, 
                problemStartPosition, 
                problemEndPosition, 
@@ -74,6 +78,7 @@ public IProblem createProblem(
 public void handle(
        int problemId, 
        String[] problemArguments, 
+       String[] messageArguments,
        int severity, 
        int problemStartPosition, 
        int problemEndPosition, 
@@ -86,7 +91,7 @@ public void handle(
        // 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
                }
@@ -97,6 +102,7 @@ public void handle(
                        unitResult.getFileName(), 
                        problemId, 
                        problemArguments, 
+                       messageArguments,
                        severity, 
                        problemStartPosition, 
                        problemEndPosition, 
@@ -132,6 +138,7 @@ public void handle(
 public void handle(
        int problemId, 
        String[] problemArguments, 
+       String[] messageArguments,
        int problemStartPosition, 
        int problemEndPosition, 
        ReferenceContext referenceContext, 
@@ -140,6 +147,7 @@ public void handle(
        this.handle(
                problemId,
                problemArguments,
+               messageArguments,
                this.computeSeverity(problemId), // severity inferred using the ID
                problemStartPosition,
                problemEndPosition,
@@ -152,7 +160,7 @@ public void record(IProblem problem, CompilationResult unitResult, ReferenceCont
 /**
  * Search the line number corresponding to a specific position
  *
- * @param methodBinding org.eclipse.jdt.internal.compiler.nameloopkup.SyntheticAccessMethodBinding
+ * @param methodBinding net.sourceforge.phpdt.internal.compiler.nameloopkup.SyntheticAccessMethodBinding
  */
 public static final int searchLineNumber(int[] startLineIndexes, int position) {
        if (startLineIndexes == null)