New Warning: "Uninitialized local variable"
authoraxelcl <axelcl>
Fri, 22 Apr 2005 21:56:26 +0000 (21:56 +0000)
committeraxelcl <axelcl>
Fri, 22 Apr 2005 21:56:26 +0000 (21:56 +0000)
New Preferences:  "Uninitialized local variable" and "Unreachble code" are configurable in Preferences (Error,Warning or Ignore)
Default is "Warning"

net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/JavaCore.java
net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/flow/UnconditionalFlowInfo.java
net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/impl/CompilerOptions.java
net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/parser/Parser.java
net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/problem/ProblemReporter.java
net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/preferences/CompilerConfigurationBlock.java
net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/preferences/PreferencesMessages.properties
net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/AllocationExpression.java
net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/QualifiedNameReference.java
net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/internal/compiler/ast/SingleNameReference.java

index b340b76..e575e0c 100644 (file)
@@ -294,13 +294,17 @@ public class JavaCore {
        
        public static final String COMPILER_PB_PHP_FILE_NOT_EXIST = CompilerOptions.OPTION_PHPIncludeNotExistWarning; //$NON-NLS-1$
        
+       public static final String COMPILER_PB_UNINITIALIZED_LOCAL_VARIABLE = CompilerOptions.OPTION_UninitializedLocalVariableWarning; //$NON-NLS-1$
+       
+       public static final String COMPILER_PB_UNREACHABLE_CODE = CompilerOptions.OPTION_CodeCannotBeReachedWarning; //$NON-NLS-1$
+       
        /**
         * Possible configurable option ID.
         * 
         * @see #getDefaultOptions
         */
-       public static final String COMPILER_PB_UNREACHABLE_CODE = PLUGIN_ID
-                       + ".compiler.problem.unreachableCode"; //$NON-NLS-1$
+//     public static final String COMPILER_PB_UNREACHABLE_CODE = PLUGIN_ID
+//                     + ".compiler.problem.unreachableCode"; //$NON-NLS-1$
 
        /**
         * Possible configurable option ID.
@@ -2919,7 +2923,7 @@ public class JavaCore {
                optionNames.add(COMPILER_CODEGEN_UNUSED_LOCAL);
 
                preferences.setDefault(COMPILER_CODEGEN_TARGET_PLATFORM, VERSION_1_1);
-               optionNames.add(COMPILER_CODEGEN_TARGET_PLATFORM);
+               optionNames.add(COMPILER_CODEGEN_TARGET_PLATFORM); 
 
                preferences.setDefault(COMPILER_PB_PHP_VAR_DEPRECATED, WARNING);
                optionNames.add(COMPILER_PB_PHP_VAR_DEPRECATED);
@@ -2929,10 +2933,11 @@ public class JavaCore {
                optionNames.add(COMPILER_PB_PHP_UPPERCASE_IDENTIFIER);
                preferences.setDefault(COMPILER_PB_PHP_FILE_NOT_EXIST, WARNING);
                optionNames.add(COMPILER_PB_PHP_FILE_NOT_EXIST);
-               preferences.setDefault(COMPILER_PB_UNREACHABLE_CODE, ERROR);
+               preferences.setDefault(COMPILER_PB_UNREACHABLE_CODE, WARNING);
                optionNames.add(COMPILER_PB_UNREACHABLE_CODE);
-
+               preferences.setDefault(COMPILER_PB_UNINITIALIZED_LOCAL_VARIABLE, WARNING);
+               optionNames.add(COMPILER_PB_UNINITIALIZED_LOCAL_VARIABLE);
+               
                preferences.setDefault(COMPILER_PB_INVALID_IMPORT, ERROR);
                optionNames.add(COMPILER_PB_INVALID_IMPORT);
 
index 685d8cb..4579ea7 100644 (file)
@@ -141,18 +141,18 @@ public class UnconditionalFlowInfo extends FlowInfo {
        }
 
        // Report an error if necessary
-       public boolean complainIfUnreachable(Statement statement, BlockScope scope, boolean didAlreadyComplain) {
-       
-               if ((this.reachMode & UNREACHABLE) != 0) {
-                       statement.bits &= ~ASTNode.IsReachableMASK;
-                       boolean reported = this == DEAD_END;
-                       if (!didAlreadyComplain && reported) {
-                               scope.problemReporter().unreachableCode(statement);
-                       }
-                       return reported; // keep going for fake reachable
-               }
-               return false;
-       }
+//     public boolean complainIfUnreachable(Statement statement, BlockScope scope, boolean didAlreadyComplain) {
+//     
+//             if ((this.reachMode & UNREACHABLE) != 0) {
+//                     statement.bits &= ~ASTNode.IsReachableMASK;
+//                     boolean reported = this == DEAD_END;
+//                     if (!didAlreadyComplain && reported) {
+//                             scope.problemReporter().unreachableCode(statement);
+//                     }
+//                     return reported; // keep going for fake reachable
+//             }
+//             return false;
+//     }
        
        /**
         * Answers a copy of the current instance
index a7a802a..b729405 100644 (file)
@@ -17,6 +17,7 @@ import java.util.HashMap;
 import java.util.Map;
 
 import net.sourceforge.phpdt.core.compiler.CharOperation;
+import net.sourceforge.phpdt.core.compiler.IProblem;
 import net.sourceforge.phpdt.internal.compiler.Compiler;
 import net.sourceforge.phpdt.internal.compiler.env.IConstants;
 import net.sourceforge.phpdt.internal.compiler.lookup.ProblemReasons;
@@ -31,6 +32,8 @@ public class CompilerOptions implements ProblemReasons, ProblemSeverities, ICons
     public static final String OPTION_PHPBadStyleKeywordWarning = "net.sourceforge.phpeclipse.compiler.problem.phpBadStyleKeywordWarning"; //$NON-NLS-1$
     public static final String OPTION_PHPBadStyleUppercaseIdentifierWarning = "net.sourceforge.phpeclipse.compiler.problem.phpBadStyleUppercaseIdentifierWarning"; //$NON-NLS-1$
     public static final String OPTION_PHPIncludeNotExistWarning = "net.sourceforge.phpeclipse.compiler.problem.phpIncludeNotExistWarning"; //$NON-NLS-1$
+    public static final String OPTION_UninitializedLocalVariableWarning = "net.sourceforge.phpeclipse.compiler.problem.uninitializedLocalVariableWarning"; //$NON-NLS-1$
+    public static final String OPTION_CodeCannotBeReachedWarning = "net.sourceforge.phpeclipse.compiler.problem.codeCannotBeReachedWarning"; //$NON-NLS-1$
     
     public static final String OPTION_LocalVariableAttribute = "net.sourceforge.phpeclipse.compiler.debug.localVariable"; //$NON-NLS-1$
        public static final String OPTION_LineNumberAttribute = "net.sourceforge.phpeclipse.compiler.debug.lineNumber"; //$NON-NLS-1$
@@ -157,6 +160,8 @@ public class CompilerOptions implements ProblemReasons, ProblemSeverities, ICons
        public static final long PHPBadStyleKeywordWarning = 0x40000000000L;
        public static final long PHPBadStyleUppercaseIdentifierWarning  = 0x80000000000L;
        public static final long PHPIncludeNotExistWarning = 0x100000000000L;
+       public static final long UninitializedLocalVariableWarning = 0x200000000000L;
+       public static final long CodeCannotBeReachedWarning = 0x400000000000L;
        // Default severity level for handlers
        public long errorThreshold = 0;
                
@@ -175,7 +180,10 @@ public class CompilerOptions implements ProblemReasons, ProblemSeverities, ICons
                | PHPVarDeprecatedWarning
                | PHPBadStyleKeywordWarning
                | PHPBadStyleUppercaseIdentifierWarning
-               | PHPIncludeNotExistWarning;
+               | PHPIncludeNotExistWarning
+               | UninitializedLocalVariableWarning
+               | CodeCannotBeReachedWarning;
+               ;
 
        // Debug attributes
        public static final int Source = 1; // SourceFileAttribute
@@ -263,9 +271,12 @@ public class CompilerOptions implements ProblemReasons, ProblemSeverities, ICons
 
        public Map getMap() {
                Map optionsMap = new HashMap(30);
+               optionsMap.put(OPTION_PHPVarDeprecatedWarning, getSeverityString(PHPIncludeNotExistWarning));
                optionsMap.put(OPTION_PHPVarDeprecatedWarning, getSeverityString(PHPVarDeprecatedWarning)); 
                optionsMap.put(OPTION_PHPBadStyleKeywordWarning, getSeverityString(PHPBadStyleKeywordWarning)); 
                optionsMap.put(OPTION_PHPBadStyleUppercaseIdentifierWarning, getSeverityString(PHPBadStyleUppercaseIdentifierWarning)); 
+               optionsMap.put(OPTION_UninitializedLocalVariableWarning, getSeverityString(UninitializedLocalVariableWarning)); 
+               optionsMap.put(OPTION_CodeCannotBeReachedWarning, getSeverityString(CodeCannotBeReachedWarning)); 
                
                optionsMap.put(OPTION_LocalVariableAttribute, (this.produceDebugAttributes & Vars) != 0 ? GENERATE : DO_NOT_GENERATE); 
                optionsMap.put(OPTION_LineNumberAttribute, (this.produceDebugAttributes & Lines) != 0 ? GENERATE : DO_NOT_GENERATE);
@@ -492,6 +503,8 @@ public class CompilerOptions implements ProblemReasons, ProblemSeverities, ICons
                if ((optionValue = optionsMap.get(OPTION_PHPBadStyleKeywordWarning)) != null) updateSeverity(PHPBadStyleKeywordWarning, optionValue);
                if ((optionValue = optionsMap.get(OPTION_PHPBadStyleUppercaseIdentifierWarning)) != null) updateSeverity(PHPBadStyleUppercaseIdentifierWarning, optionValue);
                if ((optionValue = optionsMap.get(OPTION_PHPIncludeNotExistWarning)) != null) updateSeverity(PHPIncludeNotExistWarning, optionValue);
+               if ((optionValue = optionsMap.get(OPTION_UninitializedLocalVariableWarning)) != null) updateSeverity(UninitializedLocalVariableWarning, optionValue);
+               if ((optionValue = optionsMap.get(OPTION_CodeCannotBeReachedWarning)) != null) updateSeverity(CodeCannotBeReachedWarning, optionValue);
                
                if ((optionValue = optionsMap.get(OPTION_ReportMethodWithConstructorName)) != null) updateSeverity(MethodWithConstructorName, optionValue);
                if ((optionValue = optionsMap.get(OPTION_ReportOverridingPackageDefaultMethod)) != null) updateSeverity(OverriddenPackageDefaultMethod, optionValue);
@@ -604,6 +617,8 @@ public class CompilerOptions implements ProblemReasons, ProblemSeverities, ICons
                buf.append("\n\t- don't use keywords as identifiers: ").append(getSeverityString(PHPBadStyleKeywordWarning)); //$NON-NLS-1$
                buf.append("\n\t- non-variable idenifiers should contain only uppercase characters: ").append(getSeverityString(PHPBadStyleUppercaseIdentifierWarning)); //$NON-NLS-1$
                buf.append("\n\t- include filename doesn't exist in project: ").append(getSeverityString(PHPIncludeNotExistWarning)); //$NON-NLS-1$
+               buf.append("\n\t- local variable not initialized: ").append(getSeverityString(UninitializedLocalVariableWarning)); //$NON-NLS-1$
+               buf.append("\n\t- unreachable code: ").append(getSeverityString(CodeCannotBeReachedWarning)); //$NON-NLS-1$
                
                buf.append("\n\t- local variables debug attributes: ").append((this.produceDebugAttributes & Vars) != 0 ? "ON" : " OFF"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
                buf.append("\n\t- line number debug attributes: ").append((this.produceDebugAttributes & Lines) != 0 ? "ON" : " OFF"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
index 908fbf8..d3e2a3c 100644 (file)
@@ -9,6 +9,8 @@ package net.sourceforge.phpdt.internal.compiler.parser;
 
 import java.util.ArrayList;
 import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Stack;
 
 import net.sourceforge.phpdt.core.compiler.CharOperation;
 import net.sourceforge.phpdt.core.compiler.ITerminalSymbols;
@@ -308,6 +310,7 @@ public class Parser implements ITerminalSymbols, CompilerModifiers, ParserBasicI
    */
   public void parse(String s, HashMap variables) {
     fMethodVariables = variables;
+    fStackUnassigned = new Stack();
     init(s);
     parse();
   }
@@ -470,8 +473,10 @@ public class Parser implements ITerminalSymbols, CompilerModifiers, ParserBasicI
       try {
         statement = statement();
         blockStatements.add(statement);
-        if (branchStatement && statement!=null) {
-          reportSyntaxError("Unreachable code", statement.sourceStart, statement.sourceEnd);
+        if (branchStatement && statement != null) {
+//          reportSyntaxError("Unreachable code", statement.sourceStart, statement.sourceEnd);
+          problemReporter.unreachableCode(new String(scanner.getCurrentIdentifierSource()),statement.sourceStart, statement.sourceEnd,
+              referenceContext, compilationUnit.compilationResult);
         }
         if ((token == TokenNameRBRACE) || (token == TokenNamecase) || (token == TokenNamedefault) || (token == TokenNameelse)
             || (token == TokenNameelseif) || (token == TokenNameendif) || (token == TokenNameendfor)
@@ -525,7 +530,7 @@ public class Parser implements ITerminalSymbols, CompilerModifiers, ParserBasicI
   private boolean checkUnreachableStatements(Statement statement) {
     if (statement instanceof ReturnStatement || statement instanceof ContinueStatement || statement instanceof BreakStatement) {
       return true;
-    } else if (statement instanceof IfStatement && ((IfStatement)statement).checkUnreachable) {
+    } else if (statement instanceof IfStatement && ((IfStatement) statement).checkUnreachable) {
       return true;
     }
     return false;
@@ -718,7 +723,7 @@ public class Parser implements ITerminalSymbols, CompilerModifiers, ParserBasicI
       foreach_optional_arg();
       if (token == TokenNameEQUAL_GREATER) {
         getNextToken();
-        variable();
+        variable(false);
       }
       if (token == TokenNameRPAREN) {
         getNextToken();
@@ -1059,7 +1064,7 @@ public class Parser implements ITerminalSymbols, CompilerModifiers, ParserBasicI
     if (token == TokenNameAND) {
       getNextToken();
     }
-    w_variable();
+    w_variable(true);
   }
 
   private void foreach_optional_arg() {
@@ -1075,8 +1080,9 @@ public class Parser implements ITerminalSymbols, CompilerModifiers, ParserBasicI
     //  global_var_list:
     // global_var_list ',' global_var
     //| global_var
+    HashSet set = peekVariableSet();
     while (true) {
-      global_var();
+      global_var(set);
       if (token != TokenNameCOMMA) {
         break;
       }
@@ -1084,16 +1090,17 @@ public class Parser implements ITerminalSymbols, CompilerModifiers, ParserBasicI
     }
   }
 
-  private void global_var() {
+  private void global_var(HashSet set) {
     //global_var:
     // T_VARIABLE
     //| '$' r_variable
     //| '$' '{' expr '}'
     if (token == TokenNameVariable) {
-      VariableInfo info = new VariableInfo(scanner.getCurrentTokenStartPosition(), VariableInfo.LEVEL_GLOBAL_VAR);
       if (fMethodVariables != null) {
+        VariableInfo info = new VariableInfo(scanner.getCurrentTokenStartPosition(), VariableInfo.LEVEL_GLOBAL_VAR);
         fMethodVariables.put(new String(scanner.getCurrentIdentifierSource()), info);
       }
+      addVariableSet(set);
       getNextToken();
     } else if (token == TokenNameDOLLAR) {
       getNextToken();
@@ -1115,13 +1122,15 @@ public class Parser implements ITerminalSymbols, CompilerModifiers, ParserBasicI
     // static_var_list ',' T_VARIABLE
     //| static_var_list ',' T_VARIABLE '=' static_scalar
     //| T_VARIABLE
-    //| T_VARIABLE '=' static_scalar
+    //| T_VARIABLE '=' static_scalar,
+    HashSet set = peekVariableSet();
     while (true) {
       if (token == TokenNameVariable) {
-        VariableInfo info = new VariableInfo(scanner.getCurrentTokenStartPosition(), VariableInfo.LEVEL_STATIC_VAR);
         if (fMethodVariables != null) {
+          VariableInfo info = new VariableInfo(scanner.getCurrentTokenStartPosition(), VariableInfo.LEVEL_STATIC_VAR);
           fMethodVariables.put(new String(scanner.getCurrentIdentifierSource()), info);
-        }
+        } 
+        addVariableSet(set);
         getNextToken();
         if (token == TokenNameEQUAL) {
           getNextToken();
@@ -1144,7 +1153,7 @@ public class Parser implements ITerminalSymbols, CompilerModifiers, ParserBasicI
     //    unset_variable:
     //                 variable
     while (true) {
-      variable();
+      variable(false);
       if (token != TokenNameCOMMA) {
         break;
       }
@@ -1607,15 +1616,20 @@ public class Parser implements ITerminalSymbols, CompilerModifiers, ParserBasicI
         }
       }
     }
-    functionDeclarator(methodDecl);
-    if (token == TokenNameSEMICOLON) {
-      if (!isAbstract) {
-        throwSyntaxError("Body declaration expected for method: " + new String(methodDecl.selector));
+    try {
+      pushVariableSet();
+      functionDeclarator(methodDecl);
+      if (token == TokenNameSEMICOLON) {
+        if (!isAbstract) {
+          throwSyntaxError("Body declaration expected for method: " + new String(methodDecl.selector));
+        }
+        getNextToken();
+        return;
       }
-      getNextToken();
-      return;
+      functionBody(methodDecl);
+    } finally {
+      fStackUnassigned.pop();
     }
-    functionBody(methodDecl);
   }
 
   private void functionDeclarator(MethodDeclaration methodDecl) {
@@ -1672,6 +1686,7 @@ public class Parser implements ITerminalSymbols, CompilerModifiers, ParserBasicI
     // static_scalar
     char[] typeIdentifier = null;
     if (token == TokenNameIdentifier || token == TokenNameVariable || token == TokenNameAND) {
+      HashSet set = peekVariableSet();
       while (true) {
         if (token == TokenNameIdentifier) {
           typeIdentifier = scanner.getCurrentIdentifierSource();
@@ -1691,6 +1706,7 @@ public class Parser implements ITerminalSymbols, CompilerModifiers, ParserBasicI
             info.typeIdentifier = typeIdentifier;
             fMethodVariables.put(new String(scanner.getCurrentIdentifierSource()), info);
           }
+          addVariableSet(set);
           getNextToken();
           if (token == TokenNameEQUAL) {
             getNextToken();
@@ -1799,7 +1815,7 @@ public class Parser implements ITerminalSymbols, CompilerModifiers, ParserBasicI
     checkUnreachable(iState, b);
     if (token == TokenNameelseif) {
       new_elseif_list(iState);
-    } 
+    }
     new_else_single(iState);
     if (token != TokenNameendif) {
       throwSyntaxError("'endif' expected.");
@@ -1943,14 +1959,14 @@ public class Parser implements ITerminalSymbols, CompilerModifiers, ParserBasicI
         int off = b.statements.length - 1;
         if (!(b.statements[off] instanceof ReturnStatement) && !(b.statements[off] instanceof ContinueStatement)
             && !(b.statements[off] instanceof BreakStatement)) {
-          if (!(b.statements[off] instanceof IfStatement) || !((IfStatement)b.statements[off]).checkUnreachable) {
+          if (!(b.statements[off] instanceof IfStatement) || !((IfStatement) b.statements[off]).checkUnreachable) {
             iState.checkUnreachable = false;
           }
-        } 
+        }
       }
     } else {
       if (!(s instanceof ReturnStatement) && !(s instanceof ContinueStatement) && !(s instanceof BreakStatement)) {
-        if (!(s instanceof IfStatement) || !((IfStatement)s).checkUnreachable) {
+        if (!(s instanceof IfStatement) || !((IfStatement) s).checkUnreachable) {
           iState.checkUnreachable = false;
         }
       }
@@ -2420,9 +2436,17 @@ public class Parser implements ITerminalSymbols, CompilerModifiers, ParserBasicI
       case TokenNameVariable:
       case TokenNameDOLLAR:
         boolean rememberedVar = false;
-        Expression lhs = variable();
+//        char[] lhsVar = null;
+//        if (token==TokenNameVariable) {
+//          lhsVar = scanner.getCurrentTokenSource();
+//        }
+        Expression lhs = variable(true);
+
         switch (token) {
         case TokenNameEQUAL:
+//          if (lhsVar != null) {
+//            addVariableSet(lhsVar);
+//          }
           getNextToken();
           if (token == TokenNameAND) {
             getNextToken();
@@ -2446,7 +2470,7 @@ public class Parser implements ITerminalSymbols, CompilerModifiers, ParserBasicI
                 }
               }
             } else {
-              Expression rhs = variable();
+              Expression rhs = variable(false);
               if (rhs != null && rhs instanceof FieldReference && lhs != null && lhs instanceof FieldReference) {
                 // example:
                 // $var = &$ref;
@@ -2734,8 +2758,10 @@ public class Parser implements ITerminalSymbols, CompilerModifiers, ParserBasicI
     // variable
     //| T_LIST '(' assignment_list ')'
     //| /* empty */
-    if (token == TokenNameVariable || token == TokenNameDOLLAR) {
-      variable();
+    if (token == TokenNameVariable) {
+      variable(true);
+    } else if (token == TokenNameDOLLAR) {
+      variable(false);
     } else {
       if (token == TokenNamelist) {
         getNextToken();
@@ -2776,17 +2802,17 @@ public class Parser implements ITerminalSymbols, CompilerModifiers, ParserBasicI
     while (true) {
       if (token == TokenNameAND) {
         getNextToken();
-        variable();
+        variable(false);
       } else {
         expr();
         if (token == TokenNameAND) {
           getNextToken();
-          variable();
+          variable(false);
         } else if (token == TokenNameEQUAL_GREATER) {
           getNextToken();
           if (token == TokenNameAND) {
             getNextToken();
-            variable();
+            variable(false);
           } else {
             expr();
           }
@@ -2812,7 +2838,7 @@ public class Parser implements ITerminalSymbols, CompilerModifiers, ParserBasicI
   //      }
   //    } while (true);
   //  }
-  private Expression variable_without_objects() {
+  private Expression variable_without_objects(boolean lefthandside) {
     //  variable_without_objects:
     //                 reference_variable
     //         | simple_indirect_reference reference_variable
@@ -2822,10 +2848,10 @@ public class Parser implements ITerminalSymbols, CompilerModifiers, ParserBasicI
     while (token == TokenNameDOLLAR) {
       getNextToken();
     }
-    return reference_variable();
+    return reference_variable(lefthandside);
   }
 
-  private Expression function_call() {
+  private Expression function_call(boolean lefthandside) {
     //  function_call:
     // T_STRING '(' function_call_parameter_list ')'
     //| class_constant '(' function_call_parameter_list ')'
@@ -2855,12 +2881,12 @@ public class Parser implements ITerminalSymbols, CompilerModifiers, ParserBasicI
           getNextToken();
         } else {
           //        static member:
-          variable_without_objects();
+          variable_without_objects(false);
         }
         break;
       }
     } else {
-      ref = variable_without_objects();
+      ref = variable_without_objects(lefthandside);
     }
     if (token != TokenNameLPAREN) {
       if (defineName != null) {
@@ -2931,7 +2957,7 @@ public class Parser implements ITerminalSymbols, CompilerModifiers, ParserBasicI
     while (true) {
       if (token == TokenNameAND) {
         getNextToken();
-        w_variable();
+        w_variable(false);
       } else {
         //        if (token == TokenNameIdentifier || token ==
         // TokenNameVariable
@@ -2968,10 +2994,10 @@ public class Parser implements ITerminalSymbols, CompilerModifiers, ParserBasicI
       throwSyntaxError("'::' expected after class name (static_member).");
     }
     getNextToken();
-    variable_without_objects();
+    variable_without_objects(false);
   }
 
-  private Expression base_variable_with_function_calls() {
+  private Expression base_variable_with_function_calls(boolean lefthandside) {
     //  base_variable_with_function_calls:
     // base_variable
     //| function_call
@@ -2993,7 +3019,7 @@ public class Parser implements ITerminalSymbols, CompilerModifiers, ParserBasicI
     //      scanner.phpMode = true;
     //    }
     //    if (functionCall) {
-    return function_call();
+    return function_call(lefthandside);
     //    } else {
     //      base_variable();
     //    }
@@ -3014,7 +3040,7 @@ public class Parser implements ITerminalSymbols, CompilerModifiers, ParserBasicI
       while (token == TokenNameDOLLAR) {
         getNextToken();
       }
-      reference_variable();
+      reference_variable(false);
     }
     return ref;
   }
@@ -3024,7 +3050,7 @@ public class Parser implements ITerminalSymbols, CompilerModifiers, ParserBasicI
   //    // '$'
   //    //| simple_indirect_reference '$'
   //  }
-  private Expression reference_variable() {
+  private Expression reference_variable(boolean lefthandside) {
     //  reference_variable:
     //                 reference_variable '[' dim_offset ']'
     //         | reference_variable '{' expr '}'
@@ -3033,7 +3059,7 @@ public class Parser implements ITerminalSymbols, CompilerModifiers, ParserBasicI
     if (Scanner.TRACE) {
       System.out.println("TRACE: reference_variable()");
     }
-    ref = compound_variable();
+    ref = compound_variable(lefthandside);
     while (true) {
       if (token == TokenNameLBRACE) {
         ref = null;
@@ -3061,7 +3087,7 @@ public class Parser implements ITerminalSymbols, CompilerModifiers, ParserBasicI
     return ref;
   }
 
-  private Expression compound_variable() {
+  private Expression compound_variable(boolean lefthandside) {
     //  compound_variable:
     //                 T_VARIABLE
     //         | '$' '{' expr '}'
@@ -3069,6 +3095,16 @@ public class Parser implements ITerminalSymbols, CompilerModifiers, ParserBasicI
       System.out.println("TRACE: compound_variable()");
     }
     if (token == TokenNameVariable) {
+      if (!lefthandside) {
+        if (!containsVariableSet()) {
+//          reportSyntaxError("The local variable " + new String(scanner.getCurrentIdentifierSource())
+//              + " may not have been initialized");
+          problemReporter.uninitializedLocalVariable(new String(scanner.getCurrentIdentifierSource()),scanner.getCurrentTokenStartPosition(), scanner.getCurrentTokenEndPosition(),
+              referenceContext, compilationUnit.compilationResult);
+        }
+      } else {
+        addVariableSet();
+      }
       FieldReference ref = new FieldReference(scanner.getCurrentIdentifierSource(), scanner.getCurrentTokenStartPosition());
       getNextToken();
       return ref;
@@ -3105,7 +3141,7 @@ public class Parser implements ITerminalSymbols, CompilerModifiers, ParserBasicI
       System.out.println("TRACE: object_property()");
     }
     if (token == TokenNameVariable || token == TokenNameDOLLAR) {
-      variable_without_objects();
+      variable_without_objects(false);
     } else {
       object_dim_list();
     }
@@ -3171,23 +3207,23 @@ public class Parser implements ITerminalSymbols, CompilerModifiers, ParserBasicI
   }
 
   private void r_variable() {
-    variable();
+    variable(false);
   }
 
-  private void w_variable() {
-    variable();
+  private void w_variable(boolean lefthandside) {
+    variable(lefthandside);
   }
 
   private void rw_variable() {
-    variable();
+    variable(false);
   }
 
-  private Expression variable() {
+  private Expression variable(boolean lefthandside) {
     //    variable:
     //         base_variable_with_function_calls T_OBJECT_OPERATOR
     //                 object_property method_or_not variable_properties
     // | base_variable_with_function_calls
-    Expression ref = base_variable_with_function_calls();
+    Expression ref = base_variable_with_function_calls(lefthandside);
     if (token == TokenNameMINUS_GREATER) {
       ref = null;
       getNextToken();
@@ -3526,7 +3562,7 @@ public class Parser implements ITerminalSymbols, CompilerModifiers, ParserBasicI
         throwSyntaxError("'(' expected after keyword 'empty'");
       }
       getNextToken();
-      variable();
+      variable(false);
       if (token != TokenNameRPAREN) {
         throwSyntaxError("')' expected after keyword 'empty'");
       }
@@ -3658,7 +3694,7 @@ public class Parser implements ITerminalSymbols, CompilerModifiers, ParserBasicI
       throwSyntaxError("Variable expected after keyword 'isset'");
     }
     while (true) {
-      variable();
+      variable(false);
       if (token == TokenNameCOMMA) {
         getNextToken();
       } else {
@@ -3976,6 +4012,8 @@ public class Parser implements ITerminalSymbols, CompilerModifiers, ParserBasicI
 
   HashMap fMethodVariables = null;
 
+  Stack fStackUnassigned = new Stack();
+
   //ast stack
   final static int AstStackIncrement = 100;
 
@@ -4343,8 +4381,7 @@ public class Parser implements ITerminalSymbols, CompilerModifiers, ParserBasicI
         }
       }
       if (scanner.recordLineSeparator) {
-                                       compilationUnit.compilationResult.lineSeparatorPositions =
-         scanner.getLineEnds();
+        compilationUnit.compilationResult.lineSeparatorPositions = scanner.getLineEnds();
       }
       // check placement anomalies against other kinds of brackets
       for (int kind = 0; kind < BracketKinds; kind++) {
@@ -4480,4 +4517,83 @@ public class Parser implements ITerminalSymbols, CompilerModifiers, ParserBasicI
     //endPosition is just before the ;
 
   }
+
+  public final static String[] GLOBALS = {
+      "$this",
+      "$_COOKIE",
+      "$_ENV",
+      "$_FILES",
+      "$_GET",
+      "$GLOBALS",
+      "$_POST",
+      "$_REQUEST",
+      "$_SESSION",
+      "$_SERVER"
+  };
+  /**
+   * 
+   */
+  private void pushVariableSet() {
+    HashSet set =new HashSet();
+    for (int i = 0; i < GLOBALS.length; i++) {
+      set.add(GLOBALS[i]);
+    }
+    fStackUnassigned.push(set);
+  }
+  
+  /**
+   * Returns the <i>set of assigned variables </i> returns null if no Set is defined at the current scanner position
+   */
+  private HashSet peekVariableSet() {
+    if (!fStackUnassigned.isEmpty()) {
+      return (HashSet) fStackUnassigned.peek();
+    }
+    return null;
+  }
+
+  /**
+   * add the current identifier source to the <i>set of assigned variables </i>
+   * 
+   * @param set
+   */
+  private void addVariableSet(HashSet set) {
+    if (set != null) {
+      set.add(new String(scanner.getCurrentTokenSource()));
+    }
+  }
+
+  /**
+   * add the current identifier source to the <i>set of assigned variables </i>
+   *  
+   */
+  private void addVariableSet() {
+    HashSet set = peekVariableSet();
+    if (set != null) {
+      set.add(new String(scanner.getCurrentTokenSource()));
+    }
+  }
+
+  /**
+   * add the current identifier source to the <i>set of assigned variables </i>
+   *  
+   */
+  private void addVariableSet(char[] token) {
+    HashSet set = peekVariableSet();
+    if (set != null) {
+      set.add(new String(token));
+    }
+  }
+
+  /**
+   * check if the current identifier source is in the <i>set of assigned variables </i> Returns true, if no set is defined for the
+   * current scanner position
+   *  
+   */
+  private boolean containsVariableSet() {
+    HashSet set = peekVariableSet();
+    if (set != null) {
+      return set.contains(new String(scanner.getCurrentTokenSource()));
+    }
+    return true;
+  }
 }
\ No newline at end of file
index 8e8ed0a..576be8a 100644 (file)
@@ -97,7 +97,8 @@ public class ProblemReporter extends ProblemHandler implements ProblemReasons {
     this.handle(
     // %1 must be abstract since it cannot override the inherited
         // package-private abstract method %2
-        IProblem.AbstractMethodCannotBeOverridden, new String[] { new String(type.sourceName()),
+        IProblem.AbstractMethodCannotBeOverridden, new String[] {
+            new String(type.sourceName()),
             new String(CharOperation.concat(concreteMethod.declaringClass.readableName(), concreteMethod.readableName(), '.')) },
         new String[] {
             new String(type.sourceName()),
@@ -262,10 +263,13 @@ public class ProblemReporter extends ProblemHandler implements ProblemReasons {
   }
 
   public void cannotDireclyInvokeAbstractMethod(MessageSend messageSend, MethodBinding method) {
-    this.handle(IProblem.DirectInvocationOfAbstractMethod, new String[] { new String(method.declaringClass.readableName()),
-        new String(method.selector), parametersAsString(method) }, new String[] {
-        new String(method.declaringClass.shortReadableName()), new String(method.selector), parametersAsShortString(method) },
-        messageSend.sourceStart, messageSend.sourceEnd);
+    this.handle(IProblem.DirectInvocationOfAbstractMethod, new String[] {
+        new String(method.declaringClass.readableName()),
+        new String(method.selector),
+        parametersAsString(method) }, new String[] {
+        new String(method.declaringClass.shortReadableName()),
+        new String(method.selector),
+        parametersAsShortString(method) }, messageSend.sourceStart, messageSend.sourceEnd);
   }
 
   //  public void cannotImportPackage(ImportReference importRef) {
@@ -350,6 +354,11 @@ public class ProblemReporter extends ProblemHandler implements ProblemReasons {
     case IProblem.PHPBadStyleUppercaseIdentifierWarning:
       return this.options.getSeverity(CompilerOptions.PHPBadStyleUppercaseIdentifierWarning);
 
+    case IProblem.UninitializedLocalVariable:
+      return this.options.getSeverity(CompilerOptions.UninitializedLocalVariableWarning);
+    case IProblem.CodeCannotBeReached:
+      return this.options.getSeverity(CompilerOptions.CodeCannotBeReachedWarning);
+
     case IProblem.MaskedCatch:
       return this.options.getSeverity(CompilerOptions.MaskedCatchBlock);
 
@@ -574,21 +583,27 @@ public class ProblemReporter extends ProblemHandler implements ProblemReasons {
   }
 
   public void deprecatedField(FieldBinding field, ASTNode location) {
-    this.handle(IProblem.UsingDeprecatedField, new String[] { new String(field.declaringClass.readableName()),
+    this.handle(IProblem.UsingDeprecatedField, new String[] {
+        new String(field.declaringClass.readableName()),
         new String(field.name) }, new String[] { new String(field.declaringClass.shortReadableName()), new String(field.name) },
         location.sourceStart, location.sourceEnd);
   }
 
   public void deprecatedMethod(MethodBinding method, ASTNode location) {
     if (method.isConstructor())
-      this.handle(IProblem.UsingDeprecatedConstructor, new String[] { new String(method.declaringClass.readableName()),
-          parametersAsString(method) }, new String[] { new String(method.declaringClass.shortReadableName()),
+      this.handle(IProblem.UsingDeprecatedConstructor, new String[] {
+          new String(method.declaringClass.readableName()),
+          parametersAsString(method) }, new String[] {
+          new String(method.declaringClass.shortReadableName()),
           parametersAsShortString(method) }, location.sourceStart, location.sourceEnd);
     else
-      this.handle(IProblem.UsingDeprecatedMethod, new String[] { new String(method.declaringClass.readableName()),
-          new String(method.selector), parametersAsString(method) }, new String[] {
-          new String(method.declaringClass.shortReadableName()), new String(method.selector), parametersAsShortString(method) },
-          location.sourceStart, location.sourceEnd);
+      this.handle(IProblem.UsingDeprecatedMethod, new String[] {
+          new String(method.declaringClass.readableName()),
+          new String(method.selector),
+          parametersAsString(method) }, new String[] {
+          new String(method.declaringClass.shortReadableName()),
+          new String(method.selector),
+          parametersAsShortString(method) }, location.sourceStart, location.sourceEnd);
   }
 
   public void deprecatedType(TypeBinding type, ASTNode location) {
@@ -609,7 +624,8 @@ public class ProblemReporter extends ProblemHandler implements ProblemReasons {
 
   public void duplicateFieldInType(SourceTypeBinding type, FieldDeclaration fieldDecl) {
     this.handle(IProblem.DuplicateField, new String[] { new String(type.sourceName()), fieldDecl.name() }, new String[] {
-        new String(type.shortReadableName()), fieldDecl.name() }, fieldDecl.sourceStart, fieldDecl.sourceEnd);
+        new String(type.shortReadableName()),
+        fieldDecl.name() }, fieldDecl.sourceStart, fieldDecl.sourceEnd);
   }
 
   //  public void duplicateImport(ImportReference importRef) {
@@ -644,7 +660,8 @@ public class ProblemReporter extends ProblemHandler implements ProblemReasons {
   public void duplicateModifierForMethod(ReferenceBinding type, AbstractMethodDeclaration methodDecl) {
     this.handle(IProblem.DuplicateModifierForMethod,
         new String[] { new String(type.sourceName()), new String(methodDecl.selector) }, new String[] {
-            new String(type.shortReadableName()), new String(methodDecl.selector) }, methodDecl.sourceStart, methodDecl.sourceEnd);
+            new String(type.shortReadableName()),
+            new String(methodDecl.selector) }, methodDecl.sourceStart, methodDecl.sourceEnd);
   }
 
   public void duplicateModifierForType(SourceTypeBinding type) {
@@ -664,7 +681,8 @@ public class ProblemReporter extends ProblemHandler implements ProblemReasons {
   }
 
   public void duplicateSuperinterface(SourceTypeBinding type, TypeDeclaration typeDecl, ReferenceBinding superType) {
-    this.handle(IProblem.DuplicateSuperInterface, new String[] { new String(superType.readableName()),
+    this.handle(IProblem.DuplicateSuperInterface, new String[] {
+        new String(superType.readableName()),
         new String(type.sourceName()) }, new String[] { new String(superType.shortReadableName()), new String(type.sourceName()) },
         typeDecl.sourceStart, typeDecl.sourceEnd);
   }
@@ -690,9 +708,12 @@ public class ProblemReporter extends ProblemHandler implements ProblemReasons {
       shortBuffer.append(new String(params[i].shortReadableName()));
     }
     this.handle(recType.isArrayType() ? IProblem.NoMessageSendOnArrayType : IProblem.NoMessageSendOnBaseType, new String[] {
-        new String(recType.readableName()), new String(messageSend.selector), buffer.toString() }, new String[] {
-        new String(recType.shortReadableName()), new String(messageSend.selector), shortBuffer.toString() },
-        messageSend.sourceStart, messageSend.sourceEnd);
+        new String(recType.readableName()),
+        new String(messageSend.selector),
+        buffer.toString() }, new String[] {
+        new String(recType.shortReadableName()),
+        new String(messageSend.selector),
+        shortBuffer.toString() }, messageSend.sourceStart, messageSend.sourceEnd);
   }
 
   public void errorThisSuperInStatic(ASTNode reference) {
@@ -733,8 +754,8 @@ public class ProblemReporter extends ProblemHandler implements ProblemReasons {
       return;
     }
     this.handle(id, new String[] { new String(methodDecl.selector), new String(expectedType.readableName()) }, new String[] {
-        new String(methodDecl.selector), new String(expectedType.shortReadableName()) }, exceptionType.sourceStart,
-        exceptionType.sourceEnd);
+        new String(methodDecl.selector),
+        new String(expectedType.shortReadableName()) }, exceptionType.sourceStart, exceptionType.sourceEnd);
   }
 
   public void expressionShouldBeAVariable(Expression expression) {
@@ -856,7 +877,8 @@ public class ProblemReporter extends ProblemHandler implements ProblemReasons {
           new String[] { new String(sourceType.sourceName()), shortTypeName }, start, end);
     else
       this.handle(IProblem.HierarchyCircularity, new String[] { new String(sourceType.sourceName()), typeName }, new String[] {
-          new String(sourceType.sourceName()), shortTypeName }, start, end);
+          new String(sourceType.sourceName()),
+          shortTypeName }, start, end);
   }
 
   public void hierarchyHasProblems(SourceTypeBinding type) {
@@ -1091,8 +1113,10 @@ public class ProblemReporter extends ProblemHandler implements ProblemReasons {
     shortSignature.append(concreteMethod.declaringClass.shortReadableName()).append('.').append(concreteMethod.shortReadableName());
     this.handle(
     // The inherited method %1 cannot hide the public abstract method in %2
-        IProblem.InheritedMethodReducesVisibility, new String[] { new String(concreteSignature.toString()),
-            new String(abstractMethods[0].declaringClass.readableName()) }, new String[] { new String(shortSignature.toString()),
+        IProblem.InheritedMethodReducesVisibility, new String[] {
+            new String(concreteSignature.toString()),
+            new String(abstractMethods[0].declaringClass.readableName()) }, new String[] {
+            new String(shortSignature.toString()),
             new String(abstractMethods[0].declaringClass.shortReadableName()) }, type.sourceStart(), type.sourceEnd());
   }
 
@@ -1181,8 +1205,10 @@ public class ProblemReporter extends ProblemHandler implements ProblemReasons {
       // here...
       break;
     }
-    this.handle(flag, new String[] { new String(targetConstructor.declaringClass.readableName()),
-        parametersAsString(targetConstructor) }, new String[] { new String(targetConstructor.declaringClass.shortReadableName()),
+    this.handle(flag, new String[] {
+        new String(targetConstructor.declaringClass.readableName()),
+        parametersAsString(targetConstructor) }, new String[] {
+        new String(targetConstructor.declaringClass.shortReadableName()),
         parametersAsShortString(targetConstructor) }, statement.sourceStart, statement.sourceEnd);
   }
 
@@ -1315,11 +1341,13 @@ public class ProblemReporter extends ProblemHandler implements ProblemReasons {
     //NotVisibleField
     //AmbiguousField
     if (searchedType.isBaseType()) {
-      this.handle(IProblem.NoFieldOnBaseType, new String[] { new String(searchedType.readableName()),
-          CharOperation.toString(CharOperation.subarray(nameRef.tokens, 0, index)), new String(nameRef.tokens[index]) },
-          new String[] { new String(searchedType.sourceName()),
-              CharOperation.toString(CharOperation.subarray(nameRef.tokens, 0, index)), new String(nameRef.tokens[index]) },
-          nameRef.sourceStart, nameRef.sourceEnd);
+      this.handle(IProblem.NoFieldOnBaseType, new String[] {
+          new String(searchedType.readableName()),
+          CharOperation.toString(CharOperation.subarray(nameRef.tokens, 0, index)),
+          new String(nameRef.tokens[index]) }, new String[] {
+          new String(searchedType.sourceName()),
+          CharOperation.toString(CharOperation.subarray(nameRef.tokens, 0, index)),
+          new String(nameRef.tokens[index]) }, nameRef.sourceStart, nameRef.sourceEnd);
       return;
     }
     int flag = IProblem.UndefinedField;
@@ -1417,18 +1445,24 @@ public class ProblemReporter extends ProblemHandler implements ProblemReasons {
           parameterTypeShortNames = parameterTypeNames;
         }
         this.handle(IProblem.ParameterMismatch, new String[] {
-            new String(problemMethod.closestMatch.declaringClass.readableName()), new String(problemMethod.closestMatch.selector),
-            closestParameterTypeNames, parameterTypeNames }, new String[] {
+            new String(problemMethod.closestMatch.declaringClass.readableName()),
+            new String(problemMethod.closestMatch.selector),
+            closestParameterTypeNames,
+            parameterTypeNames }, new String[] {
             new String(problemMethod.closestMatch.declaringClass.shortReadableName()),
-            new String(problemMethod.closestMatch.selector), closestParameterTypeShortNames, parameterTypeShortNames },
-            (int) (messageSend.nameSourcePosition >>> 32), (int) messageSend.nameSourcePosition);
+            new String(problemMethod.closestMatch.selector),
+            closestParameterTypeShortNames,
+            parameterTypeShortNames }, (int) (messageSend.nameSourcePosition >>> 32), (int) messageSend.nameSourcePosition);
         return;
       }
     }
-    this.handle(flag, new String[] { new String(method.declaringClass.readableName()), new String(method.selector),
-        parametersAsString(method) }, new String[] { new String(method.declaringClass.shortReadableName()),
-        new String(method.selector), parametersAsShortString(method) }, (int) (messageSend.nameSourcePosition >>> 32),
-        (int) messageSend.nameSourcePosition);
+    this.handle(flag, new String[] {
+        new String(method.declaringClass.readableName()),
+        new String(method.selector),
+        parametersAsString(method) }, new String[] {
+        new String(method.declaringClass.shortReadableName()),
+        new String(method.selector),
+        parametersAsShortString(method) }, (int) (messageSend.nameSourcePosition >>> 32), (int) messageSend.nameSourcePosition);
   }
 
   public void invalidNullToSynchronize(Expression expression) {
@@ -1505,8 +1539,8 @@ public class ProblemReporter extends ProblemHandler implements ProblemReasons {
       return;
     }
     this.handle(id, new String[] { new String(expectedType.readableName()), new String(type.sourceName()) }, new String[] {
-        new String(expectedType.shortReadableName()), new String(type.sourceName()) }, superclassRef.sourceStart,
-        superclassRef.sourceEnd);
+        new String(expectedType.shortReadableName()),
+        new String(type.sourceName()) }, superclassRef.sourceStart, superclassRef.sourceEnd);
   }
 
   public void invalidSuperinterface(SourceTypeBinding type, TypeReference superinterfaceRef, ReferenceBinding expectedType) {
@@ -1541,8 +1575,8 @@ public class ProblemReporter extends ProblemHandler implements ProblemReasons {
       return;
     }
     this.handle(id, new String[] { new String(expectedType.readableName()), new String(type.sourceName()) }, new String[] {
-        new String(expectedType.shortReadableName()), new String(type.sourceName()) }, superinterfaceRef.sourceStart,
-        superinterfaceRef.sourceEnd);
+        new String(expectedType.shortReadableName()),
+        new String(type.sourceName()) }, superinterfaceRef.sourceStart, superinterfaceRef.sourceEnd);
   }
 
   public void invalidType(ASTNode location, TypeBinding type) {
@@ -1594,402 +1628,402 @@ public class ProblemReporter extends ProblemHandler implements ProblemReasons {
         : compUnitDecl.sourceStart, compUnitDecl == null ? 1 : compUnitDecl.sourceEnd);
   }
 
-  public void javadocDuplicatedReturnTag(int sourceStart, int sourceEnd){
-       this.handle(IProblem.JavadocDuplicateReturnTag, NoArgument, NoArgument, sourceStart, sourceEnd);
-}
-public void javadocDeprecatedField(FieldBinding field, ASTNode location, int modifiers) {
-       if (javadocVisibility(this.options.reportInvalidJavadocTagsVisibility, modifiers)) {
-               this.handle(
-                       IProblem.JavadocUsingDeprecatedField,
-                       new String[] {new String(field.declaringClass.readableName()), new String(field.name)},
-                       new String[] {new String(field.declaringClass.shortReadableName()), new String(field.name)},
-                       location.sourceStart,
-                       location.sourceEnd);
-       }
-}
-public void javadocDeprecatedMethod(MethodBinding method, ASTNode location, int modifiers) {
-       if (javadocVisibility(this.options.reportInvalidJavadocTagsVisibility, modifiers)) {
-               if (method.isConstructor()) {
-                       this.handle(
-                               IProblem.JavadocUsingDeprecatedConstructor,
-                               new String[] {new String(method.declaringClass.readableName()), parametersAsString(method)},
-                               new String[] {new String(method.declaringClass.shortReadableName()), parametersAsShortString(method)},
-                               location.sourceStart,
-                               location.sourceEnd);
-               } else {
-                       this.handle(
-                               IProblem.JavadocUsingDeprecatedMethod,
-                               new String[] {new String(method.declaringClass.readableName()), new String(method.selector), parametersAsString(method)},
-                               new String[] {new String(method.declaringClass.shortReadableName()), new String(method.selector), parametersAsShortString(method)},
-                               location.sourceStart,
-                               location.sourceEnd);
-               }
-       }
-}
-public void javadocDeprecatedType(TypeBinding type, ASTNode location, int modifiers) {
-       if (location == null) return; // 1G828DN - no type ref for synthetic arguments
-       if (javadocVisibility(this.options.reportInvalidJavadocTagsVisibility, modifiers)) {
-               this.handle(
-                       IProblem.JavadocUsingDeprecatedType,
-                       new String[] {new String(type.readableName())},
-                       new String[] {new String(type.shortReadableName())},
-                       location.sourceStart,
-                       location.sourceEnd);
-       }
-}
-//public void javadocDuplicatedParamTag(JavadocSingleNameReference param, int modifiers) {
-//     if (javadocVisibility(this.options.reportInvalidJavadocTagsVisibility, modifiers)) {
-//             String[] arguments = new String[] {String.valueOf(param.token)};
-//             this.handle(IProblem.JavadocDuplicateParamName, arguments, arguments, param.sourceStart, param.sourceEnd);
-//     }
-//}
-public void javadocDuplicatedThrowsClassName(TypeReference typeReference, int modifiers) {
-       if (javadocVisibility(this.options.reportInvalidJavadocTagsVisibility, modifiers)) {
-               String[] arguments = new String[] {String.valueOf(typeReference.resolvedType.sourceName())};
-               this.handle(IProblem.JavadocDuplicateThrowsClassName, arguments, arguments, typeReference.sourceStart, typeReference.sourceEnd);
-       }
-}
-public void javadocErrorNoMethodFor(MessageSend messageSend, TypeBinding recType, TypeBinding[] params, int modifiers) {
-       StringBuffer buffer = new StringBuffer();
-       StringBuffer shortBuffer = new StringBuffer();
-       for (int i = 0, length = params.length; i < length; i++) {
-               if (i != 0){
-                       buffer.append(", "); //$NON-NLS-1$
-                       shortBuffer.append(", "); //$NON-NLS-1$
-               }
-               buffer.append(new String(params[i].readableName()));
-               shortBuffer.append(new String(params[i].shortReadableName()));
-       }
-
-       int id = recType.isArrayType() ? IProblem.JavadocNoMessageSendOnArrayType : IProblem.JavadocNoMessageSendOnBaseType;
-       if (javadocVisibility(this.options.reportInvalidJavadocTagsVisibility, modifiers)) {
-               this.handle(
-                       id,
-                       new String[] {new String(recType.readableName()), new String(messageSend.selector), buffer.toString()},
-                       new String[] {new String(recType.shortReadableName()), new String(messageSend.selector), shortBuffer.toString()},
-                       messageSend.sourceStart,
-                       messageSend.sourceEnd);
-       }
-}
-public void javadocInvalidConstructor(Statement statement, MethodBinding targetConstructor, int modifiers) {
-
-       if (!javadocVisibility(this.options.reportInvalidJavadocTagsVisibility, modifiers)) {
-               return;
-       }
-//     boolean insideDefaultConstructor = 
-//             (this.referenceContext instanceof ConstructorDeclaration)
-//                     && ((ConstructorDeclaration)this.referenceContext).isDefaultConstructor();
-//     boolean insideImplicitConstructorCall =
-//             (statement instanceof ExplicitConstructorCall)
-//                     && (((ExplicitConstructorCall) statement).accessMode == ExplicitConstructorCall.ImplicitSuper);
-
-       int id = IProblem.JavadocUndefinedConstructor; //default...
-       switch (targetConstructor.problemId()) {
-               case NotFound :
-//                     if (insideDefaultConstructor){
-//                             id = IProblem.JavadocUndefinedConstructorInDefaultConstructor;
-//                     } else if (insideImplicitConstructorCall){
-//                             id = IProblem.JavadocUndefinedConstructorInImplicitConstructorCall;
-//                     } else {
-                               id = IProblem.JavadocUndefinedConstructor;
-//                     }
-                       break;
-               case NotVisible :
-//                     if (insideDefaultConstructor){
-//                             id = IProblem.JavadocNotVisibleConstructorInDefaultConstructor;
-//                     } else if (insideImplicitConstructorCall){
-//                             id = IProblem.JavadocNotVisibleConstructorInImplicitConstructorCall;
-//                     } else {
-                               id = IProblem.JavadocNotVisibleConstructor;
-//                     }
-                       break;
-               case Ambiguous :
-//                     if (insideDefaultConstructor){
-//                             id = IProblem.AmbiguousConstructorInDefaultConstructor;
-//                     } else if (insideImplicitConstructorCall){
-//                             id = IProblem.AmbiguousConstructorInImplicitConstructorCall;
-//                     } else {
-                               id = IProblem.JavadocAmbiguousConstructor;
-//                     }
-                       break;
-               case NoError : // 0
-               default :
-                       needImplementation(); // want to fail to see why we were here...
-                       break;
-       }
-
-       this.handle(
-               id,
-               new String[] {new String(targetConstructor.declaringClass.readableName()), parametersAsString(targetConstructor)},
-               new String[] {new String(targetConstructor.declaringClass.shortReadableName()), parametersAsShortString(targetConstructor)},
-               statement.sourceStart,
-               statement.sourceEnd);
-}
-public void javadocAmbiguousMethodReference(int sourceStart, int sourceEnd, Binding fieldBinding, int modifiers) {
-       int id = IProblem.JavadocAmbiguousMethodReference;
-       if (javadocVisibility(this.options.reportInvalidJavadocTagsVisibility, modifiers)) {
-               String[] arguments = new String[] {new String(fieldBinding.readableName())};
-               handle(id, arguments, arguments, sourceStart, sourceEnd);
-       }
-}
-/*
- * Similar implementation than invalidField(FieldReference...)
- * Note that following problem id cannot occur for Javadoc:
- *     - NonStaticReferenceInStaticContext :
- *     - NonStaticReferenceInConstructorInvocation :
- *     - ReceiverTypeNotVisible :
- */
-public void javadocInvalidField(int sourceStart, int sourceEnd, Binding fieldBinding, TypeBinding searchedType, int modifiers) {
-       int id = IProblem.JavadocUndefinedField;
-       switch (fieldBinding.problemId()) {
-               case NotFound :
-                       id = IProblem.JavadocUndefinedField;
-                       break;
-               case NotVisible :
-                       id = IProblem.JavadocNotVisibleField;
-                       break;
-               case Ambiguous :
-                       id = IProblem.JavadocAmbiguousField;
-                       break;
-               case InheritedNameHidesEnclosingName :
-                       id = IProblem.JavadocInheritedFieldHidesEnclosingName;
-                       break;
-               case NoError : // 0
-               default :
-                       needImplementation(); // want to fail to see why we were here...
-                       break;
-       }
-
-       if (javadocVisibility(this.options.reportInvalidJavadocTagsVisibility, modifiers)) {
-               String[] arguments = new String[] {new String(fieldBinding.readableName())};
-               handle(id, arguments, arguments, sourceStart, sourceEnd);
-       }
-}
-/*
- * Similar implementation than invalidMethod(MessageSend...)
- * Note that following problem id cannot occur for Javadoc:
- *     - NonStaticReferenceInStaticContext :
- *     - NonStaticReferenceInConstructorInvocation :
- *     - ReceiverTypeNotVisible :
- */
-public void javadocInvalidMethod(MessageSend messageSend, MethodBinding method, int modifiers) {
-       if (!javadocVisibility(this.options.reportInvalidJavadocTagsVisibility, modifiers)) {
-               return;
-       }
-       int id = IProblem.JavadocUndefinedMethod; //default...
-       switch (method.problemId()) {
-               case NotFound :
-                       id = IProblem.JavadocUndefinedMethod;
-                       break;
-               case NotVisible :
-                       id = IProblem.JavadocNotVisibleMethod;
-                       break;
-               case Ambiguous :
-                       id = IProblem.JavadocAmbiguousMethod;
-                       break;
-               case InheritedNameHidesEnclosingName :
-                       id = IProblem.JavadocInheritedMethodHidesEnclosingName;
-                       break;
-               case NoError : // 0
-               default :
-                       needImplementation(); // want to fail to see why we were here...
-                       break;
-       }
-
-       if (id == IProblem.JavadocUndefinedMethod) {
-               ProblemMethodBinding problemMethod = (ProblemMethodBinding) method;
-               if (problemMethod.closestMatch != null) {
-                               String closestParameterTypeNames = parametersAsString(problemMethod.closestMatch);
-                               String parameterTypeNames = parametersAsString(method);
-                               String closestParameterTypeShortNames = parametersAsShortString(problemMethod.closestMatch);
-                               String parameterTypeShortNames = parametersAsShortString(method);
-                               if (closestParameterTypeShortNames.equals(parameterTypeShortNames)){
-                                       closestParameterTypeShortNames = closestParameterTypeNames;
-                                       parameterTypeShortNames = parameterTypeNames;
-                               }
-                               this.handle(
-                                       IProblem.JavadocParameterMismatch,
-                                       new String[] {
-                                               new String(problemMethod.closestMatch.declaringClass.readableName()),
-                                               new String(problemMethod.closestMatch.selector),
-                                               closestParameterTypeNames,
-                                               parameterTypeNames 
-                                       },
-                                       new String[] {
-                                               new String(problemMethod.closestMatch.declaringClass.shortReadableName()),
-                                               new String(problemMethod.closestMatch.selector),
-                                               closestParameterTypeShortNames,
-                                               parameterTypeShortNames
-                                       },
-                                       (int) (messageSend.nameSourcePosition >>> 32),
-                                       (int) messageSend.nameSourcePosition);
-                               return;
-               }
-       }
-
-       this.handle(
-               id,
-               new String[] {
-                       new String(method.declaringClass.readableName()),
-                       new String(method.selector), parametersAsString(method)},
-               new String[] {
-                       new String(method.declaringClass.shortReadableName()),
-                       new String(method.selector), parametersAsShortString(method)},
-               (int) (messageSend.nameSourcePosition >>> 32),
-               (int) messageSend.nameSourcePosition);
-}
-//public void javadocInvalidParamName(JavadocSingleNameReference param, int modifiers) {
-//     if (javadocVisibility(this.options.reportInvalidJavadocTagsVisibility, modifiers)) {
-//             String[] arguments = new String[] {String.valueOf(param.token)};
-//             this.handle(IProblem.JavadocInvalidParamName, arguments, arguments, param.sourceStart, param.sourceEnd);
-//     }
-//}
-public void javadocInvalidSeeReference(int sourceStart, int sourceEnd) {
-       this.handle(IProblem.JavadocInvalidSeeReference, NoArgument, NoArgument, sourceStart, sourceEnd);
-}
-public void javadocInvalidSeeReferenceArgs(int sourceStart, int sourceEnd) {
-       this.handle(IProblem.JavadocInvalidSeeArgs, NoArgument, NoArgument, sourceStart, sourceEnd);
-}
-public void javadocInvalidSeeUrlReference(int sourceStart, int sourceEnd) {
-       this.handle(IProblem.JavadocInvalidSeeHref, NoArgument, NoArgument, sourceStart, sourceEnd);
-}
-public void javadocInvalidTag(int sourceStart, int sourceEnd) {
-       this.handle(IProblem.JavadocInvalidTag, NoArgument, NoArgument, sourceStart, sourceEnd);
-}
-public void javadocInvalidThrowsClass(int sourceStart, int sourceEnd) {
-       this.handle(IProblem.JavadocInvalidThrowsClass, NoArgument, NoArgument, sourceStart, sourceEnd);
-}
-public void javadocInvalidThrowsClassName(TypeReference typeReference, int modifiers) {
-       if (javadocVisibility(this.options.reportInvalidJavadocTagsVisibility, modifiers)) {
-               String[] arguments = new String[] {String.valueOf(typeReference.resolvedType.sourceName())};
-               this.handle(IProblem.JavadocInvalidThrowsClassName, arguments, arguments, typeReference.sourceStart, typeReference.sourceEnd);
-       }
-}
-public void javadocInvalidType(ASTNode location, TypeBinding type, int modifiers) {
-       if (javadocVisibility(this.options.reportInvalidJavadocTagsVisibility, modifiers)) {
-               int id = IProblem.JavadocUndefinedType; // default
-               switch (type.problemId()) {
-                       case NotFound :
-                               id = IProblem.JavadocUndefinedType;
-                               break;
-                       case NotVisible :
-                               id = IProblem.JavadocNotVisibleType;
-                               break;
-                       case Ambiguous :
-                               id = IProblem.JavadocAmbiguousType;
-                               break;
-                       case InternalNameProvided :
-                               id = IProblem.JavadocInternalTypeNameProvided;
-                               break;
-                       case InheritedNameHidesEnclosingName :
-                               id = IProblem.JavadocInheritedNameHidesEnclosingTypeName;
-                               break;
-                       case NoError : // 0
-                       default :
-                               needImplementation(); // want to fail to see why we were here...
-                               break;
-               }
-               this.handle(
-                       id,
-                       new String[] {new String(type.readableName())},
-                       new String[] {new String(type.shortReadableName())},
-                       location.sourceStart,
-                       location.sourceEnd);
-       }
-}
-public void javadocMalformedSeeReference(int sourceStart, int sourceEnd) {
-       this.handle(IProblem.JavadocMalformedSeeReference, NoArgument, NoArgument, sourceStart, sourceEnd);
-}
-public void javadocMissing(int sourceStart, int sourceEnd, int modifiers){
-       boolean overriding = (modifiers & (CompilerModifiers.AccImplementing+CompilerModifiers.AccOverriding)) != 0;
-       boolean report = (this.options.getSeverity(CompilerOptions.MissingJavadocComments) != ProblemSeverities.Ignore)
-                                       && (!overriding || this.options.reportMissingJavadocCommentsOverriding);
-       if (report) {
-               String arg = javadocVisibilityArgument(this.options.reportMissingJavadocCommentsVisibility, modifiers);
-               if (arg != null) {
-                       String[] arguments = new String[] { arg };
-                       this.handle(IProblem.JavadocMissing, arguments, arguments, sourceStart, sourceEnd);
-               }
-       }
-}
-public void javadocMissingParamName(int sourceStart, int sourceEnd){
-       this.handle(IProblem.JavadocMissingParamName, NoArgument, NoArgument, sourceStart, sourceEnd);
-}
-public void javadocMissingParamTag(Argument param, int modifiers) {
-       boolean overriding = (modifiers & (CompilerModifiers.AccImplementing+CompilerModifiers.AccOverriding)) != 0;
-       boolean report = (this.options.getSeverity(CompilerOptions.MissingJavadocTags) != ProblemSeverities.Ignore)
-                                       && (!overriding || this.options.reportMissingJavadocTagsOverriding);
-       if (report && javadocVisibility(this.options.reportMissingJavadocTagsVisibility, modifiers)) {
-               String[] arguments = new String[] { String.valueOf(param.name) };
-               this.handle(IProblem.JavadocMissingParamTag, arguments, arguments, param.sourceStart, param.sourceEnd);
-       }
-}
-public void javadocMissingReturnTag(int sourceStart, int sourceEnd, int modifiers){
-       boolean overriding = (modifiers & (CompilerModifiers.AccImplementing+CompilerModifiers.AccOverriding)) != 0;
-       boolean report = (this.options.getSeverity(CompilerOptions.MissingJavadocTags) != ProblemSeverities.Ignore)
-                                       && (!overriding || this.options.reportMissingJavadocTagsOverriding);
-       if (report && javadocVisibility(this.options.reportMissingJavadocTagsVisibility, modifiers)) {
-               this.handle(IProblem.JavadocMissingReturnTag, NoArgument, NoArgument, sourceStart, sourceEnd);
-       }
-}
-public void javadocMissingSeeReference(int sourceStart, int sourceEnd){
-       this.handle(IProblem.JavadocMissingSeeReference, NoArgument, NoArgument, sourceStart, sourceEnd);
-}
-public void javadocMissingThrowsClassName(int sourceStart, int sourceEnd){
-       this.handle(IProblem.JavadocMissingThrowsClassName, NoArgument, NoArgument, sourceStart, sourceEnd);
-}
-public void javadocMissingThrowsTag(TypeReference typeRef, int modifiers){
-       boolean overriding = (modifiers & (CompilerModifiers.AccImplementing+CompilerModifiers.AccOverriding)) != 0;
-       boolean report = (this.options.getSeverity(CompilerOptions.MissingJavadocTags) != ProblemSeverities.Ignore)
-                                       && (!overriding || this.options.reportMissingJavadocTagsOverriding);
-       if (report && javadocVisibility(this.options.reportMissingJavadocTagsVisibility, modifiers)) {
-               String[] arguments = new String[] { String.valueOf(typeRef.resolvedType.sourceName()) };
-               this.handle(IProblem.JavadocMissingThrowsTag, arguments, arguments, typeRef.sourceStart, typeRef.sourceEnd);
-       }
-}
-public void javadocUnexpectedTag(int sourceStart, int sourceEnd) {
-       this.handle(IProblem.JavadocUnexpectedTag, NoArgument, NoArgument, sourceStart, sourceEnd);
-}
-public void javadocUnterminatedInlineTag(int sourceStart, int sourceEnd) {
-       this.handle(IProblem.JavadocUnterminatedInlineTag, NoArgument, NoArgument, sourceStart, sourceEnd);
-}
-private boolean javadocVisibility(int visibility, int modifiers) {
-       switch (modifiers & CompilerModifiers.AccVisibilityMASK) {
-               case IConstants.AccPublic :
-                       return true;
-               case IConstants.AccProtected:
-                       return (visibility != IConstants.AccPublic);
-//             case IConstants.AccDefault:
-//                     return (visibility == IConstants.AccDefault || visibility == IConstants.AccPrivate);
-               case IConstants.AccPrivate:
-                       return (visibility == IConstants.AccPrivate);
-       }
-       return true;
-}
-private String javadocVisibilityArgument(int visibility, int modifiers) {
-       String argument = null;
-       switch (modifiers & CompilerModifiers.AccVisibilityMASK) {
-               case IConstants.AccPublic :
-                       argument = CompilerOptions.PUBLIC;
-                       break;
-               case IConstants.AccProtected:
-                       if (visibility != IConstants.AccPublic) {
-                               argument = CompilerOptions.PROTECTED;
-                       }
-                       break;
-//             case IConstants.AccDefault:
-//                     if (visibility == IConstants.AccDefault || visibility == IConstants.AccPrivate) {
-//                             argument = CompilerOptions.DEFAULT;
-//                     }
-//                     break;
-               case IConstants.AccPrivate:
-                       if (visibility == IConstants.AccPrivate) {
-                               argument = CompilerOptions.PRIVATE;
-                       }
-                       break;
-       }
-       return argument;
-}
+  public void javadocDuplicatedReturnTag(int sourceStart, int sourceEnd) {
+    this.handle(IProblem.JavadocDuplicateReturnTag, NoArgument, NoArgument, sourceStart, sourceEnd);
+  }
+
+  public void javadocDeprecatedField(FieldBinding field, ASTNode location, int modifiers) {
+    if (javadocVisibility(this.options.reportInvalidJavadocTagsVisibility, modifiers)) {
+      this.handle(IProblem.JavadocUsingDeprecatedField, new String[] {
+          new String(field.declaringClass.readableName()),
+          new String(field.name) }, new String[] { new String(field.declaringClass.shortReadableName()), new String(field.name) },
+          location.sourceStart, location.sourceEnd);
+    }
+  }
+
+  public void javadocDeprecatedMethod(MethodBinding method, ASTNode location, int modifiers) {
+    if (javadocVisibility(this.options.reportInvalidJavadocTagsVisibility, modifiers)) {
+      if (method.isConstructor()) {
+        this.handle(IProblem.JavadocUsingDeprecatedConstructor, new String[] {
+            new String(method.declaringClass.readableName()),
+            parametersAsString(method) }, new String[] {
+            new String(method.declaringClass.shortReadableName()),
+            parametersAsShortString(method) }, location.sourceStart, location.sourceEnd);
+      } else {
+        this.handle(IProblem.JavadocUsingDeprecatedMethod, new String[] {
+            new String(method.declaringClass.readableName()),
+            new String(method.selector),
+            parametersAsString(method) }, new String[] {
+            new String(method.declaringClass.shortReadableName()),
+            new String(method.selector),
+            parametersAsShortString(method) }, location.sourceStart, location.sourceEnd);
+      }
+    }
+  }
+
+  public void javadocDeprecatedType(TypeBinding type, ASTNode location, int modifiers) {
+    if (location == null)
+      return; // 1G828DN - no type ref for synthetic arguments
+    if (javadocVisibility(this.options.reportInvalidJavadocTagsVisibility, modifiers)) {
+      this.handle(IProblem.JavadocUsingDeprecatedType, new String[] { new String(type.readableName()) }, new String[] { new String(
+          type.shortReadableName()) }, location.sourceStart, location.sourceEnd);
+    }
+  }
+
+  //public void javadocDuplicatedParamTag(JavadocSingleNameReference param, int modifiers) {
+  //   if (javadocVisibility(this.options.reportInvalidJavadocTagsVisibility, modifiers)) {
+  //           String[] arguments = new String[] {String.valueOf(param.token)};
+  //           this.handle(IProblem.JavadocDuplicateParamName, arguments, arguments, param.sourceStart, param.sourceEnd);
+  //   }
+  //}
+  public void javadocDuplicatedThrowsClassName(TypeReference typeReference, int modifiers) {
+    if (javadocVisibility(this.options.reportInvalidJavadocTagsVisibility, modifiers)) {
+      String[] arguments = new String[] { String.valueOf(typeReference.resolvedType.sourceName()) };
+      this.handle(IProblem.JavadocDuplicateThrowsClassName, arguments, arguments, typeReference.sourceStart,
+          typeReference.sourceEnd);
+    }
+  }
+
+  public void javadocErrorNoMethodFor(MessageSend messageSend, TypeBinding recType, TypeBinding[] params, int modifiers) {
+    StringBuffer buffer = new StringBuffer();
+    StringBuffer shortBuffer = new StringBuffer();
+    for (int i = 0, length = params.length; i < length; i++) {
+      if (i != 0) {
+        buffer.append(", "); //$NON-NLS-1$
+        shortBuffer.append(", "); //$NON-NLS-1$
+      }
+      buffer.append(new String(params[i].readableName()));
+      shortBuffer.append(new String(params[i].shortReadableName()));
+    }
+
+    int id = recType.isArrayType() ? IProblem.JavadocNoMessageSendOnArrayType : IProblem.JavadocNoMessageSendOnBaseType;
+    if (javadocVisibility(this.options.reportInvalidJavadocTagsVisibility, modifiers)) {
+      this.handle(id, new String[] { new String(recType.readableName()), new String(messageSend.selector), buffer.toString() },
+          new String[] { new String(recType.shortReadableName()), new String(messageSend.selector), shortBuffer.toString() },
+          messageSend.sourceStart, messageSend.sourceEnd);
+    }
+  }
+
+  public void javadocInvalidConstructor(Statement statement, MethodBinding targetConstructor, int modifiers) {
+
+    if (!javadocVisibility(this.options.reportInvalidJavadocTagsVisibility, modifiers)) {
+      return;
+    }
+    // boolean insideDefaultConstructor =
+    //         (this.referenceContext instanceof ConstructorDeclaration)
+    //                 && ((ConstructorDeclaration)this.referenceContext).isDefaultConstructor();
+    // boolean insideImplicitConstructorCall =
+    //         (statement instanceof ExplicitConstructorCall)
+    //                 && (((ExplicitConstructorCall) statement).accessMode == ExplicitConstructorCall.ImplicitSuper);
+
+    int id = IProblem.JavadocUndefinedConstructor; //default...
+    switch (targetConstructor.problemId()) {
+    case NotFound:
+      //                       if (insideDefaultConstructor){
+      //                               id = IProblem.JavadocUndefinedConstructorInDefaultConstructor;
+      //                       } else if (insideImplicitConstructorCall){
+      //                               id = IProblem.JavadocUndefinedConstructorInImplicitConstructorCall;
+      //                       } else {
+      id = IProblem.JavadocUndefinedConstructor;
+      //                       }
+      break;
+    case NotVisible:
+      //                       if (insideDefaultConstructor){
+      //                               id = IProblem.JavadocNotVisibleConstructorInDefaultConstructor;
+      //                       } else if (insideImplicitConstructorCall){
+      //                               id = IProblem.JavadocNotVisibleConstructorInImplicitConstructorCall;
+      //                       } else {
+      id = IProblem.JavadocNotVisibleConstructor;
+      //                       }
+      break;
+    case Ambiguous:
+      //                       if (insideDefaultConstructor){
+      //                               id = IProblem.AmbiguousConstructorInDefaultConstructor;
+      //                       } else if (insideImplicitConstructorCall){
+      //                               id = IProblem.AmbiguousConstructorInImplicitConstructorCall;
+      //                       } else {
+      id = IProblem.JavadocAmbiguousConstructor;
+      //                       }
+      break;
+    case NoError: // 0
+    default:
+      needImplementation(); // want to fail to see why we were here...
+      break;
+    }
+
+    this.handle(id, new String[] {
+        new String(targetConstructor.declaringClass.readableName()),
+        parametersAsString(targetConstructor) }, new String[] {
+        new String(targetConstructor.declaringClass.shortReadableName()),
+        parametersAsShortString(targetConstructor) }, statement.sourceStart, statement.sourceEnd);
+  }
+
+  public void javadocAmbiguousMethodReference(int sourceStart, int sourceEnd, Binding fieldBinding, int modifiers) {
+    int id = IProblem.JavadocAmbiguousMethodReference;
+    if (javadocVisibility(this.options.reportInvalidJavadocTagsVisibility, modifiers)) {
+      String[] arguments = new String[] { new String(fieldBinding.readableName()) };
+      handle(id, arguments, arguments, sourceStart, sourceEnd);
+    }
+  }
+
+  /*
+   * Similar implementation than invalidField(FieldReference...) Note that following problem id cannot occur for Javadoc: -
+   * NonStaticReferenceInStaticContext : - NonStaticReferenceInConstructorInvocation : - ReceiverTypeNotVisible :
+   */
+  public void javadocInvalidField(int sourceStart, int sourceEnd, Binding fieldBinding, TypeBinding searchedType, int modifiers) {
+    int id = IProblem.JavadocUndefinedField;
+    switch (fieldBinding.problemId()) {
+    case NotFound:
+      id = IProblem.JavadocUndefinedField;
+      break;
+    case NotVisible:
+      id = IProblem.JavadocNotVisibleField;
+      break;
+    case Ambiguous:
+      id = IProblem.JavadocAmbiguousField;
+      break;
+    case InheritedNameHidesEnclosingName:
+      id = IProblem.JavadocInheritedFieldHidesEnclosingName;
+      break;
+    case NoError: // 0
+    default:
+      needImplementation(); // want to fail to see why we were here...
+      break;
+    }
+
+    if (javadocVisibility(this.options.reportInvalidJavadocTagsVisibility, modifiers)) {
+      String[] arguments = new String[] { new String(fieldBinding.readableName()) };
+      handle(id, arguments, arguments, sourceStart, sourceEnd);
+    }
+  }
+
+  /*
+   * Similar implementation than invalidMethod(MessageSend...) Note that following problem id cannot occur for Javadoc: -
+   * NonStaticReferenceInStaticContext : - NonStaticReferenceInConstructorInvocation : - ReceiverTypeNotVisible :
+   */
+  public void javadocInvalidMethod(MessageSend messageSend, MethodBinding method, int modifiers) {
+    if (!javadocVisibility(this.options.reportInvalidJavadocTagsVisibility, modifiers)) {
+      return;
+    }
+    int id = IProblem.JavadocUndefinedMethod; //default...
+    switch (method.problemId()) {
+    case NotFound:
+      id = IProblem.JavadocUndefinedMethod;
+      break;
+    case NotVisible:
+      id = IProblem.JavadocNotVisibleMethod;
+      break;
+    case Ambiguous:
+      id = IProblem.JavadocAmbiguousMethod;
+      break;
+    case InheritedNameHidesEnclosingName:
+      id = IProblem.JavadocInheritedMethodHidesEnclosingName;
+      break;
+    case NoError: // 0
+    default:
+      needImplementation(); // want to fail to see why we were here...
+      break;
+    }
+
+    if (id == IProblem.JavadocUndefinedMethod) {
+      ProblemMethodBinding problemMethod = (ProblemMethodBinding) method;
+      if (problemMethod.closestMatch != null) {
+        String closestParameterTypeNames = parametersAsString(problemMethod.closestMatch);
+        String parameterTypeNames = parametersAsString(method);
+        String closestParameterTypeShortNames = parametersAsShortString(problemMethod.closestMatch);
+        String parameterTypeShortNames = parametersAsShortString(method);
+        if (closestParameterTypeShortNames.equals(parameterTypeShortNames)) {
+          closestParameterTypeShortNames = closestParameterTypeNames;
+          parameterTypeShortNames = parameterTypeNames;
+        }
+        this.handle(IProblem.JavadocParameterMismatch, new String[] {
+            new String(problemMethod.closestMatch.declaringClass.readableName()),
+            new String(problemMethod.closestMatch.selector),
+            closestParameterTypeNames,
+            parameterTypeNames }, new String[] {
+            new String(problemMethod.closestMatch.declaringClass.shortReadableName()),
+            new String(problemMethod.closestMatch.selector),
+            closestParameterTypeShortNames,
+            parameterTypeShortNames }, (int) (messageSend.nameSourcePosition >>> 32), (int) messageSend.nameSourcePosition);
+        return;
+      }
+    }
+
+    this.handle(id, new String[] {
+        new String(method.declaringClass.readableName()),
+        new String(method.selector),
+        parametersAsString(method) }, new String[] {
+        new String(method.declaringClass.shortReadableName()),
+        new String(method.selector),
+        parametersAsShortString(method) }, (int) (messageSend.nameSourcePosition >>> 32), (int) messageSend.nameSourcePosition);
+  }
+
+  //public void javadocInvalidParamName(JavadocSingleNameReference param, int modifiers) {
+  //   if (javadocVisibility(this.options.reportInvalidJavadocTagsVisibility, modifiers)) {
+  //           String[] arguments = new String[] {String.valueOf(param.token)};
+  //           this.handle(IProblem.JavadocInvalidParamName, arguments, arguments, param.sourceStart, param.sourceEnd);
+  //   }
+  //}
+  public void javadocInvalidSeeReference(int sourceStart, int sourceEnd) {
+    this.handle(IProblem.JavadocInvalidSeeReference, NoArgument, NoArgument, sourceStart, sourceEnd);
+  }
+
+  public void javadocInvalidSeeReferenceArgs(int sourceStart, int sourceEnd) {
+    this.handle(IProblem.JavadocInvalidSeeArgs, NoArgument, NoArgument, sourceStart, sourceEnd);
+  }
+
+  public void javadocInvalidSeeUrlReference(int sourceStart, int sourceEnd) {
+    this.handle(IProblem.JavadocInvalidSeeHref, NoArgument, NoArgument, sourceStart, sourceEnd);
+  }
+
+  public void javadocInvalidTag(int sourceStart, int sourceEnd) {
+    this.handle(IProblem.JavadocInvalidTag, NoArgument, NoArgument, sourceStart, sourceEnd);
+  }
+
+  public void javadocInvalidThrowsClass(int sourceStart, int sourceEnd) {
+    this.handle(IProblem.JavadocInvalidThrowsClass, NoArgument, NoArgument, sourceStart, sourceEnd);
+  }
+
+  public void javadocInvalidThrowsClassName(TypeReference typeReference, int modifiers) {
+    if (javadocVisibility(this.options.reportInvalidJavadocTagsVisibility, modifiers)) {
+      String[] arguments = new String[] { String.valueOf(typeReference.resolvedType.sourceName()) };
+      this.handle(IProblem.JavadocInvalidThrowsClassName, arguments, arguments, typeReference.sourceStart, typeReference.sourceEnd);
+    }
+  }
+
+  public void javadocInvalidType(ASTNode location, TypeBinding type, int modifiers) {
+    if (javadocVisibility(this.options.reportInvalidJavadocTagsVisibility, modifiers)) {
+      int id = IProblem.JavadocUndefinedType; // default
+      switch (type.problemId()) {
+      case NotFound:
+        id = IProblem.JavadocUndefinedType;
+        break;
+      case NotVisible:
+        id = IProblem.JavadocNotVisibleType;
+        break;
+      case Ambiguous:
+        id = IProblem.JavadocAmbiguousType;
+        break;
+      case InternalNameProvided:
+        id = IProblem.JavadocInternalTypeNameProvided;
+        break;
+      case InheritedNameHidesEnclosingName:
+        id = IProblem.JavadocInheritedNameHidesEnclosingTypeName;
+        break;
+      case NoError: // 0
+      default:
+        needImplementation(); // want to fail to see why we were here...
+        break;
+      }
+      this.handle(id, new String[] { new String(type.readableName()) }, new String[] { new String(type.shortReadableName()) },
+          location.sourceStart, location.sourceEnd);
+    }
+  }
+
+  public void javadocMalformedSeeReference(int sourceStart, int sourceEnd) {
+    this.handle(IProblem.JavadocMalformedSeeReference, NoArgument, NoArgument, sourceStart, sourceEnd);
+  }
+
+  public void javadocMissing(int sourceStart, int sourceEnd, int modifiers) {
+    boolean overriding = (modifiers & (CompilerModifiers.AccImplementing + CompilerModifiers.AccOverriding)) != 0;
+    boolean report = (this.options.getSeverity(CompilerOptions.MissingJavadocComments) != ProblemSeverities.Ignore)
+        && (!overriding || this.options.reportMissingJavadocCommentsOverriding);
+    if (report) {
+      String arg = javadocVisibilityArgument(this.options.reportMissingJavadocCommentsVisibility, modifiers);
+      if (arg != null) {
+        String[] arguments = new String[] { arg };
+        this.handle(IProblem.JavadocMissing, arguments, arguments, sourceStart, sourceEnd);
+      }
+    }
+  }
+
+  public void javadocMissingParamName(int sourceStart, int sourceEnd) {
+    this.handle(IProblem.JavadocMissingParamName, NoArgument, NoArgument, sourceStart, sourceEnd);
+  }
+
+  public void javadocMissingParamTag(Argument param, int modifiers) {
+    boolean overriding = (modifiers & (CompilerModifiers.AccImplementing + CompilerModifiers.AccOverriding)) != 0;
+    boolean report = (this.options.getSeverity(CompilerOptions.MissingJavadocTags) != ProblemSeverities.Ignore)
+        && (!overriding || this.options.reportMissingJavadocTagsOverriding);
+    if (report && javadocVisibility(this.options.reportMissingJavadocTagsVisibility, modifiers)) {
+      String[] arguments = new String[] { String.valueOf(param.name) };
+      this.handle(IProblem.JavadocMissingParamTag, arguments, arguments, param.sourceStart, param.sourceEnd);
+    }
+  }
+
+  public void javadocMissingReturnTag(int sourceStart, int sourceEnd, int modifiers) {
+    boolean overriding = (modifiers & (CompilerModifiers.AccImplementing + CompilerModifiers.AccOverriding)) != 0;
+    boolean report = (this.options.getSeverity(CompilerOptions.MissingJavadocTags) != ProblemSeverities.Ignore)
+        && (!overriding || this.options.reportMissingJavadocTagsOverriding);
+    if (report && javadocVisibility(this.options.reportMissingJavadocTagsVisibility, modifiers)) {
+      this.handle(IProblem.JavadocMissingReturnTag, NoArgument, NoArgument, sourceStart, sourceEnd);
+    }
+  }
+
+  public void javadocMissingSeeReference(int sourceStart, int sourceEnd) {
+    this.handle(IProblem.JavadocMissingSeeReference, NoArgument, NoArgument, sourceStart, sourceEnd);
+  }
+
+  public void javadocMissingThrowsClassName(int sourceStart, int sourceEnd) {
+    this.handle(IProblem.JavadocMissingThrowsClassName, NoArgument, NoArgument, sourceStart, sourceEnd);
+  }
+
+  public void javadocMissingThrowsTag(TypeReference typeRef, int modifiers) {
+    boolean overriding = (modifiers & (CompilerModifiers.AccImplementing + CompilerModifiers.AccOverriding)) != 0;
+    boolean report = (this.options.getSeverity(CompilerOptions.MissingJavadocTags) != ProblemSeverities.Ignore)
+        && (!overriding || this.options.reportMissingJavadocTagsOverriding);
+    if (report && javadocVisibility(this.options.reportMissingJavadocTagsVisibility, modifiers)) {
+      String[] arguments = new String[] { String.valueOf(typeRef.resolvedType.sourceName()) };
+      this.handle(IProblem.JavadocMissingThrowsTag, arguments, arguments, typeRef.sourceStart, typeRef.sourceEnd);
+    }
+  }
+
+  public void javadocUnexpectedTag(int sourceStart, int sourceEnd) {
+    this.handle(IProblem.JavadocUnexpectedTag, NoArgument, NoArgument, sourceStart, sourceEnd);
+  }
+
+  public void javadocUnterminatedInlineTag(int sourceStart, int sourceEnd) {
+    this.handle(IProblem.JavadocUnterminatedInlineTag, NoArgument, NoArgument, sourceStart, sourceEnd);
+  }
+
+  private boolean javadocVisibility(int visibility, int modifiers) {
+    switch (modifiers & CompilerModifiers.AccVisibilityMASK) {
+    case IConstants.AccPublic:
+      return true;
+    case IConstants.AccProtected:
+      return (visibility != IConstants.AccPublic);
+    //         case IConstants.AccDefault:
+    //                 return (visibility == IConstants.AccDefault || visibility == IConstants.AccPrivate);
+    case IConstants.AccPrivate:
+      return (visibility == IConstants.AccPrivate);
+    }
+    return true;
+  }
+
+  private String javadocVisibilityArgument(int visibility, int modifiers) {
+    String argument = null;
+    switch (modifiers & CompilerModifiers.AccVisibilityMASK) {
+    case IConstants.AccPublic:
+      argument = CompilerOptions.PUBLIC;
+      break;
+    case IConstants.AccProtected:
+      if (visibility != IConstants.AccPublic) {
+        argument = CompilerOptions.PROTECTED;
+      }
+      break;
+    //         case IConstants.AccDefault:
+    //                 if (visibility == IConstants.AccDefault || visibility == IConstants.AccPrivate) {
+    //                         argument = CompilerOptions.DEFAULT;
+    //                 }
+    //                 break;
+    case IConstants.AccPrivate:
+      if (visibility == IConstants.AccPrivate) {
+        argument = CompilerOptions.PRIVATE;
+      }
+      break;
+    }
+    return argument;
+  }
 
   public void methodNeedingAbstractModifier(MethodDeclaration methodDecl) {
     this.handle(IProblem.MethodRequiresBody, NoArgument, NoArgument, methodDecl.sourceStart, methodDecl.sourceEnd);
@@ -2041,10 +2075,13 @@ private String javadocVisibilityArgument(int visibility, int modifiers) {
   }
 
   public void mustUseAStaticMethod(MessageSend messageSend, MethodBinding method) {
-    this.handle(IProblem.StaticMethodRequested, new String[] { new String(method.declaringClass.readableName()),
-        new String(method.selector), parametersAsString(method) }, new String[] {
-        new String(method.declaringClass.shortReadableName()), new String(method.selector), parametersAsShortString(method) },
-        messageSend.sourceStart, messageSend.sourceEnd);
+    this.handle(IProblem.StaticMethodRequested, new String[] {
+        new String(method.declaringClass.readableName()),
+        new String(method.selector),
+        parametersAsString(method) }, new String[] {
+        new String(method.declaringClass.shortReadableName()),
+        new String(method.selector),
+        parametersAsShortString(method) }, messageSend.sourceStart, messageSend.sourceEnd);
   }
 
   public void nativeMethodsCannotBeStrictfp(ReferenceBinding type, AbstractMethodDeclaration methodDecl) {
@@ -2057,27 +2094,34 @@ private String javadocVisibilityArgument(int visibility, int modifiers) {
   }
 
   public void needToEmulateFieldReadAccess(FieldBinding field, ASTNode location) {
-    this.handle(IProblem.NeedToEmulateFieldReadAccess, new String[] { new String(field.declaringClass.readableName()),
+    this.handle(IProblem.NeedToEmulateFieldReadAccess, new String[] {
+        new String(field.declaringClass.readableName()),
         new String(field.name) }, new String[] { new String(field.declaringClass.shortReadableName()), new String(field.name) },
         location.sourceStart, location.sourceEnd);
   }
 
   public void needToEmulateFieldWriteAccess(FieldBinding field, ASTNode location) {
-    this.handle(IProblem.NeedToEmulateFieldWriteAccess, new String[] { new String(field.declaringClass.readableName()),
+    this.handle(IProblem.NeedToEmulateFieldWriteAccess, new String[] {
+        new String(field.declaringClass.readableName()),
         new String(field.name) }, new String[] { new String(field.declaringClass.shortReadableName()), new String(field.name) },
         location.sourceStart, location.sourceEnd);
   }
 
   public void needToEmulateMethodAccess(MethodBinding method, ASTNode location) {
     if (method.isConstructor())
-      this.handle(IProblem.NeedToEmulateConstructorAccess, new String[] { new String(method.declaringClass.readableName()),
-          parametersAsString(method) }, new String[] { new String(method.declaringClass.shortReadableName()),
+      this.handle(IProblem.NeedToEmulateConstructorAccess, new String[] {
+          new String(method.declaringClass.readableName()),
+          parametersAsString(method) }, new String[] {
+          new String(method.declaringClass.shortReadableName()),
           parametersAsShortString(method) }, location.sourceStart, location.sourceEnd);
     else
-      this.handle(IProblem.NeedToEmulateMethodAccess, new String[] { new String(method.declaringClass.readableName()),
-          new String(method.selector), parametersAsString(method) }, new String[] {
-          new String(method.declaringClass.shortReadableName()), new String(method.selector), parametersAsShortString(method) },
-          location.sourceStart, location.sourceEnd);
+      this.handle(IProblem.NeedToEmulateMethodAccess, new String[] {
+          new String(method.declaringClass.readableName()),
+          new String(method.selector),
+          parametersAsString(method) }, new String[] {
+          new String(method.declaringClass.shortReadableName()),
+          new String(method.selector),
+          parametersAsShortString(method) }, location.sourceStart, location.sourceEnd);
   }
 
   public void nestedClassCannotDeclareInterface(TypeDeclaration typeDecl) {
@@ -2134,7 +2178,8 @@ private String javadocVisibilityArgument(int visibility, int modifiers) {
       leftShortName = leftName;
       rightShortName = rightName;
     }
-    this.handle(IProblem.IncompatibleTypesInEqualityOperator, new String[] { leftName, rightName }, new String[] { leftShortName,
+    this.handle(IProblem.IncompatibleTypesInEqualityOperator, new String[] { leftName, rightName }, new String[] {
+        leftShortName,
         rightShortName }, expression.sourceStart, expression.sourceEnd);
   }
 
@@ -2148,7 +2193,8 @@ private String javadocVisibilityArgument(int visibility, int modifiers) {
       rightShortName = rightName;
     }
     this.handle(IProblem.IncompatibleTypesInConditionalOperator, new String[] { leftName, rightName }, new String[] {
-        leftShortName, rightShortName }, expression.sourceStart, expression.sourceEnd);
+        leftShortName,
+        rightShortName }, expression.sourceStart, expression.sourceEnd);
   }
 
   public void objectCannotHaveSuperTypes(SourceTypeBinding type) {
@@ -2279,9 +2325,10 @@ private String javadocVisibilityArgument(int visibility, int modifiers) {
 
   public void recursiveConstructorInvocation(ExplicitConstructorCall constructorCall) {
     this.handle(IProblem.RecursiveConstructorInvocation, new String[] {
-        new String(constructorCall.binding.declaringClass.readableName()), parametersAsString(constructorCall.binding) },
-        new String[] { new String(constructorCall.binding.declaringClass.shortReadableName()),
-            parametersAsShortString(constructorCall.binding) }, constructorCall.sourceStart, constructorCall.sourceEnd);
+        new String(constructorCall.binding.declaringClass.readableName()),
+        parametersAsString(constructorCall.binding) }, new String[] {
+        new String(constructorCall.binding.declaringClass.shortReadableName()),
+        parametersAsShortString(constructorCall.binding) }, constructorCall.sourceStart, constructorCall.sourceEnd);
   }
 
   public void redefineArgument(Argument arg) {
@@ -2336,8 +2383,8 @@ private String javadocVisibilityArgument(int visibility, int modifiers) {
       return;
     }
     this.handle(id, new String[] { new String(methodDecl.selector), new String(expectedType.readableName()) }, new String[] {
-        new String(methodDecl.selector), new String(expectedType.shortReadableName()) }, methodDecl.returnType.sourceStart,
-        methodDecl.returnType.sourceEnd);
+        new String(methodDecl.selector),
+        new String(expectedType.shortReadableName()) }, methodDecl.returnType.sourceStart, methodDecl.returnType.sourceEnd);
   }
 
   public void scannerError(Parser parser, String errorTokenName) {
@@ -2434,10 +2481,11 @@ private String javadocVisibilityArgument(int visibility, int modifiers) {
         // 8.4.6.4 - If a class inherits more than one method with the
         // same signature it is an error for one to be static
         // (non-abstract) and the other abstract.
-        IProblem.StaticInheritedMethodConflicts, new String[] { new String(concreteMethod.readableName()),
+        IProblem.StaticInheritedMethodConflicts, new String[] {
+            new String(concreteMethod.readableName()),
             new String(abstractMethods[0].declaringClass.readableName()) }, new String[] {
-            new String(concreteMethod.readableName()), new String(abstractMethods[0].declaringClass.shortReadableName()) }, type
-            .sourceStart(), type.sourceEnd());
+            new String(concreteMethod.readableName()),
+            new String(abstractMethods[0].declaringClass.shortReadableName()) }, type.sourceStart(), type.sourceEnd());
   }
 
   public void stringConstantIsExceedingUtf8Limit(ASTNode location) {
@@ -2447,12 +2495,13 @@ private String javadocVisibilityArgument(int visibility, int modifiers) {
   public void superclassMustBeAClass(SourceTypeBinding type, TypeReference superclassRef, ReferenceBinding superType) {
     this.handle(IProblem.SuperclassMustBeAClass,
         new String[] { new String(superType.readableName()), new String(type.sourceName()) }, new String[] {
-            new String(superType.shortReadableName()), new String(type.sourceName()) }, superclassRef.sourceStart,
-        superclassRef.sourceEnd);
+            new String(superType.shortReadableName()),
+            new String(type.sourceName()) }, superclassRef.sourceStart, superclassRef.sourceEnd);
   }
 
   public void superinterfaceMustBeAnInterface(SourceTypeBinding type, TypeDeclaration typeDecl, ReferenceBinding superType) {
-    this.handle(IProblem.SuperInterfaceMustBeAnInterface, new String[] { new String(superType.readableName()),
+    this.handle(IProblem.SuperInterfaceMustBeAnInterface, new String[] {
+        new String(superType.readableName()),
         new String(type.sourceName()) }, new String[] { new String(superType.shortReadableName()), new String(type.sourceName()) },
         typeDecl.sourceStart, typeDecl.sourceEnd);
   }
@@ -2512,7 +2561,8 @@ private String javadocVisibilityArgument(int visibility, int modifiers) {
       resultTypeShortName = resultTypeName;
       expectedTypeShortName = expectedTypeName;
     }
-    this.handle(IProblem.TypeMismatch, new String[] { resultTypeName, expectedTypeName }, new String[] { resultTypeShortName,
+    this.handle(IProblem.TypeMismatch, new String[] { resultTypeName, expectedTypeName }, new String[] {
+        resultTypeShortName,
         expectedTypeShortName }, location.sourceStart, location.sourceEnd);
   }
 
@@ -2525,14 +2575,15 @@ private String javadocVisibilityArgument(int visibility, int modifiers) {
       constantTypeShortName = constantTypeName;
       expectedTypeShortName = expectedTypeName;
     }
-    this.handle(IProblem.TypeMismatch, new String[] { constantTypeName, expectedTypeName }, new String[] { constantTypeShortName,
+    this.handle(IProblem.TypeMismatch, new String[] { constantTypeName, expectedTypeName }, new String[] {
+        constantTypeShortName,
         expectedTypeShortName }, expression.sourceStart, expression.sourceEnd);
   }
 
-//  public void undefinedLabel(BranchStatement statement) {
-//    String[] arguments = new String[] { new String(statement.label) };
-//    this.handle(IProblem.UndefinedLabel, arguments, arguments, statement.sourceStart, statement.sourceEnd);
-//  }
+  //  public void undefinedLabel(BranchStatement statement) {
+  //    String[] arguments = new String[] { new String(statement.label) };
+  //    this.handle(IProblem.UndefinedLabel, arguments, arguments, statement.sourceStart, statement.sourceEnd);
+  //  }
 
   public void unexpectedStaticModifierForField(SourceTypeBinding type, FieldDeclaration fieldDecl) {
     String[] arguments = new String[] { fieldDecl.name() };
@@ -2560,11 +2611,6 @@ private String javadocVisibilityArgument(int visibility, int modifiers) {
     this.handle(IProblem.UninitializedBlankFinalField, arguments, arguments, location.sourceStart, location.sourceEnd);
   }
 
-  public void uninitializedLocalVariable(LocalVariableBinding binding, ASTNode location) {
-    String[] arguments = new String[] { new String(binding.readableName()) };
-    this.handle(IProblem.UninitializedLocalVariable, arguments, arguments, location.sourceStart, location.sourceEnd);
-  }
-
   public void unmatchedBracket(int position, ReferenceContext context, CompilationResult compilationResult) {
     this.handle(IProblem.UnmatchedBracket, NoArgument, NoArgument, position, position, context, compilationResult);
   }
@@ -2575,22 +2621,22 @@ private String javadocVisibilityArgument(int visibility, int modifiers) {
   }
 
   public void unnecessaryReceiverForStaticMethod(ASTNode location, MethodBinding method) {
-    this.handle(IProblem.NonStaticAccessToStaticMethod, new String[] { new String(method.declaringClass.readableName()),
-        new String(method.selector), parametersAsString(method) }, new String[] {
-        new String(method.declaringClass.shortReadableName()), new String(method.selector), parametersAsShortString(method) },
-        location.sourceStart, location.sourceEnd);
+    this.handle(IProblem.NonStaticAccessToStaticMethod, new String[] {
+        new String(method.declaringClass.readableName()),
+        new String(method.selector),
+        parametersAsString(method) }, new String[] {
+        new String(method.declaringClass.shortReadableName()),
+        new String(method.selector),
+        parametersAsShortString(method) }, location.sourceStart, location.sourceEnd);
   }
 
   public void unnecessaryReceiverForStaticField(ASTNode location, FieldBinding field) {
-    this.handle(IProblem.NonStaticAccessToStaticField, new String[] { new String(field.declaringClass.readableName()),
+    this.handle(IProblem.NonStaticAccessToStaticField, new String[] {
+        new String(field.declaringClass.readableName()),
         new String(field.name) }, new String[] { new String(field.declaringClass.shortReadableName()), new String(field.name) },
         location.sourceStart, location.sourceEnd);
   }
 
-  public void unreachableCode(Statement statement) {
-    this.handle(IProblem.CodeCannotBeReached, NoArgument, NoArgument, statement.sourceStart, statement.sourceEnd);
-  }
-
   public void unreachableExceptionHandler(ReferenceBinding exceptionType, ASTNode location) {
     this.handle(IProblem.UnreachableCatch, NoArgument, NoArgument, location.sourceStart, location.sourceEnd);
   }
@@ -2629,8 +2675,10 @@ private String javadocVisibilityArgument(int visibility, int modifiers) {
     if (constructorDecl.arguments == null || constructorDecl.arguments.length == 0)
       return;
     MethodBinding constructor = constructorDecl.binding;
-    this.handle(IProblem.UnusedPrivateConstructor, new String[] { new String(constructor.declaringClass.readableName()),
-        parametersAsString(constructor) }, new String[] { new String(constructor.declaringClass.shortReadableName()),
+    this.handle(IProblem.UnusedPrivateConstructor, new String[] {
+        new String(constructor.declaringClass.readableName()),
+        parametersAsString(constructor) }, new String[] {
+        new String(constructor.declaringClass.shortReadableName()),
         parametersAsShortString(constructor) }, constructorDecl.sourceStart, constructorDecl.sourceEnd);
   }
 
@@ -2642,7 +2690,8 @@ private String javadocVisibilityArgument(int visibility, int modifiers) {
         && TypeBinding.LongBinding == field.type) {
       return; // do not report unused serialVersionUID field
     }
-    this.handle(IProblem.UnusedPrivateField, new String[] { new String(field.declaringClass.readableName()),
+    this.handle(IProblem.UnusedPrivateField, new String[] {
+        new String(field.declaringClass.readableName()),
         new String(field.name), }, new String[] { new String(field.declaringClass.shortReadableName()), new String(field.name), },
         fieldDecl.sourceStart, fieldDecl.sourceEnd);
   }
@@ -2675,10 +2724,13 @@ private String javadocVisibilityArgument(int visibility, int modifiers) {
         && CharOperation.equals(method.selector, TypeConstants.WRITEREPLACE)) {
       return;
     }
-    this.handle(IProblem.UnusedPrivateMethod, new String[] { new String(method.declaringClass.readableName()),
-        new String(method.selector), parametersAsString(method) }, new String[] {
-        new String(method.declaringClass.shortReadableName()), new String(method.selector), parametersAsShortString(method) },
-        methodDecl.sourceStart, methodDecl.sourceEnd);
+    this.handle(IProblem.UnusedPrivateMethod, new String[] {
+        new String(method.declaringClass.readableName()),
+        new String(method.selector),
+        parametersAsString(method) }, new String[] {
+        new String(method.declaringClass.shortReadableName()),
+        new String(method.selector),
+        parametersAsShortString(method) }, methodDecl.sourceStart, methodDecl.sourceEnd);
   }
 
   public void unusedPrivateType(TypeDeclaration typeDecl) {
@@ -2856,12 +2908,12 @@ private String javadocVisibilityArgument(int visibility, int modifiers) {
         compilationResult);
   }
 
-  public void phpIncludeNotExistWarning(String[] messageArguments, int problemStartPosition, int problemEndPosition, ReferenceContext context,
-      CompilationResult compilationResult) {
+  public void phpIncludeNotExistWarning(String[] messageArguments, int problemStartPosition, int problemEndPosition,
+      ReferenceContext context, CompilationResult compilationResult) {
     if (computeSeverity(IProblem.PHPIncludeNotExistWarning) == Ignore)
       return;
-    this.handle(IProblem.PHPIncludeNotExistWarning, NoArgument, messageArguments, problemStartPosition, problemEndPosition, context,
-        compilationResult);
+    this.handle(IProblem.PHPIncludeNotExistWarning, NoArgument, messageArguments, problemStartPosition, problemEndPosition,
+        context, compilationResult);
   }
 
   public void phpKeywordWarning(String[] messageArguments, int problemStartPosition, int problemEndPosition,
@@ -2879,4 +2931,23 @@ private String javadocVisibilityArgument(int visibility, int modifiers) {
     this.handle(IProblem.PHPBadStyleUppercaseIdentifierWarning, NoArgument, new String[] {}, problemStartPosition,
         problemEndPosition, context, compilationResult);
   }
+
+  public void uninitializedLocalVariable(String token, int problemStartPosition, int problemEndPosition, ReferenceContext context,
+      CompilationResult compilationResult) {
+    if (computeSeverity(IProblem.UninitializedLocalVariable) == Ignore)
+      return;
+    //    String[] arguments = new String[] { new String(binding.readableName()) };
+    String[] arguments = new String[] { token };
+    this.handle(IProblem.UninitializedLocalVariable, arguments, arguments, problemStartPosition, problemEndPosition, context,
+        compilationResult);
+  }
+
+  public void unreachableCode(String token, int problemStartPosition, int problemEndPosition, ReferenceContext context,
+      CompilationResult compilationResult) {
+    if (computeSeverity(IProblem.CodeCannotBeReached) == Ignore)
+      return;
+    this.handle(IProblem.CodeCannotBeReached, NoArgument, new String[] {}, problemStartPosition,
+        problemEndPosition, context, compilationResult);
+  }
+
 }
\ No newline at end of file
index 9ecf24c..8ebb7da 100644 (file)
@@ -41,6 +41,8 @@ public class CompilerConfigurationBlock extends OptionsConfigurationBlock {
     private static final String PREF_PB_PHP_KEYWORD= JavaCore.COMPILER_PB_PHP_KEYWORD;
     private static final String PREF_PB_PHP_UPPERCASE_IDENTIFIER= JavaCore.COMPILER_PB_PHP_UPPERCASE_IDENTIFIER;
     private static final String PREF_PB_PHP_FILE_NOT_EXIST= JavaCore.COMPILER_PB_PHP_FILE_NOT_EXIST;
+    private static final String PREF_PB_UNREACHABLE_CODE= JavaCore.COMPILER_PB_UNREACHABLE_CODE;
+    private static final String PREF_PB_UNINITIALIZED_LOCAL_VARIABLE= JavaCore.COMPILER_PB_UNINITIALIZED_LOCAL_VARIABLE;
 //     private static final String PREF_LOCAL_VARIABLE_ATTR=  JavaCore.COMPILER_LOCAL_VARIABLE_ATTR;
 //     private static final String PREF_LINE_NUMBER_ATTR= JavaCore.COMPILER_LINE_NUMBER_ATTR;
 //     private static final String PREF_SOURCE_FILE_ATTR= JavaCore.COMPILER_SOURCE_FILE_ATTR;
@@ -168,6 +170,8 @@ public class CompilerConfigurationBlock extends OptionsConfigurationBlock {
            PREF_PB_PHP_VAR_DEPRECATED,
            PREF_PB_PHP_KEYWORD,
            PREF_PB_PHP_UPPERCASE_IDENTIFIER,
+           PREF_PB_UNREACHABLE_CODE,
+           PREF_PB_UNINITIALIZED_LOCAL_VARIABLE,
 //             PREF_LOCAL_VARIABLE_ATTR, 
 //             PREF_LINE_NUMBER_ATTR, PREF_SOURCE_FILE_ATTR, PREF_CODEGEN_UNUSED_LOCAL,
 //             PREF_CODEGEN_TARGET_PLATFORM, 
@@ -314,6 +318,12 @@ public class CompilerConfigurationBlock extends OptionsConfigurationBlock {
                label= PreferencesMessages.getString("CompilerConfigurationBlock.pb_uppercase_identifier.label"); //$NON-NLS-1$
                addComboBox(composite, label, PREF_PB_PHP_UPPERCASE_IDENTIFIER, errorWarningIgnore, errorWarningIgnoreLabels, 0);                       
                
+               label= PreferencesMessages.getString("CompilerConfigurationBlock.pb_unreachable_code.label"); //$NON-NLS-1$
+               addComboBox(composite, label, PREF_PB_UNREACHABLE_CODE, errorWarningIgnore, errorWarningIgnoreLabels, 0);       
+               
+               label= PreferencesMessages.getString("CompilerConfigurationBlock.pb_unitialized_local_variable.label"); //$NON-NLS-1$
+               addComboBox(composite, label, PREF_PB_UNINITIALIZED_LOCAL_VARIABLE, errorWarningIgnore, errorWarningIgnoreLabels, 0);   
+               
                label= PreferencesMessages.getString("CompilerConfigurationBlock.pb_overriding_pkg_dflt.label"); //$NON-NLS-1$
 //             addComboBox(composite, label, PREF_PB_OVERRIDING_PACKAGE_DEFAULT_METHOD, errorWarningIgnore, errorWarningIgnoreLabels, 0);                      
 
index bd11016..16cd94b 100644 (file)
@@ -391,8 +391,9 @@ CompilerConfigurationBlock.pb_file_not_exist.label=Include filename doesn't exis
 CompilerConfigurationBlock.pb_var_deprecated.label=Keyword 'var' is deprecated:
 CompilerConfigurationBlock.pb_keyword.label=Don't use keyword as identifier:
 CompilerConfigurationBlock.pb_uppercase_identifier.label=Non-variable identifiers should contain only uppercase characters: 
-
 CompilerConfigurationBlock.pb_unreachable_code.label=&Unreachable code:
+CompilerConfigurationBlock.pb_unitialized_local_variable.label=Uninitialized local function or method variable:
+
 CompilerConfigurationBlock.pb_invalid_import.label=Unresol&vable import statements:
 CompilerConfigurationBlock.pb_overriding_pkg_dflt.label=&Methods overridden but not package visible:
 CompilerConfigurationBlock.pb_method_naming.label=Me&thods with a constructor name:
index b1c2034..0264ea5 100644 (file)
@@ -82,9 +82,9 @@ public class AllocationExpression
                                        SyntheticArgumentBinding syntheticArgument = syntheticArguments[i];
                                        LocalVariableBinding targetLocal;
                                        if ((targetLocal = syntheticArgument.actualOuterLocalVariable) == null) continue;
-                                       if (targetLocal.declaration != null && !flowInfo.isDefinitelyAssigned(targetLocal)){
-                                               currentScope.problemReporter().uninitializedLocalVariable(targetLocal, this);
-                                       }
+//                                     if (targetLocal.declaration != null && !flowInfo.isDefinitelyAssigned(targetLocal)){
+//                                             currentScope.problemReporter().uninitializedLocalVariable(targetLocal, this);
+//                                     }
                                }
                                                
                }
index ca262ed..94a6180 100644 (file)
@@ -71,18 +71,18 @@ public class QualifiedNameReference extends NameReference {
                                        }
                                }
                                break;
-                       case LOCAL :
-                               // first binding is a local variable
-                               LocalVariableBinding localBinding;
-                               if (!flowInfo
-                                       .isDefinitelyAssigned(localBinding = (LocalVariableBinding) binding)) {
-                                       currentScope.problemReporter().uninitializedLocalVariable(localBinding, this);
-                               }
-                               if (flowInfo.isReachable()) {
-                                       localBinding.useFlag = LocalVariableBinding.USED;
-                               } else if (localBinding.useFlag == LocalVariableBinding.UNUSED) {
-                                       localBinding.useFlag = LocalVariableBinding.FAKE_USED;
-                               }
+//                     case LOCAL :
+//                             // first binding is a local variable
+//                             LocalVariableBinding localBinding;
+//                             if (!flowInfo
+//                                     .isDefinitelyAssigned(localBinding = (LocalVariableBinding) binding)) {
+//                                     currentScope.problemReporter().uninitializedLocalVariable(localBinding, this);
+//                             }
+//                             if (flowInfo.isReachable()) {
+//                                     localBinding.useFlag = LocalVariableBinding.USED;
+//                             } else if (localBinding.useFlag == LocalVariableBinding.UNUSED) {
+//                                     localBinding.useFlag = LocalVariableBinding.FAKE_USED;
+//                             }
                }
                
                if (needValue) {
@@ -208,17 +208,17 @@ public class QualifiedNameReference extends NameReference {
                                        currentScope.problemReporter().uninitializedBlankFinalField(fieldBinding, this);
                                }
                                break;
-                       case LOCAL : // reading a local variable
-                               LocalVariableBinding localBinding;
-                               if (!flowInfo
-                                       .isDefinitelyAssigned(localBinding = (LocalVariableBinding) binding)) {
-                                       currentScope.problemReporter().uninitializedLocalVariable(localBinding, this);
-                               }
-                               if (flowInfo.isReachable()) {
-                                       localBinding.useFlag = LocalVariableBinding.USED;
-                               } else if (localBinding.useFlag == LocalVariableBinding.UNUSED) {
-                                       localBinding.useFlag = LocalVariableBinding.FAKE_USED;
-                               }
+//                     case LOCAL : // reading a local variable
+//                             LocalVariableBinding localBinding;
+//                             if (!flowInfo
+//                                     .isDefinitelyAssigned(localBinding = (LocalVariableBinding) binding)) {
+//                                     currentScope.problemReporter().uninitializedLocalVariable(localBinding, this);
+//                             }
+//                             if (flowInfo.isReachable()) {
+//                                     localBinding.useFlag = LocalVariableBinding.USED;
+//                             } else if (localBinding.useFlag == LocalVariableBinding.UNUSED) {
+//                                     localBinding.useFlag = LocalVariableBinding.FAKE_USED;
+//                             }
                }
                if (needValue) {
                        manageEnclosingInstanceAccessIfNecessary(currentScope);
index f3f7324..9f4d8eb 100644 (file)
@@ -54,18 +54,18 @@ public FlowInfo analyseAssignment(BlockScope currentScope, FlowContext flowConte
                                }
                                manageSyntheticReadAccessIfNecessary(currentScope);
                                break;
-                       case LOCAL : // reading a local variable
-                               // check if assigning a final blank field
-                               LocalVariableBinding localBinding;
-                               if (!flowInfo.isDefinitelyAssigned(localBinding = (LocalVariableBinding) binding)) {
-                                       currentScope.problemReporter().uninitializedLocalVariable(localBinding, this);
-                                       // we could improve error msg here telling "cannot use compound assignment on final local variable"
-                               }
-                               if (flowInfo.isReachable()) {
-                                       localBinding.useFlag = LocalVariableBinding.USED;
-                               } else if (localBinding.useFlag == LocalVariableBinding.UNUSED) {
-                                       localBinding.useFlag = LocalVariableBinding.FAKE_USED;
-                               }
+//                     case LOCAL : // reading a local variable
+//                             // check if assigning a final blank field
+//                             LocalVariableBinding localBinding;
+//                             if (!flowInfo.isDefinitelyAssigned(localBinding = (LocalVariableBinding) binding)) {
+//                                     currentScope.problemReporter().uninitializedLocalVariable(localBinding, this);
+//                                     // we could improve error msg here telling "cannot use compound assignment on final local variable"
+//                             }
+//                             if (flowInfo.isReachable()) {
+//                                     localBinding.useFlag = LocalVariableBinding.USED;
+//                             } else if (localBinding.useFlag == LocalVariableBinding.UNUSED) {
+//                                     localBinding.useFlag = LocalVariableBinding.FAKE_USED;
+//                             }
                }
        }
        if (assignment.expression != null) {
@@ -135,16 +135,16 @@ public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, Fl
                                }
                        }
                        break;
-               case LOCAL : // reading a local variable
-                       LocalVariableBinding localBinding;
-                       if (!flowInfo.isDefinitelyAssigned(localBinding = (LocalVariableBinding) binding)) {
-                               currentScope.problemReporter().uninitializedLocalVariable(localBinding, this);
-                       }
-                       if (flowInfo.isReachable()) {
-                               localBinding.useFlag = LocalVariableBinding.USED;
-                       } else if (localBinding.useFlag == LocalVariableBinding.UNUSED) {
-                               localBinding.useFlag = LocalVariableBinding.FAKE_USED;
-                       }
+//             case LOCAL : // reading a local variable
+//                     LocalVariableBinding localBinding;
+//                     if (!flowInfo.isDefinitelyAssigned(localBinding = (LocalVariableBinding) binding)) {
+//                             currentScope.problemReporter().uninitializedLocalVariable(localBinding, this);
+//                     }
+//                     if (flowInfo.isReachable()) {
+//                             localBinding.useFlag = LocalVariableBinding.USED;
+//                     } else if (localBinding.useFlag == LocalVariableBinding.UNUSED) {
+//                             localBinding.useFlag = LocalVariableBinding.FAKE_USED;
+//                     }
        }
        if (valueRequired) {
                manageEnclosingInstanceAccessIfNecessary(currentScope);