X-Git-Url: http://secure.phpeclipse.com diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/problem/ProblemReporter.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/problem/ProblemReporter.java index 0be0218..576be8a 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/problem/ProblemReporter.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/problem/ProblemReporter.java @@ -13,10 +13,12 @@ import net.sourceforge.phpdt.core.compiler.InvalidInputException; import net.sourceforge.phpdt.internal.compiler.CompilationResult; import net.sourceforge.phpdt.internal.compiler.IErrorHandlingPolicy; import net.sourceforge.phpdt.internal.compiler.IProblemFactory; +import net.sourceforge.phpdt.internal.compiler.env.IConstants; import net.sourceforge.phpdt.internal.compiler.impl.CompilerOptions; import net.sourceforge.phpdt.internal.compiler.impl.Constant; import net.sourceforge.phpdt.internal.compiler.impl.ReferenceContext; import net.sourceforge.phpdt.internal.compiler.lookup.Binding; +import net.sourceforge.phpdt.internal.compiler.lookup.CompilerModifiers; import net.sourceforge.phpdt.internal.compiler.lookup.FieldBinding; import net.sourceforge.phpdt.internal.compiler.lookup.LocalVariableBinding; import net.sourceforge.phpdt.internal.compiler.lookup.MethodBinding; @@ -30,6 +32,7 @@ import net.sourceforge.phpdt.internal.compiler.lookup.TypeConstants; import net.sourceforge.phpdt.internal.compiler.parser.Parser; import net.sourceforge.phpdt.internal.compiler.parser.Scanner; import net.sourceforge.phpdt.internal.compiler.util.Util; +import net.sourceforge.phpeclipse.internal.compiler.ast.ASTNode; import net.sourceforge.phpeclipse.internal.compiler.ast.AbstractMethodDeclaration; import net.sourceforge.phpeclipse.internal.compiler.ast.AbstractVariableDeclaration; import net.sourceforge.phpeclipse.internal.compiler.ast.AllocationExpression; @@ -37,10 +40,9 @@ import net.sourceforge.phpeclipse.internal.compiler.ast.Argument; import net.sourceforge.phpeclipse.internal.compiler.ast.ArrayAllocationExpression; import net.sourceforge.phpeclipse.internal.compiler.ast.ArrayReference; import net.sourceforge.phpeclipse.internal.compiler.ast.Assignment; -import net.sourceforge.phpeclipse.internal.compiler.ast.ASTNode; import net.sourceforge.phpeclipse.internal.compiler.ast.BinaryExpression; import net.sourceforge.phpeclipse.internal.compiler.ast.BranchStatement; -import net.sourceforge.phpeclipse.internal.compiler.ast.Case; +import net.sourceforge.phpeclipse.internal.compiler.ast.CaseStatement; import net.sourceforge.phpeclipse.internal.compiler.ast.CastExpression; import net.sourceforge.phpeclipse.internal.compiler.ast.CompilationUnitDeclaration; import net.sourceforge.phpeclipse.internal.compiler.ast.CompoundAssignment; @@ -95,7 +97,8 @@ public class ProblemReporter extends ProblemHandler implements ProblemReasons { this.handle( // %1 must be abstract since it cannot override the inherited // package-private abstract method %2 - IProblem.AbstractMethodCannotBeOverridden, new String[] { new String(type.sourceName()), + IProblem.AbstractMethodCannotBeOverridden, new String[] { + new String(type.sourceName()), new String(CharOperation.concat(concreteMethod.declaringClass.readableName(), concreteMethod.readableName(), '.')) }, new String[] { new String(type.sourceName()), @@ -260,10 +263,13 @@ public class ProblemReporter extends ProblemHandler implements ProblemReasons { } public void cannotDireclyInvokeAbstractMethod(MessageSend messageSend, MethodBinding method) { - this.handle(IProblem.DirectInvocationOfAbstractMethod, new String[] { new String(method.declaringClass.readableName()), - new String(method.selector), parametersAsString(method) }, new String[] { - new String(method.declaringClass.shortReadableName()), new String(method.selector), parametersAsShortString(method) }, - messageSend.sourceStart, messageSend.sourceEnd); + this.handle(IProblem.DirectInvocationOfAbstractMethod, new String[] { + new String(method.declaringClass.readableName()), + new String(method.selector), + parametersAsString(method) }, new String[] { + new String(method.declaringClass.shortReadableName()), + new String(method.selector), + parametersAsShortString(method) }, messageSend.sourceStart, messageSend.sourceEnd); } // public void cannotImportPackage(ImportReference importRef) { @@ -348,6 +354,11 @@ public class ProblemReporter extends ProblemHandler implements ProblemReasons { case IProblem.PHPBadStyleUppercaseIdentifierWarning: return this.options.getSeverity(CompilerOptions.PHPBadStyleUppercaseIdentifierWarning); + case IProblem.UninitializedLocalVariable: + return this.options.getSeverity(CompilerOptions.UninitializedLocalVariableWarning); + case IProblem.CodeCannotBeReached: + return this.options.getSeverity(CompilerOptions.CodeCannotBeReachedWarning); + case IProblem.MaskedCatch: return this.options.getSeverity(CompilerOptions.MaskedCatchBlock); @@ -572,21 +583,27 @@ public class ProblemReporter extends ProblemHandler implements ProblemReasons { } public void deprecatedField(FieldBinding field, ASTNode location) { - this.handle(IProblem.UsingDeprecatedField, new String[] { new String(field.declaringClass.readableName()), + this.handle(IProblem.UsingDeprecatedField, new String[] { + new String(field.declaringClass.readableName()), new String(field.name) }, new String[] { new String(field.declaringClass.shortReadableName()), new String(field.name) }, location.sourceStart, location.sourceEnd); } public void deprecatedMethod(MethodBinding method, ASTNode location) { if (method.isConstructor()) - this.handle(IProblem.UsingDeprecatedConstructor, new String[] { new String(method.declaringClass.readableName()), - parametersAsString(method) }, new String[] { new String(method.declaringClass.shortReadableName()), + this.handle(IProblem.UsingDeprecatedConstructor, new String[] { + new String(method.declaringClass.readableName()), + parametersAsString(method) }, new String[] { + new String(method.declaringClass.shortReadableName()), parametersAsShortString(method) }, location.sourceStart, location.sourceEnd); else - this.handle(IProblem.UsingDeprecatedMethod, new String[] { new String(method.declaringClass.readableName()), - new String(method.selector), parametersAsString(method) }, new String[] { - new String(method.declaringClass.shortReadableName()), new String(method.selector), parametersAsShortString(method) }, - location.sourceStart, location.sourceEnd); + this.handle(IProblem.UsingDeprecatedMethod, new String[] { + new String(method.declaringClass.readableName()), + new String(method.selector), + parametersAsString(method) }, new String[] { + new String(method.declaringClass.shortReadableName()), + new String(method.selector), + parametersAsShortString(method) }, location.sourceStart, location.sourceEnd); } public void deprecatedType(TypeBinding type, ASTNode location) { @@ -596,7 +613,7 @@ public class ProblemReporter extends ProblemHandler implements ProblemReasons { .shortReadableName()) }, location.sourceStart, location.sourceEnd); } - public void duplicateCase(Case statement, Constant constant) { + public void duplicateCase(CaseStatement statement, Constant constant) { String[] arguments = new String[] { String.valueOf(constant.intValue()) }; this.handle(IProblem.DuplicateCase, arguments, arguments, statement.sourceStart, statement.sourceEnd); } @@ -607,7 +624,8 @@ public class ProblemReporter extends ProblemHandler implements ProblemReasons { public void duplicateFieldInType(SourceTypeBinding type, FieldDeclaration fieldDecl) { this.handle(IProblem.DuplicateField, new String[] { new String(type.sourceName()), fieldDecl.name() }, new String[] { - new String(type.shortReadableName()), fieldDecl.name() }, fieldDecl.sourceStart, fieldDecl.sourceEnd); + new String(type.shortReadableName()), + fieldDecl.name() }, fieldDecl.sourceStart, fieldDecl.sourceEnd); } // public void duplicateImport(ImportReference importRef) { @@ -642,7 +660,8 @@ public class ProblemReporter extends ProblemHandler implements ProblemReasons { public void duplicateModifierForMethod(ReferenceBinding type, AbstractMethodDeclaration methodDecl) { this.handle(IProblem.DuplicateModifierForMethod, new String[] { new String(type.sourceName()), new String(methodDecl.selector) }, new String[] { - new String(type.shortReadableName()), new String(methodDecl.selector) }, methodDecl.sourceStart, methodDecl.sourceEnd); + new String(type.shortReadableName()), + new String(methodDecl.selector) }, methodDecl.sourceStart, methodDecl.sourceEnd); } public void duplicateModifierForType(SourceTypeBinding type) { @@ -662,7 +681,8 @@ public class ProblemReporter extends ProblemHandler implements ProblemReasons { } public void duplicateSuperinterface(SourceTypeBinding type, TypeDeclaration typeDecl, ReferenceBinding superType) { - this.handle(IProblem.DuplicateSuperInterface, new String[] { new String(superType.readableName()), + this.handle(IProblem.DuplicateSuperInterface, new String[] { + new String(superType.readableName()), new String(type.sourceName()) }, new String[] { new String(superType.shortReadableName()), new String(type.sourceName()) }, typeDecl.sourceStart, typeDecl.sourceEnd); } @@ -688,9 +708,12 @@ public class ProblemReporter extends ProblemHandler implements ProblemReasons { shortBuffer.append(new String(params[i].shortReadableName())); } this.handle(recType.isArrayType() ? IProblem.NoMessageSendOnArrayType : IProblem.NoMessageSendOnBaseType, new String[] { - new String(recType.readableName()), new String(messageSend.selector), buffer.toString() }, new String[] { - new String(recType.shortReadableName()), new String(messageSend.selector), shortBuffer.toString() }, - messageSend.sourceStart, messageSend.sourceEnd); + new String(recType.readableName()), + new String(messageSend.selector), + buffer.toString() }, new String[] { + new String(recType.shortReadableName()), + new String(messageSend.selector), + shortBuffer.toString() }, messageSend.sourceStart, messageSend.sourceEnd); } public void errorThisSuperInStatic(ASTNode reference) { @@ -731,8 +754,8 @@ public class ProblemReporter extends ProblemHandler implements ProblemReasons { return; } this.handle(id, new String[] { new String(methodDecl.selector), new String(expectedType.readableName()) }, new String[] { - new String(methodDecl.selector), new String(expectedType.shortReadableName()) }, exceptionType.sourceStart, - exceptionType.sourceEnd); + new String(methodDecl.selector), + new String(expectedType.shortReadableName()) }, exceptionType.sourceStart, exceptionType.sourceEnd); } public void expressionShouldBeAVariable(Expression expression) { @@ -854,7 +877,8 @@ public class ProblemReporter extends ProblemHandler implements ProblemReasons { new String[] { new String(sourceType.sourceName()), shortTypeName }, start, end); else this.handle(IProblem.HierarchyCircularity, new String[] { new String(sourceType.sourceName()), typeName }, new String[] { - new String(sourceType.sourceName()), shortTypeName }, start, end); + new String(sourceType.sourceName()), + shortTypeName }, start, end); } public void hierarchyHasProblems(SourceTypeBinding type) { @@ -1089,8 +1113,10 @@ public class ProblemReporter extends ProblemHandler implements ProblemReasons { shortSignature.append(concreteMethod.declaringClass.shortReadableName()).append('.').append(concreteMethod.shortReadableName()); this.handle( // The inherited method %1 cannot hide the public abstract method in %2 - IProblem.InheritedMethodReducesVisibility, new String[] { new String(concreteSignature.toString()), - new String(abstractMethods[0].declaringClass.readableName()) }, new String[] { new String(shortSignature.toString()), + IProblem.InheritedMethodReducesVisibility, new String[] { + new String(concreteSignature.toString()), + new String(abstractMethods[0].declaringClass.readableName()) }, new String[] { + new String(shortSignature.toString()), new String(abstractMethods[0].declaringClass.shortReadableName()) }, type.sourceStart(), type.sourceEnd()); } @@ -1179,8 +1205,10 @@ public class ProblemReporter extends ProblemHandler implements ProblemReasons { // here... break; } - this.handle(flag, new String[] { new String(targetConstructor.declaringClass.readableName()), - parametersAsString(targetConstructor) }, new String[] { new String(targetConstructor.declaringClass.shortReadableName()), + this.handle(flag, new String[] { + new String(targetConstructor.declaringClass.readableName()), + parametersAsString(targetConstructor) }, new String[] { + new String(targetConstructor.declaringClass.shortReadableName()), parametersAsShortString(targetConstructor) }, statement.sourceStart, statement.sourceEnd); } @@ -1313,11 +1341,13 @@ public class ProblemReporter extends ProblemHandler implements ProblemReasons { //NotVisibleField //AmbiguousField if (searchedType.isBaseType()) { - this.handle(IProblem.NoFieldOnBaseType, new String[] { new String(searchedType.readableName()), - CharOperation.toString(CharOperation.subarray(nameRef.tokens, 0, index)), new String(nameRef.tokens[index]) }, - new String[] { new String(searchedType.sourceName()), - CharOperation.toString(CharOperation.subarray(nameRef.tokens, 0, index)), new String(nameRef.tokens[index]) }, - nameRef.sourceStart, nameRef.sourceEnd); + this.handle(IProblem.NoFieldOnBaseType, new String[] { + new String(searchedType.readableName()), + CharOperation.toString(CharOperation.subarray(nameRef.tokens, 0, index)), + new String(nameRef.tokens[index]) }, new String[] { + new String(searchedType.sourceName()), + CharOperation.toString(CharOperation.subarray(nameRef.tokens, 0, index)), + new String(nameRef.tokens[index]) }, nameRef.sourceStart, nameRef.sourceEnd); return; } int flag = IProblem.UndefinedField; @@ -1415,18 +1445,24 @@ public class ProblemReporter extends ProblemHandler implements ProblemReasons { parameterTypeShortNames = parameterTypeNames; } this.handle(IProblem.ParameterMismatch, new String[] { - new String(problemMethod.closestMatch.declaringClass.readableName()), new String(problemMethod.closestMatch.selector), - closestParameterTypeNames, parameterTypeNames }, new String[] { + new String(problemMethod.closestMatch.declaringClass.readableName()), + new String(problemMethod.closestMatch.selector), + closestParameterTypeNames, + parameterTypeNames }, new String[] { new String(problemMethod.closestMatch.declaringClass.shortReadableName()), - new String(problemMethod.closestMatch.selector), closestParameterTypeShortNames, parameterTypeShortNames }, - (int) (messageSend.nameSourcePosition >>> 32), (int) messageSend.nameSourcePosition); + new String(problemMethod.closestMatch.selector), + closestParameterTypeShortNames, + parameterTypeShortNames }, (int) (messageSend.nameSourcePosition >>> 32), (int) messageSend.nameSourcePosition); return; } } - this.handle(flag, new String[] { new String(method.declaringClass.readableName()), new String(method.selector), - parametersAsString(method) }, new String[] { new String(method.declaringClass.shortReadableName()), - new String(method.selector), parametersAsShortString(method) }, (int) (messageSend.nameSourcePosition >>> 32), - (int) messageSend.nameSourcePosition); + this.handle(flag, new String[] { + new String(method.declaringClass.readableName()), + new String(method.selector), + parametersAsString(method) }, new String[] { + new String(method.declaringClass.shortReadableName()), + new String(method.selector), + parametersAsShortString(method) }, (int) (messageSend.nameSourcePosition >>> 32), (int) messageSend.nameSourcePosition); } public void invalidNullToSynchronize(Expression expression) { @@ -1503,8 +1539,8 @@ public class ProblemReporter extends ProblemHandler implements ProblemReasons { return; } this.handle(id, new String[] { new String(expectedType.readableName()), new String(type.sourceName()) }, new String[] { - new String(expectedType.shortReadableName()), new String(type.sourceName()) }, superclassRef.sourceStart, - superclassRef.sourceEnd); + new String(expectedType.shortReadableName()), + new String(type.sourceName()) }, superclassRef.sourceStart, superclassRef.sourceEnd); } public void invalidSuperinterface(SourceTypeBinding type, TypeReference superinterfaceRef, ReferenceBinding expectedType) { @@ -1539,8 +1575,8 @@ public class ProblemReporter extends ProblemHandler implements ProblemReasons { return; } this.handle(id, new String[] { new String(expectedType.readableName()), new String(type.sourceName()) }, new String[] { - new String(expectedType.shortReadableName()), new String(type.sourceName()) }, superinterfaceRef.sourceStart, - superinterfaceRef.sourceEnd); + new String(expectedType.shortReadableName()), + new String(type.sourceName()) }, superinterfaceRef.sourceStart, superinterfaceRef.sourceEnd); } public void invalidType(ASTNode location, TypeBinding type) { @@ -1592,8 +1628,401 @@ public class ProblemReporter extends ProblemHandler implements ProblemReasons { : compUnitDecl.sourceStart, compUnitDecl == null ? 1 : compUnitDecl.sourceEnd); } - public void maskedExceptionHandler(ReferenceBinding exceptionType, ASTNode location) { - this.handle(IProblem.MaskedCatch, NoArgument, NoArgument, location.sourceStart, location.sourceEnd); + public void javadocDuplicatedReturnTag(int sourceStart, int sourceEnd) { + this.handle(IProblem.JavadocDuplicateReturnTag, NoArgument, NoArgument, sourceStart, sourceEnd); + } + + public void javadocDeprecatedField(FieldBinding field, ASTNode location, int modifiers) { + if (javadocVisibility(this.options.reportInvalidJavadocTagsVisibility, modifiers)) { + this.handle(IProblem.JavadocUsingDeprecatedField, new String[] { + new String(field.declaringClass.readableName()), + new String(field.name) }, new String[] { new String(field.declaringClass.shortReadableName()), new String(field.name) }, + location.sourceStart, location.sourceEnd); + } + } + + public void javadocDeprecatedMethod(MethodBinding method, ASTNode location, int modifiers) { + if (javadocVisibility(this.options.reportInvalidJavadocTagsVisibility, modifiers)) { + if (method.isConstructor()) { + this.handle(IProblem.JavadocUsingDeprecatedConstructor, new String[] { + new String(method.declaringClass.readableName()), + parametersAsString(method) }, new String[] { + new String(method.declaringClass.shortReadableName()), + parametersAsShortString(method) }, location.sourceStart, location.sourceEnd); + } else { + this.handle(IProblem.JavadocUsingDeprecatedMethod, new String[] { + new String(method.declaringClass.readableName()), + new String(method.selector), + parametersAsString(method) }, new String[] { + new String(method.declaringClass.shortReadableName()), + new String(method.selector), + parametersAsShortString(method) }, location.sourceStart, location.sourceEnd); + } + } + } + + public void javadocDeprecatedType(TypeBinding type, ASTNode location, int modifiers) { + if (location == null) + return; // 1G828DN - no type ref for synthetic arguments + if (javadocVisibility(this.options.reportInvalidJavadocTagsVisibility, modifiers)) { + this.handle(IProblem.JavadocUsingDeprecatedType, new String[] { new String(type.readableName()) }, new String[] { new String( + type.shortReadableName()) }, location.sourceStart, location.sourceEnd); + } + } + + //public void javadocDuplicatedParamTag(JavadocSingleNameReference param, int modifiers) { + // if (javadocVisibility(this.options.reportInvalidJavadocTagsVisibility, modifiers)) { + // String[] arguments = new String[] {String.valueOf(param.token)}; + // this.handle(IProblem.JavadocDuplicateParamName, arguments, arguments, param.sourceStart, param.sourceEnd); + // } + //} + public void javadocDuplicatedThrowsClassName(TypeReference typeReference, int modifiers) { + if (javadocVisibility(this.options.reportInvalidJavadocTagsVisibility, modifiers)) { + String[] arguments = new String[] { String.valueOf(typeReference.resolvedType.sourceName()) }; + this.handle(IProblem.JavadocDuplicateThrowsClassName, arguments, arguments, typeReference.sourceStart, + typeReference.sourceEnd); + } + } + + public void javadocErrorNoMethodFor(MessageSend messageSend, TypeBinding recType, TypeBinding[] params, int modifiers) { + StringBuffer buffer = new StringBuffer(); + StringBuffer shortBuffer = new StringBuffer(); + for (int i = 0, length = params.length; i < length; i++) { + if (i != 0) { + buffer.append(", "); //$NON-NLS-1$ + shortBuffer.append(", "); //$NON-NLS-1$ + } + buffer.append(new String(params[i].readableName())); + shortBuffer.append(new String(params[i].shortReadableName())); + } + + int id = recType.isArrayType() ? IProblem.JavadocNoMessageSendOnArrayType : IProblem.JavadocNoMessageSendOnBaseType; + if (javadocVisibility(this.options.reportInvalidJavadocTagsVisibility, modifiers)) { + this.handle(id, new String[] { new String(recType.readableName()), new String(messageSend.selector), buffer.toString() }, + new String[] { new String(recType.shortReadableName()), new String(messageSend.selector), shortBuffer.toString() }, + messageSend.sourceStart, messageSend.sourceEnd); + } + } + + public void javadocInvalidConstructor(Statement statement, MethodBinding targetConstructor, int modifiers) { + + if (!javadocVisibility(this.options.reportInvalidJavadocTagsVisibility, modifiers)) { + return; + } + // boolean insideDefaultConstructor = + // (this.referenceContext instanceof ConstructorDeclaration) + // && ((ConstructorDeclaration)this.referenceContext).isDefaultConstructor(); + // boolean insideImplicitConstructorCall = + // (statement instanceof ExplicitConstructorCall) + // && (((ExplicitConstructorCall) statement).accessMode == ExplicitConstructorCall.ImplicitSuper); + + int id = IProblem.JavadocUndefinedConstructor; //default... + switch (targetConstructor.problemId()) { + case NotFound: + // if (insideDefaultConstructor){ + // id = IProblem.JavadocUndefinedConstructorInDefaultConstructor; + // } else if (insideImplicitConstructorCall){ + // id = IProblem.JavadocUndefinedConstructorInImplicitConstructorCall; + // } else { + id = IProblem.JavadocUndefinedConstructor; + // } + break; + case NotVisible: + // if (insideDefaultConstructor){ + // id = IProblem.JavadocNotVisibleConstructorInDefaultConstructor; + // } else if (insideImplicitConstructorCall){ + // id = IProblem.JavadocNotVisibleConstructorInImplicitConstructorCall; + // } else { + id = IProblem.JavadocNotVisibleConstructor; + // } + break; + case Ambiguous: + // if (insideDefaultConstructor){ + // id = IProblem.AmbiguousConstructorInDefaultConstructor; + // } else if (insideImplicitConstructorCall){ + // id = IProblem.AmbiguousConstructorInImplicitConstructorCall; + // } else { + id = IProblem.JavadocAmbiguousConstructor; + // } + break; + case NoError: // 0 + default: + needImplementation(); // want to fail to see why we were here... + break; + } + + this.handle(id, new String[] { + new String(targetConstructor.declaringClass.readableName()), + parametersAsString(targetConstructor) }, new String[] { + new String(targetConstructor.declaringClass.shortReadableName()), + parametersAsShortString(targetConstructor) }, statement.sourceStart, statement.sourceEnd); + } + + public void javadocAmbiguousMethodReference(int sourceStart, int sourceEnd, Binding fieldBinding, int modifiers) { + int id = IProblem.JavadocAmbiguousMethodReference; + if (javadocVisibility(this.options.reportInvalidJavadocTagsVisibility, modifiers)) { + String[] arguments = new String[] { new String(fieldBinding.readableName()) }; + handle(id, arguments, arguments, sourceStart, sourceEnd); + } + } + + /* + * Similar implementation than invalidField(FieldReference...) Note that following problem id cannot occur for Javadoc: - + * NonStaticReferenceInStaticContext : - NonStaticReferenceInConstructorInvocation : - ReceiverTypeNotVisible : + */ + public void javadocInvalidField(int sourceStart, int sourceEnd, Binding fieldBinding, TypeBinding searchedType, int modifiers) { + int id = IProblem.JavadocUndefinedField; + switch (fieldBinding.problemId()) { + case NotFound: + id = IProblem.JavadocUndefinedField; + break; + case NotVisible: + id = IProblem.JavadocNotVisibleField; + break; + case Ambiguous: + id = IProblem.JavadocAmbiguousField; + break; + case InheritedNameHidesEnclosingName: + id = IProblem.JavadocInheritedFieldHidesEnclosingName; + break; + case NoError: // 0 + default: + needImplementation(); // want to fail to see why we were here... + break; + } + + if (javadocVisibility(this.options.reportInvalidJavadocTagsVisibility, modifiers)) { + String[] arguments = new String[] { new String(fieldBinding.readableName()) }; + handle(id, arguments, arguments, sourceStart, sourceEnd); + } + } + + /* + * Similar implementation than invalidMethod(MessageSend...) Note that following problem id cannot occur for Javadoc: - + * NonStaticReferenceInStaticContext : - NonStaticReferenceInConstructorInvocation : - ReceiverTypeNotVisible : + */ + public void javadocInvalidMethod(MessageSend messageSend, MethodBinding method, int modifiers) { + if (!javadocVisibility(this.options.reportInvalidJavadocTagsVisibility, modifiers)) { + return; + } + int id = IProblem.JavadocUndefinedMethod; //default... + switch (method.problemId()) { + case NotFound: + id = IProblem.JavadocUndefinedMethod; + break; + case NotVisible: + id = IProblem.JavadocNotVisibleMethod; + break; + case Ambiguous: + id = IProblem.JavadocAmbiguousMethod; + break; + case InheritedNameHidesEnclosingName: + id = IProblem.JavadocInheritedMethodHidesEnclosingName; + break; + case NoError: // 0 + default: + needImplementation(); // want to fail to see why we were here... + break; + } + + if (id == IProblem.JavadocUndefinedMethod) { + ProblemMethodBinding problemMethod = (ProblemMethodBinding) method; + if (problemMethod.closestMatch != null) { + String closestParameterTypeNames = parametersAsString(problemMethod.closestMatch); + String parameterTypeNames = parametersAsString(method); + String closestParameterTypeShortNames = parametersAsShortString(problemMethod.closestMatch); + String parameterTypeShortNames = parametersAsShortString(method); + if (closestParameterTypeShortNames.equals(parameterTypeShortNames)) { + closestParameterTypeShortNames = closestParameterTypeNames; + parameterTypeShortNames = parameterTypeNames; + } + this.handle(IProblem.JavadocParameterMismatch, new String[] { + new String(problemMethod.closestMatch.declaringClass.readableName()), + new String(problemMethod.closestMatch.selector), + closestParameterTypeNames, + parameterTypeNames }, new String[] { + new String(problemMethod.closestMatch.declaringClass.shortReadableName()), + new String(problemMethod.closestMatch.selector), + closestParameterTypeShortNames, + parameterTypeShortNames }, (int) (messageSend.nameSourcePosition >>> 32), (int) messageSend.nameSourcePosition); + return; + } + } + + this.handle(id, new String[] { + new String(method.declaringClass.readableName()), + new String(method.selector), + parametersAsString(method) }, new String[] { + new String(method.declaringClass.shortReadableName()), + new String(method.selector), + parametersAsShortString(method) }, (int) (messageSend.nameSourcePosition >>> 32), (int) messageSend.nameSourcePosition); + } + + //public void javadocInvalidParamName(JavadocSingleNameReference param, int modifiers) { + // if (javadocVisibility(this.options.reportInvalidJavadocTagsVisibility, modifiers)) { + // String[] arguments = new String[] {String.valueOf(param.token)}; + // this.handle(IProblem.JavadocInvalidParamName, arguments, arguments, param.sourceStart, param.sourceEnd); + // } + //} + public void javadocInvalidSeeReference(int sourceStart, int sourceEnd) { + this.handle(IProblem.JavadocInvalidSeeReference, NoArgument, NoArgument, sourceStart, sourceEnd); + } + + public void javadocInvalidSeeReferenceArgs(int sourceStart, int sourceEnd) { + this.handle(IProblem.JavadocInvalidSeeArgs, NoArgument, NoArgument, sourceStart, sourceEnd); + } + + public void javadocInvalidSeeUrlReference(int sourceStart, int sourceEnd) { + this.handle(IProblem.JavadocInvalidSeeHref, NoArgument, NoArgument, sourceStart, sourceEnd); + } + + public void javadocInvalidTag(int sourceStart, int sourceEnd) { + this.handle(IProblem.JavadocInvalidTag, NoArgument, NoArgument, sourceStart, sourceEnd); + } + + public void javadocInvalidThrowsClass(int sourceStart, int sourceEnd) { + this.handle(IProblem.JavadocInvalidThrowsClass, NoArgument, NoArgument, sourceStart, sourceEnd); + } + + public void javadocInvalidThrowsClassName(TypeReference typeReference, int modifiers) { + if (javadocVisibility(this.options.reportInvalidJavadocTagsVisibility, modifiers)) { + String[] arguments = new String[] { String.valueOf(typeReference.resolvedType.sourceName()) }; + this.handle(IProblem.JavadocInvalidThrowsClassName, arguments, arguments, typeReference.sourceStart, typeReference.sourceEnd); + } + } + + public void javadocInvalidType(ASTNode location, TypeBinding type, int modifiers) { + if (javadocVisibility(this.options.reportInvalidJavadocTagsVisibility, modifiers)) { + int id = IProblem.JavadocUndefinedType; // default + switch (type.problemId()) { + case NotFound: + id = IProblem.JavadocUndefinedType; + break; + case NotVisible: + id = IProblem.JavadocNotVisibleType; + break; + case Ambiguous: + id = IProblem.JavadocAmbiguousType; + break; + case InternalNameProvided: + id = IProblem.JavadocInternalTypeNameProvided; + break; + case InheritedNameHidesEnclosingName: + id = IProblem.JavadocInheritedNameHidesEnclosingTypeName; + break; + case NoError: // 0 + default: + needImplementation(); // want to fail to see why we were here... + break; + } + this.handle(id, new String[] { new String(type.readableName()) }, new String[] { new String(type.shortReadableName()) }, + location.sourceStart, location.sourceEnd); + } + } + + public void javadocMalformedSeeReference(int sourceStart, int sourceEnd) { + this.handle(IProblem.JavadocMalformedSeeReference, NoArgument, NoArgument, sourceStart, sourceEnd); + } + + public void javadocMissing(int sourceStart, int sourceEnd, int modifiers) { + boolean overriding = (modifiers & (CompilerModifiers.AccImplementing + CompilerModifiers.AccOverriding)) != 0; + boolean report = (this.options.getSeverity(CompilerOptions.MissingJavadocComments) != ProblemSeverities.Ignore) + && (!overriding || this.options.reportMissingJavadocCommentsOverriding); + if (report) { + String arg = javadocVisibilityArgument(this.options.reportMissingJavadocCommentsVisibility, modifiers); + if (arg != null) { + String[] arguments = new String[] { arg }; + this.handle(IProblem.JavadocMissing, arguments, arguments, sourceStart, sourceEnd); + } + } + } + + public void javadocMissingParamName(int sourceStart, int sourceEnd) { + this.handle(IProblem.JavadocMissingParamName, NoArgument, NoArgument, sourceStart, sourceEnd); + } + + public void javadocMissingParamTag(Argument param, int modifiers) { + boolean overriding = (modifiers & (CompilerModifiers.AccImplementing + CompilerModifiers.AccOverriding)) != 0; + boolean report = (this.options.getSeverity(CompilerOptions.MissingJavadocTags) != ProblemSeverities.Ignore) + && (!overriding || this.options.reportMissingJavadocTagsOverriding); + if (report && javadocVisibility(this.options.reportMissingJavadocTagsVisibility, modifiers)) { + String[] arguments = new String[] { String.valueOf(param.name) }; + this.handle(IProblem.JavadocMissingParamTag, arguments, arguments, param.sourceStart, param.sourceEnd); + } + } + + public void javadocMissingReturnTag(int sourceStart, int sourceEnd, int modifiers) { + boolean overriding = (modifiers & (CompilerModifiers.AccImplementing + CompilerModifiers.AccOverriding)) != 0; + boolean report = (this.options.getSeverity(CompilerOptions.MissingJavadocTags) != ProblemSeverities.Ignore) + && (!overriding || this.options.reportMissingJavadocTagsOverriding); + if (report && javadocVisibility(this.options.reportMissingJavadocTagsVisibility, modifiers)) { + this.handle(IProblem.JavadocMissingReturnTag, NoArgument, NoArgument, sourceStart, sourceEnd); + } + } + + public void javadocMissingSeeReference(int sourceStart, int sourceEnd) { + this.handle(IProblem.JavadocMissingSeeReference, NoArgument, NoArgument, sourceStart, sourceEnd); + } + + public void javadocMissingThrowsClassName(int sourceStart, int sourceEnd) { + this.handle(IProblem.JavadocMissingThrowsClassName, NoArgument, NoArgument, sourceStart, sourceEnd); + } + + public void javadocMissingThrowsTag(TypeReference typeRef, int modifiers) { + boolean overriding = (modifiers & (CompilerModifiers.AccImplementing + CompilerModifiers.AccOverriding)) != 0; + boolean report = (this.options.getSeverity(CompilerOptions.MissingJavadocTags) != ProblemSeverities.Ignore) + && (!overriding || this.options.reportMissingJavadocTagsOverriding); + if (report && javadocVisibility(this.options.reportMissingJavadocTagsVisibility, modifiers)) { + String[] arguments = new String[] { String.valueOf(typeRef.resolvedType.sourceName()) }; + this.handle(IProblem.JavadocMissingThrowsTag, arguments, arguments, typeRef.sourceStart, typeRef.sourceEnd); + } + } + + public void javadocUnexpectedTag(int sourceStart, int sourceEnd) { + this.handle(IProblem.JavadocUnexpectedTag, NoArgument, NoArgument, sourceStart, sourceEnd); + } + + public void javadocUnterminatedInlineTag(int sourceStart, int sourceEnd) { + this.handle(IProblem.JavadocUnterminatedInlineTag, NoArgument, NoArgument, sourceStart, sourceEnd); + } + + private boolean javadocVisibility(int visibility, int modifiers) { + switch (modifiers & CompilerModifiers.AccVisibilityMASK) { + case IConstants.AccPublic: + return true; + case IConstants.AccProtected: + return (visibility != IConstants.AccPublic); + // case IConstants.AccDefault: + // return (visibility == IConstants.AccDefault || visibility == IConstants.AccPrivate); + case IConstants.AccPrivate: + return (visibility == IConstants.AccPrivate); + } + return true; + } + + private String javadocVisibilityArgument(int visibility, int modifiers) { + String argument = null; + switch (modifiers & CompilerModifiers.AccVisibilityMASK) { + case IConstants.AccPublic: + argument = CompilerOptions.PUBLIC; + break; + case IConstants.AccProtected: + if (visibility != IConstants.AccPublic) { + argument = CompilerOptions.PROTECTED; + } + break; + // case IConstants.AccDefault: + // if (visibility == IConstants.AccDefault || visibility == IConstants.AccPrivate) { + // argument = CompilerOptions.DEFAULT; + // } + // break; + case IConstants.AccPrivate: + if (visibility == IConstants.AccPrivate) { + argument = CompilerOptions.PRIVATE; + } + break; + } + return argument; } public void methodNeedingAbstractModifier(MethodDeclaration methodDecl) { @@ -1646,10 +2075,13 @@ public class ProblemReporter extends ProblemHandler implements ProblemReasons { } public void mustUseAStaticMethod(MessageSend messageSend, MethodBinding method) { - this.handle(IProblem.StaticMethodRequested, new String[] { new String(method.declaringClass.readableName()), - new String(method.selector), parametersAsString(method) }, new String[] { - new String(method.declaringClass.shortReadableName()), new String(method.selector), parametersAsShortString(method) }, - messageSend.sourceStart, messageSend.sourceEnd); + this.handle(IProblem.StaticMethodRequested, new String[] { + new String(method.declaringClass.readableName()), + new String(method.selector), + parametersAsString(method) }, new String[] { + new String(method.declaringClass.shortReadableName()), + new String(method.selector), + parametersAsShortString(method) }, messageSend.sourceStart, messageSend.sourceEnd); } public void nativeMethodsCannotBeStrictfp(ReferenceBinding type, AbstractMethodDeclaration methodDecl) { @@ -1662,27 +2094,34 @@ public class ProblemReporter extends ProblemHandler implements ProblemReasons { } public void needToEmulateFieldReadAccess(FieldBinding field, ASTNode location) { - this.handle(IProblem.NeedToEmulateFieldReadAccess, new String[] { new String(field.declaringClass.readableName()), + this.handle(IProblem.NeedToEmulateFieldReadAccess, new String[] { + new String(field.declaringClass.readableName()), new String(field.name) }, new String[] { new String(field.declaringClass.shortReadableName()), new String(field.name) }, location.sourceStart, location.sourceEnd); } public void needToEmulateFieldWriteAccess(FieldBinding field, ASTNode location) { - this.handle(IProblem.NeedToEmulateFieldWriteAccess, new String[] { new String(field.declaringClass.readableName()), + this.handle(IProblem.NeedToEmulateFieldWriteAccess, new String[] { + new String(field.declaringClass.readableName()), new String(field.name) }, new String[] { new String(field.declaringClass.shortReadableName()), new String(field.name) }, location.sourceStart, location.sourceEnd); } public void needToEmulateMethodAccess(MethodBinding method, ASTNode location) { if (method.isConstructor()) - this.handle(IProblem.NeedToEmulateConstructorAccess, new String[] { new String(method.declaringClass.readableName()), - parametersAsString(method) }, new String[] { new String(method.declaringClass.shortReadableName()), + this.handle(IProblem.NeedToEmulateConstructorAccess, new String[] { + new String(method.declaringClass.readableName()), + parametersAsString(method) }, new String[] { + new String(method.declaringClass.shortReadableName()), parametersAsShortString(method) }, location.sourceStart, location.sourceEnd); else - this.handle(IProblem.NeedToEmulateMethodAccess, new String[] { new String(method.declaringClass.readableName()), - new String(method.selector), parametersAsString(method) }, new String[] { - new String(method.declaringClass.shortReadableName()), new String(method.selector), parametersAsShortString(method) }, - location.sourceStart, location.sourceEnd); + this.handle(IProblem.NeedToEmulateMethodAccess, new String[] { + new String(method.declaringClass.readableName()), + new String(method.selector), + parametersAsString(method) }, new String[] { + new String(method.declaringClass.shortReadableName()), + new String(method.selector), + parametersAsShortString(method) }, location.sourceStart, location.sourceEnd); } public void nestedClassCannotDeclareInterface(TypeDeclaration typeDecl) { @@ -1739,7 +2178,8 @@ public class ProblemReporter extends ProblemHandler implements ProblemReasons { leftShortName = leftName; rightShortName = rightName; } - this.handle(IProblem.IncompatibleTypesInEqualityOperator, new String[] { leftName, rightName }, new String[] { leftShortName, + this.handle(IProblem.IncompatibleTypesInEqualityOperator, new String[] { leftName, rightName }, new String[] { + leftShortName, rightShortName }, expression.sourceStart, expression.sourceEnd); } @@ -1753,7 +2193,8 @@ public class ProblemReporter extends ProblemHandler implements ProblemReasons { rightShortName = rightName; } this.handle(IProblem.IncompatibleTypesInConditionalOperator, new String[] { leftName, rightName }, new String[] { - leftShortName, rightShortName }, expression.sourceStart, expression.sourceEnd); + leftShortName, + rightShortName }, expression.sourceStart, expression.sourceEnd); } public void objectCannotHaveSuperTypes(SourceTypeBinding type) { @@ -1884,9 +2325,10 @@ public class ProblemReporter extends ProblemHandler implements ProblemReasons { public void recursiveConstructorInvocation(ExplicitConstructorCall constructorCall) { this.handle(IProblem.RecursiveConstructorInvocation, new String[] { - new String(constructorCall.binding.declaringClass.readableName()), parametersAsString(constructorCall.binding) }, - new String[] { new String(constructorCall.binding.declaringClass.shortReadableName()), - parametersAsShortString(constructorCall.binding) }, constructorCall.sourceStart, constructorCall.sourceEnd); + new String(constructorCall.binding.declaringClass.readableName()), + parametersAsString(constructorCall.binding) }, new String[] { + new String(constructorCall.binding.declaringClass.shortReadableName()), + parametersAsShortString(constructorCall.binding) }, constructorCall.sourceStart, constructorCall.sourceEnd); } public void redefineArgument(Argument arg) { @@ -1941,8 +2383,8 @@ public class ProblemReporter extends ProblemHandler implements ProblemReasons { return; } this.handle(id, new String[] { new String(methodDecl.selector), new String(expectedType.readableName()) }, new String[] { - new String(methodDecl.selector), new String(expectedType.shortReadableName()) }, methodDecl.returnType.sourceStart, - methodDecl.returnType.sourceEnd); + new String(methodDecl.selector), + new String(expectedType.shortReadableName()) }, methodDecl.returnType.sourceStart, methodDecl.returnType.sourceEnd); } public void scannerError(Parser parser, String errorTokenName) { @@ -2039,10 +2481,11 @@ public class ProblemReporter extends ProblemHandler implements ProblemReasons { // 8.4.6.4 - If a class inherits more than one method with the // same signature it is an error for one to be static // (non-abstract) and the other abstract. - IProblem.StaticInheritedMethodConflicts, new String[] { new String(concreteMethod.readableName()), + IProblem.StaticInheritedMethodConflicts, new String[] { + new String(concreteMethod.readableName()), new String(abstractMethods[0].declaringClass.readableName()) }, new String[] { - new String(concreteMethod.readableName()), new String(abstractMethods[0].declaringClass.shortReadableName()) }, type - .sourceStart(), type.sourceEnd()); + new String(concreteMethod.readableName()), + new String(abstractMethods[0].declaringClass.shortReadableName()) }, type.sourceStart(), type.sourceEnd()); } public void stringConstantIsExceedingUtf8Limit(ASTNode location) { @@ -2052,12 +2495,13 @@ public class ProblemReporter extends ProblemHandler implements ProblemReasons { public void superclassMustBeAClass(SourceTypeBinding type, TypeReference superclassRef, ReferenceBinding superType) { this.handle(IProblem.SuperclassMustBeAClass, new String[] { new String(superType.readableName()), new String(type.sourceName()) }, new String[] { - new String(superType.shortReadableName()), new String(type.sourceName()) }, superclassRef.sourceStart, - superclassRef.sourceEnd); + new String(superType.shortReadableName()), + new String(type.sourceName()) }, superclassRef.sourceStart, superclassRef.sourceEnd); } public void superinterfaceMustBeAnInterface(SourceTypeBinding type, TypeDeclaration typeDecl, ReferenceBinding superType) { - this.handle(IProblem.SuperInterfaceMustBeAnInterface, new String[] { new String(superType.readableName()), + this.handle(IProblem.SuperInterfaceMustBeAnInterface, new String[] { + new String(superType.readableName()), new String(type.sourceName()) }, new String[] { new String(superType.shortReadableName()), new String(type.sourceName()) }, typeDecl.sourceStart, typeDecl.sourceEnd); } @@ -2117,7 +2561,8 @@ public class ProblemReporter extends ProblemHandler implements ProblemReasons { resultTypeShortName = resultTypeName; expectedTypeShortName = expectedTypeName; } - this.handle(IProblem.TypeMismatch, new String[] { resultTypeName, expectedTypeName }, new String[] { resultTypeShortName, + this.handle(IProblem.TypeMismatch, new String[] { resultTypeName, expectedTypeName }, new String[] { + resultTypeShortName, expectedTypeShortName }, location.sourceStart, location.sourceEnd); } @@ -2130,14 +2575,15 @@ public class ProblemReporter extends ProblemHandler implements ProblemReasons { constantTypeShortName = constantTypeName; expectedTypeShortName = expectedTypeName; } - this.handle(IProblem.TypeMismatch, new String[] { constantTypeName, expectedTypeName }, new String[] { constantTypeShortName, + this.handle(IProblem.TypeMismatch, new String[] { constantTypeName, expectedTypeName }, new String[] { + constantTypeShortName, expectedTypeShortName }, expression.sourceStart, expression.sourceEnd); } - public void undefinedLabel(BranchStatement statement) { - String[] arguments = new String[] { new String(statement.label) }; - this.handle(IProblem.UndefinedLabel, arguments, arguments, statement.sourceStart, statement.sourceEnd); - } + // public void undefinedLabel(BranchStatement statement) { + // String[] arguments = new String[] { new String(statement.label) }; + // this.handle(IProblem.UndefinedLabel, arguments, arguments, statement.sourceStart, statement.sourceEnd); + // } public void unexpectedStaticModifierForField(SourceTypeBinding type, FieldDeclaration fieldDecl) { String[] arguments = new String[] { fieldDecl.name() }; @@ -2165,11 +2611,6 @@ public class ProblemReporter extends ProblemHandler implements ProblemReasons { this.handle(IProblem.UninitializedBlankFinalField, arguments, arguments, location.sourceStart, location.sourceEnd); } - public void uninitializedLocalVariable(LocalVariableBinding binding, ASTNode location) { - String[] arguments = new String[] { new String(binding.readableName()) }; - this.handle(IProblem.UninitializedLocalVariable, arguments, arguments, location.sourceStart, location.sourceEnd); - } - public void unmatchedBracket(int position, ReferenceContext context, CompilationResult compilationResult) { this.handle(IProblem.UnmatchedBracket, NoArgument, NoArgument, position, position, context, compilationResult); } @@ -2180,22 +2621,22 @@ public class ProblemReporter extends ProblemHandler implements ProblemReasons { } public void unnecessaryReceiverForStaticMethod(ASTNode location, MethodBinding method) { - this.handle(IProblem.NonStaticAccessToStaticMethod, new String[] { new String(method.declaringClass.readableName()), - new String(method.selector), parametersAsString(method) }, new String[] { - new String(method.declaringClass.shortReadableName()), new String(method.selector), parametersAsShortString(method) }, - location.sourceStart, location.sourceEnd); + this.handle(IProblem.NonStaticAccessToStaticMethod, new String[] { + new String(method.declaringClass.readableName()), + new String(method.selector), + parametersAsString(method) }, new String[] { + new String(method.declaringClass.shortReadableName()), + new String(method.selector), + parametersAsShortString(method) }, location.sourceStart, location.sourceEnd); } public void unnecessaryReceiverForStaticField(ASTNode location, FieldBinding field) { - this.handle(IProblem.NonStaticAccessToStaticField, new String[] { new String(field.declaringClass.readableName()), + this.handle(IProblem.NonStaticAccessToStaticField, new String[] { + new String(field.declaringClass.readableName()), new String(field.name) }, new String[] { new String(field.declaringClass.shortReadableName()), new String(field.name) }, location.sourceStart, location.sourceEnd); } - public void unreachableCode(Statement statement) { - this.handle(IProblem.CodeCannotBeReached, NoArgument, NoArgument, statement.sourceStart, statement.sourceEnd); - } - public void unreachableExceptionHandler(ReferenceBinding exceptionType, ASTNode location) { this.handle(IProblem.UnreachableCatch, NoArgument, NoArgument, location.sourceStart, location.sourceEnd); } @@ -2234,8 +2675,10 @@ public class ProblemReporter extends ProblemHandler implements ProblemReasons { if (constructorDecl.arguments == null || constructorDecl.arguments.length == 0) return; MethodBinding constructor = constructorDecl.binding; - this.handle(IProblem.UnusedPrivateConstructor, new String[] { new String(constructor.declaringClass.readableName()), - parametersAsString(constructor) }, new String[] { new String(constructor.declaringClass.shortReadableName()), + this.handle(IProblem.UnusedPrivateConstructor, new String[] { + new String(constructor.declaringClass.readableName()), + parametersAsString(constructor) }, new String[] { + new String(constructor.declaringClass.shortReadableName()), parametersAsShortString(constructor) }, constructorDecl.sourceStart, constructorDecl.sourceEnd); } @@ -2247,7 +2690,8 @@ public class ProblemReporter extends ProblemHandler implements ProblemReasons { && TypeBinding.LongBinding == field.type) { return; // do not report unused serialVersionUID field } - this.handle(IProblem.UnusedPrivateField, new String[] { new String(field.declaringClass.readableName()), + this.handle(IProblem.UnusedPrivateField, new String[] { + new String(field.declaringClass.readableName()), new String(field.name), }, new String[] { new String(field.declaringClass.shortReadableName()), new String(field.name), }, fieldDecl.sourceStart, fieldDecl.sourceEnd); } @@ -2280,10 +2724,13 @@ public class ProblemReporter extends ProblemHandler implements ProblemReasons { && CharOperation.equals(method.selector, TypeConstants.WRITEREPLACE)) { return; } - this.handle(IProblem.UnusedPrivateMethod, new String[] { new String(method.declaringClass.readableName()), - new String(method.selector), parametersAsString(method) }, new String[] { - new String(method.declaringClass.shortReadableName()), new String(method.selector), parametersAsShortString(method) }, - methodDecl.sourceStart, methodDecl.sourceEnd); + this.handle(IProblem.UnusedPrivateMethod, new String[] { + new String(method.declaringClass.readableName()), + new String(method.selector), + parametersAsString(method) }, new String[] { + new String(method.declaringClass.shortReadableName()), + new String(method.selector), + parametersAsShortString(method) }, methodDecl.sourceStart, methodDecl.sourceEnd); } public void unusedPrivateType(TypeDeclaration typeDecl) { @@ -2461,12 +2908,12 @@ public class ProblemReporter extends ProblemHandler implements ProblemReasons { compilationResult); } - public void phpIncludeNotExistWarning(String[] messageArguments, int problemStartPosition, int problemEndPosition, ReferenceContext context, - CompilationResult compilationResult) { + public void phpIncludeNotExistWarning(String[] messageArguments, int problemStartPosition, int problemEndPosition, + ReferenceContext context, CompilationResult compilationResult) { if (computeSeverity(IProblem.PHPIncludeNotExistWarning) == Ignore) return; - this.handle(IProblem.PHPIncludeNotExistWarning, NoArgument, messageArguments, problemStartPosition, problemEndPosition, context, - compilationResult); + this.handle(IProblem.PHPIncludeNotExistWarning, NoArgument, messageArguments, problemStartPosition, problemEndPosition, + context, compilationResult); } public void phpKeywordWarning(String[] messageArguments, int problemStartPosition, int problemEndPosition, @@ -2484,4 +2931,23 @@ public class ProblemReporter extends ProblemHandler implements ProblemReasons { this.handle(IProblem.PHPBadStyleUppercaseIdentifierWarning, NoArgument, new String[] {}, problemStartPosition, problemEndPosition, context, compilationResult); } + + public void uninitializedLocalVariable(String token, int problemStartPosition, int problemEndPosition, ReferenceContext context, + CompilationResult compilationResult) { + if (computeSeverity(IProblem.UninitializedLocalVariable) == Ignore) + return; + // String[] arguments = new String[] { new String(binding.readableName()) }; + String[] arguments = new String[] { token }; + this.handle(IProblem.UninitializedLocalVariable, arguments, arguments, problemStartPosition, problemEndPosition, context, + compilationResult); + } + + public void unreachableCode(String token, int problemStartPosition, int problemEndPosition, ReferenceContext context, + CompilationResult compilationResult) { + if (computeSeverity(IProblem.CodeCannotBeReached) == Ignore) + return; + this.handle(IProblem.CodeCannotBeReached, NoArgument, new String[] {}, problemStartPosition, + problemEndPosition, context, compilationResult); + } + } \ No newline at end of file