removed Makefile; lifted repo/org.ibex.tool/src/ to src/
[org.ibex.tool.git] / src / org / eclipse / jdt / internal / compiler / problem / ProblemReporter.java
1 /*******************************************************************************
2  * Copyright (c) 2000, 2004 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials 
4  * are made available under the terms of the Common Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/cpl-v10.html
7  * 
8  * Contributors:
9  *     IBM Corporation - initial API and implementation
10  *******************************************************************************/
11 package org.eclipse.jdt.internal.compiler.problem;
12
13 import org.eclipse.jdt.core.compiler.CharOperation;
14 import org.eclipse.jdt.core.compiler.IProblem;
15 import org.eclipse.jdt.internal.compiler.*;
16 import org.eclipse.jdt.internal.compiler.ast.*;
17 import org.eclipse.jdt.internal.compiler.env.IConstants;
18 import org.eclipse.jdt.internal.compiler.impl.CompilerOptions;
19 import org.eclipse.jdt.internal.compiler.impl.ReferenceContext;
20 import org.eclipse.jdt.internal.compiler.lookup.*;
21 import org.eclipse.jdt.internal.compiler.parser.*;
22 import org.eclipse.jdt.internal.compiler.util.Util;
23
24 public class ProblemReporter extends ProblemHandler implements ProblemReasons {
25         
26         public ReferenceContext referenceContext;
27         
28 public ProblemReporter(IErrorHandlingPolicy policy, CompilerOptions options, IProblemFactory problemFactory) {
29         super(policy, options, problemFactory);
30 }
31 public void abortDueToInternalError(String errorMessage) {
32         String[] arguments = new String[] {errorMessage};
33         this.handle(
34                 IProblem.Unclassified,
35                 arguments,
36                 arguments,
37                 Error | Abort,
38                 0,
39                 0);
40 }
41 public void abortDueToInternalError(String errorMessage, ASTNode location) {
42         String[] arguments = new String[] {errorMessage};
43         this.handle(
44                 IProblem.Unclassified,
45                 arguments,
46                 arguments,
47                 Error | Abort,
48                 location.sourceStart,
49                 location.sourceEnd);
50 }
51 public void abstractMethodCannotBeOverridden(SourceTypeBinding type, MethodBinding concreteMethod) {
52
53         this.handle(
54                 // %1 must be abstract since it cannot override the inherited package-private abstract method %2
55                 IProblem.AbstractMethodCannotBeOverridden,
56                 new String[] {
57                         new String(type.sourceName()), 
58                         new String(
59                                         CharOperation.concat(
60                                                 concreteMethod.declaringClass.readableName(),
61                                                 concreteMethod.readableName(),
62                                                 '.'))},
63                 new String[] {
64                         new String(type.sourceName()), 
65                         new String(
66                                         CharOperation.concat(
67                                                 concreteMethod.declaringClass.shortReadableName(),
68                                                 concreteMethod.shortReadableName(),
69                                                 '.'))},
70                 type.sourceStart(),
71                 type.sourceEnd());
72 }
73 public void abstractMethodInAbstractClass(SourceTypeBinding type, AbstractMethodDeclaration methodDecl) {
74
75         String[] arguments = new String[] {new String(type.sourceName()), new String(methodDecl.selector)};
76         this.handle(
77                 IProblem.AbstractMethodInAbstractClass,
78                 arguments,
79                 arguments,
80                 methodDecl.sourceStart,
81                 methodDecl.sourceEnd);
82 }
83 public void abstractMethodMustBeImplemented(SourceTypeBinding type, MethodBinding abstractMethod) {
84         this.handle(
85                 // Must implement the inherited abstract method %1
86                 // 8.4.3 - Every non-abstract subclass of an abstract type, A, must provide a concrete implementation of all of A's methods.
87                 IProblem.AbstractMethodMustBeImplemented,
88                 new String[] {
89                         new String(
90                                 CharOperation.concat(
91                                         abstractMethod.declaringClass.readableName(),
92                                         abstractMethod.readableName(),
93                                         '.'))},
94                 new String[] {
95                         new String(
96                                 CharOperation.concat(
97                                         abstractMethod.declaringClass.shortReadableName(),
98                                         abstractMethod.shortReadableName(),
99                                         '.'))},
100                 type.sourceStart(),
101                 type.sourceEnd());
102 }
103 public void abstractMethodNeedingNoBody(AbstractMethodDeclaration method) {
104         this.handle(
105                 IProblem.BodyForAbstractMethod,
106                 NoArgument,
107                 NoArgument,
108                 method.sourceStart,
109                 method.sourceEnd,
110                 method,
111                 method.compilationResult());
112 }
113 public void alreadyDefinedLabel(char[] labelName, ASTNode location) {
114         String[] arguments = new String[] {new String(labelName)};
115         this.handle(
116                 IProblem.DuplicateLabel,
117                 arguments,
118                 arguments,
119                 location.sourceStart,
120                 location.sourceEnd);
121 }
122 public void anonymousClassCannotExtendFinalClass(Expression expression, TypeBinding type) {
123         this.handle(
124                 IProblem.AnonymousClassCannotExtendFinalClass,
125                 new String[] {new String(type.readableName())},
126                 new String[] {new String(type.shortReadableName())},
127                 expression.sourceStart,
128                 expression.sourceEnd);
129 }
130 public void argumentTypeCannotBeVoid(SourceTypeBinding type, AbstractMethodDeclaration methodDecl, Argument arg) {
131         String[] arguments = new String[] {new String(methodDecl.selector), new String(arg.name)};
132         this.handle(
133                 IProblem.ArgumentTypeCannotBeVoid,
134                 arguments,
135                 arguments,
136                 methodDecl.sourceStart,
137                 methodDecl.sourceEnd);
138 }
139 public void argumentTypeCannotBeVoidArray(SourceTypeBinding type, AbstractMethodDeclaration methodDecl, Argument arg) {
140         String[] arguments = new String[] {new String(methodDecl.selector), new String(arg.name)};
141         this.handle(
142                 IProblem.ArgumentTypeCannotBeVoidArray,
143                 arguments,
144                 arguments,
145                 methodDecl.sourceStart,
146                 methodDecl.sourceEnd);
147 }
148 public void argumentTypeProblem(SourceTypeBinding type, AbstractMethodDeclaration methodDecl, Argument arg, TypeBinding expectedType) {
149         int problemId = expectedType.problemId();
150         int id;
151         switch (problemId) {
152                 case NotFound : // 1
153                         id = IProblem.ArgumentTypeNotFound;
154                         break;
155                 case NotVisible : // 2
156                         id = IProblem.ArgumentTypeNotVisible;
157                         break;
158                 case Ambiguous : // 3
159                         id = IProblem.ArgumentTypeAmbiguous;
160                         break;
161                 case InternalNameProvided : // 4
162                         id = IProblem.ArgumentTypeInternalNameProvided;
163                         break;
164                 case InheritedNameHidesEnclosingName : // 5
165                         id = IProblem.ArgumentTypeInheritedNameHidesEnclosingName;
166                         break;
167                 case NoError : // 0
168                 default :
169                         needImplementation(); // want to fail to see why we were here...
170                         return;
171         }
172         this.handle(
173                 id,
174                 new String[] {new String(methodDecl.selector), new String(arg.name), new String(expectedType.readableName())},
175                 new String[] {new String(methodDecl.selector), new String(arg.name), new String(expectedType.shortReadableName())},
176                 arg.type.sourceStart,
177                 arg.type.sourceEnd);
178 }
179 public void arrayConstantsOnlyInArrayInitializers(int sourceStart, int sourceEnd) {
180         this.handle(
181                 IProblem.ArrayConstantsOnlyInArrayInitializers,
182                 NoArgument,
183                 NoArgument,
184                 sourceStart,
185                 sourceEnd);
186 }
187 public void assignmentHasNoEffect(Assignment assignment, char[] name){
188         String[] arguments = new String[] { new String(name) }; 
189         this.handle(
190                         IProblem.AssignmentHasNoEffect,
191                         arguments,
192                         arguments,
193                         assignment.sourceStart,
194                         assignment.sourceEnd);
195 }
196 public void attemptToReturnNonVoidExpression(ReturnStatement returnStatement, TypeBinding expectedType) {
197         this.handle(
198                 IProblem.VoidMethodReturnsValue,
199                 new String[] {new String(expectedType.readableName())},
200                 new String[] {new String(expectedType.shortReadableName())},
201                 returnStatement.sourceStart,
202                 returnStatement.sourceEnd);
203 }
204 public void attemptToReturnVoidValue(ReturnStatement returnStatement) {
205         this.handle(
206                 IProblem.MethodReturnsVoid,
207                 NoArgument,
208                 NoArgument,
209                 returnStatement.sourceStart,
210                 returnStatement.sourceEnd);
211 }
212 public void bytecodeExceeds64KLimit(AbstractMethodDeclaration location) {
213         String[] arguments = new String[] {new String(location.selector), parametersAsString(location.binding)};
214         if (location.isConstructor()) {
215                 this.handle(
216                         IProblem.BytecodeExceeds64KLimitForConstructor,
217                         arguments,
218                         arguments,
219                         Error | Abort,
220                         location.sourceStart,
221                         location.sourceEnd);
222         } else {
223                 this.handle(
224                         IProblem.BytecodeExceeds64KLimit,
225                         arguments,
226                         arguments,
227                         Error | Abort,
228                         location.sourceStart,
229                         location.sourceEnd);
230         }
231 }
232 public void bytecodeExceeds64KLimit(TypeDeclaration location) {
233         this.handle(
234                 IProblem.BytecodeExceeds64KLimitForClinit,
235                 NoArgument,
236                 NoArgument,
237                 Error | Abort,
238                 location.sourceStart,
239                 location.sourceEnd);
240 }
241 public void cannotAllocateVoidArray(Expression expression) {
242         this.handle(
243                 IProblem.CannotAllocateVoidArray,
244                 NoArgument,
245                 NoArgument,
246                 expression.sourceStart,
247                 expression.sourceEnd);
248 }
249 public void cannotAssignToFinalField(FieldBinding field, ASTNode location) {
250         this.handle(
251                 IProblem.FinalFieldAssignment,
252                 new String[] {
253                         (field.declaringClass == null ? "array" : new String(field.declaringClass.readableName())), //$NON-NLS-1$
254                         new String(field.readableName())},
255                 new String[] {
256                         (field.declaringClass == null ? "array" : new String(field.declaringClass.shortReadableName())), //$NON-NLS-1$
257                         new String(field.shortReadableName())},
258                 location.sourceStart,
259                 location.sourceEnd);
260 }
261 public void cannotAssignToFinalLocal(LocalVariableBinding local, ASTNode location) {
262         String[] arguments = new String[] { new String(local.readableName())};
263         this.handle(
264                 IProblem.NonBlankFinalLocalAssignment,
265                 arguments,
266                 arguments,
267                 location.sourceStart,
268                 location.sourceEnd);
269 }
270 public void cannotAssignToFinalOuterLocal(LocalVariableBinding local, ASTNode location) {
271         String[] arguments = new String[] {new String(local.readableName())};
272         this.handle(
273                 IProblem.FinalOuterLocalAssignment,
274                 arguments,
275                 arguments,
276                 location.sourceStart,
277                 location.sourceEnd);
278 }
279 public void cannotDeclareLocalInterface(char[] interfaceName, int sourceStart, int sourceEnd) {
280         String[] arguments = new String[] {new String(interfaceName)};
281         this.handle(
282                 IProblem.CannotDefineInterfaceInLocalType,
283                 arguments,
284                 arguments,
285                 sourceStart,
286                 sourceEnd);
287 }
288 public void cannotDefineDimensionsAndInitializer(ArrayAllocationExpression expresssion) {
289         this.handle(
290                 IProblem.CannotDefineDimensionExpressionsWithInit,
291                 NoArgument,
292                 NoArgument,
293                 expresssion.sourceStart,
294                 expresssion.sourceEnd);
295 }
296 public void cannotDireclyInvokeAbstractMethod(MessageSend messageSend, MethodBinding method) {
297         this.handle(
298                 IProblem.DirectInvocationOfAbstractMethod,
299                 new String[] {new String(method.declaringClass.readableName()), new String(method.selector), parametersAsString(method)},
300                 new String[] {new String(method.declaringClass.shortReadableName()), new String(method.selector), parametersAsShortString(method)},
301                 messageSend.sourceStart,
302                 messageSend.sourceEnd);
303 }
304 public void cannotImportPackage(ImportReference importRef) {
305         String[] arguments = new String[] {CharOperation.toString(importRef.tokens)};
306         this.handle(
307                 IProblem.CannotImportPackage,
308                 arguments,
309                 arguments,
310                 importRef.sourceStart,
311                 importRef.sourceEnd);
312 }
313 public void cannotInstantiate(TypeReference typeRef, TypeBinding type) {
314         this.handle(
315                 IProblem.InvalidClassInstantiation,
316                 new String[] {new String(type.readableName())},
317                 new String[] {new String(type.shortReadableName())},
318                 typeRef.sourceStart,
319                 typeRef.sourceEnd);
320 }
321 public void cannotReferToNonFinalOuterLocal(LocalVariableBinding local, ASTNode location) {
322         String[] arguments =new String[]{ new String(local.readableName())};
323         this.handle(
324                 IProblem.OuterLocalMustBeFinal,
325                 arguments,
326                 arguments,
327                 location.sourceStart,
328                 location.sourceEnd);
329 }
330 public void cannotReturnInInitializer(ASTNode location) {
331         this.handle(
332                 IProblem.CannotReturnInInitializer,
333                 NoArgument,
334                 NoArgument,
335                 location.sourceStart,
336                 location.sourceEnd);
337 }
338 public void cannotThrowNull(ThrowStatement statement) {
339         this.handle(
340                 IProblem.CannotThrowNull,
341                 NoArgument,
342                 NoArgument,
343                 statement.sourceStart,
344                 statement.sourceEnd);
345 }
346 public void cannotThrowType(SourceTypeBinding type, AbstractMethodDeclaration methodDecl, TypeReference exceptionType, TypeBinding expectedType) {
347         this.handle(
348                 IProblem.CannotThrowType,
349                 new String[] {new String(expectedType.readableName())},
350                 new String[] {new String(expectedType.shortReadableName())},
351                 exceptionType.sourceStart,
352                 exceptionType.sourceEnd);
353 }
354 public void cannotUseSuperInJavaLangObject(ASTNode reference) {
355         this.handle(
356                 IProblem.ObjectHasNoSuperclass,
357                 NoArgument,
358                 NoArgument,
359                 reference.sourceStart,
360                 reference.sourceEnd);
361 }
362 public void cannotUseSuperInCodeSnippet(int start, int end) {
363         this.handle(
364                 IProblem.CannotUseSuperInCodeSnippet,
365                 NoArgument,
366                 NoArgument,
367                 Error | Abort,
368                 start,
369                 end);
370 }
371 public void caseExpressionMustBeConstant(Expression expression) {
372         this.handle(
373                 IProblem.NonConstantExpression,
374                 NoArgument,
375                 NoArgument,
376                 expression.sourceStart,
377                 expression.sourceEnd);
378 }
379 public void classExtendFinalClass(SourceTypeBinding type, TypeReference superclass, TypeBinding expectedType) {
380         String name = new String(type.sourceName());
381         String expectedFullName = new String(expectedType.readableName());
382         String expectedShortName = new String(expectedType.shortReadableName());
383         if (expectedShortName.equals(name)) expectedShortName = expectedFullName;
384         this.handle(
385                 IProblem.ClassExtendFinalClass,
386                 new String[] {expectedFullName, name},
387                 new String[] {expectedShortName, name},
388                 superclass.sourceStart,
389                 superclass.sourceEnd);
390 }
391 public void codeSnippetMissingClass(String missing, int start, int end) {
392         String[] arguments = new String[]{missing};
393         this.handle(
394                 IProblem.CodeSnippetMissingClass,
395                 arguments,
396                 arguments,
397                 Error | Abort,
398                 start,
399                 end);
400 }
401 public void codeSnippetMissingMethod(String className, String missingMethod, String argumentTypes, int start, int end) {
402         String[] arguments = new String[]{ className, missingMethod, argumentTypes };
403         this.handle(
404                 IProblem.CodeSnippetMissingMethod,
405                 arguments,
406                 arguments,
407                 Error | Abort,
408                 start,
409                 end);
410 }
411 /*
412  * Given the current configuration, answers which category the problem
413  * falls into:
414  *              Error | Warning | Ignore
415  */
416 public int computeSeverity(int problemId){
417
418         // severity can have been preset on the problem
419 //      if ((problem.severity & Fatal) != 0){
420 //              return Error;
421 //      }
422
423         // if not then check whether it is a configurable problem
424         switch(problemId){
425
426                 case IProblem.MaskedCatch : 
427                         return this.options.getSeverity(CompilerOptions.MaskedCatchBlock);
428
429                 case IProblem.UnusedImport :
430                         return this.options.getSeverity(CompilerOptions.UnusedImport);
431                         
432                 case IProblem.MethodButWithConstructorName :
433                         return this.options.getSeverity(CompilerOptions.MethodWithConstructorName);
434                 
435                 case IProblem.OverridingNonVisibleMethod :
436                         return this.options.getSeverity(CompilerOptions.OverriddenPackageDefaultMethod);
437
438                 case IProblem.IncompatibleReturnTypeForNonInheritedInterfaceMethod :
439                 case IProblem.IncompatibleExceptionInThrowsClauseForNonInheritedInterfaceMethod :
440                         return this.options.getSeverity(CompilerOptions.IncompatibleNonInheritedInterfaceMethod);
441
442                 case IProblem.OverridingDeprecatedMethod :                              
443                 case IProblem.UsingDeprecatedType :                             
444                 case IProblem.UsingDeprecatedMethod :
445                 case IProblem.UsingDeprecatedConstructor :
446                 case IProblem.UsingDeprecatedField :
447                         return this.options.getSeverity(CompilerOptions.UsingDeprecatedAPI);
448                 
449                 case IProblem.LocalVariableIsNeverUsed :
450                         return this.options.getSeverity(CompilerOptions.UnusedLocalVariable);
451                 
452                 case IProblem.ArgumentIsNeverUsed :
453                         return this.options.getSeverity(CompilerOptions.UnusedArgument);
454
455                 case IProblem.NoImplicitStringConversionForCharArrayExpression :
456                         return this.options.getSeverity(CompilerOptions.NoImplicitStringConversion);
457
458                 case IProblem.NeedToEmulateFieldReadAccess :
459                 case IProblem.NeedToEmulateFieldWriteAccess :
460                 case IProblem.NeedToEmulateMethodAccess :
461                 case IProblem.NeedToEmulateConstructorAccess :                  
462                         return this.options.getSeverity(CompilerOptions.AccessEmulation);
463
464                 case IProblem.NonExternalizedStringLiteral :
465                         return this.options.getSeverity(CompilerOptions.NonExternalizedString);
466
467                 case IProblem.UseAssertAsAnIdentifier :
468                         return this.options.getSeverity(CompilerOptions.AssertUsedAsAnIdentifier);
469
470                 case IProblem.NonStaticAccessToStaticMethod :
471                 case IProblem.NonStaticAccessToStaticField :
472                         return this.options.getSeverity(CompilerOptions.NonStaticAccessToStatic);
473
474                 case IProblem.IndirectAccessToStaticMethod :
475                 case IProblem.IndirectAccessToStaticField :
476                 case IProblem.IndirectAccessToStaticType :
477                         return this.options.getSeverity(CompilerOptions.IndirectStaticAccess);
478
479                 case IProblem.AssignmentHasNoEffect:
480                         return this.options.getSeverity(CompilerOptions.NoEffectAssignment);
481
482                 case IProblem.UnusedPrivateConstructor:
483                 case IProblem.UnusedPrivateMethod:
484                 case IProblem.UnusedPrivateField:
485                 case IProblem.UnusedPrivateType:
486                         return this.options.getSeverity(CompilerOptions.UnusedPrivateMember);
487
488                 case IProblem.Task :
489                         return Warning;                 
490
491                 case IProblem.LocalVariableHidingLocalVariable:
492                 case IProblem.LocalVariableHidingField:
493                 case IProblem.ArgumentHidingLocalVariable:
494                 case IProblem.ArgumentHidingField:
495                         return this.options.getSeverity(CompilerOptions.LocalVariableHiding);
496
497                 case IProblem.FieldHidingLocalVariable:
498                 case IProblem.FieldHidingField:
499                         return this.options.getSeverity(CompilerOptions.FieldHiding);
500
501                 case IProblem.PossibleAccidentalBooleanAssignment:
502                         return this.options.getSeverity(CompilerOptions.AccidentalBooleanAssign);
503
504                 case IProblem.SuperfluousSemicolon:
505                 case IProblem.EmptyControlFlowStatement:
506                         return this.options.getSeverity(CompilerOptions.EmptyStatement);
507
508                 case IProblem.UndocumentedEmptyBlock:
509                         return this.options.getSeverity(CompilerOptions.UndocumentedEmptyBlock);
510                         
511                 case IProblem.UnnecessaryCast:
512                 case IProblem.UnnecessaryArgumentCast:
513                 case IProblem.UnnecessaryInstanceof:
514                         return this.options.getSeverity(CompilerOptions.UnnecessaryTypeCheck);
515                         
516                 case IProblem.FinallyMustCompleteNormally:
517                         return this.options.getSeverity(CompilerOptions.FinallyBlockNotCompleting);
518                         
519                 case IProblem.UnusedMethodDeclaredThrownException:
520                 case IProblem.UnusedConstructorDeclaredThrownException:
521                         return this.options.getSeverity(CompilerOptions.UnusedDeclaredThrownException);
522
523                 case IProblem.UnqualifiedFieldAccess:
524                         return this.options.getSeverity(CompilerOptions.UnqualifiedFieldAccess);
525                 
526                 case IProblem.UnnecessaryElse:
527                         return this.options.getSeverity(CompilerOptions.UnnecessaryElse);
528
529                 /*
530                  * Javadoc syntax errors
531                  */
532                 // Javadoc explicit IDs
533                 case IProblem.JavadocUnexpectedTag:
534                 case IProblem.JavadocDuplicateReturnTag:
535                 case IProblem.JavadocInvalidThrowsClass:
536                 case IProblem.JavadocInvalidSeeReference:
537                 case IProblem.JavadocMalformedSeeReference:
538                 case IProblem.JavadocInvalidSeeHref:
539                 case IProblem.JavadocInvalidSeeArgs:
540                 case IProblem.JavadocInvalidTag:
541                 case IProblem.JavadocUnterminatedInlineTag:
542                         if (this.options.docCommentSupport) {
543                                 return this.options.getSeverity(CompilerOptions.InvalidJavadoc);
544                         } else {
545                                 return ProblemSeverities.Ignore;
546                         }
547
548                 /*
549                  * Javadoc tags resolved references errors
550                  */
551                 case IProblem.JavadocInvalidParamName:
552                 case IProblem.JavadocDuplicateParamName:
553                 case IProblem.JavadocMissingParamName:
554                 case IProblem.JavadocInvalidThrowsClassName:
555                 case IProblem.JavadocDuplicateThrowsClassName:
556                 case IProblem.JavadocMissingThrowsClassName:
557                 case IProblem.JavadocMissingSeeReference:
558                 case IProblem.JavadocUsingDeprecatedField:
559                 case IProblem.JavadocUsingDeprecatedConstructor:
560                 case IProblem.JavadocUsingDeprecatedMethod:
561                 case IProblem.JavadocUsingDeprecatedType:
562                 case IProblem.JavadocUndefinedField:
563                 case IProblem.JavadocNotVisibleField:
564                 case IProblem.JavadocAmbiguousField:
565                 case IProblem.JavadocUndefinedConstructor:
566                 case IProblem.JavadocNotVisibleConstructor:
567                 case IProblem.JavadocAmbiguousConstructor:
568                 case IProblem.JavadocUndefinedMethod:
569                 case IProblem.JavadocNotVisibleMethod:
570                 case IProblem.JavadocAmbiguousMethod:
571                 case IProblem.JavadocAmbiguousMethodReference:
572                 case IProblem.JavadocParameterMismatch:
573                 case IProblem.JavadocUndefinedType:
574                 case IProblem.JavadocNotVisibleType:
575                 case IProblem.JavadocAmbiguousType:
576                 case IProblem.JavadocInternalTypeNameProvided:
577                 case IProblem.JavadocNoMessageSendOnArrayType:
578                 case IProblem.JavadocNoMessageSendOnBaseType:
579                 case IProblem.JavadocInheritedMethodHidesEnclosingName:
580                 case IProblem.JavadocInheritedFieldHidesEnclosingName:
581                 case IProblem.JavadocInheritedNameHidesEnclosingTypeName:
582                         if (this.options.docCommentSupport && this.options.reportInvalidJavadocTags) {
583                                 return this.options.getSeverity(CompilerOptions.InvalidJavadoc);
584                         } else {
585                                 return ProblemSeverities.Ignore;
586                         }
587
588                 /*
589                  * Javadoc missing tags errors
590                  */
591                 case IProblem.JavadocMissingParamTag:
592                 case IProblem.JavadocMissingReturnTag:
593                 case IProblem.JavadocMissingThrowsTag:
594                         if (this.options.docCommentSupport) {
595                                 return this.options.getSeverity(CompilerOptions.MissingJavadocTags);
596                         } else {
597                                 return ProblemSeverities.Ignore;
598                         }
599
600                 /*
601                  * Missing Javadoc errors
602                  */
603                 case IProblem.JavadocMissing:
604                         if (this.options.docCommentSupport) {
605                                 return this.options.getSeverity(CompilerOptions.MissingJavadocComments);
606                         } else {
607                                 return ProblemSeverities.Ignore;
608                         }
609
610                 // by default problems are errors.
611                 default:
612                         return Error;
613         }
614 }
615 public void conditionalArgumentsIncompatibleTypes(ConditionalExpression expression, TypeBinding trueType, TypeBinding falseType) {
616         this.handle(
617                 IProblem.IncompatibleTypesInConditionalOperator,
618                 new String[] {new String(trueType.readableName()), new String(falseType.readableName())},
619                 new String[] {new String(trueType.sourceName()), new String(falseType.sourceName())},
620                 expression.sourceStart,
621                 expression.sourceEnd);
622 }
623 public void conflictingImport(ImportReference importRef) {
624         String[] arguments = new String[] {CharOperation.toString(importRef.tokens)};
625         this.handle(
626                 IProblem.ConflictingImport,
627                 arguments,
628                 arguments,
629                 importRef.sourceStart,
630                 importRef.sourceEnd);
631 }
632 public void constantOutOfFormat(NumberLiteral literal) {
633         // the literal is not in a correct format
634         // this code is called on IntLiteral and LongLiteral 
635         // example 000811 ...the 8 is uncorrect.
636
637         if ((literal instanceof LongLiteral) || (literal instanceof IntLiteral)) {
638                 char[] source = literal.source();
639                 try {
640                         final String Radix;
641                         final int radix;
642                         if ((source[1] == 'x') || (source[1] == 'X')) {
643                                 radix = 16;
644                                 Radix = "Hex"; //$NON-NLS-1$
645                         } else {
646                                 radix = 8;
647                                 Radix = "Octal"; //$NON-NLS-1$
648                         }
649                         //look for the first digit that is incorrect
650                         int place = -1;
651                         label : for (int i = radix == 8 ? 1 : 2; i < source.length; i++) {
652                                 if (Character.digit(source[i], radix) == -1) {
653                                         place = i;
654                                         break label;
655                                 }
656                         }
657                         String[] arguments = new String[] {
658                                 new String(literal.literalType(null).readableName()), // numeric literals do not need scope to reach type
659                                 Radix + " " + new String(source) + " (digit " + new String(new char[] {source[place]}) + ")"}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
660
661                         this.handle(
662                                 IProblem.NumericValueOutOfRange,
663                                 arguments,
664                                 arguments,
665                                 literal.sourceStart,
666                                 literal.sourceEnd);
667                         return;
668                 } catch (IndexOutOfBoundsException ex) {
669                         // should never happen
670                 }
671         
672                 // just in case .... use a predefined error..
673                 // we should never come here...(except if the code changes !)
674                 this.constantOutOfRange(literal, literal.literalType(null)); // numeric literals do not need scope to reach type
675         }
676 }
677 public void constantOutOfRange(Literal literal, TypeBinding literalType) {
678         String[] arguments = new String[] {new String(literalType.readableName()), new String(literal.source())};
679         this.handle(
680                 IProblem.NumericValueOutOfRange,
681                 arguments,
682                 arguments,
683                 literal.sourceStart,
684                 literal.sourceEnd);
685 }
686 public void deprecatedField(FieldBinding field, ASTNode location) {
687         this.handle(
688                 IProblem.UsingDeprecatedField,
689                 new String[] {new String(field.declaringClass.readableName()), new String(field.name)},
690                 new String[] {new String(field.declaringClass.shortReadableName()), new String(field.name)},
691                 location.sourceStart,
692                 location.sourceEnd);
693 }
694 public void deprecatedMethod(MethodBinding method, ASTNode location) {
695         if (method.isConstructor()) {
696                 this.handle(
697                         IProblem.UsingDeprecatedConstructor,
698                         new String[] {new String(method.declaringClass.readableName()), parametersAsString(method)},
699                         new String[] {new String(method.declaringClass.shortReadableName()), parametersAsShortString(method)},
700                         location.sourceStart,
701                         location.sourceEnd);
702         } else {
703                 this.handle(
704                         IProblem.UsingDeprecatedMethod,
705                         new String[] {new String(method.declaringClass.readableName()), new String(method.selector), parametersAsString(method)},
706                         new String[] {new String(method.declaringClass.shortReadableName()), new String(method.selector), parametersAsShortString(method)},
707                         location.sourceStart,
708                         location.sourceEnd);
709         }
710 }
711 public void deprecatedType(TypeBinding type, ASTNode location) {
712         if (location == null) return; // 1G828DN - no type ref for synthetic arguments
713         this.handle(
714                 IProblem.UsingDeprecatedType,
715                 new String[] {new String(type.readableName())},
716                 new String[] {new String(type.shortReadableName())},
717                 location.sourceStart,
718                 location.sourceEnd);
719 }
720 public void duplicateCase(CaseStatement caseStatement) {
721         this.handle(
722                 IProblem.DuplicateCase,
723                 NoArgument,
724                 NoArgument,
725                 caseStatement.sourceStart,
726                 caseStatement.sourceEnd);
727 }
728 public void duplicateDefaultCase(ASTNode statement) {
729         this.handle(
730                 IProblem.DuplicateDefaultCase,
731                 NoArgument,
732                 NoArgument,
733                 statement.sourceStart,
734                 statement.sourceEnd);
735 }
736 public void duplicateFieldInType(SourceTypeBinding type, FieldDeclaration fieldDecl) {
737         this.handle(
738                 IProblem.DuplicateField,
739                 new String[] {new String(type.sourceName()), new String(fieldDecl.name)},
740                 new String[] {new String(type.shortReadableName()), new String(fieldDecl.name)},
741                 fieldDecl.sourceStart,
742                 fieldDecl.sourceEnd);
743 }
744 public void duplicateImport(ImportReference importRef) {
745         String[] arguments = new String[] {CharOperation.toString(importRef.tokens)};
746         this.handle(
747                 IProblem.DuplicateImport,
748                 arguments,
749                 arguments,
750                 importRef.sourceStart,
751                 importRef.sourceEnd);
752 }
753 public void duplicateInitializationOfBlankFinalField(FieldBinding field, Reference reference) {
754         String[] arguments = new String[]{ new String(field.readableName())};
755         this.handle(
756                 IProblem.DuplicateBlankFinalFieldInitialization,
757                 arguments,
758                 arguments,
759                 reference.sourceStart,
760                 reference.sourceEnd);
761 }
762 public void duplicateInitializationOfFinalLocal(LocalVariableBinding local, ASTNode location) {
763         String[] arguments = new String[] { new String(local.readableName())};
764         this.handle(
765                 IProblem.DuplicateFinalLocalInitialization,
766                 arguments,
767                 arguments,
768                 location.sourceStart,
769                 location.sourceEnd);
770 }
771 public void duplicateMethodInType(SourceTypeBinding type, AbstractMethodDeclaration methodDecl) {
772         String[] arguments = new String[] {new String(methodDecl.selector), new String(type.sourceName())};
773         this.handle(
774                 IProblem.DuplicateMethod,
775                 arguments,
776                 arguments,
777                 methodDecl.sourceStart,
778                 methodDecl.sourceEnd);
779 }
780 public void duplicateModifierForField(ReferenceBinding type, FieldDeclaration fieldDecl) {
781 /* to highlight modifiers use:
782         this.handle(
783                 new Problem(
784                         DuplicateModifierForField,
785                         new String[] {new String(fieldDecl.name)},
786                         fieldDecl.modifiers.sourceStart,
787                         fieldDecl.modifiers.sourceEnd));
788 */
789         String[] arguments = new String[] {new String(fieldDecl.name)};
790         this.handle(
791                 IProblem.DuplicateModifierForField,
792                 arguments,
793                 arguments,
794                 fieldDecl.sourceStart,
795                 fieldDecl.sourceEnd);
796 }
797 public void duplicateModifierForMethod(ReferenceBinding type, AbstractMethodDeclaration methodDecl) {
798         this.handle(
799                 IProblem.DuplicateModifierForMethod,
800                 new String[] {new String(type.sourceName()), new String(methodDecl.selector)},
801                 new String[] {new String(type.shortReadableName()), new String(methodDecl.selector)},
802                 methodDecl.sourceStart,
803                 methodDecl.sourceEnd);
804 }
805 public void duplicateModifierForType(SourceTypeBinding type) {
806         String[] arguments = new String[] {new String(type.sourceName())};
807         this.handle(
808                 IProblem.DuplicateModifierForType,
809                 arguments,
810                 arguments,
811                 type.sourceStart(),
812                 type.sourceEnd());
813 }
814 public void duplicateModifierForVariable(LocalDeclaration localDecl, boolean complainForArgument) {
815         String[] arguments = new String[] {new String(localDecl.name)};
816         this.handle(
817                 complainForArgument
818                         ? IProblem.DuplicateModifierForArgument 
819                         : IProblem.DuplicateModifierForVariable,
820                 arguments,
821                 arguments,
822                 localDecl.sourceStart,
823                 localDecl.sourceEnd);
824 }
825 public void duplicateNestedType(TypeDeclaration typeDecl) {
826         String[] arguments = new String[] {new String(typeDecl.name)};
827         this.handle(
828                 IProblem.DuplicateNestedType,
829                 arguments,
830                 arguments,
831                 typeDecl.sourceStart,
832                 typeDecl.sourceEnd);
833 }
834 public void duplicateSuperinterface(SourceTypeBinding type, TypeDeclaration typeDecl, ReferenceBinding superType) {
835         this.handle(
836                 IProblem.DuplicateSuperInterface,
837                 new String[] {
838                         new String(superType.readableName()),
839                         new String(type.sourceName())},
840                 new String[] {
841                         new String(superType.shortReadableName()),
842                         new String(type.sourceName())},
843                 typeDecl.sourceStart,
844                 typeDecl.sourceEnd);
845 }
846 public void duplicateTypes(CompilationUnitDeclaration compUnitDecl, TypeDeclaration typeDecl) {
847         String[] arguments = new String[] {new String(compUnitDecl.getFileName()), new String(typeDecl.name)};
848         this.referenceContext = typeDecl; // report the problem against the type not the entire compilation unit
849         this.handle(
850                 IProblem.DuplicateTypes,
851                 arguments,
852                 arguments,
853                 typeDecl.sourceStart,
854                 typeDecl.sourceEnd,
855                 compUnitDecl.compilationResult);
856 }
857 public void emptyControlFlowStatement(int sourceStart, int sourceEnd) {
858         this.handle(
859                 IProblem.EmptyControlFlowStatement,
860                 NoArgument,
861                 NoArgument,
862                 sourceStart,
863                 sourceEnd);     
864 }
865 public void errorNoMethodFor(MessageSend messageSend, TypeBinding recType, TypeBinding[] params) {
866         StringBuffer buffer = new StringBuffer();
867         StringBuffer shortBuffer = new StringBuffer();
868         for (int i = 0, length = params.length; i < length; i++) {
869                 if (i != 0){
870                         buffer.append(", "); //$NON-NLS-1$
871                         shortBuffer.append(", "); //$NON-NLS-1$
872                 }
873                 buffer.append(new String(params[i].readableName()));
874                 shortBuffer.append(new String(params[i].shortReadableName()));
875         }
876
877         int id = recType.isArrayType() ? IProblem.NoMessageSendOnArrayType : IProblem.NoMessageSendOnBaseType;
878         /*
879         if ((messageSend.bits & ASTNode.InsideJavadoc) != 0) {
880                 id |= IProblem.Javadoc;
881                 if (!reportInvalidJavadocTagsVisibility()) return;
882         }
883         */
884         this.handle(
885                 id,
886                 new String[] {new String(recType.readableName()), new String(messageSend.selector), buffer.toString()},
887                 new String[] {new String(recType.shortReadableName()), new String(messageSend.selector), shortBuffer.toString()},
888                 messageSend.sourceStart,
889                 messageSend.sourceEnd);
890 }
891 public void errorThisSuperInStatic(ASTNode reference) {
892         String[] arguments = new String[] {reference.isSuper() ? "super" : "this"}; //$NON-NLS-2$ //$NON-NLS-1$
893         this.handle(
894                 IProblem.ThisInStaticContext,
895                 arguments,
896                 arguments,
897                 reference.sourceStart,
898                 reference.sourceEnd);
899 }
900 public void exceptionTypeProblem(SourceTypeBinding type, AbstractMethodDeclaration methodDecl, TypeReference exceptionType, TypeBinding expectedType) {
901         int problemId = expectedType.problemId();
902         int id;
903         switch (problemId) {
904                 case NotFound : // 1
905                         id = IProblem.ExceptionTypeNotFound;
906                         break;
907                 case NotVisible : // 2
908                         id = IProblem.ExceptionTypeNotVisible;
909                         break;
910                 case Ambiguous : // 3
911                         id = IProblem.ExceptionTypeAmbiguous;
912                         break;
913                 case InternalNameProvided : // 4
914                         id = IProblem.ExceptionTypeInternalNameProvided;
915                         break;
916                 case InheritedNameHidesEnclosingName : // 5
917                         id = IProblem.ExceptionTypeInheritedNameHidesEnclosingName;
918                         break;
919                 case NoError : // 0
920                 default :
921                         needImplementation(); // want to fail to see why we were here...
922                         return;
923         }
924         this.handle(
925                 id,
926                 new String[] {new String(methodDecl.selector), new String(expectedType.readableName())},
927                 new String[] {new String(methodDecl.selector), new String(expectedType.shortReadableName())},
928                 exceptionType.sourceStart,
929                 exceptionType.sourceEnd);
930 }
931 public void expressionShouldBeAVariable(Expression expression) {
932         this.handle(
933                 IProblem.ExpressionShouldBeAVariable,
934                 NoArgument,
935                 NoArgument,
936                 expression.sourceStart,
937                 expression.sourceEnd);
938 }
939 public void fieldHiding(FieldDeclaration fieldDecl, Binding hiddenVariable) {
940         FieldBinding field = fieldDecl.binding;
941         if (CharOperation.equals(TypeConstants.SERIALVERSIONUID, field.name)
942                         && field.isStatic()
943                         && field.isFinal()
944                         && BaseTypes.LongBinding == field.type) {
945                                 return; // do not report unused serialVersionUID field
946         }
947         if (CharOperation.equals(TypeConstants.SERIALPERSISTENTFIELDS, field.name)
948                         && field.isStatic()
949                         && field.isFinal()
950                         && field.type.dimensions() == 1
951                         && CharOperation.equals(TypeConstants.CharArray_JAVA_IO_OBJECTSTREAMFIELD, field.type.leafComponentType().readableName())) {
952                                 return; // do not report unused serialPersistentFields field
953         }
954         
955         if (hiddenVariable instanceof LocalVariableBinding) {
956                 this.handle(
957                         IProblem.FieldHidingLocalVariable,
958                         new String[] {new String(field.declaringClass.readableName()), new String(field.name) },
959                         new String[] {new String(field.declaringClass.shortReadableName()), new String(field.name) },
960                         fieldDecl.sourceStart,
961                         fieldDecl.sourceEnd);
962         } else if (hiddenVariable instanceof FieldBinding) {
963                 FieldBinding hiddenField = (FieldBinding) hiddenVariable;
964                 this.handle(
965                         IProblem.FieldHidingField,
966                         new String[] {new String(field.declaringClass.readableName()), new String(field.name) , new String(hiddenField.declaringClass.readableName())  },
967                         new String[] {new String(field.declaringClass.shortReadableName()), new String(field.name) , new String(hiddenField.declaringClass.shortReadableName()) },
968                         fieldDecl.sourceStart,
969                         fieldDecl.sourceEnd);
970         }
971 }
972 private int fieldLocation(FieldBinding field, ASTNode node) {
973         if (node instanceof QualifiedNameReference) {
974                 QualifiedNameReference ref = (QualifiedNameReference) node;
975                 FieldBinding[] bindings = ref.otherBindings;
976                 if (bindings != null)
977                         for (int i = bindings.length; --i >= 0;)
978                                 if (bindings[i] == field)
979                                         return (int) ref.sourcePositions[i + 1]; // first position is for the primary field
980         }
981         return node.sourceEnd;
982 }
983 public void fieldsOrThisBeforeConstructorInvocation(ThisReference reference) {
984         this.handle(
985                 IProblem.ThisSuperDuringConstructorInvocation,
986                 NoArgument,
987                 NoArgument,
988                 reference.sourceStart,
989                 reference.sourceEnd);
990 }
991 public void fieldTypeProblem(SourceTypeBinding type, FieldDeclaration fieldDecl, TypeBinding expectedType) {
992         int problemId = expectedType.problemId();
993         int id;
994         switch (problemId) {
995                 case NotFound : // 1
996                         id = IProblem.FieldTypeNotFound;
997                         break;
998                 case NotVisible : // 2
999                         id = IProblem.FieldTypeNotVisible;
1000                         break;
1001                 case Ambiguous : // 3
1002                         id = IProblem.FieldTypeAmbiguous;
1003                         break;
1004                 case InternalNameProvided : // 4
1005                         id = IProblem.FieldTypeInternalNameProvided;
1006                         break;
1007                 case InheritedNameHidesEnclosingName : // 5
1008                         id = IProblem.FieldTypeInheritedNameHidesEnclosingName;
1009                         break;
1010                 case NoError : // 0
1011                 default :
1012                         needImplementation(); // want to fail to see why we were here...
1013                         return;
1014         }
1015         this.handle(
1016                 id,
1017                 new String[] {new String(fieldDecl.name), new String(type.sourceName()), new String(expectedType.readableName())},
1018                 new String[] {new String(fieldDecl.name), new String(type.sourceName()), new String(expectedType.shortReadableName())},
1019                 fieldDecl.type.sourceStart,
1020                 fieldDecl.type.sourceEnd);
1021 }
1022 public void finallyMustCompleteNormally(Block finallyBlock) {
1023         this.handle(
1024                 IProblem.FinallyMustCompleteNormally,
1025                 NoArgument,
1026                 NoArgument,
1027                 finallyBlock.sourceStart,
1028                 finallyBlock.sourceEnd);
1029 }
1030 public void finalMethodCannotBeOverridden(MethodBinding currentMethod, MethodBinding inheritedMethod) {
1031         this.handle(
1032                 // Cannot override the final method from %1
1033                 // 8.4.3.3 - Final methods cannot be overridden or hidden.
1034                 IProblem.FinalMethodCannotBeOverridden,
1035                 new String[] {new String(inheritedMethod.declaringClass.readableName())},
1036                 new String[] {new String(inheritedMethod.declaringClass.shortReadableName())},
1037                 currentMethod.sourceStart(),
1038                 currentMethod.sourceEnd());
1039 }
1040 public void forwardReference(Reference reference, int indexInQualification, TypeBinding type) {
1041         this.handle(
1042                 IProblem.ReferenceToForwardField,
1043                 NoArgument,
1044                 NoArgument,
1045                 reference.sourceStart,
1046                 reference.sourceEnd);
1047 }
1048 // use this private API when the compilation unit result can be found through the
1049 // reference context. Otherwise, use the other API taking a problem and a compilation result
1050 // as arguments
1051 private void handle(
1052         int problemId, 
1053         String[] problemArguments,
1054         String[] messageArguments,
1055         int problemStartPosition, 
1056         int problemEndPosition){
1057
1058         this.handle(
1059                         problemId,
1060                         problemArguments,
1061                         messageArguments,
1062                         problemStartPosition,
1063                         problemEndPosition,
1064                         this.referenceContext, 
1065                         this.referenceContext == null ? null : this.referenceContext.compilationResult()); 
1066         this.referenceContext = null;
1067 }
1068 // use this private API when the compilation unit result can be found through the
1069 // reference context. Otherwise, use the other API taking a problem and a compilation result
1070 // as arguments
1071 private void handle(
1072         int problemId, 
1073         String[] problemArguments,
1074         String[] messageArguments,
1075         int severity,
1076         int problemStartPosition, 
1077         int problemEndPosition){
1078
1079         this.handle(
1080                         problemId,
1081                         problemArguments,
1082                         messageArguments,
1083                         severity,
1084                         problemStartPosition,
1085                         problemEndPosition,
1086                         this.referenceContext, 
1087                         this.referenceContext == null ? null : this.referenceContext.compilationResult()); 
1088         this.referenceContext = null;
1089 }
1090 // use this private API when the compilation unit result cannot be found through the
1091 // reference context. 
1092
1093 private void handle(
1094         int problemId, 
1095         String[] problemArguments,
1096         String[] messageArguments,
1097         int problemStartPosition, 
1098         int problemEndPosition,
1099         CompilationResult unitResult){
1100
1101         this.handle(
1102                         problemId,
1103                         problemArguments,
1104                         messageArguments,
1105                         problemStartPosition,
1106                         problemEndPosition,
1107                         this.referenceContext, 
1108                         unitResult); 
1109         this.referenceContext = null;
1110 }
1111 public void hiddenCatchBlock(ReferenceBinding exceptionType, ASTNode location) {
1112         this.handle(
1113                 IProblem.MaskedCatch,
1114                 new String[] {
1115                         new String(exceptionType.readableName()),
1116                  }, 
1117                 new String[] {
1118                         new String(exceptionType.shortReadableName()),
1119                  }, 
1120                 location.sourceStart,
1121                 location.sourceEnd);
1122 }
1123 public void hidingEnclosingType(TypeDeclaration typeDecl) {
1124         String[] arguments = new String[] {new String(typeDecl.name)};
1125         this.handle(
1126                 IProblem.HidingEnclosingType,
1127                 arguments,
1128                 arguments,
1129                 typeDecl.sourceStart,
1130                 typeDecl.sourceEnd);
1131 }
1132 public void hierarchyCircularity(SourceTypeBinding sourceType, ReferenceBinding superType, TypeReference reference) {
1133         int start = 0;
1134         int end = 0;
1135         String typeName = ""; //$NON-NLS-1$
1136         String shortTypeName = ""; //$NON-NLS-1$
1137
1138         if (reference == null) {        // can only happen when java.lang.Object is busted
1139                 start = sourceType.sourceStart();
1140                 end = sourceType.sourceEnd();
1141                 typeName = new String(superType.readableName());
1142                 shortTypeName = new String(superType.sourceName());
1143         } else {
1144                 start = reference.sourceStart;
1145                 end = reference.sourceEnd;
1146                 char[][] qName = reference.getTypeName();
1147                 typeName = CharOperation.toString(qName);
1148                 shortTypeName = new String(qName[qName.length-1]);
1149         }
1150
1151         if (sourceType == superType)
1152                 this.handle(
1153                         IProblem.HierarchyCircularitySelfReference,
1154                         new String[] {new String(sourceType.sourceName()), typeName},
1155                         new String[] {new String(sourceType.sourceName()), shortTypeName},
1156                         start,
1157                         end);
1158         else
1159                 this.handle(
1160                         IProblem.HierarchyCircularity,
1161                         new String[] {new String(sourceType.sourceName()), typeName},
1162                         new String[] {new String(sourceType.sourceName()), shortTypeName},
1163                         start,
1164                         end);
1165 }
1166 public void hierarchyHasProblems(SourceTypeBinding type) {
1167         String[] arguments = new String[] {new String(type.sourceName())};
1168         this.handle(
1169                 IProblem.HierarchyHasProblems,
1170                 arguments,
1171                 arguments,
1172                 type.sourceStart(),
1173                 type.sourceEnd());
1174 }
1175 public void illegalAbstractModifierCombinationForMethod(ReferenceBinding type, AbstractMethodDeclaration methodDecl) {
1176         String[] arguments = new String[] {new String(type.sourceName()), new String(methodDecl.selector)};
1177         this.handle(
1178                 IProblem.IllegalAbstractModifierCombinationForMethod,
1179                 arguments,
1180                 arguments,
1181                 methodDecl.sourceStart,
1182                 methodDecl.sourceEnd);
1183 }
1184 public void illegalModifierCombinationFinalAbstractForClass(SourceTypeBinding type) {
1185         String[] arguments = new String[] {new String(type.sourceName())};
1186         this.handle(
1187                 IProblem.IllegalModifierCombinationFinalAbstractForClass,
1188                 arguments,
1189                 arguments,
1190                 type.sourceStart(),
1191                 type.sourceEnd());
1192 }
1193 public void illegalModifierCombinationFinalVolatileForField(ReferenceBinding type, FieldDeclaration fieldDecl) {
1194         String[] arguments = new String[] {new String(fieldDecl.name)};
1195
1196         this.handle(
1197                 IProblem.IllegalModifierCombinationFinalVolatileForField,
1198                 arguments,
1199                 arguments,
1200                 fieldDecl.sourceStart,
1201                 fieldDecl.sourceEnd);
1202 }
1203
1204 public void illegalModifierForClass(SourceTypeBinding type) {
1205         String[] arguments = new String[] {new String(type.sourceName())};
1206         this.handle(
1207                 IProblem.IllegalModifierForClass,
1208                 arguments,
1209                 arguments,
1210                 type.sourceStart(),
1211                 type.sourceEnd());
1212 }
1213 public void illegalModifierForField(ReferenceBinding type, FieldDeclaration fieldDecl) {
1214         String[] arguments = new String[] {new String(fieldDecl.name)};
1215         this.handle(
1216                 IProblem.IllegalModifierForField,
1217                 arguments,
1218                 arguments,
1219                 fieldDecl.sourceStart,
1220                 fieldDecl.sourceEnd);
1221 }
1222 public void illegalModifierForInterface(SourceTypeBinding type) {
1223         String[] arguments = new String[] {new String(type.sourceName())};
1224         this.handle(
1225                 IProblem.IllegalModifierForInterface,
1226                 arguments,
1227                 arguments,
1228                 type.sourceStart(),
1229                 type.sourceEnd());
1230 }
1231 public void illegalModifierForInterfaceField(ReferenceBinding type, FieldDeclaration fieldDecl) {
1232         String[] arguments = new String[] {new String(fieldDecl.name)};
1233         this.handle(
1234                 IProblem.IllegalModifierForInterfaceField,
1235                 arguments,
1236                 arguments,
1237                 fieldDecl.sourceStart,
1238                 fieldDecl.sourceEnd);
1239 }
1240 public void illegalModifierForInterfaceMethod(ReferenceBinding type, AbstractMethodDeclaration methodDecl) {
1241         String[] arguments = new String[] {new String(type.sourceName()), new String(methodDecl.selector)};
1242         this.handle(
1243                 IProblem.IllegalModifierForInterfaceMethod,
1244                 arguments,
1245                 arguments,
1246                 methodDecl.sourceStart,
1247                 methodDecl.sourceEnd);
1248 }
1249 public void illegalModifierForLocalClass(SourceTypeBinding type) {
1250         String[] arguments = new String[] {new String(type.sourceName())};
1251         this.handle(
1252                 IProblem.IllegalModifierForLocalClass,
1253                 arguments,
1254                 arguments,
1255                 type.sourceStart(),
1256                 type.sourceEnd());
1257 }
1258 public void illegalModifierForMemberClass(SourceTypeBinding type) {
1259         String[] arguments = new String[] {new String(type.sourceName())};
1260         this.handle(
1261                 IProblem.IllegalModifierForMemberClass,
1262                 arguments,
1263                 arguments,
1264                 type.sourceStart(),
1265                 type.sourceEnd());
1266 }
1267 public void illegalModifierForMemberInterface(SourceTypeBinding type) {
1268         String[] arguments = new String[] {new String(type.sourceName())};
1269         this.handle(
1270                 IProblem.IllegalModifierForMemberInterface,
1271                 arguments,
1272                 arguments,
1273                 type.sourceStart(),
1274                 type.sourceEnd());
1275 }
1276 public void illegalModifierForMethod(ReferenceBinding type, AbstractMethodDeclaration methodDecl) {
1277         String[] arguments = new String[] {new String(type.sourceName()), new String(methodDecl.selector)};
1278         this.handle(
1279                 IProblem.IllegalModifierForMethod,
1280                 arguments,
1281                 arguments,
1282                 methodDecl.sourceStart,
1283                 methodDecl.sourceEnd);
1284 }
1285 public void illegalModifierForVariable(LocalDeclaration localDecl, boolean complainAsArgument) {
1286         String[] arguments = new String[] {new String(localDecl.name)};
1287         this.handle(
1288                 complainAsArgument
1289                         ? IProblem.IllegalModifierForArgument
1290                         : IProblem.IllegalModifierForVariable,
1291                 arguments,
1292                 arguments,
1293                 localDecl.sourceStart,
1294                 localDecl.sourceEnd);
1295 }
1296 public void illegalPrimitiveOrArrayTypeForEnclosingInstance(TypeBinding enclosingType, ASTNode location) {
1297         this.handle(
1298                 IProblem.IllegalPrimitiveOrArrayTypeForEnclosingInstance,
1299                 new String[] {new String(enclosingType.readableName())},
1300                 new String[] {new String(enclosingType.shortReadableName())},
1301                 location.sourceStart,
1302                 location.sourceEnd);
1303 }
1304 public void illegalStaticModifierForMemberType(SourceTypeBinding type) {
1305         String[] arguments = new String[] {new String(type.sourceName())};
1306         this.handle(
1307                 IProblem.IllegalStaticModifierForMemberType,
1308                 arguments,
1309                 arguments,
1310                 type.sourceStart(),
1311                 type.sourceEnd());
1312 }
1313 public void illegalVisibilityModifierCombinationForField(ReferenceBinding type, FieldDeclaration fieldDecl) {
1314         String[] arguments = new String[] {new String(fieldDecl.name)};
1315         this.handle(
1316                 IProblem.IllegalVisibilityModifierCombinationForField,
1317                 arguments,
1318                 arguments,
1319                 fieldDecl.sourceStart,
1320                 fieldDecl.sourceEnd);
1321 }
1322 public void illegalVisibilityModifierCombinationForMemberType(SourceTypeBinding type) {
1323         String[] arguments = new String[] {new String(type.sourceName())};
1324         this.handle(
1325                 IProblem.IllegalVisibilityModifierCombinationForMemberType,
1326                 arguments,
1327                 arguments,
1328                 type.sourceStart(),
1329                 type.sourceEnd());
1330 }
1331 public void illegalVisibilityModifierCombinationForMethod(ReferenceBinding type, AbstractMethodDeclaration methodDecl) {
1332         String[] arguments = new String[] {new String(type.sourceName()), new String(methodDecl.selector)};
1333         this.handle(
1334                 IProblem.IllegalVisibilityModifierCombinationForMethod,
1335                 arguments,
1336                 arguments,
1337                 methodDecl.sourceStart,
1338                 methodDecl.sourceEnd);
1339 }
1340 public void illegalVisibilityModifierForInterfaceMemberType(SourceTypeBinding type) {
1341         String[] arguments = new String[] {new String(type.sourceName())};
1342         this.handle(
1343                 IProblem.IllegalVisibilityModifierForInterfaceMemberType,
1344                 arguments,
1345                 arguments,
1346                 type.sourceStart(),
1347                 type.sourceEnd());
1348 }
1349 public void illegalVoidExpression(ASTNode location) {
1350         this.handle(
1351                 IProblem.InvalidVoidExpression,
1352                 NoArgument,
1353                 NoArgument,
1354                 location.sourceStart,
1355                 location.sourceEnd);
1356 }
1357 public void importProblem(ImportReference importRef, Binding expectedImport) {
1358         int problemId = expectedImport.problemId();
1359         int id;
1360         switch (problemId) {
1361                 case NotFound : // 1
1362                         id = IProblem.ImportNotFound;
1363                         break;
1364                 case NotVisible : // 2
1365                         id = IProblem.ImportNotVisible;
1366                         break;
1367                 case Ambiguous : // 3
1368                         id = IProblem.ImportAmbiguous;
1369                         break;
1370                 case InternalNameProvided : // 4
1371                         id = IProblem.ImportInternalNameProvided;
1372                         break;
1373                 case InheritedNameHidesEnclosingName : // 5
1374                         id = IProblem.ImportInheritedNameHidesEnclosingName;
1375                         break;
1376                 case NoError : // 0
1377                 default :
1378                         needImplementation(); // want to fail to see why we were here...
1379                         return;
1380         }
1381         char[][] tokens = expectedImport instanceof ProblemReferenceBinding
1382                 ? ((ProblemReferenceBinding) expectedImport).compoundName
1383                 : importRef.tokens;
1384         String[] arguments = new String[]{CharOperation.toString(tokens)};
1385         this.handle(id, arguments, arguments, importRef.sourceStart, (int) importRef.sourcePositions[tokens.length - 1]);
1386 }
1387 public void incompatibleExceptionInThrowsClause(SourceTypeBinding type, MethodBinding currentMethod, MethodBinding inheritedMethod, ReferenceBinding exceptionType) {
1388         if (type == currentMethod.declaringClass) {
1389                 int id;
1390                 if (currentMethod.declaringClass.isInterface() 
1391                                 && !inheritedMethod.isPublic()){ // interface inheriting Object protected method
1392                         id = IProblem.IncompatibleExceptionInThrowsClauseForNonInheritedInterfaceMethod;
1393                 } else {
1394                         id = IProblem.IncompatibleExceptionInThrowsClause;
1395                 }
1396                 this.handle(
1397                         // Exception %1 is not compatible with throws clause in %2
1398                         // 9.4.4 - The type of exception in the throws clause is incompatible.
1399                         id,
1400                         new String[] {
1401                                 new String(exceptionType.sourceName()),
1402                                 new String(
1403                                         CharOperation.concat(
1404                                                 inheritedMethod.declaringClass.readableName(),
1405                                                 inheritedMethod.readableName(),
1406                                                 '.'))},
1407                         new String[] {
1408                                 new String(exceptionType.sourceName()),
1409                                 new String(
1410                                         CharOperation.concat(
1411                                                 inheritedMethod.declaringClass.shortReadableName(),
1412                                                 inheritedMethod.shortReadableName(),
1413                                                 '.'))},
1414                         currentMethod.sourceStart(),
1415                         currentMethod.sourceEnd());
1416         } else  
1417                 this.handle(
1418                         // Exception %1 in throws clause of %2 is not compatible with %3
1419                         // 9.4.4 - The type of exception in the throws clause is incompatible.
1420                         IProblem.IncompatibleExceptionInInheritedMethodThrowsClause,
1421                         new String[] {
1422                                 new String(exceptionType.sourceName()),
1423                                 new String(
1424                                         CharOperation.concat(
1425                                                 currentMethod.declaringClass.sourceName(),
1426                                                 currentMethod.readableName(),
1427                                                 '.')),
1428                                 new String(
1429                                         CharOperation.concat(
1430                                                 inheritedMethod.declaringClass.readableName(),
1431                                                 inheritedMethod.readableName(),
1432                                                 '.'))},
1433                         new String[] {
1434                                 new String(exceptionType.sourceName()),
1435                                 new String(
1436                                         CharOperation.concat(
1437                                                 currentMethod.declaringClass.sourceName(),
1438                                                 currentMethod.shortReadableName(),
1439                                                 '.')),
1440                                 new String(
1441                                         CharOperation.concat(
1442                                                 inheritedMethod.declaringClass.shortReadableName(),
1443                                                 inheritedMethod.shortReadableName(),
1444                                                 '.'))},
1445                         type.sourceStart(),
1446                         type.sourceEnd());
1447 }
1448 public void incompatibleReturnType(MethodBinding currentMethod, MethodBinding inheritedMethod) {
1449         StringBuffer methodSignature = new StringBuffer();
1450         methodSignature
1451                 .append(inheritedMethod.declaringClass.readableName())
1452                 .append('.')
1453                 .append(inheritedMethod.readableName());
1454
1455         StringBuffer shortSignature = new StringBuffer();
1456         shortSignature
1457                 .append(inheritedMethod.declaringClass.shortReadableName())
1458                 .append('.')
1459                 .append(inheritedMethod.shortReadableName());
1460
1461         int id;
1462         if (currentMethod.declaringClass.isInterface() 
1463                         && !inheritedMethod.isPublic()){ // interface inheriting Object protected method
1464                 id = IProblem.IncompatibleReturnTypeForNonInheritedInterfaceMethod;
1465         } else {
1466                 id = IProblem.IncompatibleReturnType;
1467         }
1468         this.handle(
1469                 id,
1470                 new String[] {methodSignature.toString()},
1471                 new String[] {shortSignature.toString()},
1472                 currentMethod.sourceStart(),
1473                 currentMethod.sourceEnd());
1474 }
1475 public void incorrectLocationForEmptyDimension(ArrayAllocationExpression expression, int index) {
1476         this.handle(
1477                 IProblem.IllegalDimension,
1478                 NoArgument,
1479                 NoArgument,
1480                 expression.dimensions[index + 1].sourceStart,
1481                 expression.dimensions[index + 1].sourceEnd);
1482 }
1483 public void indirectAccessToStaticField(ASTNode location, FieldBinding field){
1484         this.handle(
1485                 IProblem.IndirectAccessToStaticField,
1486                 new String[] {new String(field.declaringClass.readableName()), new String(field.name)},
1487                 new String[] {new String(field.declaringClass.shortReadableName()), new String(field.name)},
1488                 location.sourceStart,
1489                 fieldLocation(field, location));
1490 }
1491 public void indirectAccessToStaticMethod(ASTNode location, MethodBinding method) {
1492         this.handle(
1493                 IProblem.IndirectAccessToStaticMethod,
1494                 new String[] {new String(method.declaringClass.readableName()), new String(method.selector), parametersAsString(method)},
1495                 new String[] {new String(method.declaringClass.shortReadableName()), new String(method.selector), parametersAsShortString(method)},
1496                 location.sourceStart,
1497                 location.sourceEnd);
1498 }
1499 public void indirectAccessToStaticType(ASTNode location, ReferenceBinding type) {
1500         this.handle(
1501                 IProblem.IndirectAccessToStaticMethod,
1502                 new String[] {new String(type.enclosingType().readableName()), new String(type.sourceName) },
1503                 new String[] {new String(type.enclosingType().shortReadableName()), new String(type.sourceName) },
1504                 location.sourceStart,
1505                 location.sourceEnd);
1506 }
1507 public void incorrectSwitchType(Expression expression, TypeBinding testType) {
1508         this.handle(
1509                 IProblem.IncorrectSwitchType,
1510                 new String[] {new String(testType.readableName())},
1511                 new String[] {new String(testType.shortReadableName())},
1512                 expression.sourceStart,
1513                 expression.sourceEnd);
1514 }
1515 public void inheritedMethodReducesVisibility(SourceTypeBinding type, MethodBinding concreteMethod, MethodBinding[] abstractMethods) {
1516         StringBuffer concreteSignature = new StringBuffer();
1517         concreteSignature
1518                 .append(concreteMethod.declaringClass.readableName())
1519                 .append('.')
1520                 .append(concreteMethod.readableName());
1521         StringBuffer shortSignature = new StringBuffer();
1522         shortSignature
1523                 .append(concreteMethod.declaringClass.shortReadableName())
1524                 .append('.')
1525                 .append(concreteMethod.shortReadableName());
1526         this.handle(
1527                 // The inherited method %1 cannot hide the public abstract method in %2
1528                 IProblem.InheritedMethodReducesVisibility,
1529                 new String[] {
1530                         concreteSignature.toString(),
1531                         new String(abstractMethods[0].declaringClass.readableName())},
1532                 new String[] {
1533                         new String(shortSignature.toString()),
1534                         new String(abstractMethods[0].declaringClass.shortReadableName())},
1535                 type.sourceStart(),
1536                 type.sourceEnd());
1537 }
1538 public void inheritedMethodsHaveIncompatibleReturnTypes(SourceTypeBinding type, MethodBinding[] inheritedMethods, int length) {
1539         StringBuffer methodSignatures = new StringBuffer();
1540         StringBuffer shortSignatures = new StringBuffer();
1541         for (int i = length; --i >= 0;) {
1542                 methodSignatures
1543                         .append(inheritedMethods[i].declaringClass.readableName())
1544                         .append('.')
1545                         .append(inheritedMethods[i].readableName());
1546                 shortSignatures
1547                         .append(inheritedMethods[i].declaringClass.shortReadableName())
1548                         .append('.')
1549                         .append(inheritedMethods[i].shortReadableName());
1550                 if (i != 0){
1551                         methodSignatures.append(", "); //$NON-NLS-1$
1552                         shortSignatures.append(", "); //$NON-NLS-1$
1553                 }
1554         }
1555
1556         this.handle(
1557                 // Return type is incompatible with %1
1558                 // 9.4.2 - The return type from the method is incompatible with the declaration.
1559                 IProblem.IncompatibleReturnType,
1560                 new String[] {methodSignatures.toString()},
1561                 new String[] {shortSignatures.toString()},
1562                 type.sourceStart(),
1563                 type.sourceEnd());
1564 }
1565 public void initializerMustCompleteNormally(FieldDeclaration fieldDecl) {
1566         this.handle(
1567                 IProblem.InitializerMustCompleteNormally,
1568                 NoArgument,
1569                 NoArgument,
1570                 fieldDecl.sourceStart,
1571                 fieldDecl.sourceEnd);
1572 }
1573 public void innerTypesCannotDeclareStaticInitializers(ReferenceBinding innerType, ASTNode location) {
1574         this.handle(
1575                 IProblem.CannotDefineStaticInitializerInLocalType,
1576                 new String[] {new String(innerType.readableName())},
1577                 new String[] {new String(innerType.shortReadableName())},
1578                 location.sourceStart,
1579                 location.sourceEnd);
1580 }
1581 public void interfaceCannotHaveConstructors(ConstructorDeclaration constructor) {
1582         this.handle(
1583                 IProblem.InterfaceCannotHaveConstructors,
1584                 NoArgument,
1585                 NoArgument,
1586                 constructor.sourceStart,
1587                 constructor.sourceEnd,
1588                 constructor,
1589                 constructor.compilationResult());
1590 }
1591 public void interfaceCannotHaveInitializers(SourceTypeBinding type, FieldDeclaration fieldDecl) {
1592         String[] arguments = new String[] {new String(type.sourceName())};
1593
1594         this.handle(
1595                 IProblem.InterfaceCannotHaveInitializers,
1596                 arguments,
1597                 arguments,
1598                 fieldDecl.sourceStart,
1599                 fieldDecl.sourceEnd);
1600 }
1601 public void invalidBreak(ASTNode location) {
1602         this.handle(
1603                 IProblem.InvalidBreak,
1604                 NoArgument,
1605                 NoArgument,
1606                 location.sourceStart,
1607                 location.sourceEnd);
1608 }
1609 public void invalidConstructor(Statement statement, MethodBinding targetConstructor) {
1610
1611         boolean insideDefaultConstructor = 
1612                 (this.referenceContext instanceof ConstructorDeclaration)
1613                         && ((ConstructorDeclaration)this.referenceContext).isDefaultConstructor();
1614         boolean insideImplicitConstructorCall =
1615                 (statement instanceof ExplicitConstructorCall)
1616                         && (((ExplicitConstructorCall) statement).accessMode == ExplicitConstructorCall.ImplicitSuper);
1617
1618         int id = IProblem.UndefinedConstructor; //default...
1619         switch (targetConstructor.problemId()) {
1620                 case NotFound :
1621                         if (insideDefaultConstructor){
1622                                 id = IProblem.UndefinedConstructorInDefaultConstructor;
1623                         } else if (insideImplicitConstructorCall){
1624                                 id = IProblem.UndefinedConstructorInImplicitConstructorCall;
1625                         } else {
1626                                 id = IProblem.UndefinedConstructor;
1627                         }
1628                         break;
1629                 case NotVisible :
1630                         if (insideDefaultConstructor){
1631                                 id = IProblem.NotVisibleConstructorInDefaultConstructor;
1632                         } else if (insideImplicitConstructorCall){
1633                                 id = IProblem.NotVisibleConstructorInImplicitConstructorCall;
1634                         } else {
1635                                 id = IProblem.NotVisibleConstructor;
1636                         }
1637                         break;
1638                 case Ambiguous :
1639                         if (insideDefaultConstructor){
1640                                 id = IProblem.AmbiguousConstructorInDefaultConstructor;
1641                         } else if (insideImplicitConstructorCall){
1642                                 id = IProblem.AmbiguousConstructorInImplicitConstructorCall;
1643                         } else {
1644                                 id = IProblem.AmbiguousConstructor;
1645                         }
1646                         break;
1647                 case NoError : // 0
1648                 default :
1649                         needImplementation(); // want to fail to see why we were here...
1650                         break;
1651         }
1652
1653         this.handle(
1654                 id,
1655                 new String[] {new String(targetConstructor.declaringClass.readableName()), parametersAsString(targetConstructor)},
1656                 new String[] {new String(targetConstructor.declaringClass.shortReadableName()), parametersAsShortString(targetConstructor)},
1657                 statement.sourceStart,
1658                 statement.sourceEnd);
1659 }
1660
1661 public void invalidExplicitConstructorCall(ASTNode location) {
1662         
1663         this.handle(
1664                 IProblem.InvalidExplicitConstructorCall,
1665                 NoArgument,
1666                 NoArgument,
1667                 location.sourceStart,
1668                 location.sourceEnd);
1669 }
1670 public void invalidContinue(ASTNode location) {
1671         this.handle(
1672                 IProblem.InvalidContinue,
1673                 NoArgument,
1674                 NoArgument,
1675                 location.sourceStart,
1676                 location.sourceEnd);
1677 }
1678 public void invalidEnclosingType(Expression expression, TypeBinding type, ReferenceBinding enclosingType) {
1679
1680         if (enclosingType.isAnonymousType()) enclosingType = enclosingType.superclass();
1681         int flag = IProblem.UndefinedType; // default
1682         switch (type.problemId()) {
1683                 case NotFound : // 1
1684                         flag = IProblem.UndefinedType;
1685                         break;
1686                 case NotVisible : // 2
1687                         flag = IProblem.NotVisibleType;
1688                         break;
1689                 case Ambiguous : // 3
1690                         flag = IProblem.AmbiguousType;
1691                         break;
1692                 case InternalNameProvided :
1693                         flag = IProblem.InternalTypeNameProvided;
1694                         break;
1695                 case NoError : // 0
1696                 default :
1697                         needImplementation(); // want to fail to see why we were here...
1698                         break;
1699         }
1700
1701         this.handle(
1702                 flag,
1703                 new String[] {new String(enclosingType.readableName()) + "." + new String(type.readableName())}, //$NON-NLS-1$
1704                 new String[] {new String(enclosingType.shortReadableName()) + "." + new String(type.shortReadableName())}, //$NON-NLS-1$
1705                 expression.sourceStart,
1706                 expression.sourceEnd);
1707 }
1708 public void invalidExpressionAsStatement(Expression expression){
1709         this.handle(
1710                 IProblem.InvalidExpressionAsStatement,
1711                 NoArgument,
1712                 NoArgument,
1713                 expression.sourceStart,
1714                 expression.sourceEnd);
1715 }
1716 public void invalidField(FieldReference fieldRef, TypeBinding searchedType) {
1717         int id = IProblem.UndefinedField;
1718         FieldBinding field = fieldRef.binding;
1719         switch (field.problemId()) {
1720                 case NotFound :
1721                         id = IProblem.UndefinedField;
1722 /* also need to check that the searchedType is the receiver type
1723                         if (searchedType.isHierarchyInconsistent())
1724                                 severity = SecondaryError;
1725 */
1726                         break;
1727                 case NotVisible :
1728                         id = IProblem.NotVisibleField;
1729                         break;
1730                 case Ambiguous :
1731                         id = IProblem.AmbiguousField;
1732                         break;
1733                 case NonStaticReferenceInStaticContext :
1734                         id = IProblem.NonStaticFieldFromStaticInvocation;
1735                         break;
1736                 case NonStaticReferenceInConstructorInvocation :
1737                         id = IProblem.InstanceFieldDuringConstructorInvocation;
1738                         break;
1739                 case InheritedNameHidesEnclosingName :
1740                         id = IProblem.InheritedFieldHidesEnclosingName;
1741                         break;
1742                 case ReceiverTypeNotVisible :
1743                         this.handle(
1744                                 IProblem.NotVisibleType, // cannot occur in javadoc comments
1745                                 new String[] {new String(searchedType.leafComponentType().readableName())},
1746                                 new String[] {new String(searchedType.leafComponentType().shortReadableName())},
1747                                 fieldRef.receiver.sourceStart,
1748                                 fieldRef.receiver.sourceEnd);
1749                         return;
1750                         
1751                 case NoError : // 0
1752                 default :
1753                         needImplementation(); // want to fail to see why we were here...
1754                         break;
1755         }
1756
1757         String[] arguments = new String[] {new String(field.readableName())};
1758         this.handle(
1759                 id,
1760                 arguments,
1761                 arguments,
1762                 fieldRef.sourceStart,
1763                 fieldRef.sourceEnd);
1764 }
1765 public void invalidField(NameReference nameRef, FieldBinding field) {
1766         int id = IProblem.UndefinedField;
1767         switch (field.problemId()) {
1768                 case NotFound :
1769                         id = IProblem.UndefinedField;
1770                         break;
1771                 case NotVisible :
1772                         id = IProblem.NotVisibleField;
1773                         break;
1774                 case Ambiguous :
1775                         id = IProblem.AmbiguousField;
1776                         break;
1777                 case NonStaticReferenceInStaticContext :
1778                         id = IProblem.NonStaticFieldFromStaticInvocation;
1779                         break;
1780                 case NonStaticReferenceInConstructorInvocation :
1781                         id = IProblem.InstanceFieldDuringConstructorInvocation;
1782                         break;
1783                 case InheritedNameHidesEnclosingName :
1784                         id = IProblem.InheritedFieldHidesEnclosingName;
1785                         break;
1786                 case ReceiverTypeNotVisible :
1787                         this.handle(
1788                                 IProblem.NotVisibleType,
1789                                 new String[] {new String(field.declaringClass.leafComponentType().readableName())},
1790                                 new String[] {new String(field.declaringClass.leafComponentType().shortReadableName())},
1791                                 nameRef.sourceStart,
1792                                 nameRef.sourceEnd);
1793                         return;
1794                 case NoError : // 0
1795                 default :
1796                         needImplementation(); // want to fail to see why we were here...
1797                         break;
1798         }
1799         String[] arguments = new String[] {new String(field.readableName())};
1800         this.handle(
1801                 id,
1802                 arguments,
1803                 arguments,
1804                 nameRef.sourceStart,
1805                 nameRef.sourceEnd);
1806 }
1807 public void invalidField(QualifiedNameReference nameRef, FieldBinding field, int index, TypeBinding searchedType) {
1808         //the resolution of the index-th field of qname failed
1809         //qname.otherBindings[index] is the binding that has produced the error
1810
1811         //The different targetted errors should be :
1812         //UndefinedField
1813         //NotVisibleField
1814         //AmbiguousField
1815
1816         if (searchedType.isBaseType()) {
1817                 this.handle(
1818                         IProblem.NoFieldOnBaseType,
1819                         new String[] {
1820                                 new String(searchedType.readableName()),
1821                                 CharOperation.toString(CharOperation.subarray(nameRef.tokens, 0, index)),
1822                                 new String(nameRef.tokens[index])},
1823                         new String[] {
1824                                 new String(searchedType.sourceName()),
1825                                 CharOperation.toString(CharOperation.subarray(nameRef.tokens, 0, index)),
1826                                 new String(nameRef.tokens[index])},
1827                         nameRef.sourceStart,
1828                         (int) nameRef.sourcePositions[index]);
1829                 return;
1830         }
1831
1832         int id = IProblem.UndefinedField;
1833         switch (field.problemId()) {
1834                 case NotFound :
1835                         id = IProblem.UndefinedField;
1836 /* also need to check that the searchedType is the receiver type
1837                         if (searchedType.isHierarchyInconsistent())
1838                                 severity = SecondaryError;
1839 */
1840                         break;
1841                 case NotVisible :
1842                         id = IProblem.NotVisibleField;
1843                         break;
1844                 case Ambiguous :
1845                         id = IProblem.AmbiguousField;
1846                         break;
1847                 case NonStaticReferenceInStaticContext :
1848                         id = IProblem.NonStaticFieldFromStaticInvocation;
1849                         break;
1850                 case NonStaticReferenceInConstructorInvocation :
1851                         id = IProblem.InstanceFieldDuringConstructorInvocation;
1852                         break;
1853                 case InheritedNameHidesEnclosingName :
1854                         id = IProblem.InheritedFieldHidesEnclosingName;
1855                         break;
1856                 case ReceiverTypeNotVisible :
1857                         this.handle(
1858                                 IProblem.NotVisibleType,
1859                                 new String[] {new String(searchedType.leafComponentType().readableName())},
1860                                 new String[] {new String(searchedType.leafComponentType().shortReadableName())},
1861                                 nameRef.sourceStart,
1862                                 nameRef.sourceEnd);
1863                         return;
1864                 case NoError : // 0
1865                 default :
1866                         needImplementation(); // want to fail to see why we were here...
1867                         break;
1868         }
1869         String[] arguments = new String[] {CharOperation.toString(CharOperation.subarray(nameRef.tokens, 0, index + 1))};
1870         this.handle(
1871                 id, 
1872                 arguments,
1873                 arguments,
1874                 nameRef.sourceStart, 
1875                 (int) nameRef.sourcePositions[index]);
1876 }
1877 public void invalidMethod(MessageSend messageSend, MethodBinding method) {
1878         // CODE should be UPDATED according to error coding in the different method binding errors
1879         // The different targetted errors should be :
1880         //      UndefinedMethod
1881         //      NotVisibleMethod
1882         //      AmbiguousMethod
1883         //  InheritedNameHidesEnclosingName
1884         //      InstanceMethodDuringConstructorInvocation
1885         // StaticMethodRequested
1886
1887         int id = IProblem.UndefinedMethod; //default...
1888         switch (method.problemId()) {
1889                 case NotFound :
1890                         id = IProblem.UndefinedMethod;
1891                         break;
1892                 case NotVisible :
1893                         id = IProblem.NotVisibleMethod;
1894                         break;
1895                 case Ambiguous :
1896                         id = IProblem.AmbiguousMethod;
1897                         break;
1898                 case InheritedNameHidesEnclosingName :
1899                         id = IProblem.InheritedMethodHidesEnclosingName;
1900                         break;
1901                 case NonStaticReferenceInConstructorInvocation :
1902                         id = IProblem.InstanceMethodDuringConstructorInvocation;
1903                         break;
1904                 case NonStaticReferenceInStaticContext :
1905                         id = IProblem.StaticMethodRequested;
1906                         break;
1907                 case ReceiverTypeNotVisible :
1908                         this.handle(
1909                                 IProblem.NotVisibleType,        // cannot occur in javadoc comments
1910                                 new String[] {new String(method.declaringClass.leafComponentType().readableName())},
1911                                 new String[] {new String(method.declaringClass.leafComponentType().shortReadableName())},
1912                                 messageSend.receiver.sourceStart,
1913                                 messageSend.receiver.sourceEnd);
1914                         return;
1915                 
1916                 case NoError : // 0
1917                 default :
1918                         needImplementation(); // want to fail to see why we were here...
1919                         break;
1920         }
1921
1922         if (id == IProblem.UndefinedMethod) {
1923                 ProblemMethodBinding problemMethod = (ProblemMethodBinding) method;
1924                 if (problemMethod.closestMatch != null) {
1925                                 String closestParameterTypeNames = parametersAsString(problemMethod.closestMatch);
1926                                 String parameterTypeNames = parametersAsString(method);
1927                                 String closestParameterTypeShortNames = parametersAsShortString(problemMethod.closestMatch);
1928                                 String parameterTypeShortNames = parametersAsShortString(method);
1929                                 if (closestParameterTypeShortNames.equals(parameterTypeShortNames)){
1930                                         closestParameterTypeShortNames = closestParameterTypeNames;
1931                                         parameterTypeShortNames = parameterTypeNames;
1932                                 }
1933                                 id = IProblem.ParameterMismatch;
1934                                 this.handle(
1935                                         id,
1936                                         new String[] {
1937                                                 new String(problemMethod.closestMatch.declaringClass.readableName()),
1938                                                 new String(problemMethod.closestMatch.selector),
1939                                                 closestParameterTypeNames,
1940                                                 parameterTypeNames 
1941                                         },
1942                                         new String[] {
1943                                                 new String(problemMethod.closestMatch.declaringClass.shortReadableName()),
1944                                                 new String(problemMethod.closestMatch.selector),
1945                                                 closestParameterTypeShortNames,
1946                                                 parameterTypeShortNames
1947                                         },
1948                                         (int) (messageSend.nameSourcePosition >>> 32),
1949                                         (int) messageSend.nameSourcePosition);
1950                                 return;
1951                 }
1952         }
1953
1954         this.handle(
1955                 id,
1956                 new String[] {
1957                         new String(method.declaringClass.readableName()),
1958                         new String(method.selector), parametersAsString(method)},
1959                 new String[] {
1960                         new String(method.declaringClass.shortReadableName()),
1961                         new String(method.selector), parametersAsShortString(method)},
1962                 (int) (messageSend.nameSourcePosition >>> 32),
1963                 (int) messageSend.nameSourcePosition);
1964 }
1965 public void invalidNullToSynchronize(Expression expression) {
1966         this.handle(
1967                 IProblem.InvalidNullToSynchronized,
1968                 NoArgument,
1969                 NoArgument,
1970                 expression.sourceStart,
1971                 expression.sourceEnd);
1972 }
1973 public void invalidOperator(BinaryExpression expression, TypeBinding leftType, TypeBinding rightType) {
1974         String leftName = new String(leftType.readableName());
1975         String rightName = new String(rightType.readableName());
1976         String leftShortName = new String(leftType.shortReadableName());
1977         String rightShortName = new String(rightType.shortReadableName());
1978         if (leftShortName.equals(rightShortName)){
1979                 leftShortName = leftName;
1980                 rightShortName = rightName;
1981         }
1982         this.handle(
1983                 IProblem.InvalidOperator,
1984                 new String[] {
1985                         expression.operatorToString(),
1986                         leftName + ", " + rightName}, //$NON-NLS-1$
1987                 new String[] {
1988                         expression.operatorToString(),
1989                         leftShortName + ", " + rightShortName}, //$NON-NLS-1$
1990                 expression.sourceStart,
1991                 expression.sourceEnd);
1992 }
1993 public void invalidOperator(CompoundAssignment assign, TypeBinding leftType, TypeBinding rightType) {
1994         String leftName = new String(leftType.readableName());
1995         String rightName = new String(rightType.readableName());
1996         String leftShortName = new String(leftType.shortReadableName());
1997         String rightShortName = new String(rightType.shortReadableName());
1998         if (leftShortName.equals(rightShortName)){
1999                 leftShortName = leftName;
2000                 rightShortName = rightName;
2001         }
2002         this.handle(
2003                 IProblem.InvalidOperator,
2004                 new String[] {
2005                         assign.operatorToString(),
2006                         leftName + ", " + rightName}, //$NON-NLS-1$
2007                 new String[] {
2008                         assign.operatorToString(),
2009                         leftShortName + ", " + rightShortName}, //$NON-NLS-1$
2010                 assign.sourceStart,
2011                 assign.sourceEnd);
2012 }
2013 public void invalidOperator(UnaryExpression expression, TypeBinding type) {
2014         this.handle(
2015                 IProblem.InvalidOperator,
2016                 new String[] {expression.operatorToString(), new String(type.readableName())},
2017                 new String[] {expression.operatorToString(), new String(type.shortReadableName())},
2018                 expression.sourceStart,
2019                 expression.sourceEnd);
2020 }
2021 public void invalidParenthesizedExpression(ASTNode reference) {
2022         this.handle(
2023                 IProblem.InvalidParenthesizedExpression,
2024                 NoArgument,
2025                 NoArgument,
2026                 reference.sourceStart,
2027                 reference.sourceEnd);
2028 }
2029 public void invalidSuperclass(SourceTypeBinding type, TypeReference superclassRef, ReferenceBinding expectedType) {
2030         int problemId = expectedType.problemId();
2031         int id;
2032         switch (problemId) {
2033                 case NotFound : // 1
2034                         id = IProblem.SuperclassNotFound;
2035                         break;
2036                 case NotVisible : // 2
2037                         id = IProblem.SuperclassNotVisible;
2038                         break;
2039                 case Ambiguous : // 3
2040                         id = IProblem.SuperclassAmbiguous;
2041                         break;
2042                 case InternalNameProvided : // 4
2043                         id = IProblem.SuperclassInternalNameProvided;
2044                         break;
2045                 case InheritedNameHidesEnclosingName : // 5
2046                         id = IProblem.SuperclassInheritedNameHidesEnclosingName;
2047                         break;
2048                 case NoError : // 0
2049                 default :
2050                         needImplementation(); // want to fail to see why we were here...
2051                         return;
2052         }
2053         this.handle(
2054                 id,
2055                 new String[] {new String(expectedType.readableName()), new String(type.sourceName())},
2056                 new String[] {new String(expectedType.shortReadableName()), new String(type.sourceName())},
2057                 superclassRef.sourceStart,
2058                 superclassRef.sourceEnd);
2059 }
2060 public void invalidSuperinterface(SourceTypeBinding type, TypeReference superinterfaceRef, ReferenceBinding expectedType) {
2061         int problemId = expectedType.problemId();
2062         int id;
2063         switch (problemId) {
2064                 case NotFound : // 1
2065                         id = IProblem.InterfaceNotFound;
2066                         break;
2067                 case NotVisible : // 2
2068                         id = IProblem.InterfaceNotVisible;
2069                         break;
2070                 case Ambiguous : // 3
2071                         id = IProblem.InterfaceAmbiguous;
2072                         break;
2073                 case InternalNameProvided : // 4
2074                         id = IProblem.InterfaceInternalNameProvided;
2075                         break;
2076                 case InheritedNameHidesEnclosingName : // 5
2077                         id = IProblem.InterfaceInheritedNameHidesEnclosingName;
2078                         break;
2079                 case NoError : // 0
2080                 default :
2081                         needImplementation(); // want to fail to see why we were here...
2082                         return;
2083         }
2084                 this.handle(
2085                         id,
2086                         new String[] {new String(expectedType.readableName()), new String(type.sourceName())},
2087                         new String[] {new String(expectedType.shortReadableName()), new String(type.sourceName())},
2088                         superinterfaceRef.sourceStart,
2089                         superinterfaceRef.sourceEnd);
2090 }
2091 public void invalidType(ASTNode location, TypeBinding type) {
2092         int id = IProblem.UndefinedType; // default
2093         switch (type.problemId()) {
2094                 case NotFound :
2095                         id = IProblem.UndefinedType;
2096                         break;
2097                 case NotVisible :
2098                         id = IProblem.NotVisibleType;
2099                         break;
2100                 case Ambiguous :
2101                         id = IProblem.AmbiguousType;
2102                         break;
2103                 case InternalNameProvided :
2104                         id = IProblem.InternalTypeNameProvided;
2105                         break;
2106                 case InheritedNameHidesEnclosingName :
2107                         id = IProblem.InheritedTypeHidesEnclosingName;
2108                         break;
2109                 case NoError : // 0
2110                 default :
2111                         needImplementation(); // want to fail to see why we were here...
2112                         break;
2113         }
2114         
2115         int end = location.sourceEnd;
2116         if (location instanceof QualifiedNameReference) {
2117                 QualifiedNameReference ref = (QualifiedNameReference) location;
2118                 if (ref.indexOfFirstFieldBinding >= 1)
2119                         end = (int) ref.sourcePositions[ref.indexOfFirstFieldBinding - 1];
2120         }
2121         this.handle(
2122                 id,
2123                 new String[] {new String(type.readableName())},
2124                 new String[] {new String(type.shortReadableName())},
2125                 location.sourceStart,
2126                 end);
2127 }
2128 public void invalidTypeReference(Expression expression) {
2129         this.handle(
2130                 IProblem.InvalidTypeExpression,
2131                 NoArgument,
2132                 NoArgument,
2133                 expression.sourceStart,
2134                 expression.sourceEnd);
2135 }
2136 public void invalidTypeToSynchronize(Expression expression, TypeBinding type) {
2137         this.handle(
2138                 IProblem.InvalidTypeToSynchronized,
2139                 new String[] {new String(type.readableName())},
2140                 new String[] {new String(type.shortReadableName())},
2141                 expression.sourceStart,
2142                 expression.sourceEnd);
2143 }
2144 public void invalidUnaryExpression(Expression expression) {
2145         this.handle(
2146                 IProblem.InvalidUnaryExpression,
2147                 NoArgument,
2148                 NoArgument,
2149                 expression.sourceStart,
2150                 expression.sourceEnd);
2151 }
2152 public void isClassPathCorrect(char[][] wellKnownTypeName, CompilationUnitDeclaration compUnitDecl) {
2153         this.referenceContext = compUnitDecl;
2154         String[] arguments = new String[] {CharOperation.toString(wellKnownTypeName)};
2155         this.handle(
2156                 IProblem.IsClassPathCorrect,
2157                 arguments, 
2158                 arguments,
2159                 AbortCompilation | Error,
2160                 0,
2161                 0);
2162 }
2163 public void javadocDuplicatedReturnTag(int sourceStart, int sourceEnd){
2164         this.handle(IProblem.JavadocDuplicateReturnTag, NoArgument, NoArgument, sourceStart, sourceEnd);
2165 }
2166 public void javadocDeprecatedField(FieldBinding field, ASTNode location, int modifiers) {
2167         if (javadocVisibility(this.options.reportInvalidJavadocTagsVisibility, modifiers)) {
2168                 this.handle(
2169                         IProblem.JavadocUsingDeprecatedField,
2170                         new String[] {new String(field.declaringClass.readableName()), new String(field.name)},
2171                         new String[] {new String(field.declaringClass.shortReadableName()), new String(field.name)},
2172                         location.sourceStart,
2173                         location.sourceEnd);
2174         }
2175 }
2176 public void javadocDeprecatedMethod(MethodBinding method, ASTNode location, int modifiers) {
2177         if (javadocVisibility(this.options.reportInvalidJavadocTagsVisibility, modifiers)) {
2178                 if (method.isConstructor()) {
2179                         this.handle(
2180                                 IProblem.JavadocUsingDeprecatedConstructor,
2181                                 new String[] {new String(method.declaringClass.readableName()), parametersAsString(method)},
2182                                 new String[] {new String(method.declaringClass.shortReadableName()), parametersAsShortString(method)},
2183                                 location.sourceStart,
2184                                 location.sourceEnd);
2185                 } else {
2186                         this.handle(
2187                                 IProblem.JavadocUsingDeprecatedMethod,
2188                                 new String[] {new String(method.declaringClass.readableName()), new String(method.selector), parametersAsString(method)},
2189                                 new String[] {new String(method.declaringClass.shortReadableName()), new String(method.selector), parametersAsShortString(method)},
2190                                 location.sourceStart,
2191                                 location.sourceEnd);
2192                 }
2193         }
2194 }
2195 public void javadocDeprecatedType(TypeBinding type, ASTNode location, int modifiers) {
2196         if (location == null) return; // 1G828DN - no type ref for synthetic arguments
2197         if (javadocVisibility(this.options.reportInvalidJavadocTagsVisibility, modifiers)) {
2198                 this.handle(
2199                         IProblem.JavadocUsingDeprecatedType,
2200                         new String[] {new String(type.readableName())},
2201                         new String[] {new String(type.shortReadableName())},
2202                         location.sourceStart,
2203                         location.sourceEnd);
2204         }
2205 }
2206 public void javadocDuplicatedParamTag(JavadocSingleNameReference param, int modifiers) {
2207         if (javadocVisibility(this.options.reportInvalidJavadocTagsVisibility, modifiers)) {
2208                 String[] arguments = new String[] {String.valueOf(param.token)};
2209                 this.handle(IProblem.JavadocDuplicateParamName, arguments, arguments, param.sourceStart, param.sourceEnd);
2210         }
2211 }
2212 public void javadocDuplicatedThrowsClassName(TypeReference typeReference, int modifiers) {
2213         if (javadocVisibility(this.options.reportInvalidJavadocTagsVisibility, modifiers)) {
2214                 String[] arguments = new String[] {String.valueOf(typeReference.resolvedType.sourceName())};
2215                 this.handle(IProblem.JavadocDuplicateThrowsClassName, arguments, arguments, typeReference.sourceStart, typeReference.sourceEnd);
2216         }
2217 }
2218 public void javadocErrorNoMethodFor(MessageSend messageSend, TypeBinding recType, TypeBinding[] params, int modifiers) {
2219         StringBuffer buffer = new StringBuffer();
2220         StringBuffer shortBuffer = new StringBuffer();
2221         for (int i = 0, length = params.length; i < length; i++) {
2222                 if (i != 0){
2223                         buffer.append(", "); //$NON-NLS-1$
2224                         shortBuffer.append(", "); //$NON-NLS-1$
2225                 }
2226                 buffer.append(new String(params[i].readableName()));
2227                 shortBuffer.append(new String(params[i].shortReadableName()));
2228         }
2229
2230         int id = recType.isArrayType() ? IProblem.JavadocNoMessageSendOnArrayType : IProblem.JavadocNoMessageSendOnBaseType;
2231         if (javadocVisibility(this.options.reportInvalidJavadocTagsVisibility, modifiers)) {
2232                 this.handle(
2233                         id,
2234                         new String[] {new String(recType.readableName()), new String(messageSend.selector), buffer.toString()},
2235                         new String[] {new String(recType.shortReadableName()), new String(messageSend.selector), shortBuffer.toString()},
2236                         messageSend.sourceStart,
2237                         messageSend.sourceEnd);
2238         }
2239 }
2240 public void javadocInvalidConstructor(Statement statement, MethodBinding targetConstructor, int modifiers) {
2241
2242         if (!javadocVisibility(this.options.reportInvalidJavadocTagsVisibility, modifiers)) {
2243                 return;
2244         }
2245 //      boolean insideDefaultConstructor = 
2246 //              (this.referenceContext instanceof ConstructorDeclaration)
2247 //                      && ((ConstructorDeclaration)this.referenceContext).isDefaultConstructor();
2248 //      boolean insideImplicitConstructorCall =
2249 //              (statement instanceof ExplicitConstructorCall)
2250 //                      && (((ExplicitConstructorCall) statement).accessMode == ExplicitConstructorCall.ImplicitSuper);
2251
2252         int id = IProblem.JavadocUndefinedConstructor; //default...
2253         switch (targetConstructor.problemId()) {
2254                 case NotFound :
2255 //                      if (insideDefaultConstructor){
2256 //                              id = IProblem.JavadocUndefinedConstructorInDefaultConstructor;
2257 //                      } else if (insideImplicitConstructorCall){
2258 //                              id = IProblem.JavadocUndefinedConstructorInImplicitConstructorCall;
2259 //                      } else {
2260                                 id = IProblem.JavadocUndefinedConstructor;
2261 //                      }
2262                         break;
2263                 case NotVisible :
2264 //                      if (insideDefaultConstructor){
2265 //                              id = IProblem.JavadocNotVisibleConstructorInDefaultConstructor;
2266 //                      } else if (insideImplicitConstructorCall){
2267 //                              id = IProblem.JavadocNotVisibleConstructorInImplicitConstructorCall;
2268 //                      } else {
2269                                 id = IProblem.JavadocNotVisibleConstructor;
2270 //                      }
2271                         break;
2272                 case Ambiguous :
2273 //                      if (insideDefaultConstructor){
2274 //                              id = IProblem.AmbiguousConstructorInDefaultConstructor;
2275 //                      } else if (insideImplicitConstructorCall){
2276 //                              id = IProblem.AmbiguousConstructorInImplicitConstructorCall;
2277 //                      } else {
2278                                 id = IProblem.JavadocAmbiguousConstructor;
2279 //                      }
2280                         break;
2281                 case NoError : // 0
2282                 default :
2283                         needImplementation(); // want to fail to see why we were here...
2284                         break;
2285         }
2286
2287         this.handle(
2288                 id,
2289                 new String[] {new String(targetConstructor.declaringClass.readableName()), parametersAsString(targetConstructor)},
2290                 new String[] {new String(targetConstructor.declaringClass.shortReadableName()), parametersAsShortString(targetConstructor)},
2291                 statement.sourceStart,
2292                 statement.sourceEnd);
2293 }
2294 public void javadocAmbiguousMethodReference(int sourceStart, int sourceEnd, Binding fieldBinding, int modifiers) {
2295         int id = IProblem.JavadocAmbiguousMethodReference;
2296         if (javadocVisibility(this.options.reportInvalidJavadocTagsVisibility, modifiers)) {
2297                 String[] arguments = new String[] {new String(fieldBinding.readableName())};
2298                 handle(id, arguments, arguments, sourceStart, sourceEnd);
2299         }
2300 }
2301 /*
2302  * Similar implementation than invalidField(FieldReference...)
2303  * Note that following problem id cannot occur for Javadoc:
2304  *      - NonStaticReferenceInStaticContext :
2305  *      - NonStaticReferenceInConstructorInvocation :
2306  *      - ReceiverTypeNotVisible :
2307  */
2308 public void javadocInvalidField(int sourceStart, int sourceEnd, Binding fieldBinding, TypeBinding searchedType, int modifiers) {
2309         int id = IProblem.JavadocUndefinedField;
2310         switch (fieldBinding.problemId()) {
2311                 case NotFound :
2312                         id = IProblem.JavadocUndefinedField;
2313                         break;
2314                 case NotVisible :
2315                         id = IProblem.JavadocNotVisibleField;
2316                         break;
2317                 case Ambiguous :
2318                         id = IProblem.JavadocAmbiguousField;
2319                         break;
2320                 case InheritedNameHidesEnclosingName :
2321                         id = IProblem.JavadocInheritedFieldHidesEnclosingName;
2322                         break;
2323                 case NoError : // 0
2324                 default :
2325                         needImplementation(); // want to fail to see why we were here...
2326                         break;
2327         }
2328
2329         if (javadocVisibility(this.options.reportInvalidJavadocTagsVisibility, modifiers)) {
2330                 String[] arguments = new String[] {new String(fieldBinding.readableName())};
2331                 handle(id, arguments, arguments, sourceStart, sourceEnd);
2332         }
2333 }
2334 /*
2335  * Similar implementation than invalidMethod(MessageSend...)
2336  * Note that following problem id cannot occur for Javadoc:
2337  *      - NonStaticReferenceInStaticContext :
2338  *      - NonStaticReferenceInConstructorInvocation :
2339  *      - ReceiverTypeNotVisible :
2340  */
2341 public void javadocInvalidMethod(MessageSend messageSend, MethodBinding method, int modifiers) {
2342         if (!javadocVisibility(this.options.reportInvalidJavadocTagsVisibility, modifiers)) {
2343                 return;
2344         }
2345         int id = IProblem.JavadocUndefinedMethod; //default...
2346         switch (method.problemId()) {
2347                 case NotFound :
2348                         id = IProblem.JavadocUndefinedMethod;
2349                         break;
2350                 case NotVisible :
2351                         id = IProblem.JavadocNotVisibleMethod;
2352                         break;
2353                 case Ambiguous :
2354                         id = IProblem.JavadocAmbiguousMethod;
2355                         break;
2356                 case InheritedNameHidesEnclosingName :
2357                         id = IProblem.JavadocInheritedMethodHidesEnclosingName;
2358                         break;
2359                 case NoError : // 0
2360                 default :
2361                         needImplementation(); // want to fail to see why we were here...
2362                         break;
2363         }
2364
2365         if (id == IProblem.JavadocUndefinedMethod) {
2366                 ProblemMethodBinding problemMethod = (ProblemMethodBinding) method;
2367                 if (problemMethod.closestMatch != null) {
2368                                 String closestParameterTypeNames = parametersAsString(problemMethod.closestMatch);
2369                                 String parameterTypeNames = parametersAsString(method);
2370                                 String closestParameterTypeShortNames = parametersAsShortString(problemMethod.closestMatch);
2371                                 String parameterTypeShortNames = parametersAsShortString(method);
2372                                 if (closestParameterTypeShortNames.equals(parameterTypeShortNames)){
2373                                         closestParameterTypeShortNames = closestParameterTypeNames;
2374                                         parameterTypeShortNames = parameterTypeNames;
2375                                 }
2376                                 this.handle(
2377                                         IProblem.JavadocParameterMismatch,
2378                                         new String[] {
2379                                                 new String(problemMethod.closestMatch.declaringClass.readableName()),
2380                                                 new String(problemMethod.closestMatch.selector),
2381                                                 closestParameterTypeNames,
2382                                                 parameterTypeNames 
2383                                         },
2384                                         new String[] {
2385                                                 new String(problemMethod.closestMatch.declaringClass.shortReadableName()),
2386                                                 new String(problemMethod.closestMatch.selector),
2387                                                 closestParameterTypeShortNames,
2388                                                 parameterTypeShortNames
2389                                         },
2390                                         (int) (messageSend.nameSourcePosition >>> 32),
2391                                         (int) messageSend.nameSourcePosition);
2392                                 return;
2393                 }
2394         }
2395
2396         this.handle(
2397                 id,
2398                 new String[] {
2399                         new String(method.declaringClass.readableName()),
2400                         new String(method.selector), parametersAsString(method)},
2401                 new String[] {
2402                         new String(method.declaringClass.shortReadableName()),
2403                         new String(method.selector), parametersAsShortString(method)},
2404                 (int) (messageSend.nameSourcePosition >>> 32),
2405                 (int) messageSend.nameSourcePosition);
2406 }
2407 public void javadocInvalidParamName(JavadocSingleNameReference param, int modifiers) {
2408         if (javadocVisibility(this.options.reportInvalidJavadocTagsVisibility, modifiers)) {
2409                 String[] arguments = new String[] {String.valueOf(param.token)};
2410                 this.handle(IProblem.JavadocInvalidParamName, arguments, arguments, param.sourceStart, param.sourceEnd);
2411         }
2412 }
2413 public void javadocInvalidSeeReference(int sourceStart, int sourceEnd) {
2414         this.handle(IProblem.JavadocInvalidSeeReference, NoArgument, NoArgument, sourceStart, sourceEnd);
2415 }
2416 public void javadocInvalidSeeReferenceArgs(int sourceStart, int sourceEnd) {
2417         this.handle(IProblem.JavadocInvalidSeeArgs, NoArgument, NoArgument, sourceStart, sourceEnd);
2418 }
2419 public void javadocInvalidSeeUrlReference(int sourceStart, int sourceEnd) {
2420         this.handle(IProblem.JavadocInvalidSeeHref, NoArgument, NoArgument, sourceStart, sourceEnd);
2421 }
2422 public void javadocInvalidTag(int sourceStart, int sourceEnd) {
2423         this.handle(IProblem.JavadocInvalidTag, NoArgument, NoArgument, sourceStart, sourceEnd);
2424 }
2425 public void javadocInvalidThrowsClass(int sourceStart, int sourceEnd) {
2426         this.handle(IProblem.JavadocInvalidThrowsClass, NoArgument, NoArgument, sourceStart, sourceEnd);
2427 }
2428 public void javadocInvalidThrowsClassName(TypeReference typeReference, int modifiers) {
2429         if (javadocVisibility(this.options.reportInvalidJavadocTagsVisibility, modifiers)) {
2430                 String[] arguments = new String[] {String.valueOf(typeReference.resolvedType.sourceName())};
2431                 this.handle(IProblem.JavadocInvalidThrowsClassName, arguments, arguments, typeReference.sourceStart, typeReference.sourceEnd);
2432         }
2433 }
2434 public void javadocInvalidType(ASTNode location, TypeBinding type, int modifiers) {
2435         if (javadocVisibility(this.options.reportInvalidJavadocTagsVisibility, modifiers)) {
2436                 int id = IProblem.JavadocUndefinedType; // default
2437                 switch (type.problemId()) {
2438                         case NotFound :
2439                                 id = IProblem.JavadocUndefinedType;
2440                                 break;
2441                         case NotVisible :
2442                                 id = IProblem.JavadocNotVisibleType;
2443                                 break;
2444                         case Ambiguous :
2445                                 id = IProblem.JavadocAmbiguousType;
2446                                 break;
2447                         case InternalNameProvided :
2448                                 id = IProblem.JavadocInternalTypeNameProvided;
2449                                 break;
2450                         case InheritedNameHidesEnclosingName :
2451                                 id = IProblem.JavadocInheritedNameHidesEnclosingTypeName;
2452                                 break;
2453                         case NoError : // 0
2454                         default :
2455                                 needImplementation(); // want to fail to see why we were here...
2456                                 break;
2457                 }
2458                 this.handle(
2459                         id,
2460                         new String[] {new String(type.readableName())},
2461                         new String[] {new String(type.shortReadableName())},
2462                         location.sourceStart,
2463                         location.sourceEnd);
2464         }
2465 }
2466 public void javadocMalformedSeeReference(int sourceStart, int sourceEnd) {
2467         this.handle(IProblem.JavadocMalformedSeeReference, NoArgument, NoArgument, sourceStart, sourceEnd);
2468 }
2469 public void javadocMissing(int sourceStart, int sourceEnd, int modifiers){
2470         boolean overriding = (modifiers & (CompilerModifiers.AccImplementing+CompilerModifiers.AccOverriding)) != 0;
2471         boolean report = (this.options.getSeverity(CompilerOptions.MissingJavadocComments) != ProblemSeverities.Ignore)
2472                                         && (!overriding || this.options.reportMissingJavadocCommentsOverriding);
2473         if (report) {
2474                 String arg = javadocVisibilityArgument(this.options.reportMissingJavadocCommentsVisibility, modifiers);
2475                 if (arg != null) {
2476                         String[] arguments = new String[] { arg };
2477                         this.handle(IProblem.JavadocMissing, arguments, arguments, sourceStart, sourceEnd);
2478                 }
2479         }
2480 }
2481 public void javadocMissingParamName(int sourceStart, int sourceEnd){
2482         this.handle(IProblem.JavadocMissingParamName, NoArgument, NoArgument, sourceStart, sourceEnd);
2483 }
2484 public void javadocMissingParamTag(Argument param, int modifiers) {
2485         boolean overriding = (modifiers & (CompilerModifiers.AccImplementing+CompilerModifiers.AccOverriding)) != 0;
2486         boolean report = (this.options.getSeverity(CompilerOptions.MissingJavadocTags) != ProblemSeverities.Ignore)
2487                                         && (!overriding || this.options.reportMissingJavadocTagsOverriding);
2488         if (report && javadocVisibility(this.options.reportMissingJavadocTagsVisibility, modifiers)) {
2489                 String[] arguments = new String[] { String.valueOf(param.name) };
2490                 this.handle(IProblem.JavadocMissingParamTag, arguments, arguments, param.sourceStart, param.sourceEnd);
2491         }
2492 }
2493 public void javadocMissingReturnTag(int sourceStart, int sourceEnd, int modifiers){
2494         boolean overriding = (modifiers & (CompilerModifiers.AccImplementing+CompilerModifiers.AccOverriding)) != 0;
2495         boolean report = (this.options.getSeverity(CompilerOptions.MissingJavadocTags) != ProblemSeverities.Ignore)
2496                                         && (!overriding || this.options.reportMissingJavadocTagsOverriding);
2497         if (report && javadocVisibility(this.options.reportMissingJavadocTagsVisibility, modifiers)) {
2498                 this.handle(IProblem.JavadocMissingReturnTag, NoArgument, NoArgument, sourceStart, sourceEnd);
2499         }
2500 }
2501 public void javadocMissingSeeReference(int sourceStart, int sourceEnd){
2502         this.handle(IProblem.JavadocMissingSeeReference, NoArgument, NoArgument, sourceStart, sourceEnd);
2503 }
2504 public void javadocMissingThrowsClassName(int sourceStart, int sourceEnd){
2505         this.handle(IProblem.JavadocMissingThrowsClassName, NoArgument, NoArgument, sourceStart, sourceEnd);
2506 }
2507 public void javadocMissingThrowsTag(TypeReference typeRef, int modifiers){
2508         boolean overriding = (modifiers & (CompilerModifiers.AccImplementing+CompilerModifiers.AccOverriding)) != 0;
2509         boolean report = (this.options.getSeverity(CompilerOptions.MissingJavadocTags) != ProblemSeverities.Ignore)
2510                                         && (!overriding || this.options.reportMissingJavadocTagsOverriding);
2511         if (report && javadocVisibility(this.options.reportMissingJavadocTagsVisibility, modifiers)) {
2512                 String[] arguments = new String[] { String.valueOf(typeRef.resolvedType.sourceName()) };
2513                 this.handle(IProblem.JavadocMissingThrowsTag, arguments, arguments, typeRef.sourceStart, typeRef.sourceEnd);
2514         }
2515 }
2516 public void javadocUnexpectedTag(int sourceStart, int sourceEnd) {
2517         this.handle(IProblem.JavadocUnexpectedTag, NoArgument, NoArgument, sourceStart, sourceEnd);
2518 }
2519 public void javadocUnterminatedInlineTag(int sourceStart, int sourceEnd) {
2520         this.handle(IProblem.JavadocUnterminatedInlineTag, NoArgument, NoArgument, sourceStart, sourceEnd);
2521 }
2522 private boolean javadocVisibility(int visibility, int modifiers) {
2523         switch (modifiers & CompilerModifiers.AccVisibilityMASK) {
2524                 case IConstants.AccPublic :
2525                         return true;
2526                 case IConstants.AccProtected:
2527                         return (visibility != IConstants.AccPublic);
2528                 case IConstants.AccDefault:
2529                         return (visibility == IConstants.AccDefault || visibility == IConstants.AccPrivate);
2530                 case IConstants.AccPrivate:
2531                         return (visibility == IConstants.AccPrivate);
2532         }
2533         return true;
2534 }
2535 private String javadocVisibilityArgument(int visibility, int modifiers) {
2536         String argument = null;
2537         switch (modifiers & CompilerModifiers.AccVisibilityMASK) {
2538                 case IConstants.AccPublic :
2539                         argument = CompilerOptions.PUBLIC;
2540                         break;
2541                 case IConstants.AccProtected:
2542                         if (visibility != IConstants.AccPublic) {
2543                                 argument = CompilerOptions.PROTECTED;
2544                         }
2545                         break;
2546                 case IConstants.AccDefault:
2547                         if (visibility == IConstants.AccDefault || visibility == IConstants.AccPrivate) {
2548                                 argument = CompilerOptions.DEFAULT;
2549                         }
2550                         break;
2551                 case IConstants.AccPrivate:
2552                         if (visibility == IConstants.AccPrivate) {
2553                                 argument = CompilerOptions.PRIVATE;
2554                         }
2555                         break;
2556         }
2557         return argument;
2558 }
2559 public void localVariableHiding(LocalDeclaration local, Binding hiddenVariable, boolean  isSpecialArgHidingField) {
2560         if (hiddenVariable instanceof LocalVariableBinding) {
2561                 String[] arguments = new String[] {new String(local.name)  };
2562                 this.handle(
2563                         (local instanceof Argument) 
2564                                 ? IProblem.ArgumentHidingLocalVariable 
2565                                 : IProblem.LocalVariableHidingLocalVariable,
2566                         arguments,
2567                         arguments,
2568                         local.sourceStart,
2569                         local.sourceEnd);
2570         } else if (hiddenVariable instanceof FieldBinding) {
2571                 if (isSpecialArgHidingField && !this.options.reportSpecialParameterHidingField){
2572                         return;
2573                 }
2574                 FieldBinding field = (FieldBinding) hiddenVariable;
2575                 this.handle(
2576                         (local instanceof Argument)
2577                                 ? IProblem.ArgumentHidingField
2578                                 : IProblem.LocalVariableHidingField,
2579                         new String[] {new String(local.name) , new String(field.declaringClass.readableName()) },
2580                         new String[] {new String(local.name), new String(field.declaringClass.shortReadableName()) },
2581                         local.sourceStart,
2582                         local.sourceEnd);
2583         }
2584 }
2585 public void methodNeedBody(AbstractMethodDeclaration methodDecl) {
2586         this.handle(
2587                 IProblem.MethodRequiresBody,
2588                 NoArgument,
2589                 NoArgument,
2590                 methodDecl.sourceStart,
2591                 methodDecl.sourceEnd);
2592 }
2593 public void methodNeedingNoBody(MethodDeclaration methodDecl) {
2594         this.handle(
2595                 ((methodDecl.modifiers & IConstants.AccNative) != 0) ? IProblem.BodyForNativeMethod : IProblem.BodyForAbstractMethod,
2596                 NoArgument,
2597                 NoArgument,
2598                 methodDecl.sourceStart,
2599                 methodDecl.sourceEnd);
2600 }
2601 public void methodWithConstructorName(MethodDeclaration methodDecl) {
2602         this.handle(
2603                 IProblem.MethodButWithConstructorName,
2604                 NoArgument,
2605                 NoArgument,
2606                 methodDecl.sourceStart,
2607                 methodDecl.sourceEnd);
2608 }
2609 public void missingReturnType(AbstractMethodDeclaration methodDecl) {
2610         this.handle(
2611                 IProblem.MissingReturnType,
2612                 NoArgument,
2613                 NoArgument,
2614                 methodDecl.sourceStart,
2615                 methodDecl.sourceEnd);
2616 }
2617 public void missingSemiColon(Expression expression){
2618         this.handle(
2619                 IProblem.MissingSemiColon,
2620                 NoArgument,
2621                 NoArgument,
2622                 expression.sourceStart,
2623                 expression.sourceEnd);
2624 }
2625 public void mustDefineDimensionsOrInitializer(ArrayAllocationExpression expression) {
2626         this.handle(
2627                 IProblem.MustDefineEitherDimensionExpressionsOrInitializer,
2628                 NoArgument,
2629                 NoArgument,
2630                 expression.sourceStart,
2631                 expression.sourceEnd);
2632 }
2633 public void mustSpecifyPackage(CompilationUnitDeclaration compUnitDecl) {
2634         String[] arguments = new String[] {new String(compUnitDecl.getFileName())};
2635         this.handle(
2636                 IProblem.MustSpecifyPackage,
2637                 arguments,
2638                 arguments,
2639                 compUnitDecl.sourceStart,
2640                 compUnitDecl.sourceStart + 1);  
2641 }
2642 public void mustUseAStaticMethod(MessageSend messageSend, MethodBinding method) {
2643         this.handle(
2644                 IProblem.StaticMethodRequested,
2645                 new String[] {new String(method.declaringClass.readableName()), new String(method.selector), parametersAsString(method)},
2646                 new String[] {new String(method.declaringClass.shortReadableName()), new String(method.selector), parametersAsShortString(method)},
2647                 messageSend.sourceStart,
2648                 messageSend.sourceEnd);
2649 }
2650
2651 public void nativeMethodsCannotBeStrictfp(ReferenceBinding type, AbstractMethodDeclaration methodDecl) {
2652         String[] arguments = new String[] {new String(type.sourceName()), new String(methodDecl.selector)};
2653         this.handle(
2654                 IProblem.NativeMethodsCannotBeStrictfp,
2655                 arguments,
2656                 arguments,
2657                 methodDecl.sourceStart,
2658                 methodDecl.sourceEnd);
2659 }
2660 public void needImplementation() {
2661         this.abortDueToInternalError(Util.bind("abort.missingCode")); //$NON-NLS-1$
2662 }
2663 public void needToEmulateFieldReadAccess(FieldBinding field, ASTNode location) {
2664         this.handle(
2665                 IProblem.NeedToEmulateFieldReadAccess,
2666                 new String[] {new String(field.declaringClass.readableName()), new String(field.name)},
2667                 new String[] {new String(field.declaringClass.shortReadableName()), new String(field.name)},
2668                 location.sourceStart,
2669                 location.sourceEnd);
2670 }
2671 public void needToEmulateFieldWriteAccess(FieldBinding field, ASTNode location) {
2672         this.handle(
2673                 IProblem.NeedToEmulateFieldWriteAccess,
2674                 new String[] {new String(field.declaringClass.readableName()), new String(field.name)},
2675                 new String[] {new String(field.declaringClass.shortReadableName()), new String(field.name)},
2676                 location.sourceStart,
2677                 location.sourceEnd);
2678 }
2679 public void needToEmulateMethodAccess(
2680         MethodBinding method, 
2681         ASTNode location) {
2682
2683         if (method.isConstructor())
2684                 this.handle(
2685                         IProblem.NeedToEmulateConstructorAccess, 
2686                         new String[] {
2687                                 new String(method.declaringClass.readableName()), 
2688                                 parametersAsString(method)
2689                          }, 
2690                         new String[] {
2691                                 new String(method.declaringClass.shortReadableName()), 
2692                                 parametersAsShortString(method)
2693                          }, 
2694                         location.sourceStart, 
2695                         location.sourceEnd); 
2696         else
2697                 this.handle(
2698                         IProblem.NeedToEmulateMethodAccess, 
2699                         new String[] {
2700                                 new String(method.declaringClass.readableName()), 
2701                                 new String(method.selector), 
2702                                 parametersAsString(method)
2703                          }, 
2704                         new String[] {
2705                                 new String(method.declaringClass.shortReadableName()), 
2706                                 new String(method.selector), 
2707                                 parametersAsShortString(method)
2708                          }, 
2709                         location.sourceStart, 
2710                         location.sourceEnd); 
2711 }
2712 public void nestedClassCannotDeclareInterface(TypeDeclaration typeDecl) {
2713         String[] arguments = new String[] {new String(typeDecl.name)};
2714         this.handle(
2715                 IProblem.CannotDefineInterfaceInLocalType,
2716                 arguments,
2717                 arguments,
2718                 typeDecl.sourceStart,
2719                 typeDecl.sourceEnd);
2720 }
2721 public void noMoreAvailableSpaceForArgument(LocalVariableBinding local, ASTNode location) {
2722         String[] arguments = new String[]{ new String(local.name) };
2723         this.handle(
2724                 local instanceof SyntheticArgumentBinding
2725                         ? IProblem.TooManySyntheticArgumentSlots
2726                         : IProblem.TooManyArgumentSlots,
2727                 arguments,
2728                 arguments,
2729                 Abort | Error,
2730                 location.sourceStart,
2731                 location.sourceEnd);
2732 }
2733 public void noMoreAvailableSpaceForLocal(LocalVariableBinding local, ASTNode location) {
2734         String[] arguments = new String[]{ new String(local.name) };
2735         this.handle(
2736                 IProblem.TooManyLocalVariableSlots,
2737                 arguments,
2738                 arguments,
2739                 Abort | Error,
2740                 location.sourceStart,
2741                 location.sourceEnd);
2742 }
2743 public void nonStaticAccessToStaticMethod(ASTNode location, MethodBinding method) {
2744         this.handle(
2745                 IProblem.NonStaticAccessToStaticMethod,
2746                 new String[] {new String(method.declaringClass.readableName()), new String(method.selector), parametersAsString(method)},
2747                 new String[] {new String(method.declaringClass.shortReadableName()), new String(method.selector), parametersAsShortString(method)},
2748                 location.sourceStart,
2749                 location.sourceEnd);
2750 }
2751 public void nonStaticAccessToStaticField(ASTNode location, FieldBinding field) {
2752         this.handle(
2753                 IProblem.NonStaticAccessToStaticField,
2754                 new String[] {new String(field.declaringClass.readableName()), new String(field.name)},
2755                 new String[] {new String(field.declaringClass.shortReadableName()), new String(field.name)},
2756                 location.sourceStart,
2757                 fieldLocation(field, location));
2758 }
2759 public void noSuchEnclosingInstance(TypeBinding targetType, ASTNode location, boolean isConstructorCall) {
2760
2761         int id;
2762
2763         if (isConstructorCall) {
2764                 //28 = No enclosing instance of type {0} is available due to some intermediate constructor invocation
2765                 id = IProblem.EnclosingInstanceInConstructorCall;
2766         } else if ((location instanceof ExplicitConstructorCall)
2767                                 && ((ExplicitConstructorCall) location).accessMode == ExplicitConstructorCall.ImplicitSuper) {
2768                 //20 = No enclosing instance of type {0} is accessible to invoke the super constructor. Must define a constructor and explicitly qualify its super constructor invocation with an instance of {0} (e.g. x.super() where x is an instance of {0}).
2769                 id = IProblem.MissingEnclosingInstanceForConstructorCall;
2770         } else if (location instanceof AllocationExpression 
2771                                 && (((AllocationExpression) location).binding.declaringClass.isMemberType()
2772                                         || (((AllocationExpression) location).binding.declaringClass.isAnonymousType() 
2773                                                 && ((AllocationExpression) location).binding.declaringClass.superclass().isMemberType()))) {
2774                 //21 = No enclosing instance of type {0} is accessible. Must qualify the allocation with an enclosing instance of type {0} (e.g. x.new A() where x is an instance of {0}).
2775                 id = IProblem.MissingEnclosingInstance;
2776         } else { // default
2777                 //22 = No enclosing instance of the type {0} is accessible in scope
2778                 id = IProblem.IncorrectEnclosingInstanceReference;
2779         }
2780
2781         this.handle(
2782                 id,
2783                 new String[] { new String(targetType.readableName())}, 
2784                 new String[] { new String(targetType.shortReadableName())}, 
2785                 location.sourceStart, 
2786                 location.sourceEnd); 
2787 }
2788 public void notCompatibleTypesError(EqualExpression expression, TypeBinding leftType, TypeBinding rightType) {
2789         String leftName = new String(leftType.readableName());
2790         String rightName = new String(rightType.readableName());
2791         String leftShortName = new String(leftType.shortReadableName());
2792         String rightShortName = new String(rightType.shortReadableName());
2793         if (leftShortName.equals(rightShortName)){
2794                 leftShortName = leftName;
2795                 rightShortName = rightName;
2796         }
2797         this.handle(
2798                 IProblem.IncompatibleTypesInEqualityOperator,
2799                 new String[] {leftName, rightName },
2800                 new String[] {leftShortName, rightShortName },
2801                 expression.sourceStart,
2802                 expression.sourceEnd);
2803 }
2804 public void notCompatibleTypesError(InstanceOfExpression expression, TypeBinding leftType, TypeBinding rightType) {
2805         String leftName = new String(leftType.readableName());
2806         String rightName = new String(rightType.readableName());
2807         String leftShortName = new String(leftType.shortReadableName());
2808         String rightShortName = new String(rightType.shortReadableName());
2809         if (leftShortName.equals(rightShortName)){
2810                 leftShortName = leftName;
2811                 rightShortName = rightName;
2812         }
2813         this.handle(
2814                 IProblem.IncompatibleTypesInConditionalOperator,
2815                 new String[] {leftName, rightName },
2816                 new String[] {leftShortName, rightShortName },
2817                 expression.sourceStart,
2818                 expression.sourceEnd);
2819 }
2820 public void objectCannotHaveSuperTypes(SourceTypeBinding type) {
2821         this.handle(
2822                 IProblem.ObjectCannotHaveSuperTypes,
2823                 NoArgument,
2824                 NoArgument,
2825                 type.sourceStart(),
2826                 type.sourceEnd());
2827 }
2828 public void operatorOnlyValidOnNumericType(CompoundAssignment  assignment, TypeBinding leftType, TypeBinding rightType) {
2829         String leftName = new String(leftType.readableName());
2830         String rightName = new String(rightType.readableName());
2831         String leftShortName = new String(leftType.shortReadableName());
2832         String rightShortName = new String(rightType.shortReadableName());
2833         if (leftShortName.equals(rightShortName)){
2834                 leftShortName = leftName;
2835                 rightShortName = rightName;
2836         }
2837         this.handle(
2838                 IProblem.TypeMismatch,
2839                 new String[] {leftName, rightName },
2840                 new String[] {leftShortName, rightShortName },
2841                 assignment.sourceStart,
2842                 assignment.sourceEnd);
2843 }
2844 public void overridesDeprecatedMethod(MethodBinding localMethod, MethodBinding inheritedMethod) {
2845         this.handle(
2846                 IProblem.OverridingDeprecatedMethod,
2847                 new String[] {
2848                         new String(
2849                                         CharOperation.concat(
2850                                                 localMethod.declaringClass.readableName(),
2851                                                 localMethod.readableName(),
2852                                                 '.')),
2853                         new String(inheritedMethod.declaringClass.readableName())},
2854                 new String[] {
2855                         new String(
2856                                         CharOperation.concat(
2857                                                 localMethod.declaringClass.shortReadableName(),
2858                                                 localMethod.shortReadableName(),
2859                                                 '.')),
2860                         new String(inheritedMethod.declaringClass.shortReadableName())},
2861                 localMethod.sourceStart(),
2862                 localMethod.sourceEnd());
2863 }
2864 public void overridesPackageDefaultMethod(MethodBinding localMethod, MethodBinding inheritedMethod) {
2865         this.handle(
2866                 IProblem.OverridingNonVisibleMethod,
2867                 new String[] {
2868                         new String(
2869                                         CharOperation.concat(
2870                                                 localMethod.declaringClass.readableName(),
2871                                                 localMethod.readableName(),
2872                                                 '.')),
2873                         new String(inheritedMethod.declaringClass.readableName())},
2874                 new String[] {
2875                         new String(
2876                                         CharOperation.concat(
2877                                                 localMethod.declaringClass.shortReadableName(),
2878                                                 localMethod.shortReadableName(),
2879                                                 '.')),
2880                         new String(inheritedMethod.declaringClass.shortReadableName())},
2881                 localMethod.sourceStart(),
2882                 localMethod.sourceEnd());
2883 }
2884 public void packageCollidesWithType(CompilationUnitDeclaration compUnitDecl) {
2885         String[] arguments = new String[] {CharOperation.toString(compUnitDecl.currentPackage.tokens)};
2886         this.handle(
2887                 IProblem.PackageCollidesWithType,
2888                 arguments,
2889                 arguments,
2890                 compUnitDecl.currentPackage.sourceStart,
2891                 compUnitDecl.currentPackage.sourceEnd);
2892 }
2893 public void packageIsNotExpectedPackage(CompilationUnitDeclaration compUnitDecl) {
2894         String[] arguments = new String[] {CharOperation.toString(compUnitDecl.compilationResult.compilationUnit.getPackageName())};
2895         this.handle(
2896                 IProblem.PackageIsNotExpectedPackage,
2897                 arguments,
2898                 arguments,
2899                 compUnitDecl.currentPackage == null ? 0 : compUnitDecl.currentPackage.sourceStart,
2900                 compUnitDecl.currentPackage == null ? 0 : compUnitDecl.currentPackage.sourceEnd);
2901 }
2902 private String parametersAsString(MethodBinding method) {
2903         TypeBinding[] params = method.parameters;
2904         StringBuffer buffer = new StringBuffer();
2905         for (int i = 0, length = params.length; i < length; i++) {
2906                 if (i != 0)
2907                         buffer.append(", "); //$NON-NLS-1$
2908                 buffer.append(new String(params[i].readableName()));
2909         }
2910         return buffer.toString();
2911 }
2912 private String parametersAsShortString(MethodBinding method) {
2913         TypeBinding[] params = method.parameters;
2914         StringBuffer buffer = new StringBuffer();
2915         for (int i = 0, length = params.length; i < length; i++) {
2916                 if (i != 0)
2917                         buffer.append(", "); //$NON-NLS-1$
2918                 buffer.append(new String(params[i].shortReadableName()));
2919         }
2920         return buffer.toString();
2921 }
2922 public void parseError(
2923         int startPosition, 
2924         int endPosition, 
2925         int currentToken,
2926         char[] currentTokenSource, 
2927         String errorTokenName, 
2928         String[] possibleTokens) {
2929                 
2930         if (possibleTokens.length == 0) { //no suggestion available
2931                 if (isKeyword(currentToken)) {
2932                         String[] arguments = new String[] {new String(currentTokenSource)};
2933                         this.handle(
2934                                 IProblem.ParsingErrorOnKeywordNoSuggestion,
2935                                 arguments,
2936                                 arguments,
2937                                 // this is the current -invalid- token position
2938                                 startPosition,
2939                                 endPosition);
2940                         return;
2941                 } else {
2942                         String[] arguments = new String[] {errorTokenName};
2943                         this.handle(
2944                                 IProblem.ParsingErrorNoSuggestion,
2945                                 arguments,
2946                                 arguments,
2947                                 // this is the current -invalid- token position
2948                                 startPosition,
2949                                 endPosition);
2950                         return;
2951                 }
2952         }
2953
2954         //build a list of probable right tokens
2955         StringBuffer list = new StringBuffer(20);
2956         for (int i = 0, max = possibleTokens.length; i < max; i++) {
2957                 if (i > 0)
2958                         list.append(", "); //$NON-NLS-1$
2959                 list.append('"');
2960                 list.append(possibleTokens[i]);
2961                 list.append('"');
2962         }
2963
2964         if (isKeyword(currentToken)) {
2965                 String[] arguments = new String[] {new String(currentTokenSource), list.toString()};
2966                 this.handle(
2967                         IProblem.ParsingErrorOnKeyword,
2968                         arguments,
2969                         arguments,
2970                         // this is the current -invalid- token position
2971                         startPosition,
2972                         endPosition);
2973                 return;
2974         }
2975         //extract the literal when it's a literal  
2976         if (isLiteral(currentToken) ||
2977                 isIdentifier(currentToken)) { //$NON-NLS-1$
2978                         errorTokenName = new String(currentTokenSource);
2979         }
2980
2981         String[] arguments = new String[] {errorTokenName, list.toString()};
2982         this.handle(
2983                 IProblem.ParsingError,
2984                 arguments,
2985                 arguments,
2986                 // this is the current -invalid- token position
2987                 startPosition,
2988                 endPosition);
2989 }
2990 public void possibleAccidentalBooleanAssignment(Assignment assignment) {
2991         String[] arguments = new String[] {};
2992         this.handle(
2993                 IProblem.PossibleAccidentalBooleanAssignment,
2994                 arguments,
2995                 arguments,
2996                 assignment.sourceStart,
2997                 assignment.sourceEnd);
2998 }
2999 public void publicClassMustMatchFileName(CompilationUnitDeclaration compUnitDecl, TypeDeclaration typeDecl) {
3000         this.referenceContext = typeDecl; // report the problem against the type not the entire compilation unit
3001         String[] arguments = new String[] {new String(compUnitDecl.getFileName()), new String(typeDecl.name)};
3002         this.handle(
3003                 IProblem.PublicClassMustMatchFileName,
3004                 arguments,
3005                 arguments,
3006                 typeDecl.sourceStart,
3007                 typeDecl.sourceEnd,
3008                 compUnitDecl.compilationResult);
3009 }
3010 public void recursiveConstructorInvocation(ExplicitConstructorCall constructorCall) {
3011
3012         this.handle(
3013                 IProblem.RecursiveConstructorInvocation,
3014                 new String[] {
3015                         new String(constructorCall.binding.declaringClass.readableName()), 
3016                         parametersAsString(constructorCall.binding)
3017                 },
3018                 new String[] {
3019                         new String(constructorCall.binding.declaringClass.shortReadableName()), 
3020                         parametersAsShortString(constructorCall.binding)
3021                 },
3022                 constructorCall.sourceStart,
3023                 constructorCall.sourceEnd);
3024 }
3025
3026 public void redefineArgument(Argument arg) {
3027         String[] arguments = new String[] {new String(arg.name)};
3028         this.handle(
3029                 IProblem.RedefinedArgument,
3030                 arguments,
3031                 arguments,
3032                 arg.sourceStart,
3033                 arg.sourceEnd);
3034 }
3035 public void redefineLocal(LocalDeclaration localDecl) {
3036         String[] arguments = new String[] {new String(localDecl.name)};
3037         this.handle(
3038                 IProblem.RedefinedLocal,
3039                 arguments,
3040                 arguments,
3041                 localDecl.sourceStart,
3042                 localDecl.sourceEnd);
3043 }
3044 public void referenceMustBeArrayTypeAt(TypeBinding arrayType, ArrayReference arrayRef) {
3045         this.handle(
3046                 IProblem.ArrayReferenceRequired,
3047                 new String[] {new String(arrayType.readableName())},
3048                 new String[] {new String(arrayType.shortReadableName())},
3049                 arrayRef.sourceStart,
3050                 arrayRef.sourceEnd);
3051 }
3052 public void returnTypeCannotBeVoidArray(SourceTypeBinding type, MethodDeclaration methodDecl) {
3053         String[] arguments = new String[] {new String(methodDecl.selector)};
3054         this.handle(
3055                 IProblem.ReturnTypeCannotBeVoidArray,
3056                 arguments,
3057                 arguments,
3058                 methodDecl.sourceStart,
3059                 methodDecl.sourceEnd);
3060 }
3061 public void returnTypeProblem(SourceTypeBinding type, MethodDeclaration methodDecl, TypeBinding expectedType) {
3062         int problemId = expectedType.problemId();
3063         int id;
3064         switch (problemId) {
3065                 case NotFound : // 1
3066                         id = IProblem.ReturnTypeNotFound;
3067                         break;
3068                 case NotVisible : // 2
3069                         id = IProblem.ReturnTypeNotVisible;
3070                         break;
3071                 case Ambiguous : // 3
3072                         id = IProblem.ReturnTypeAmbiguous;
3073                         break;
3074                 case InternalNameProvided : // 4
3075                         id = IProblem.ReturnTypeInternalNameProvided;
3076                         break;
3077                 case InheritedNameHidesEnclosingName : // 5
3078                         id = IProblem.ReturnTypeInheritedNameHidesEnclosingName;
3079                         break;
3080                 case NoError : // 0
3081                 default :
3082                         needImplementation(); // want to fail to see why we were here...
3083                         return;
3084         }
3085         this.handle(
3086                 id,
3087                 new String[] {new String(methodDecl.selector), new String(expectedType.readableName())},
3088                 new String[] {new String(methodDecl.selector), new String(expectedType.shortReadableName())},
3089                 methodDecl.returnType.sourceStart,
3090                 methodDecl.returnType.sourceEnd);
3091 }
3092 public void scannerError(Parser parser, String errorTokenName) {
3093         Scanner scanner = parser.scanner;
3094
3095         int flag = IProblem.ParsingErrorNoSuggestion;
3096         int startPos = scanner.startPosition;
3097
3098         //special treatment for recognized errors....
3099         if (errorTokenName.equals(Scanner.END_OF_SOURCE))
3100                 flag = IProblem.EndOfSource;
3101         else if (errorTokenName.equals(Scanner.INVALID_HEXA))
3102                 flag = IProblem.InvalidHexa;
3103         else if (errorTokenName.equals(Scanner.INVALID_OCTAL))
3104                 flag = IProblem.InvalidOctal;
3105         else if (errorTokenName.equals(Scanner.INVALID_CHARACTER_CONSTANT))
3106                 flag = IProblem.InvalidCharacterConstant;
3107         else if (errorTokenName.equals(Scanner.INVALID_ESCAPE))
3108                 flag = IProblem.InvalidEscape;
3109         else if (errorTokenName.equals(Scanner.INVALID_UNICODE_ESCAPE)){
3110                 flag = IProblem.InvalidUnicodeEscape;
3111                 // better locate the error message
3112                 char[] source = scanner.source;
3113                 int checkPos = scanner.currentPosition - 1;
3114                 if (checkPos >= source.length) checkPos = source.length - 1;
3115                 while (checkPos >= startPos){
3116                         if (source[checkPos] == '\\') break;
3117                         checkPos --;
3118                 }
3119                 startPos = checkPos;
3120         } else if (errorTokenName.equals(Scanner.INVALID_FLOAT))
3121                 flag = IProblem.InvalidFloat;
3122         else if (errorTokenName.equals(Scanner.UNTERMINATED_STRING))
3123                 flag = IProblem.UnterminatedString;
3124         else if (errorTokenName.equals(Scanner.UNTERMINATED_COMMENT))
3125                 flag = IProblem.UnterminatedComment;
3126         else if (errorTokenName.equals(Scanner.INVALID_CHAR_IN_STRING))
3127                 flag = IProblem.UnterminatedString;
3128         else if (errorTokenName.equals(Scanner.INVALID_INPUT))
3129                 flag = IProblem.InvalidInput;
3130
3131         String[] arguments = flag == IProblem.ParsingErrorNoSuggestion 
3132                         ? new String[] {errorTokenName}
3133                         : NoArgument;
3134         this.handle(
3135                 flag, 
3136                 arguments,
3137                 arguments,
3138                 // this is the current -invalid- token position
3139                 startPos, 
3140                 scanner.currentPosition - 1,
3141                 parser.compilationUnit.compilationResult);
3142 }
3143 public void shouldReturn(TypeBinding returnType, ASTNode location) {
3144         this.handle(
3145                 IProblem.ShouldReturnValue,
3146                 new String[] { new String (returnType.readableName())},
3147                 new String[] { new String (returnType.shortReadableName())},
3148                 location.sourceStart,
3149                 location.sourceEnd);
3150 }
3151 public void signalNoImplicitStringConversionForCharArrayExpression(Expression expression) {
3152         this.handle(
3153                 IProblem.NoImplicitStringConversionForCharArrayExpression,
3154                 NoArgument,
3155                 NoArgument,
3156                 expression.sourceStart,
3157                 expression.sourceEnd);
3158 }
3159 public void staticAndInstanceConflict(MethodBinding currentMethod, MethodBinding inheritedMethod) {
3160         if (currentMethod.isStatic())
3161                 this.handle(
3162                         // This static method cannot hide the instance method from %1
3163                         // 8.4.6.4 - If a class inherits more than one method with the same signature a static (non-abstract) method cannot hide an instance method.
3164                         IProblem.CannotHideAnInstanceMethodWithAStaticMethod,
3165                         new String[] {new String(inheritedMethod.declaringClass.readableName())},
3166                         new String[] {new String(inheritedMethod.declaringClass.shortReadableName())},
3167                         currentMethod.sourceStart(),
3168                         currentMethod.sourceEnd());
3169         else
3170                 this.handle(
3171                         // This instance method cannot override the static method from %1
3172                         // 8.4.6.4 - If a class inherits more than one method with the same signature an instance (non-abstract) method cannot override a static method.
3173                         IProblem.CannotOverrideAStaticMethodWithAnInstanceMethod,
3174                         new String[] {new String(inheritedMethod.declaringClass.readableName())},
3175                         new String[] {new String(inheritedMethod.declaringClass.shortReadableName())},
3176                         currentMethod.sourceStart(),
3177                         currentMethod.sourceEnd());
3178 }
3179 public void staticFieldAccessToNonStaticVariable(ASTNode location, FieldBinding field) {
3180         String[] arguments = new String[] {new String(field.readableName())};
3181         this.handle(
3182                 IProblem.NonStaticFieldFromStaticInvocation,
3183                 arguments,
3184                 arguments,
3185                 location.sourceStart,
3186                 fieldLocation(field, location)); 
3187 }
3188 public void staticInheritedMethodConflicts(SourceTypeBinding type, MethodBinding concreteMethod, MethodBinding[] abstractMethods) {
3189         this.handle(
3190                 // The static method %1 conflicts with the abstract method in %2
3191                 // 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.
3192                 IProblem.StaticInheritedMethodConflicts,
3193                 new String[] {
3194                         new String(concreteMethod.readableName()),
3195                         new String(abstractMethods[0].declaringClass.readableName())},
3196                 new String[] {
3197                         new String(concreteMethod.readableName()),
3198                         new String(abstractMethods[0].declaringClass.shortReadableName())},
3199                 type.sourceStart(),
3200                 type.sourceEnd());
3201 }
3202 public void stringConstantIsExceedingUtf8Limit(ASTNode location) {
3203         this.handle(
3204                 IProblem.StringConstantIsExceedingUtf8Limit,
3205                 NoArgument,
3206                 NoArgument,
3207                 location.sourceStart,
3208                 location.sourceEnd);
3209 }
3210 public void superclassMustBeAClass(SourceTypeBinding type, TypeReference superclassRef, ReferenceBinding superType) {
3211         this.handle(
3212                 IProblem.SuperclassMustBeAClass,
3213                 new String[] {new String(superType.readableName()), new String(type.sourceName())},
3214                 new String[] {new String(superType.shortReadableName()), new String(type.sourceName())},
3215                 superclassRef.sourceStart,
3216                 superclassRef.sourceEnd);
3217 }
3218 public void superfluousSemicolon(int sourceStart, int sourceEnd) {
3219         this.handle(
3220                 IProblem.SuperfluousSemicolon,
3221                 NoArgument,
3222                 NoArgument,
3223                 sourceStart,
3224                 sourceEnd);     
3225 }
3226 public void superinterfaceMustBeAnInterface(SourceTypeBinding type, TypeDeclaration typeDecl, ReferenceBinding superType) {
3227         this.handle(
3228                 IProblem.SuperInterfaceMustBeAnInterface,
3229                 new String[] {new String(superType.readableName()), new String(type.sourceName())},
3230                 new String[] {new String(superType.shortReadableName()), new String(type.sourceName())},
3231                 typeDecl.sourceStart,
3232                 typeDecl.sourceEnd);
3233 }
3234 public void task(String tag, String message, String priority, int start, int end){
3235         this.handle(
3236                 IProblem.Task,
3237                 new String[] { tag, message, priority/*secret argument that is not surfaced in getMessage()*/},
3238                 new String[] { tag, message, priority/*secret argument that is not surfaced in getMessage()*/}, 
3239                 start,
3240                 end);
3241 }
3242 public void tooManyDimensions(ASTNode expression) {
3243         this.handle(
3244                 IProblem.TooManyArrayDimensions,
3245                 NoArgument,
3246                 NoArgument,
3247                 expression.sourceStart,
3248                 expression.sourceEnd);
3249 }
3250 public void tooManyFields(TypeDeclaration typeDeclaration) {
3251         this.handle(
3252                 IProblem.TooManyFields,
3253                 new String[]{ new String(typeDeclaration.binding.readableName())},
3254                 new String[]{ new String(typeDeclaration.binding.shortReadableName())},
3255                 Abort | Error,
3256                 typeDeclaration.sourceStart,
3257                 typeDeclaration.sourceEnd);
3258 }
3259 public void tooManyMethods(TypeDeclaration typeDeclaration) {
3260         this.handle(
3261                 IProblem.TooManyMethods,
3262                 new String[]{ new String(typeDeclaration.binding.readableName())},
3263                 new String[]{ new String(typeDeclaration.binding.shortReadableName())},
3264                 Abort | Error,
3265                 typeDeclaration.sourceStart,
3266                 typeDeclaration.sourceEnd);
3267 }
3268 public void typeCastError(CastExpression expression, TypeBinding leftType, TypeBinding rightType) {
3269         String leftName = new String(leftType.readableName());
3270         String rightName = new String(rightType.readableName());
3271         String leftShortName = new String(leftType.shortReadableName());
3272         String rightShortName = new String(rightType.shortReadableName());
3273         if (leftShortName.equals(rightShortName)){
3274                 leftShortName = leftName;
3275                 rightShortName = rightName;
3276         }
3277         this.handle(
3278                 IProblem.IllegalCast,
3279                 new String[] { rightName, leftName },
3280                 new String[] { rightShortName, leftShortName },
3281                 expression.sourceStart,
3282                 expression.sourceEnd);
3283 }
3284 public void typeCollidesWithPackage(CompilationUnitDeclaration compUnitDecl, TypeDeclaration typeDecl) {
3285         this.referenceContext = typeDecl; // report the problem against the type not the entire compilation unit
3286         String[] arguments = new String[] {new String(compUnitDecl.getFileName()), new String(typeDecl.name)};
3287         this.handle(
3288                 IProblem.TypeCollidesWithPackage,
3289                 arguments,
3290                 arguments,
3291                 typeDecl.sourceStart,
3292                 typeDecl.sourceEnd,
3293                 compUnitDecl.compilationResult);
3294 }
3295 public void typeMismatchError(TypeBinding resultType, TypeBinding expectedType, ASTNode location) {
3296         String resultTypeName = new String(resultType.readableName());
3297         String expectedTypeName = new String(expectedType.readableName());
3298         String resultTypeShortName = new String(resultType.shortReadableName());
3299         String expectedTypeShortName = new String(expectedType.shortReadableName());
3300         if (resultTypeShortName.equals(expectedTypeShortName)){
3301                 resultTypeShortName = resultTypeName;
3302                 expectedTypeShortName = expectedTypeName;
3303         }
3304         this.handle(
3305                 IProblem.TypeMismatch,
3306                 new String[] {resultTypeName, expectedTypeName},
3307                 new String[] {resultTypeShortName, expectedTypeShortName},
3308                 location.sourceStart,
3309                 location.sourceEnd);
3310 }
3311 public void typeMismatchErrorActualTypeExpectedType(Expression expression, TypeBinding constantType, TypeBinding expectedType) {
3312         String constantTypeName = new String(constantType.readableName());
3313         String expectedTypeName = new String(expectedType.readableName());
3314         String constantTypeShortName = new String(constantType.shortReadableName());
3315         String expectedTypeShortName = new String(expectedType.shortReadableName());
3316         if (constantTypeShortName.equals(expectedTypeShortName)){
3317                 constantTypeShortName = constantTypeName;
3318                 expectedTypeShortName = expectedTypeName;
3319         }
3320         this.handle(
3321                 IProblem.TypeMismatch,
3322                 new String[] {constantTypeName, expectedTypeName},
3323                 new String[] {constantTypeShortName, expectedTypeShortName},
3324                 expression.sourceStart,
3325                 expression.sourceEnd);
3326 }
3327 public void undefinedLabel(BranchStatement statement) {
3328         String[] arguments = new String[] {new String(statement.label)};
3329         this.handle(
3330                 IProblem.UndefinedLabel,
3331                 arguments,
3332                 arguments,
3333                 statement.sourceStart,
3334                 statement.sourceEnd);
3335 }
3336 public void undocumentedEmptyBlock(int blockStart, int blockEnd) {
3337         String[] arguments = new String[] {};
3338         this.handle(
3339                 IProblem.UndocumentedEmptyBlock,
3340                 arguments,
3341                 arguments,
3342                 blockStart,
3343                 blockEnd);
3344 }
3345 public void unexpectedStaticModifierForField(SourceTypeBinding type, FieldDeclaration fieldDecl) {
3346         String[] arguments = new String[] {new String(fieldDecl.name)};
3347         this.handle(
3348                 IProblem.UnexpectedStaticModifierForField,
3349                 arguments,
3350                 arguments,
3351                 fieldDecl.sourceStart,
3352                 fieldDecl.sourceEnd);
3353 }
3354 public void unexpectedStaticModifierForMethod(ReferenceBinding type, AbstractMethodDeclaration methodDecl) {
3355         String[] arguments = new String[] {new String(type.sourceName()), new String(methodDecl.selector)};
3356         this.handle(
3357                 IProblem.UnexpectedStaticModifierForMethod,
3358                 arguments,
3359                 arguments,
3360                 methodDecl.sourceStart,
3361                 methodDecl.sourceEnd);
3362 }
3363 public void unhandledException(TypeBinding exceptionType, ASTNode location) {
3364
3365         boolean insideDefaultConstructor = 
3366                 (this.referenceContext instanceof ConstructorDeclaration)
3367                         && ((ConstructorDeclaration)this.referenceContext).isDefaultConstructor();
3368         boolean insideImplicitConstructorCall =
3369                 (location instanceof ExplicitConstructorCall)
3370                         && (((ExplicitConstructorCall) location).accessMode == ExplicitConstructorCall.ImplicitSuper);
3371
3372         this.handle(
3373                 insideDefaultConstructor
3374                         ? IProblem.UnhandledExceptionInDefaultConstructor
3375                         : (insideImplicitConstructorCall 
3376                                         ? IProblem.UndefinedConstructorInImplicitConstructorCall
3377                                         : IProblem.UnhandledException),
3378                 new String[] {new String(exceptionType.readableName())},
3379                 new String[] {new String(exceptionType.shortReadableName())},
3380                 location.sourceStart,
3381                 location.sourceEnd);
3382 }
3383 public void uninitializedBlankFinalField(FieldBinding binding, ASTNode location) {
3384         String[] arguments = new String[] {new String(binding.readableName())};
3385         this.handle(
3386                 IProblem.UninitializedBlankFinalField,
3387                 arguments,
3388                 arguments,
3389                 location.sourceStart,
3390                 fieldLocation(binding, location));
3391 }
3392 public void uninitializedLocalVariable(LocalVariableBinding binding, ASTNode location) {
3393         String[] arguments = new String[] {new String(binding.readableName())};
3394         this.handle(
3395                 IProblem.UninitializedLocalVariable,
3396                 arguments,
3397                 arguments,
3398                 location.sourceStart,
3399                 location.sourceEnd);
3400 }
3401 public void unmatchedBracket(int position, ReferenceContext context, CompilationResult compilationResult) {
3402         this.handle(
3403                 IProblem.UnmatchedBracket, 
3404                 NoArgument,
3405                 NoArgument,
3406                 position, 
3407                 position,
3408                 context,
3409                 compilationResult);
3410 }
3411 public void unnecessaryCast(CastExpression castExpression) {
3412         TypeBinding castedExpressionType = castExpression.expression.resolvedType;
3413         this.handle(
3414                 IProblem.UnnecessaryCast,
3415                 new String[]{ new String(castedExpressionType.readableName()), new String(castExpression.resolvedType.readableName())},
3416                 new String[]{ new String(castedExpressionType.shortReadableName()), new String(castExpression.resolvedType.shortReadableName())},
3417                 castExpression.sourceStart,
3418                 castExpression.sourceEnd);
3419 }
3420 public void unnecessaryCastForArgument(CastExpression castExpression, TypeBinding parameterType) {
3421         TypeBinding castedExpressionType = castExpression.expression.resolvedType;
3422         this.handle(
3423                 IProblem.UnnecessaryArgumentCast,
3424                 new String[]{ new String(castedExpressionType.readableName()), new String(castExpression.resolvedType.readableName()), new String(parameterType.readableName())},
3425                 new String[]{ new String(castedExpressionType.shortReadableName()), new String(castExpression.resolvedType.shortReadableName()), new String(parameterType.shortReadableName())},
3426                 castExpression.sourceStart,
3427                 castExpression.sourceEnd);
3428 }
3429 public void unnecessaryInstanceof(InstanceOfExpression instanceofExpression, TypeBinding checkType) {
3430         TypeBinding expressionType = instanceofExpression.expression.resolvedType;
3431         this.handle(
3432                 IProblem.UnnecessaryInstanceof,
3433                 new String[]{ new String(expressionType.readableName()), new String(checkType.readableName())},
3434                 new String[]{ new String(expressionType.shortReadableName()), new String(checkType.shortReadableName())},
3435                 instanceofExpression.sourceStart,
3436                 instanceofExpression.sourceEnd);
3437 }
3438 public void unqualifiedFieldAccess(NameReference reference, FieldBinding field) {
3439         int end = reference.sourceEnd;
3440         if (reference instanceof QualifiedNameReference) {
3441                 QualifiedNameReference qref = (QualifiedNameReference) reference;
3442                 end = (int) qref.sourcePositions[0];
3443         }
3444         this.handle(
3445                 IProblem.UnqualifiedFieldAccess,
3446                 new String[] {new String(field.declaringClass.readableName()), new String(field.name)},
3447                 new String[] {new String(field.declaringClass.shortReadableName()), new String(field.name)},
3448                 reference.sourceStart,
3449                 end);
3450 }
3451 public void unnecessaryElse(ASTNode location) {
3452         this.handle(
3453                 IProblem.UnnecessaryElse,
3454                 NoArgument,
3455                 NoArgument,
3456                 location.sourceStart,
3457                 location.sourceEnd);
3458 }
3459 public void unnecessaryEnclosingInstanceSpecification(Expression expression, ReferenceBinding targetType) {
3460         this.handle(
3461                 IProblem.IllegalEnclosingInstanceSpecification,
3462                 new String[]{ new String(targetType.readableName())},
3463                 new String[]{ new String(targetType.shortReadableName())},
3464                 expression.sourceStart,
3465                 expression.sourceEnd);
3466 }
3467 public void unreachableCatchBlock(ReferenceBinding exceptionType, ASTNode location) {
3468         this.handle(
3469                 IProblem.UnreachableCatch,
3470                 new String[] {
3471                         new String(exceptionType.readableName()),
3472                  }, 
3473                 new String[] {
3474                         new String(exceptionType.shortReadableName()),
3475                  }, 
3476                 location.sourceStart,
3477                 location.sourceEnd);
3478 }
3479 public void unreachableCode(Statement statement) {
3480         this.handle(
3481                 IProblem.CodeCannotBeReached,
3482                 NoArgument,
3483                 NoArgument,
3484                 statement.sourceStart,
3485                 statement.sourceEnd);
3486 }
3487 public void unresolvableReference(NameReference nameRef, Binding binding) {
3488         int severity = Error;
3489 /* also need to check that the searchedType is the receiver type
3490         if (binding instanceof ProblemBinding) {
3491                 ProblemBinding problem = (ProblemBinding) binding;
3492                 if (problem.searchType != null && problem.searchType.isHierarchyInconsistent())
3493                         severity = SecondaryError;
3494         }
3495 */
3496         String[] arguments = new String[] {new String(binding.readableName())};
3497         int end = nameRef.sourceEnd;
3498         if (nameRef instanceof QualifiedNameReference) {
3499                 QualifiedNameReference ref = (QualifiedNameReference) nameRef;
3500                 if (ref.indexOfFirstFieldBinding >= 1)
3501                         end = (int) ref.sourcePositions[ref.indexOfFirstFieldBinding - 1];
3502         }
3503         this.handle(
3504                 IProblem.UndefinedName,
3505                 arguments,
3506                 arguments,
3507                 severity,
3508                 nameRef.sourceStart,
3509                 end);
3510 }
3511 public void unusedArgument(LocalDeclaration localDecl) {
3512
3513         String[] arguments = new String[] {new String(localDecl.name)};
3514         this.handle(
3515                 IProblem.ArgumentIsNeverUsed,
3516                 arguments,
3517                 arguments,
3518                 localDecl.sourceStart,
3519                 localDecl.sourceEnd);
3520 }
3521 public void unusedDeclaredThrownException(ReferenceBinding exceptionType, AbstractMethodDeclaration method, ASTNode location) {
3522         if (method.isConstructor()) {
3523                 this.handle(
3524                         IProblem.UnusedConstructorDeclaredThrownException,
3525                         new String[] {
3526                                 new String(method.binding.declaringClass.readableName()),
3527                                 parametersAsString(method.binding),
3528                                 new String(exceptionType.readableName()),
3529                          }, 
3530                         new String[] {
3531                                 new String(method.binding.declaringClass.shortReadableName()),
3532                                 parametersAsShortString(method.binding),
3533                                 new String(exceptionType.shortReadableName()),
3534                          }, 
3535                         location.sourceStart,
3536                         location.sourceEnd);
3537         } else {
3538                 this.handle(
3539                         IProblem.UnusedMethodDeclaredThrownException,
3540                         new String[] {
3541                                 new String(method.binding.declaringClass.readableName()),
3542                                 new String(method.selector),
3543                                 parametersAsString(method.binding),
3544                                 new String(exceptionType.readableName()),
3545                          }, 
3546                         new String[] {
3547                                 new String(method.binding.declaringClass.shortReadableName()),
3548                                 new String(method.selector),
3549                                 parametersAsShortString(method.binding),
3550                                 new String(exceptionType.shortReadableName()),
3551                          }, 
3552                         location.sourceStart,
3553                         location.sourceEnd);
3554         }
3555 }
3556 public void unusedImport(ImportReference importRef) {
3557         String[] arguments = new String[] { CharOperation.toString(importRef.tokens) };
3558         this.handle(
3559                 IProblem.UnusedImport,
3560                 arguments,
3561                 arguments,
3562                 importRef.sourceStart,
3563                 importRef.sourceEnd); 
3564 }
3565 public void unusedLocalVariable(LocalDeclaration localDecl) {
3566         String[] arguments = new String[] {new String(localDecl.name)};
3567         this.handle(
3568                 IProblem.LocalVariableIsNeverUsed,
3569                 arguments,
3570                 arguments,
3571                 localDecl.sourceStart,
3572                 localDecl.sourceEnd);
3573 }
3574 public void unusedPrivateConstructor(ConstructorDeclaration constructorDecl) {
3575         
3576         if (computeSeverity(IProblem.UnusedPrivateConstructor) == Ignore) return;
3577
3578         // no complaint for no-arg constructors (or default ones) - known pattern to block instantiation
3579         if (constructorDecl.arguments == null || constructorDecl.arguments.length == 0) return;
3580                                         
3581         MethodBinding constructor = constructorDecl.binding;
3582         this.handle(
3583                         IProblem.UnusedPrivateConstructor,
3584                 new String[] {
3585                         new String(constructor.declaringClass.readableName()),
3586                         parametersAsString(constructor)
3587                  }, 
3588                 new String[] {
3589                         new String(constructor.declaringClass.shortReadableName()),
3590                         parametersAsShortString(constructor)
3591                  }, 
3592                 constructorDecl.sourceStart,
3593                 constructorDecl.sourceEnd);
3594 }
3595 public void unusedPrivateField(FieldDeclaration fieldDecl) {
3596         
3597         if (computeSeverity(IProblem.UnusedPrivateField) == Ignore) return;
3598
3599         FieldBinding field = fieldDecl.binding;
3600         
3601         if (CharOperation.equals(TypeConstants.SERIALVERSIONUID, field.name)
3602                         && field.isStatic()
3603                         && field.isFinal()
3604                         && BaseTypes.LongBinding == field.type) {
3605                                 return; // do not report unused serialVersionUID field
3606         }
3607         if (CharOperation.equals(TypeConstants.SERIALPERSISTENTFIELDS, field.name)
3608                         && field.isStatic()
3609                         && field.isFinal()
3610                         && field.type.dimensions() == 1
3611                         && CharOperation.equals(TypeConstants.CharArray_JAVA_IO_OBJECTSTREAMFIELD, field.type.leafComponentType().readableName())) {
3612                                 return; // do not report unused serialPersistentFields field
3613         }
3614         this.handle(
3615                         IProblem.UnusedPrivateField,
3616                 new String[] {
3617                         new String(field.declaringClass.readableName()),
3618                         new String(field.name),
3619                  }, 
3620                 new String[] {
3621                         new String(field.declaringClass.shortReadableName()),
3622                         new String(field.name),
3623                  }, 
3624                 fieldDecl.sourceStart,
3625                 fieldDecl.sourceEnd);
3626 }
3627 public void unusedPrivateMethod(AbstractMethodDeclaration methodDecl) {
3628
3629         if (computeSeverity(IProblem.UnusedPrivateMethod) == Ignore) return;
3630         
3631         MethodBinding method = methodDecl.binding;
3632         
3633         // no report for serialization support 'void readObject(ObjectInputStream)'
3634         if (!method.isStatic()
3635                         && BaseTypes.VoidBinding == method.returnType
3636                         && method.parameters.length == 1
3637                         && method.parameters[0].dimensions() == 0
3638                         && CharOperation.equals(method.selector, TypeConstants.READOBJECT)
3639                         && CharOperation.equals(TypeConstants.CharArray_JAVA_IO_OBJECTINPUTSTREAM, method.parameters[0].readableName())) {
3640                 return;
3641         }
3642         // no report for serialization support 'void writeObject(ObjectOutputStream)'
3643         if (!method.isStatic()
3644                         && BaseTypes.VoidBinding == method.returnType
3645                         && method.parameters.length == 1
3646                         && method.parameters[0].dimensions() == 0
3647                         && CharOperation.equals(method.selector, TypeConstants.WRITEOBJECT)
3648                         && CharOperation.equals(TypeConstants.CharArray_JAVA_IO_OBJECTOUTPUTSTREAM, method.parameters[0].readableName())) {
3649                 return;
3650         }
3651         // no report for serialization support 'Object readResolve()'
3652         if (!method.isStatic()
3653                         && TypeIds.T_Object == method.returnType.id
3654                         && method.parameters.length == 0
3655                         && CharOperation.equals(method.selector, TypeConstants.READRESOLVE)) {
3656                 return;
3657         }
3658         // no report for serialization support 'Object writeReplace()'
3659         if (!method.isStatic()
3660                         && TypeIds.T_Object == method.returnType.id
3661                         && method.parameters.length == 0
3662                         && CharOperation.equals(method.selector, TypeConstants.WRITEREPLACE)) {
3663                 return;
3664         }
3665         this.handle(
3666                         IProblem.UnusedPrivateMethod,
3667                 new String[] {
3668                         new String(method.declaringClass.readableName()),
3669                         new String(method.selector),
3670                         parametersAsString(method)
3671                  }, 
3672                 new String[] {
3673                         new String(method.declaringClass.shortReadableName()),
3674                         new String(method.selector),
3675                         parametersAsShortString(method)
3676                  }, 
3677                 methodDecl.sourceStart,
3678                 methodDecl.sourceEnd);
3679 }
3680 public void unusedPrivateType(TypeDeclaration typeDecl) {
3681         
3682         if (computeSeverity(IProblem.UnusedPrivateType) == Ignore) return;
3683
3684         ReferenceBinding type = typeDecl.binding;
3685         this.handle(
3686                         IProblem.UnusedPrivateType,
3687                 new String[] {
3688                         new String(type.readableName()),
3689                  }, 
3690                 new String[] {
3691                         new String(type.shortReadableName()),
3692                  }, 
3693                 typeDecl.sourceStart,
3694                 typeDecl.sourceEnd);
3695 }
3696 public void useAssertAsAnIdentifier(int sourceStart, int sourceEnd) {
3697         this.handle(
3698                 IProblem.UseAssertAsAnIdentifier,
3699                 NoArgument,
3700                 NoArgument,
3701                 sourceStart,
3702                 sourceEnd);     
3703 }
3704
3705 public void variableTypeCannotBeVoid(AbstractVariableDeclaration varDecl) {
3706         String[] arguments = new String[] {new String(varDecl.name)};
3707         this.handle(
3708                 IProblem.VariableTypeCannotBeVoid,
3709                 arguments,
3710                 arguments,
3711                 varDecl.sourceStart,
3712                 varDecl.sourceEnd);
3713 }
3714 public void variableTypeCannotBeVoidArray(AbstractVariableDeclaration varDecl) {
3715         String[] arguments = new String[] {new String(varDecl.name)};
3716         this.handle(
3717                 IProblem.VariableTypeCannotBeVoidArray,
3718                 arguments,
3719                 arguments,
3720                 varDecl.sourceStart,
3721                 varDecl.sourceEnd);
3722 }
3723 public void visibilityConflict(MethodBinding currentMethod, MethodBinding inheritedMethod) {
3724         this.handle(
3725                 //      Cannot reduce the visibility of the inherited method from %1
3726                 // 8.4.6.3 - The access modifier of an hiding method must provide at least as much access as the hidden method.
3727                 // 8.4.6.3 - The access modifier of an overiding method must provide at least as much access as the overriden method.
3728                 IProblem.MethodReducesVisibility,
3729                 new String[] {new String(inheritedMethod.declaringClass.readableName())},
3730                 new String[] {new String(inheritedMethod.declaringClass.shortReadableName())},
3731                 currentMethod.sourceStart(),
3732                 currentMethod.sourceEnd());
3733 }
3734 public void nonExternalizedStringLiteral(ASTNode location) {
3735         this.handle(
3736                 IProblem.NonExternalizedStringLiteral,
3737                 NoArgument,
3738                 NoArgument,
3739                 location.sourceStart,
3740                 location.sourceEnd);
3741 }
3742
3743 public void noMoreAvailableSpaceForConstant(TypeDeclaration typeDeclaration) {
3744         this.handle(
3745                 IProblem.TooManyBytesForStringConstant,
3746                 new String[]{ new String(typeDeclaration.binding.readableName())},
3747                 new String[]{ new String(typeDeclaration.binding.shortReadableName())},
3748                 Abort | Error,
3749                 typeDeclaration.sourceStart,
3750                 typeDeclaration.sourceEnd);
3751 }
3752
3753 public void noMoreAvailableSpaceInConstantPool(TypeDeclaration typeDeclaration) {
3754         this.handle(
3755                 IProblem.TooManyConstantsInConstantPool,
3756                 new String[]{ new String(typeDeclaration.binding.readableName())},
3757                 new String[]{ new String(typeDeclaration.binding.shortReadableName())},
3758                 Abort | Error,
3759                 typeDeclaration.sourceStart,
3760                 typeDeclaration.sourceEnd);
3761 }
3762
3763 private boolean isKeyword(int token) {
3764         switch(token) {
3765                 case TerminalTokens.TokenNameabstract:
3766                 case TerminalTokens.TokenNameassert:
3767                 case TerminalTokens.TokenNamebyte:
3768                 case TerminalTokens.TokenNamebreak:
3769                 case TerminalTokens.TokenNameboolean:
3770                 case TerminalTokens.TokenNamecase:
3771                 case TerminalTokens.TokenNamechar:
3772                 case TerminalTokens.TokenNamecatch:
3773                 case TerminalTokens.TokenNameclass:
3774                 case TerminalTokens.TokenNamecontinue:
3775                 case TerminalTokens.TokenNamedo:
3776                 case TerminalTokens.TokenNamedouble:
3777                 case TerminalTokens.TokenNamedefault:
3778                 case TerminalTokens.TokenNameelse:
3779                 case TerminalTokens.TokenNameextends:
3780                 case TerminalTokens.TokenNamefor:
3781                 case TerminalTokens.TokenNamefinal:
3782                 case TerminalTokens.TokenNamefloat:
3783                 case TerminalTokens.TokenNamefalse:
3784                 case TerminalTokens.TokenNamefinally:
3785                 case TerminalTokens.TokenNameif:
3786                 case TerminalTokens.TokenNameint:
3787                 case TerminalTokens.TokenNameimport:
3788                 case TerminalTokens.TokenNameinterface:
3789                 case TerminalTokens.TokenNameimplements:
3790                 case TerminalTokens.TokenNameinstanceof:
3791                 case TerminalTokens.TokenNamelong:
3792                 case TerminalTokens.TokenNamenew:
3793                 case TerminalTokens.TokenNamenull:
3794                 case TerminalTokens.TokenNamenative:
3795                 case TerminalTokens.TokenNamepublic:
3796                 case TerminalTokens.TokenNamepackage:
3797                 case TerminalTokens.TokenNameprivate:
3798                 case TerminalTokens.TokenNameprotected:
3799                 case TerminalTokens.TokenNamereturn:
3800                 case TerminalTokens.TokenNameshort:
3801                 case TerminalTokens.TokenNamesuper:
3802                 case TerminalTokens.TokenNamestatic:
3803                 case TerminalTokens.TokenNameswitch:
3804                 case TerminalTokens.TokenNamestrictfp:
3805                 case TerminalTokens.TokenNamesynchronized:
3806                 case TerminalTokens.TokenNametry:
3807                 case TerminalTokens.TokenNamethis:
3808                 case TerminalTokens.TokenNametrue:
3809                 case TerminalTokens.TokenNamethrow:
3810                 case TerminalTokens.TokenNamethrows:
3811                 case TerminalTokens.TokenNametransient:
3812                 case TerminalTokens.TokenNamevoid:
3813                 case TerminalTokens.TokenNamevolatile:
3814                 case TerminalTokens.TokenNamewhile:
3815                         return true;
3816                 default: 
3817                         return false;
3818         }
3819 }
3820
3821 private boolean isLiteral(int token) {
3822         switch(token) {
3823                 case TerminalTokens.TokenNameIntegerLiteral:
3824                 case TerminalTokens.TokenNameLongLiteral:
3825                 case TerminalTokens.TokenNameFloatingPointLiteral:
3826                 case TerminalTokens.TokenNameDoubleLiteral:
3827                 case TerminalTokens.TokenNameStringLiteral:
3828                 case TerminalTokens.TokenNameCharacterLiteral:
3829                         return true;
3830                 default: 
3831                         return false;
3832         }
3833 }
3834
3835 private boolean isIdentifier(int token) {
3836         return token == TerminalTokens.TokenNameIdentifier;
3837 }
3838
3839 private void syntaxError(
3840         int id,
3841         int startPosition, 
3842         int endPosition, 
3843         int currentKind,
3844         char[] currentTokenSource, 
3845         String errorTokenName, 
3846         String expectedToken) {
3847
3848         String eTokenName;
3849         if (isKeyword(currentKind) ||
3850                 isLiteral(currentKind) ||
3851                 isIdentifier(currentKind)) { //$NON-NLS-1$
3852                         eTokenName = new String(currentTokenSource);
3853         } else {
3854                 eTokenName = errorTokenName;
3855         }
3856
3857         String[] arguments;
3858         if(expectedToken != null) {
3859                 arguments = new String[] {eTokenName, expectedToken};
3860         } else {
3861                 arguments = new String[] {eTokenName};
3862         }
3863         this.handle(
3864                 id,
3865                 arguments,
3866                 arguments,
3867                 startPosition,
3868                 endPosition);
3869 }
3870
3871 public void parseErrorInsertBeforeToken(
3872         int start,
3873         int end,
3874         int currentKind,
3875         char[] errorTokenSource,
3876         String errorTokenName,
3877         String expectedToken){
3878         this.syntaxError(
3879                 IProblem.ParsingErrorInsertTokenBefore,
3880                 start, 
3881                 end, 
3882                 currentKind,
3883                 errorTokenSource, 
3884                 errorTokenName, 
3885                 expectedToken); 
3886 }
3887 public void parseErrorInsertAfterToken(
3888         int start,
3889         int end,
3890         int currentKind,
3891         char[] errorTokenSource,
3892         String errorTokenName,
3893         String expectedToken){
3894         this.syntaxError(
3895                 IProblem.ParsingErrorInsertTokenAfter,
3896                 start, 
3897                 end, 
3898                 currentKind,
3899                 errorTokenSource, 
3900                 errorTokenName, 
3901                 expectedToken); 
3902 }
3903 public void parseErrorDeleteToken(
3904         int start,
3905         int end,
3906         int currentKind,
3907         char[] errorTokenSource,
3908         String errorTokenName){
3909         this.syntaxError(
3910                 IProblem.ParsingErrorDeleteToken,
3911                 start, 
3912                 end, 
3913                 currentKind,
3914                 errorTokenSource, 
3915                 errorTokenName,
3916                 null); 
3917 }
3918 public void parseErrorReplaceToken(
3919         int start,
3920         int end,
3921         int currentKind,
3922         char[] errorTokenSource,
3923         String errorTokenName,
3924         String expectedToken){
3925         this.syntaxError(
3926                 IProblem.ParsingError,
3927                 start, 
3928                 end, 
3929                 currentKind,
3930                 errorTokenSource, 
3931                 errorTokenName, 
3932                 expectedToken); 
3933 }
3934 public void parseErrorInvalidToken(
3935         int start,
3936         int end,
3937         int currentKind,
3938         char[] errorTokenSource,
3939         String errorTokenName,
3940         String expectedToken){
3941         this.syntaxError(
3942                 IProblem.ParsingErrorInvalidToken,
3943                 start, 
3944                 end, 
3945                 currentKind,
3946                 errorTokenSource, 
3947                 errorTokenName, 
3948                 expectedToken); 
3949 }
3950 public void parseErrorUnexpectedEnd(
3951         int start,
3952         int end){
3953                 
3954         String[] arguments;
3955         if(this.referenceContext instanceof ConstructorDeclaration) {
3956                 arguments = new String[] {Util.bind("parser.endOfConstructor")}; //$NON-NLS-1$
3957         } else if(this.referenceContext instanceof MethodDeclaration) {
3958                 arguments = new String[] {Util.bind("parser.endOfMethod")}; //$NON-NLS-1$
3959         } else if(this.referenceContext instanceof TypeDeclaration) {
3960                 arguments = new String[] {Util.bind("parser.endOfInitializer")}; //$NON-NLS-1$
3961         } else {
3962                 arguments = new String[] {Util.bind("parser.endOfFile")}; //$NON-NLS-1$
3963         }
3964         this.handle(
3965                 IProblem.ParsingErrorUnexpectedEOF,
3966                 arguments,
3967                 arguments,
3968                 start,
3969                 end);
3970 }
3971 public void parseErrorMergeTokens(
3972         int start,
3973         int end,
3974         String expectedToken){
3975         String[] arguments = new String[] {expectedToken};
3976         this.handle(
3977                 IProblem.ParsingErrorMergeTokens,
3978                 arguments,
3979                 arguments,
3980                 start,
3981                 end);
3982 }
3983 public void parseErrorMisplacedConstruct(
3984         int start,
3985         int end){
3986         this.handle(
3987                 IProblem.ParsingErrorMisplacedConstruct,
3988                 NoArgument,
3989                 NoArgument,
3990                 start,
3991                 end);
3992 }
3993 public void parseErrorNoSuggestion(
3994         int start,
3995         int end,
3996         int currentKind,
3997         char[] errorTokenSource,
3998         String errorTokenName){
3999         this.syntaxError(
4000                 IProblem.ParsingErrorNoSuggestion,
4001                 start, 
4002                 end, 
4003                 currentKind,
4004                 errorTokenSource, 
4005                 errorTokenName,
4006                 null); 
4007 }
4008 public void parseErrorDeleteTokens(
4009         int start,
4010         int end){
4011         this.handle(
4012                 IProblem.ParsingErrorDeleteTokens,
4013                 NoArgument,
4014                 NoArgument,
4015                 start,
4016                 end);
4017 }
4018 public void parseErrorNoSuggestionForTokens(
4019         int start,
4020         int end){
4021         this.handle(
4022                 IProblem.ParsingErrorNoSuggestionForTokens,
4023                 NoArgument,
4024                 NoArgument,
4025                 start,
4026                 end);
4027 }
4028 public void parseErrorReplaceTokens(
4029         int start,
4030         int end,
4031         String expectedToken){
4032         String[] arguments = new String[] {expectedToken};
4033         this.handle(
4034                 IProblem.ParsingErrorReplaceTokens,
4035                 arguments,
4036                 arguments,
4037                 start,
4038                 end);
4039 }
4040 public void parseErrorInsertToComplete(
4041         int start,
4042         int end,
4043         String inserted,
4044         String completed){
4045         String[] arguments = new String[] {inserted, completed};
4046         this.handle(
4047                 IProblem.ParsingErrorInsertToComplete,
4048                 arguments,
4049                 arguments,
4050                 start,
4051                 end);
4052 }
4053 public void parseErrorInsertToCompleteScope(
4054         int start,
4055         int end,
4056         String inserted){
4057         String[] arguments = new String[] {inserted};
4058         this.handle(
4059                 IProblem.ParsingErrorInsertToCompleteScope,
4060                 arguments,
4061                 arguments,
4062                 start,
4063                 end);
4064 }
4065 public void parseErrorInsertToCompletePhrase(
4066         int start,
4067         int end,
4068         String inserted){
4069         String[] arguments = new String[] {inserted};
4070         this.handle(
4071                 IProblem.ParsingErrorInsertToCompletePhrase,
4072                 arguments,
4073                 arguments,
4074                 start,
4075                 end);
4076 }
4077 public void wrongSequenceOfExceptionTypesError(TryStatement statement, TypeBinding exceptionType, int under, TypeBinding hidingExceptionType) {
4078         //the two catch block under and upper are in an incorrect order.
4079         //under should be define BEFORE upper in the source
4080
4081         TypeReference typeRef = statement.catchArguments[under].type;
4082         this.handle(
4083                 IProblem.InvalidCatchBlockSequence,
4084                 new String[] {
4085                         new String(exceptionType.readableName()),
4086                         new String(hidingExceptionType.readableName()),
4087                  }, 
4088                 new String[] {
4089                         new String(exceptionType.shortReadableName()),
4090                         new String(hidingExceptionType.shortReadableName()),
4091                  }, 
4092                 typeRef.sourceStart,
4093                 typeRef.sourceEnd);
4094 }
4095
4096 }