import net.sourceforge.phpdt.internal.compiler.CompilationResult;
import net.sourceforge.phpdt.internal.compiler.IErrorHandlingPolicy;
import net.sourceforge.phpdt.internal.compiler.IProblemFactory;
+import net.sourceforge.phpdt.internal.compiler.impl.CompilerOptions;
import net.sourceforge.phpdt.internal.compiler.impl.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;
import net.sourceforge.phpdt.internal.compiler.lookup.ProblemMethodBinding;
import net.sourceforge.phpdt.internal.compiler.lookup.ProblemReasons;
-import net.sourceforge.phpdt.internal.compiler.lookup.ProblemReferenceBinding;
import net.sourceforge.phpdt.internal.compiler.lookup.ReferenceBinding;
import net.sourceforge.phpdt.internal.compiler.lookup.SourceTypeBinding;
import net.sourceforge.phpdt.internal.compiler.lookup.SyntheticArgumentBinding;
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.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.Expression;
import net.sourceforge.phpeclipse.internal.compiler.ast.FieldDeclaration;
import net.sourceforge.phpeclipse.internal.compiler.ast.FieldReference;
-import net.sourceforge.phpeclipse.internal.compiler.ast.ImportReference;
import net.sourceforge.phpeclipse.internal.compiler.ast.InstanceOfExpression;
import net.sourceforge.phpeclipse.internal.compiler.ast.IntLiteral;
import net.sourceforge.phpeclipse.internal.compiler.ast.Literal;
public class ProblemReporter extends ProblemHandler implements ProblemReasons {
public ReferenceContext referenceContext;
public ProblemReporter(IErrorHandlingPolicy policy,
+ CompilerOptions options,
IProblemFactory problemFactory) {
- //CompilerOptions options, IProblemFactory problemFactory) {
- super(policy, problemFactory);//options, problemFactory);
+
+ // IProblemFactory problemFactory) {
+ super(policy, options, problemFactory); //), problemFactory);
}
public void abortDueToInternalError(String errorMessage) {
String[] arguments = new String[]{errorMessage};
this.handle(IProblem.Unclassified, arguments, arguments, Error | Abort, 0,
0);
}
- public void abortDueToInternalError(String errorMessage, AstNode location) {
+ public void abortDueToInternalError(String errorMessage, ASTNode location) {
String[] arguments = new String[]{errorMessage};
this.handle(IProblem.Unclassified, arguments, arguments, Error | Abort,
location.sourceStart, location.sourceEnd);
method.sourceStart, method.sourceEnd, method, method
.compilationResult());
}
- public void alreadyDefinedLabel(char[] labelName, AstNode location) {
+ public void alreadyDefinedLabel(char[] labelName, ASTNode location) {
String[] arguments = new String[]{new String(labelName)};
this.handle(IProblem.DuplicateLabel, arguments, arguments,
location.sourceStart, location.sourceEnd);
this.handle(IProblem.CannotAllocateVoidArray, NoArgument, NoArgument,
expression.sourceStart, expression.sourceEnd);
}
- public void cannotAssignToFinalField(FieldBinding field, AstNode location) {
+ public void cannotAssignToFinalField(FieldBinding field, ASTNode location) {
this.handle(IProblem.FinalFieldAssignment, new String[]{
(field.declaringClass == null ? "array" : new String(
field.declaringClass.readableName())), //$NON-NLS-1$
location.sourceEnd);
}
public void cannotAssignToFinalLocal(LocalVariableBinding local,
- AstNode location) {
+ ASTNode location) {
String[] arguments = new String[]{new String(local.readableName())};
this.handle(IProblem.NonBlankFinalLocalAssignment, arguments, arguments,
location.sourceStart, location.sourceEnd);
}
public void cannotAssignToFinalOuterLocal(LocalVariableBinding local,
- AstNode location) {
+ ASTNode location) {
String[] arguments = new String[]{new String(local.readableName())};
this.handle(IProblem.FinalOuterLocalAssignment, arguments, arguments,
location.sourceStart, location.sourceEnd);
new String(method.selector), parametersAsShortString(method)},
messageSend.sourceStart, messageSend.sourceEnd);
}
- public void cannotImportPackage(ImportReference importRef) {
- String[] arguments = new String[]{CharOperation.toString(importRef.tokens)};
- this.handle(IProblem.CannotImportPackage, arguments, arguments,
- importRef.sourceStart, importRef.sourceEnd);
- }
+// public void cannotImportPackage(ImportReference importRef) {
+// String[] arguments = new String[]{CharOperation.toString(importRef.tokens)};
+// this.handle(IProblem.CannotImportPackage, arguments, arguments,
+// importRef.sourceStart, importRef.sourceEnd);
+// }
public void cannotInstantiate(TypeReference typeRef, TypeBinding type) {
this.handle(IProblem.InvalidClassInstantiation, new String[]{new String(
type.readableName())},
typeRef.sourceStart, typeRef.sourceEnd);
}
public void cannotReferToNonFinalOuterLocal(LocalVariableBinding local,
- AstNode location) {
+ ASTNode location) {
String[] arguments = new String[]{new String(local.readableName())};
this.handle(IProblem.OuterLocalMustBeFinal, arguments, arguments,
location.sourceStart, location.sourceEnd);
}
- public void cannotReturnInInitializer(AstNode location) {
+ public void cannotReturnInInitializer(ASTNode location) {
this.handle(IProblem.CannotReturnInInitializer, NoArgument, NoArgument,
location.sourceStart, location.sourceEnd);
}
.shortReadableName())}, exceptionType.sourceStart,
exceptionType.sourceEnd);
}
- public void cannotUseSuperInJavaLangObject(AstNode reference) {
+ public void cannotUseSuperInJavaLangObject(ASTNode reference) {
this.handle(IProblem.ObjectHasNoSuperclass, NoArgument, NoArgument,
reference.sourceStart, reference.sourceEnd);
}
| Abort, start, end);
}
/*
- * Given the current configuration, answers which category the problem falls
- * into: Error | Warning | Ignore
+ * Given the current configuration, answers which category the problem
+ * falls into:
+ * Error | Warning | Ignore
*/
- //public int computeSeverity(int problemId){
- //
- // // severity can have been preset on the problem
- //// if ((problem.severity & Fatal) != 0){
- //// return Error;
- //// }
- //
- // // if not then check whether it is a configurable problem
- // int errorThreshold = options.errorThreshold;
- // int warningThreshold = options.warningThreshold;
- //
- // switch(problemId){
- //
- // case IProblem.UnreachableCatch :
- // case IProblem.CodeCannotBeReached :
- // if ((errorThreshold & CompilerOptions.UnreachableCode) != 0){
- // return Error;
- // }
- // if ((warningThreshold & CompilerOptions.UnreachableCode) != 0){
- // return Warning;
- // }
- // return Ignore;
- //
- // case IProblem.MaskedCatch :
- // if ((errorThreshold & CompilerOptions.MaskedCatchBlock) != 0){
- // return Error;
- // }
- // if ((warningThreshold & CompilerOptions.MaskedCatchBlock) != 0){
- // return Warning;
- // }
- // return Ignore;
- //
- ///*
- // case Never Used :
- // if ((errorThreshold & ParsingOptionalError) != 0){
- // return Error;
- // }
- // if ((warningThreshold & ParsingOptionalError) != 0){
- // return Warning;
- // }
- // return Ignore;
- //*/
- // case IProblem.ImportNotFound :
- // case IProblem.ImportNotVisible :
- // case IProblem.ImportAmbiguous :
- // case IProblem.ImportInternalNameProvided :
- // case IProblem.ImportInheritedNameHidesEnclosingName :
- // case IProblem.DuplicateImport :
- // case IProblem.ConflictingImport :
- // case IProblem.CannotImportPackage :
- // if ((errorThreshold & CompilerOptions.ImportProblem) != 0){
- // return Error;
- // }
- // if ((warningThreshold & CompilerOptions.ImportProblem) != 0){
- // return Warning;
- // }
- // return Ignore;
- //
- // case IProblem.UnusedImport :
- // // if import problem are disabled, then ignore
- // if ((errorThreshold & CompilerOptions.ImportProblem) == 0
- // && (warningThreshold & CompilerOptions.ImportProblem) == 0){
- // return Ignore;
- // }
- // if ((errorThreshold & CompilerOptions.UnusedImport) != 0){
- // return Error;
- // }
- // if ((warningThreshold & CompilerOptions.UnusedImport) != 0){
- // return Warning;
- // }
- // return Ignore;
- //
- // case IProblem.MethodButWithConstructorName :
- // if ((errorThreshold & CompilerOptions.MethodWithConstructorName) != 0){
- // return Error;
- // }
- // if ((warningThreshold & CompilerOptions.MethodWithConstructorName) !=
- // 0){
- // return Warning;
- // }
- // return Ignore;
- //
- // case IProblem.OverridingNonVisibleMethod :
- // if ((errorThreshold & CompilerOptions.OverriddenPackageDefaultMethod) !=
- // 0){
- // return Error;
- // }
- // if ((warningThreshold & CompilerOptions.OverriddenPackageDefaultMethod)
- // != 0){
- // return Warning;
- // }
- // return Ignore;
- //
- // case IProblem.IncompatibleReturnTypeForNonInheritedInterfaceMethod :
- // case
- // IProblem.IncompatibleExceptionInThrowsClauseForNonInheritedInterfaceMethod
- // :
- // if ((errorThreshold &
- // CompilerOptions.IncompatibleNonInheritedInterfaceMethod) != 0){
- // return Error;
- // }
- // if ((warningThreshold &
- // CompilerOptions.IncompatibleNonInheritedInterfaceMethod) != 0){
- // return Warning;
- // }
- // return Ignore;
- //
- // case IProblem.OverridingDeprecatedMethod :
- // case IProblem.UsingDeprecatedType :
- // case IProblem.UsingDeprecatedMethod :
- // case IProblem.UsingDeprecatedConstructor :
- // case IProblem.UsingDeprecatedField :
- // if ((errorThreshold & CompilerOptions.UsingDeprecatedAPI) != 0){
- // return Error;
- // }
- // if ((warningThreshold & CompilerOptions.UsingDeprecatedAPI) != 0){
- // return Warning;
- // }
- // return Ignore;
- //
- // case IProblem.LocalVariableIsNeverUsed :
- // if ((errorThreshold & CompilerOptions.UnusedLocalVariable) != 0){
- // return Error;
- // }
- // if ((warningThreshold & CompilerOptions.UnusedLocalVariable) != 0){
- // return Warning;
- // }
- // return Ignore;
- //
- // case IProblem.ArgumentIsNeverUsed :
- // if ((errorThreshold & CompilerOptions.UnusedArgument) != 0){
- // return Error;
- // }
- // if ((warningThreshold & CompilerOptions.UnusedArgument) != 0){
- // return Warning;
- // }
- // return Ignore;
- //
- // case IProblem.NoImplicitStringConversionForCharArrayExpression :
- // if ((errorThreshold & CompilerOptions.NoImplicitStringConversion) != 0){
- // return Error;
- // }
- // if ((warningThreshold & CompilerOptions.NoImplicitStringConversion) !=
- // 0){
- // return Warning;
- // }
- // return Ignore;
- //
- // case IProblem.NeedToEmulateFieldReadAccess :
- // case IProblem.NeedToEmulateFieldWriteAccess :
- // case IProblem.NeedToEmulateMethodAccess :
- // case IProblem.NeedToEmulateConstructorAccess :
- // if ((errorThreshold & CompilerOptions.AccessEmulation) != 0){
- // return Error;
- // }
- // if ((warningThreshold & CompilerOptions.AccessEmulation) != 0){
- // return Warning;
- // }
- // return Ignore;
- // case IProblem.NonExternalizedStringLiteral :
- // if ((errorThreshold & CompilerOptions.NonExternalizedString) != 0){
- // return Error;
- // }
- // if ((warningThreshold & CompilerOptions.NonExternalizedString) != 0){
- // return Warning;
- // }
- // return Ignore;
- // case IProblem.UseAssertAsAnIdentifier :
- // if ((errorThreshold & CompilerOptions.AssertUsedAsAnIdentifier) != 0){
- // return Error;
- // }
- // if ((warningThreshold & CompilerOptions.AssertUsedAsAnIdentifier) != 0){
- // return Warning;
- // }
- // return Ignore;
- // case IProblem.NonStaticAccessToStaticMethod :
- // case IProblem.NonStaticAccessToStaticField :
- // if ((errorThreshold & CompilerOptions.StaticAccessReceiver) != 0){
- // return Error;
- // }
- // if ((warningThreshold & CompilerOptions.StaticAccessReceiver) != 0){
- // return Warning;
- // }
- // return Ignore;
- // case IProblem.AssignmentHasNoEffect:
- // if ((errorThreshold & CompilerOptions.NoEffectAssignment) != 0){
- // return Error;
- // }
- // if ((warningThreshold & CompilerOptions.NoEffectAssignment) != 0){
- // return Warning;
- // }
- // return Ignore;
- // case IProblem.UnusedPrivateConstructor:
- // case IProblem.UnusedPrivateMethod:
- // case IProblem.UnusedPrivateField:
- // case IProblem.UnusedPrivateType:
- // if ((errorThreshold & CompilerOptions.UnusedPrivateMember) != 0){
- // return Error;
- // }
- // if ((warningThreshold & CompilerOptions.UnusedPrivateMember) != 0){
- // return Warning;
- // }
- // return Ignore;
- //
- // case IProblem.Task :
- // return Warning;
- // default:
- // return Error;
- // }
- //}
+ public int computeSeverity(int problemId){
+
+ // severity can have been preset on the problem
+// if ((problem.severity & Fatal) != 0){
+// return Error;
+// }
+
+ // if not then check whether it is a configurable problem
+ switch(problemId){
+ case IProblem.PHPVarDeprecatedWarning :
+ return this.options.getSeverity(CompilerOptions.PHPVarDeprecatedWarning);
+ case IProblem.PHPBadStyleKeywordWarning :
+ return this.options.getSeverity(CompilerOptions.PHPBadStyleKeywordWarning);
+ case IProblem.PHPBadStyleUppercaseIdentifierWarning :
+ return this.options.getSeverity(CompilerOptions.PHPBadStyleUppercaseIdentifierWarning);
+
+ case IProblem.MaskedCatch :
+ return this.options.getSeverity(CompilerOptions.MaskedCatchBlock);
+
+ case IProblem.UnusedImport :
+ return this.options.getSeverity(CompilerOptions.UnusedImport);
+
+ case IProblem.MethodButWithConstructorName :
+ return this.options.getSeverity(CompilerOptions.MethodWithConstructorName);
+
+ case IProblem.OverridingNonVisibleMethod :
+ return this.options.getSeverity(CompilerOptions.OverriddenPackageDefaultMethod);
+
+ case IProblem.IncompatibleReturnTypeForNonInheritedInterfaceMethod :
+ case IProblem.IncompatibleExceptionInThrowsClauseForNonInheritedInterfaceMethod :
+ return this.options.getSeverity(CompilerOptions.IncompatibleNonInheritedInterfaceMethod);
+
+ case IProblem.OverridingDeprecatedMethod :
+ case IProblem.UsingDeprecatedType :
+ case IProblem.UsingDeprecatedMethod :
+ case IProblem.UsingDeprecatedConstructor :
+ case IProblem.UsingDeprecatedField :
+ return this.options.getSeverity(CompilerOptions.UsingDeprecatedAPI);
+
+ case IProblem.LocalVariableIsNeverUsed :
+ return this.options.getSeverity(CompilerOptions.UnusedLocalVariable);
+
+ case IProblem.ArgumentIsNeverUsed :
+ return this.options.getSeverity(CompilerOptions.UnusedArgument);
+
+ case IProblem.NoImplicitStringConversionForCharArrayExpression :
+ return this.options.getSeverity(CompilerOptions.NoImplicitStringConversion);
+
+ case IProblem.NeedToEmulateFieldReadAccess :
+ case IProblem.NeedToEmulateFieldWriteAccess :
+ case IProblem.NeedToEmulateMethodAccess :
+ case IProblem.NeedToEmulateConstructorAccess :
+ return this.options.getSeverity(CompilerOptions.AccessEmulation);
+
+ case IProblem.NonExternalizedStringLiteral :
+ return this.options.getSeverity(CompilerOptions.NonExternalizedString);
+
+ case IProblem.UseAssertAsAnIdentifier :
+ return this.options.getSeverity(CompilerOptions.AssertUsedAsAnIdentifier);
+
+ case IProblem.NonStaticAccessToStaticMethod :
+ case IProblem.NonStaticAccessToStaticField :
+ return this.options.getSeverity(CompilerOptions.NonStaticAccessToStatic);
+
+// case IProblem.IndirectAccessToStaticMethod :
+// case IProblem.IndirectAccessToStaticField :
+// case IProblem.IndirectAccessToStaticType :
+// return this.options.getSeverity(CompilerOptions.IndirectStaticAccess);
+
+ case IProblem.AssignmentHasNoEffect:
+ return this.options.getSeverity(CompilerOptions.NoEffectAssignment);
+
+ case IProblem.UnusedPrivateConstructor:
+ case IProblem.UnusedPrivateMethod:
+ case IProblem.UnusedPrivateField:
+ case IProblem.UnusedPrivateType:
+ return this.options.getSeverity(CompilerOptions.UnusedPrivateMember);
+
+ case IProblem.Task :
+ return Warning;
+
+// case IProblem.LocalVariableHidingLocalVariable:
+// case IProblem.LocalVariableHidingField:
+// case IProblem.ArgumentHidingLocalVariable:
+// case IProblem.ArgumentHidingField:
+// return this.options.getSeverity(CompilerOptions.LocalVariableHiding);
+
+// case IProblem.FieldHidingLocalVariable:
+// case IProblem.FieldHidingField:
+// return this.options.getSeverity(CompilerOptions.FieldHiding);
+
+// case IProblem.PossibleAccidentalBooleanAssignment:
+// return this.options.getSeverity(CompilerOptions.AccidentalBooleanAssign);
+
+// case IProblem.SuperfluousSemicolon:
+// return this.options.getSeverity(CompilerOptions.SuperfluousSemicolon);
+//
+// case IProblem.UndocumentedEmptyBlock:
+// return this.options.getSeverity(CompilerOptions.UndocumentedEmptyBlock);
+//
+// case IProblem.UnnecessaryCast:
+// case IProblem.UnnecessaryArgumentCast:
+// case IProblem.UnnecessaryInstanceof:
+// return this.options.getSeverity(CompilerOptions.UnnecessaryTypeCheck);
+//
+// case IProblem.FinallyMustCompleteNormally:
+// return this.options.getSeverity(CompilerOptions.FinallyBlockNotCompleting);
+//
+// case IProblem.UnusedMethodDeclaredThrownException:
+// case IProblem.UnusedConstructorDeclaredThrownException:
+// return this.options.getSeverity(CompilerOptions.UnusedDeclaredThrownException);
+//
+// case IProblem.UnqualifiedFieldAccess:
+// return this.options.getSeverity(CompilerOptions.UnqualifiedFieldAccess);
+
+ /*
+ * Javadoc syntax errors
+ */
+ // Javadoc explicit IDs
+// case IProblem.JavadocUnexpectedTag:
+// case IProblem.JavadocDuplicateReturnTag:
+// case IProblem.JavadocInvalidThrowsClass:
+// case IProblem.JavadocInvalidSeeReference:
+// case IProblem.JavadocInvalidSeeHref:
+// case IProblem.JavadocInvalidSeeArgs:
+// case IProblem.JavadocInvalidTag:
+// return this.options.getSeverity(CompilerOptions.InvalidJavadoc);
+
+ /*
+ * Javadoc tags resolved references errors
+ */
+// case IProblem.JavadocInvalidParamName:
+// case IProblem.JavadocDuplicateParamName:
+// case IProblem.JavadocMissingParamName:
+// case IProblem.JavadocInvalidThrowsClassName:
+// case IProblem.JavadocDuplicateThrowsClassName:
+// case IProblem.JavadocMissingThrowsClassName:
+// case IProblem.JavadocMissingSeeReference:
+// case IProblem.JavadocUsingDeprecatedField:
+// case IProblem.JavadocUsingDeprecatedConstructor:
+// case IProblem.JavadocUsingDeprecatedMethod:
+// case IProblem.JavadocUsingDeprecatedType:
+// case IProblem.JavadocUndefinedField:
+// case IProblem.JavadocNotVisibleField:
+// case IProblem.JavadocAmbiguousField:
+// case IProblem.JavadocUndefinedConstructor:
+// case IProblem.JavadocNotVisibleConstructor:
+// case IProblem.JavadocAmbiguousConstructor:
+// case IProblem.JavadocUndefinedMethod:
+// case IProblem.JavadocNotVisibleMethod:
+// case IProblem.JavadocAmbiguousMethod:
+// case IProblem.JavadocParameterMismatch:
+// case IProblem.JavadocUndefinedType:
+// case IProblem.JavadocNotVisibleType:
+// case IProblem.JavadocAmbiguousType:
+// case IProblem.JavadocInternalTypeNameProvided:
+// case IProblem.JavadocNoMessageSendOnArrayType:
+// case IProblem.JavadocNoMessageSendOnBaseType:
+// if (!this.options.reportInvalidJavadocTags)
+// return ProblemSeverities.Ignore;
+// else
+// return this.options.getSeverity(CompilerOptions.InvalidJavadoc);
+
+ /*
+ * Javadoc missing tags errors
+ */
+// case IProblem.JavadocMissingParamTag:
+// case IProblem.JavadocMissingReturnTag:
+// case IProblem.JavadocMissingThrowsTag:
+// return this.options.getSeverity(CompilerOptions.MissingJavadocTags);
+
+ /*
+ * Missing Javadoc errors
+ */
+// case IProblem.JavadocMissing:
+// return this.options.getSeverity(CompilerOptions.MissingJavadocComments);
+
+ // by default problems are errors.
+ default:
+ return Error;
+ }
+ }
//public void conditionalArgumentsIncompatibleTypes(ConditionalExpression
// expression, TypeBinding trueType, TypeBinding falseType) {
// this.handle(
// expression.sourceStart,
// expression.sourceEnd);
//}
- public void conflictingImport(ImportReference importRef) {
- String[] arguments = new String[]{CharOperation.toString(importRef.tokens)};
- this.handle(IProblem.ConflictingImport, arguments, arguments,
- importRef.sourceStart, importRef.sourceEnd);
- }
+// public void conflictingImport(ImportReference importRef) {
+// String[] arguments = new String[]{CharOperation.toString(importRef.tokens)};
+// this.handle(IProblem.ConflictingImport, arguments, arguments,
+// importRef.sourceStart, importRef.sourceEnd);
+// }
public void constantOutOfFormat(NumberLiteral lit) {
// the literal is not in a correct format
// this code is called on IntLiteral and LongLiteral
this.handle(IProblem.NumericValueOutOfRange, arguments, arguments,
lit.sourceStart, lit.sourceEnd);
}
- public void deprecatedField(FieldBinding field, AstNode location) {
+ public void deprecatedField(FieldBinding field, ASTNode location) {
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) {
+ public void deprecatedMethod(MethodBinding method, ASTNode location) {
if (method.isConstructor())
this.handle(IProblem.UsingDeprecatedConstructor, new String[]{
new String(method.declaringClass.readableName()),
new String(method.selector), parametersAsShortString(method)},
location.sourceStart, location.sourceEnd);
}
- public void deprecatedType(TypeBinding type, AstNode location) {
+ public void deprecatedType(TypeBinding type, ASTNode location) {
if (location == null)
return; // 1G828DN - no type ref for synthetic arguments
this.handle(IProblem.UsingDeprecatedType, new String[]{new String(type
new String(type.shortReadableName()), fieldDecl.name()},
fieldDecl.sourceStart, fieldDecl.sourceEnd);
}
- public void duplicateImport(ImportReference importRef) {
- String[] arguments = new String[]{CharOperation.toString(importRef.tokens)};
- this.handle(IProblem.DuplicateImport, arguments, arguments,
- importRef.sourceStart, importRef.sourceEnd);
- }
+// public void duplicateImport(ImportReference importRef) {
+// String[] arguments = new String[]{CharOperation.toString(importRef.tokens)};
+// this.handle(IProblem.DuplicateImport, arguments, arguments,
+// importRef.sourceStart, importRef.sourceEnd);
+// }
public void duplicateInitializationOfBlankFinalField(FieldBinding field,
Reference reference) {
String[] arguments = new String[]{new String(field.readableName())};
arguments, reference.sourceStart, reference.sourceEnd);
}
public void duplicateInitializationOfFinalLocal(LocalVariableBinding local,
- AstNode location) {
+ ASTNode location) {
String[] arguments = new String[]{new String(local.readableName())};
this.handle(IProblem.DuplicateFinalLocalInitialization, arguments,
arguments, location.sourceStart, location.sourceEnd);
new String(messageSend.selector), shortBuffer.toString()},
messageSend.sourceStart, messageSend.sourceEnd);
}
- public void errorThisSuperInStatic(AstNode reference) {
+ public void errorThisSuperInStatic(ASTNode reference) {
String[] arguments = new String[]{reference.isSuper() ? "super" : "this"}; //$NON-NLS-2$ //$NON-NLS-1$
this.handle(IProblem.ThisInStaticContext, arguments, arguments,
reference.sourceStart, reference.sourceEnd);
localDecl.sourceStart, localDecl.sourceEnd);
}
public void illegalPrimitiveOrArrayTypeForEnclosingInstance(
- TypeBinding enclosingType, AstNode location) {
+ TypeBinding enclosingType, ASTNode location) {
this.handle(IProblem.IllegalPrimitiveOrArrayTypeForEnclosingInstance,
new String[]{new String(enclosingType.readableName())},
new String[]{new String(enclosingType.shortReadableName())},
this.handle(IProblem.IllegalVisibilityModifierForInterfaceMemberType,
arguments, arguments, type.sourceStart(), type.sourceEnd());
}
- public void illegalVoidExpression(AstNode location) {
+ public void illegalVoidExpression(ASTNode location) {
this.handle(IProblem.InvalidVoidExpression, NoArgument, NoArgument,
location.sourceStart, location.sourceEnd);
}
- public void importProblem(ImportReference importRef, Binding expectedImport) {
- int problemId = expectedImport.problemId();
- int id;
- switch (problemId) {
- case NotFound :
- // 1
- id = IProblem.ImportNotFound;
- break;
- case NotVisible :
- // 2
- id = IProblem.ImportNotVisible;
- break;
- case Ambiguous :
- // 3
- id = IProblem.ImportAmbiguous;
- break;
- case InternalNameProvided :
- // 4
- id = IProblem.ImportInternalNameProvided;
- break;
- case InheritedNameHidesEnclosingName :
- // 5
- id = IProblem.ImportInheritedNameHidesEnclosingName;
- break;
- case NoError :
- // 0
- default :
- needImplementation(); // want to fail to see why we were
- // here...
- return;
- }
- String argument;
- if (expectedImport instanceof ProblemReferenceBinding) {
- argument = CharOperation
- .toString(((ProblemReferenceBinding) expectedImport).compoundName);
- } else {
- argument = CharOperation.toString(importRef.tokens);
- }
- String[] arguments = new String[]{argument};
- this.handle(id, arguments, arguments, importRef.sourceStart,
- importRef.sourceEnd);
- }
+// public void importProblem(ImportReference importRef, Binding expectedImport) {
+// int problemId = expectedImport.problemId();
+// int id;
+// switch (problemId) {
+// case NotFound :
+// // 1
+// id = IProblem.ImportNotFound;
+// break;
+// case NotVisible :
+// // 2
+// id = IProblem.ImportNotVisible;
+// break;
+// case Ambiguous :
+// // 3
+// id = IProblem.ImportAmbiguous;
+// break;
+// case InternalNameProvided :
+// // 4
+// id = IProblem.ImportInternalNameProvided;
+// break;
+// case InheritedNameHidesEnclosingName :
+// // 5
+// id = IProblem.ImportInheritedNameHidesEnclosingName;
+// break;
+// case NoError :
+// // 0
+// default :
+// needImplementation(); // want to fail to see why we were
+// // here...
+// return;
+// }
+// String argument;
+// if (expectedImport instanceof ProblemReferenceBinding) {
+// argument = CharOperation
+// .toString(((ProblemReferenceBinding) expectedImport).compoundName);
+// } else {
+// argument = CharOperation.toString(importRef.tokens);
+// }
+// String[] arguments = new String[]{argument};
+// this.handle(id, arguments, arguments, importRef.sourceStart,
+// importRef.sourceEnd);
+// }
public void incompatibleExceptionInThrowsClause(SourceTypeBinding type,
MethodBinding currentMethod, MethodBinding inheritedMethod,
ReferenceBinding exceptionType) {
NoArgument, fieldDecl.sourceStart, fieldDecl.sourceEnd);
}
public void innerTypesCannotDeclareStaticInitializers(
- ReferenceBinding innerType, AstNode location) {
+ ReferenceBinding innerType, ASTNode location) {
this.handle(IProblem.CannotDefineStaticInitializerInLocalType,
new String[]{new String(innerType.readableName())},
new String[]{new String(innerType.shortReadableName())},
this.handle(IProblem.InterfaceCannotHaveInitializers, arguments, arguments,
fieldDecl.sourceStart, fieldDecl.sourceEnd);
}
- public void invalidBreak(AstNode location) {
+ public void invalidBreak(ASTNode location) {
this.handle(IProblem.InvalidBreak, NoArgument, NoArgument,
location.sourceStart, location.sourceEnd);
}
parametersAsShortString(targetConstructor)}, statement.sourceStart,
statement.sourceEnd);
}
- public void invalidContinue(AstNode location) {
+ public void invalidContinue(ASTNode location) {
this.handle(IProblem.InvalidContinue, NoArgument, NoArgument,
location.sourceStart, location.sourceEnd);
}
new String(type.shortReadableName())}, expression.sourceStart,
expression.sourceEnd);
}
- public void invalidParenthesizedExpression(AstNode reference) {
+ public void invalidParenthesizedExpression(ASTNode reference) {
this.handle(IProblem.InvalidParenthesizedExpression, NoArgument,
NoArgument, reference.sourceStart, reference.sourceEnd);
}
new String(type.sourceName())}, superinterfaceRef.sourceStart,
superinterfaceRef.sourceEnd);
}
- public void invalidType(AstNode location, TypeBinding type) {
+ public void invalidType(ASTNode location, TypeBinding type) {
int flag = IProblem.UndefinedType; // default
switch (type.problemId()) {
case NotFound :
: compUnitDecl.sourceEnd);
}
public void maskedExceptionHandler(ReferenceBinding exceptionType,
- AstNode location) {
+ ASTNode location) {
this.handle(IProblem.MaskedCatch, NoArgument, NoArgument,
location.sourceStart, location.sourceEnd);
}
methodDecl.sourceStart, methodDecl.sourceEnd);
}
//public void missingEnclosingInstanceSpecification(ReferenceBinding
- // enclosingType, AstNode location) {
+ // enclosingType, ASTNode location) {
// boolean insideConstructorCall =
// (location instanceof ExplicitConstructorCall)
// && (((ExplicitConstructorCall) location).accessMode ==
public void needImplementation() {
this.abortDueToInternalError(Util.bind("abort.missingCode")); //$NON-NLS-1$
}
- public void needToEmulateFieldReadAccess(FieldBinding field, AstNode location) {
+ public void needToEmulateFieldReadAccess(FieldBinding field, ASTNode location) {
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) {
+ public void needToEmulateFieldWriteAccess(FieldBinding field, ASTNode location) {
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) {
+ public void needToEmulateMethodAccess(MethodBinding method, ASTNode location) {
if (method.isConstructor())
this.handle(IProblem.NeedToEmulateConstructorAccess, new String[]{
new String(method.declaringClass.readableName()),
arguments, typeDecl.sourceStart, typeDecl.sourceEnd);
}
public void noMoreAvailableSpaceForArgument(LocalVariableBinding local,
- AstNode location) {
+ ASTNode location) {
String[] arguments = new String[]{new String(local.name)};
this.handle(local instanceof SyntheticArgumentBinding
? IProblem.TooManySyntheticArgumentSlots
location.sourceStart, location.sourceEnd);
}
public void noMoreAvailableSpaceForLocal(LocalVariableBinding local,
- AstNode location) {
+ ASTNode location) {
String[] arguments = new String[]{new String(local.name)};
this.handle(IProblem.TooManyLocalVariableSlots, arguments, arguments, Abort
| Error, location.sourceStart, location.sourceEnd);
}
- public void noSuchEnclosingInstance(TypeBinding targetType, AstNode location,
+ public void noSuchEnclosingInstance(TypeBinding targetType, ASTNode location,
boolean isConstructorCall) {
int id;
if (isConstructorCall) {
new String(inheritedMethod.declaringClass.shortReadableName())},
localMethod.sourceStart(), localMethod.sourceEnd());
}
- public void packageCollidesWithType(CompilationUnitDeclaration compUnitDecl) {
- String[] arguments = new String[]{CharOperation
- .toString(compUnitDecl.currentPackage.tokens)};
- this.handle(IProblem.PackageCollidesWithType, arguments, arguments,
- compUnitDecl.currentPackage.sourceStart,
- compUnitDecl.currentPackage.sourceEnd);
- }
+// public void packageCollidesWithType(CompilationUnitDeclaration compUnitDecl) {
+// String[] arguments = new String[]{CharOperation
+// .toString(compUnitDecl.currentPackage.tokens)};
+// this.handle(IProblem.PackageCollidesWithType, arguments, arguments,
+// compUnitDecl.currentPackage.sourceStart,
+// compUnitDecl.currentPackage.sourceEnd);
+// }
public void packageIsNotExpectedPackage(
CompilationUnitDeclaration compUnitDecl) {
String[] arguments = new String[]{CharOperation
startPos, scanner.currentPosition - 1,
parser.compilationUnit.compilationResult);
}
- public void shouldReturn(TypeBinding returnType, AstNode location) {
+ public void shouldReturn(TypeBinding returnType, ASTNode location) {
this.handle(IProblem.ShouldReturnValue, new String[]{new String(returnType
.readableName())}, new String[]{new String(returnType
.shortReadableName())}, location.sourceStart, location.sourceEnd);
new String(abstractMethods[0].declaringClass.shortReadableName())},
type.sourceStart(), type.sourceEnd());
}
- public void stringConstantIsExceedingUtf8Limit(AstNode location) {
+ public void stringConstantIsExceedingUtf8Limit(ASTNode location) {
this.handle(IProblem.StringConstantIsExceedingUtf8Limit, NoArgument,
NoArgument, location.sourceStart, location.sourceEnd);
}
* surfaced in getMessage()
*/}, start, end);
}
- public void tooManyDimensions(AstNode expression) {
+ public void tooManyDimensions(ASTNode expression) {
this.handle(IProblem.TooManyArrayDimensions, NoArgument, NoArgument,
expression.sourceStart, expression.sourceEnd);
}
compUnitDecl.compilationResult);
}
public void typeMismatchError(TypeBinding resultType,
- TypeBinding expectedType, AstNode location) {
+ TypeBinding expectedType, ASTNode location) {
String resultTypeName = new String(resultType.readableName());
String expectedTypeName = new String(expectedType.readableName());
String resultTypeShortName = new String(resultType.shortReadableName());
this.handle(IProblem.UnexpectedStaticModifierForMethod, arguments,
arguments, methodDecl.sourceStart, methodDecl.sourceEnd);
}
- public void unhandledException(TypeBinding exceptionType, AstNode location) {
+ public void unhandledException(TypeBinding exceptionType, ASTNode location) {
boolean insideDefaultConstructor = (referenceContext instanceof ConstructorDeclaration)
&& ((ConstructorDeclaration) referenceContext).isDefaultConstructor();
boolean insideImplicitConstructorCall = (location instanceof ExplicitConstructorCall)
.shortReadableName())}, location.sourceStart, location.sourceEnd);
}
public void uninitializedBlankFinalField(FieldBinding binding,
- AstNode location) {
+ ASTNode location) {
String[] arguments = new String[]{new String(binding.readableName())};
this.handle(IProblem.UninitializedBlankFinalField, arguments, arguments,
location.sourceStart, location.sourceEnd);
}
public void uninitializedLocalVariable(LocalVariableBinding binding,
- AstNode location) {
+ ASTNode location) {
String[] arguments = new String[]{new String(binding.readableName())};
this.handle(IProblem.UninitializedLocalVariable, arguments, arguments,
location.sourceStart, location.sourceEnd);
new String[]{new String(targetType.shortReadableName())},
expression.sourceStart, expression.sourceEnd);
}
- public void unnecessaryReceiverForStaticMethod(AstNode location,
+ public void unnecessaryReceiverForStaticMethod(ASTNode location,
MethodBinding method) {
this.handle(IProblem.NonStaticAccessToStaticMethod, new String[]{
new String(method.declaringClass.readableName()),
new String(method.selector), parametersAsShortString(method)},
location.sourceStart, location.sourceEnd);
}
- public void unnecessaryReceiverForStaticField(AstNode location,
+ public void unnecessaryReceiverForStaticField(ASTNode location,
FieldBinding field) {
this.handle(IProblem.NonStaticAccessToStaticField,
new String[]{new String(field.declaringClass.readableName()),
statement.sourceStart, statement.sourceEnd);
}
public void unreachableExceptionHandler(ReferenceBinding exceptionType,
- AstNode location) {
+ ASTNode location) {
this.handle(IProblem.UnreachableCatch, NoArgument, NoArgument,
location.sourceStart, location.sourceEnd);
}
this.handle(IProblem.ArgumentIsNeverUsed, arguments, arguments,
localDecl.sourceStart, localDecl.sourceEnd);
}
- public void unusedImport(ImportReference importRef) {
- String[] arguments = new String[]{CharOperation.toString(importRef.tokens)};
- this.handle(IProblem.UnusedImport, arguments, arguments,
- importRef.sourceStart, importRef.sourceEnd);
- }
+// public void unusedImport(ImportReference importRef) {
+// String[] arguments = new String[]{CharOperation.toString(importRef.tokens)};
+// this.handle(IProblem.UnusedImport, arguments, arguments,
+// importRef.sourceStart, importRef.sourceEnd);
+// }
public void unusedLocalVariable(LocalDeclaration localDecl) {
String[] arguments = new String[]{localDecl.name()};
this.handle(IProblem.LocalVariableIsNeverUsed, arguments, arguments,
this.handle(IProblem.UnreachableCatch, NoArgument, NoArgument,
typeRef.sourceStart, typeRef.sourceEnd);
}
- public void nonExternalizedStringLiteral(AstNode location) {
+ public void nonExternalizedStringLiteral(ASTNode location) {
this.handle(IProblem.NonExternalizedStringLiteral, NoArgument, NoArgument,
location.sourceStart, location.sourceEnd);
}
// case Scanner.TokenNamestrictfp:
// case Scanner.TokenNamesynchronized:
case Scanner.TokenNametry :
- case Scanner.TokenNamethis :
+// case Scanner.TokenNamethis :
// case Scanner.TokenNametrue :
case Scanner.TokenNamethrow :
// case Scanner.TokenNamethrows:
public void phpVarDeprecatedWarning(
int problemStartPosition, int problemEndPosition,
ReferenceContext context, CompilationResult compilationResult) {
+ if (computeSeverity(IProblem.PHPVarDeprecatedWarning) == Ignore)
+ return;
this.handle(IProblem.PHPVarDeprecatedWarning, NoArgument, new String[]{},
problemStartPosition, problemEndPosition, context, compilationResult);
}
+
+ public void phpKeywordWarning(String[] messageArguments,
+ int problemStartPosition, int problemEndPosition,
+ ReferenceContext context, CompilationResult compilationResult) {
+ if (computeSeverity(IProblem.PHPBadStyleKeywordWarning) == Ignore)
+ return;
+ this.handle(IProblem.PHPBadStyleKeywordWarning, NoArgument, messageArguments,
+ problemStartPosition, problemEndPosition, context, compilationResult);
+ }
+
+ public void phpUppercaseIdentifierWarning(
+ int problemStartPosition, int problemEndPosition,
+ ReferenceContext context, CompilationResult compilationResult) {
+ if (computeSeverity(IProblem.PHPBadStyleUppercaseIdentifierWarning) == Ignore)
+ return;
+ this.handle(IProblem.PHPBadStyleUppercaseIdentifierWarning, NoArgument, new String[]{},
+ problemStartPosition, problemEndPosition, context, compilationResult);
+ }
}