Eclipse JDT
Release 3.1

org.eclipse.jdt.core.compiler
Class CategorizedProblem

java.lang.Object
  extended byorg.eclipse.jdt.core.compiler.CategorizedProblem
All Implemented Interfaces:
IProblem

public abstract class CategorizedProblem
extends Object
implements IProblem

Richer description of a Java problem, as detected by the compiler or some of the underlying technology reusing the compiler. With the introduction of CompilationParticipant, the simpler problem interface IProblem did not carry enough information to better separate and categorize Java problems. In order to minimize impact on existing API, Java problems are still passed around as IProblem, though actual implementations should explicitly extend CategorizedProblem. Participants can produce their own problem definitions, and given these are categorized problems, they can be better handled by clients (such as user interface). A categorized problem provides access to:

Note: the compiler produces IProblems internally, which are turned into markers by the JavaBuilder so as to persist problem descriptions. This explains why there is no API allowing to reach IProblem detected when compiling. However, the Java problem markers carry equivalent information to IProblem, in particular their ID (attribute "id") is set to one of the IDs defined on this interface. Note: Standard Java problems produced by Java default tooling will be subclasses of this class. Technically, most API methods dealing with problems are referring to IProblem for backward compatibility reason. It is intended that CategorizedProblem will be subclassed for custom problem implementation when participating in compilation operations, so as to allow participant to contribute their own marker types, and thus defining their own domain specific problem/category IDs.

Since:
3.2
See Also:
CompilationParticipant

Field Summary
static int CAT_BUILDPATH
           
static int CAT_CODE_STYLE
           
static int CAT_DEPRECATION
           
static int CAT_IMPORT
           
static int CAT_JAVADOC
           
static int CAT_MEMBER
           
static int CAT_NAME_SHADOWING_CONFLICT
           
static int CAT_NLS
           
static int CAT_POTENTIAL_PROGRAMMING_PROBLEM
           
static int CAT_SYNTAX
           
static int CAT_TYPE
           
static int CAT_UNCHECKED_RAW
           
static int CAT_UNNECESSARY_CODE
           
static int CAT_UNSPECIFIED
          List of standard category IDs used by Java problems, more categories will be added in the future.
 
Fields inherited from interface org.eclipse.jdt.core.compiler.IProblem
AbstractMethodCannotBeOverridden, AbstractMethodInAbstractClass, AbstractMethodMustBeImplemented, AmbiguousConstructor, AmbiguousConstructorInDefaultConstructor, AmbiguousConstructorInImplicitConstructorCall, AmbiguousField, AmbiguousMethod, AmbiguousType, AnnotationCannotOverrideMethod, AnnotationCircularity, AnnotationCircularitySelfReference, AnnotationFieldNeedConstantInitialization, AnnotationMembersCannotHaveParameters, AnnotationMembersCannotHaveTypeParameters, AnnotationTypeDeclarationCannotHaveConstructor, AnnotationTypeDeclarationCannotHaveSuperclass, AnnotationTypeDeclarationCannotHaveSuperinterfaces, AnnotationTypeUsedAsSuperInterface, AnnotationValueMustBeAnnotation, AnnotationValueMustBeArrayInitializer, AnnotationValueMustBeClassLiteral, AnnotationValueMustBeConstant, AnonymousClassCannotExtendFinalClass, ArgumentHidingField, ArgumentHidingLocalVariable, ArgumentIsNeverUsed, ArgumentTypeAmbiguous, ArgumentTypeCannotBeVoid, ArgumentTypeCannotBeVoidArray, ArgumentTypeInheritedNameHidesEnclosingName, ArgumentTypeInternalNameProvided, ArgumentTypeNotFound, ArgumentTypeNotVisible, ArrayConstantsOnlyInArrayInitializers, ArrayReferenceRequired, AssignmentHasNoEffect, BodyForAbstractMethod, BodyForNativeMethod, BoundCannotBeArray, BoundHasConflictingArguments, BoundMustBeAnInterface, BoxingConversion, BytecodeExceeds64KLimit, BytecodeExceeds64KLimitForClinit, BytecodeExceeds64KLimitForConstructor, CannotAllocateVoidArray, CannotDeclareEnumSpecialMethod, CannotDefineAnnotationInLocalType, CannotDefineDimensionExpressionsWithInit, CannotDefineEnumInLocalType, CannotDefineInterfaceInLocalType, CannotDefineStaticInitializerInLocalType, CannotExtendEnum, CannotHideAnInstanceMethodWithAStaticMethod, CannotImportPackage, CannotInvokeSuperConstructorInEnum, CannotOverrideAStaticMethodWithAnInstanceMethod, CannotReturnInInitializer, CannotThrowNull, CannotThrowType, CannotUseSuperInCodeSnippet, ClassExtendFinalClass, CodeCannotBeReached, CodeSnippetMissingClass, CodeSnippetMissingMethod, ConflictingImport, ConstructorRelated, ConstructorVarargsArgumentNeedCast, CorruptedSignature, DirectInvocationOfAbstractMethod, DisallowedTargetForAnnotation, DiscouragedReference, DuplicateAnnotation, DuplicateAnnotationMember, DuplicateBlankFinalFieldInitialization, DuplicateBounds, DuplicateCase, DuplicateDefaultCase, DuplicateField, DuplicateFinalLocalInitialization, DuplicateImport, DuplicateLabel, DuplicateMethod, DuplicateMethodErasure, DuplicateModifierForArgument, DuplicateModifierForField, DuplicateModifierForMethod, DuplicateModifierForType, DuplicateModifierForVariable, DuplicateNestedType, DuplicateParameterizedMethods, DuplicateSuperInterface, DuplicateTargetInTargetAnnotation, DuplicateTypes, DuplicateTypeVariable, EmptyControlFlowStatement, EnclosingInstanceInConstructorCall, EndOfSource, EnumAbstractMethodMustBeImplemented, EnumConstantsCannotBeSurroundedByParenthesis, EnumStaticFieldInInInitializerContext, EnumSwitchCannotTargetField, ExceptionTypeAmbiguous, ExceptionTypeInheritedNameHidesEnclosingName, ExceptionTypeInternalNameProvided, ExceptionTypeNotFound, ExceptionTypeNotVisible, ExpressionShouldBeAVariable, ExternalProblemFixable, ExternalProblemNotFixable, FieldHidingField, FieldHidingLocalVariable, FieldMissingDeprecatedAnnotation, FieldRelated, FieldTypeAmbiguous, FieldTypeInheritedNameHidesEnclosingName, FieldTypeInternalNameProvided, FieldTypeNotFound, FieldTypeNotVisible, FinalBoundForTypeVariable, FinalFieldAssignment, FinallyMustCompleteNormally, FinalMethodCannotBeOverridden, FinalOuterLocalAssignment, ForbiddenReference, GenericConstructorTypeArgumentMismatch, GenericMethodTypeArgumentMismatch, GenericTypeCannotExtendThrowable, HidingEnclosingType, HierarchyCircularity, HierarchyCircularitySelfReference, HierarchyHasProblems, IgnoreCategoriesMask, IllegalAbstractModifierCombinationForMethod, IllegalCast, IllegalClassLiteralForTypeVariable, IllegalDimension, IllegalEnclosingInstanceSpecification, IllegalExtendedDimensions, IllegalExtendedDimensionsForVarArgs, IllegalGenericArray, IllegalInstanceofParameterizedType, IllegalInstanceofTypeParameter, IllegalModifierCombinationFinalAbstractForClass, IllegalModifierCombinationFinalVolatileForField, IllegalModifierForAnnotationField, IllegalModifierForAnnotationMemberType, IllegalModifierForAnnotationMethod, IllegalModifierForAnnotationType, IllegalModifierForArgument, IllegalModifierForClass, IllegalModifierForEnum, IllegalModifierForEnumConstant, IllegalModifierForEnumConstructor, IllegalModifierForField, IllegalModifierForInterface, IllegalModifierForInterfaceField, IllegalModifierForInterfaceMethod, IllegalModifierForLocalClass, IllegalModifierForLocalEnum, IllegalModifierForMemberClass, IllegalModifierForMemberEnum, IllegalModifierForMemberInterface, IllegalModifierForMethod, IllegalModifierForVariable, IllegalPrimitiveOrArrayTypeForEnclosingInstance, IllegalQualifiedEnumConstantLabel, IllegalQualifiedParameterizedTypeAllocation, IllegalStaticModifierForMemberType, IllegalTypeVariableSuperReference, IllegalUsageOfQualifiedTypeReference, IllegalVararg, IllegalVisibilityModifierCombinationForField, IllegalVisibilityModifierCombinationForMemberType, IllegalVisibilityModifierCombinationForMethod, IllegalVisibilityModifierForInterfaceMemberType, ImportAmbiguous, ImportInheritedNameHidesEnclosingName, ImportInternalNameProvided, ImportNotFound, ImportNotVisible, ImportRelated, IncompatibleExceptionInInheritedMethodThrowsClause, IncompatibleExceptionInThrowsClause, IncompatibleExceptionInThrowsClauseForNonInheritedInterfaceMethod, IncompatibleReturnType, IncompatibleReturnTypeForNonInheritedInterfaceMethod, IncompatibleTypesInConditionalOperator, IncompatibleTypesInEqualityOperator, IncompatibleTypesInForeach, IncorrectArityForParameterizedConstructor, IncorrectArityForParameterizedMethod, IncorrectArityForParameterizedType, IncorrectEnclosingInstanceReference, IncorrectSwitchType, IndirectAccessToStaticField, IndirectAccessToStaticMethod, IndirectAccessToStaticType, InheritedFieldHidesEnclosingName, InheritedMethodHidesEnclosingName, InheritedMethodReducesVisibility, InheritedTypeHidesEnclosingName, InitializerMustCompleteNormally, InstanceFieldDuringConstructorInvocation, InstanceMethodDuringConstructorInvocation, InterfaceAmbiguous, InterfaceCannotHaveConstructors, InterfaceCannotHaveInitializers, InterfaceInheritedNameHidesEnclosingName, InterfaceInternalNameProvided, InterfaceNotFound, InterfaceNotVisible, Internal, InternalTypeNameProvided, InvalidAnnotationMemberType, InvalidBreak, InvalidCatchBlockSequence, InvalidCharacterConstant, InvalidClassInstantiation, InvalidContinue, InvalidDigit, InvalidEscape, InvalidExplicitConstructorCall, InvalidExpressionAsStatement, InvalidFileNameForPackageAnnotations, InvalidFloat, InvalidHexa, InvalidHighSurrogate, InvalidInput, InvalidLowSurrogate, InvalidNullToSynchronized, InvalidOctal, InvalidOperator, InvalidParameterizedExceptionType, InvalidParenthesizedExpression, InvalidTypeExpression, InvalidTypeForCollection, InvalidTypeForStaticImport, InvalidTypeToSynchronized, InvalidTypeVariableExceptionType, InvalidUnaryExpression, InvalidUnicodeEscape, InvalidUsageOfAnnotationDeclarations, InvalidUsageOfAnnotations, InvalidUsageOfEnumDeclarations, InvalidUsageOfForeachStatements, InvalidUsageOfStaticImports, InvalidUsageOfTypeArguments, InvalidUsageOfTypeParameters, InvalidUsageOfVarargs, InvalidVoidExpression, IsClassPathCorrect, Javadoc, JavadocAmbiguousConstructor, JavadocAmbiguousField, JavadocAmbiguousMethod, JavadocAmbiguousMethodReference, JavadocAmbiguousType, JavadocDuplicateParamName, JavadocDuplicateReturnTag, JavadocDuplicateThrowsClassName, JavadocEmptyReturnTag, JavadocGenericConstructorTypeArgumentMismatch, JavadocGenericMethodTypeArgumentMismatch, JavadocIncorrectArityForParameterizedConstructor, JavadocIncorrectArityForParameterizedMethod, JavadocInheritedFieldHidesEnclosingName, JavadocInheritedMethodHidesEnclosingName, JavadocInheritedNameHidesEnclosingTypeName, JavadocInternalTypeNameProvided, JavadocInvalidParamName, JavadocInvalidParamTagName, JavadocInvalidParamTagTypeParameter, JavadocInvalidSeeArgs, JavadocInvalidSeeHref, JavadocInvalidSeeReference, JavadocInvalidTag, JavadocInvalidThrowsClass, JavadocInvalidThrowsClassName, JavadocInvalidValueReference, JavadocMalformedSeeReference, JavadocMessagePrefix, JavadocMissing, JavadocMissingHashCharacter, JavadocMissingIdentifier, JavadocMissingParamName, JavadocMissingParamTag, JavadocMissingReturnTag, JavadocMissingSeeReference, JavadocMissingThrowsClassName, JavadocMissingThrowsTag, JavadocNoMessageSendOnArrayType, JavadocNoMessageSendOnBaseType, JavadocNonGenericConstructor, JavadocNonGenericMethod, JavadocNonStaticTypeFromStaticInvocation, JavadocNotVisibleConstructor, JavadocNotVisibleField, JavadocNotVisibleMethod, JavadocNotVisibleType, JavadocParameterizedConstructorArgumentTypeMismatch, JavadocParameterizedMethodArgumentTypeMismatch, JavadocParameterMismatch, JavadocTypeArgumentsForRawGenericConstructor, JavadocTypeArgumentsForRawGenericMethod, JavadocUndefinedConstructor, JavadocUndefinedField, JavadocUndefinedMethod, JavadocUndefinedType, JavadocUnexpectedTag, JavadocUnexpectedText, JavadocUnterminatedInlineTag, JavadocUsingDeprecatedConstructor, JavadocUsingDeprecatedField, JavadocUsingDeprecatedMethod, JavadocUsingDeprecatedType, LocalVariableCannotBeNull, LocalVariableCanOnlyBeNull, LocalVariableHidingField, LocalVariableHidingLocalVariable, LocalVariableIsNeverUsed, LocalVariableMayBeNull, MaskedCatch, MethodButWithConstructorName, MethodMissingDeprecatedAnnotation, MethodMustOverride, MethodNameClash, MethodReducesVisibility, MethodRelated, MethodRequiresBody, MethodReturnsVoid, MethodVarargsArgumentNeedCast, MissingArgumentsForParameterizedMemberType, MissingEnclosingInstance, MissingEnclosingInstanceForConstructorCall, MissingEnumConstantCase, MissingOverrideAnnotation, MissingReturnType, MissingSemiColon, MissingSerialVersion, MissingValueForAnnotationMember, MustDefineEitherDimensionExpressionsOrInitializer, MustSpecifyPackage, NativeMethodsCannotBeStrictfp, NeedToEmulateConstructorAccess, NeedToEmulateFieldReadAccess, NeedToEmulateFieldWriteAccess, NeedToEmulateMethodAccess, NoAdditionalBoundAfterTypeVariable, NoFieldOnBaseType, NoImplicitStringConversionForCharArrayExpression, NoMessageSendOnArrayType, NoMessageSendOnBaseType, NonBlankFinalLocalAssignment, NonConstantExpression, NonExternalizedStringLiteral, NonGenericConstructor, NonGenericMethod, NonGenericType, NonStaticAccessToStaticField, NonStaticAccessToStaticMethod, NonStaticContextForEnumMemberType, NonStaticFieldFromStaticInvocation, NonStaticTypeFromStaticInvocation, NotVisibleConstructor, NotVisibleConstructorInDefaultConstructor, NotVisibleConstructorInImplicitConstructorCall, NotVisibleField, NotVisibleMethod, NotVisibleType, NullSourceString, NumericValueOutOfRange, ObjectCannotBeGeneric, ObjectCannotHaveSuperTypes, ObjectHasNoSuperclass, ObjectMustBeClass, OuterLocalMustBeFinal, OverridingDeprecatedMethod, OverridingNonVisibleMethod, PackageCollidesWithType, PackageIsNotExpectedPackage, ParameterAssignment, ParameterizedConstructorArgumentTypeMismatch, ParameterizedMethodArgumentTypeMismatch, ParameterMismatch, ParsingError, ParsingErrorDeleteToken, ParsingErrorDeleteTokens, ParsingErrorInsertToComplete, ParsingErrorInsertToCompletePhrase, ParsingErrorInsertToCompleteScope, ParsingErrorInsertTokenAfter, ParsingErrorInsertTokenBefore, ParsingErrorInvalidToken, ParsingErrorMergeTokens, ParsingErrorMisplacedConstruct, ParsingErrorNoSuggestion, ParsingErrorNoSuggestionForTokens, ParsingErrorOnKeyword, ParsingErrorOnKeywordNoSuggestion, ParsingErrorReplaceTokens, ParsingErrorUnexpectedEOF, PossibleAccidentalBooleanAssignment, PublicClassMustMatchFileName, RawMemberTypeCannotBeParameterized, RawTypeReference, RecursiveConstructorInvocation, RedefinedArgument, RedefinedLocal, ReferenceToForwardField, ReferenceToForwardTypeVariable, ReturnTypeAmbiguous, ReturnTypeCannotBeVoidArray, ReturnTypeInheritedNameHidesEnclosingName, ReturnTypeInternalNameProvided, ReturnTypeNotFound, ReturnTypeNotVisible, ShouldReturnValue, StaticInheritedMethodConflicts, StaticMemberOfParameterizedType, StaticMethodRequested, StringConstantIsExceedingUtf8Limit, SuperclassAmbiguous, SuperclassInheritedNameHidesEnclosingName, SuperclassInternalNameProvided, SuperclassMustBeAClass, SuperclassNotFound, SuperclassNotVisible, SuperfluousSemicolon, SuperInterfaceMustBeAnInterface, SuperInterfacesCollide, SuperTypeUsingWildcard, Syntax, Task, ThisInStaticContext, ThisSuperDuringConstructorInvocation, TooManyArgumentSlots, TooManyArrayDimensions, TooManyBytesForStringConstant, TooManyConstantsInConstantPool, TooManyFields, TooManyLocalVariableSlots, TooManyMethods, TooManySyntheticArgumentSlots, TypeArgumentMismatch, TypeArgumentsForRawGenericConstructor, TypeArgumentsForRawGenericMethod, TypeCollidesWithPackage, TypeMismatch, TypeMissingDeprecatedAnnotation, TypeParameterHidingType, TypeRelated, UnboxingConversion, Unclassified, UndefinedAnnotationMember, UndefinedConstructor, UndefinedConstructorInDefaultConstructor, UndefinedConstructorInImplicitConstructorCall, UndefinedField, UndefinedLabel, UndefinedMethod, UndefinedName, UndefinedType, UndefinedTypeVariable, UndocumentedEmptyBlock, UnexpectedStaticModifierForField, UnexpectedStaticModifierForMethod, UnhandledException, UnhandledExceptionInDefaultConstructor, UnhandledExceptionInImplicitConstructorCall, UnhandledWarningToken, UninitializedBlankFinalField, UninitializedLocalVariable, UnmatchedBracket, UnnecessaryArgumentCast, UnnecessaryCast, UnnecessaryElse, UnnecessaryInstanceof, UnnecessaryNLSTag, UnqualifiedFieldAccess, UnreachableCatch, UnsafeGenericCast, UnsafeRawConstructorInvocation, UnsafeRawFieldAssignment, UnsafeRawGenericConstructorInvocation, UnsafeRawGenericMethodInvocation, UnsafeRawMethodInvocation, UnsafeReturnTypeOverride, UnsafeTypeConversion, UnterminatedComment, UnterminatedString, UnusedConstructorDeclaredThrownException, UnusedImport, UnusedLabel, UnusedMethodDeclaredThrownException, UnusedPrivateConstructor, UnusedPrivateField, UnusedPrivateMethod, UnusedPrivateType, UseAssertAsAnIdentifier, UseEnumAsAnIdentifier, UsingDeprecatedConstructor, UsingDeprecatedField, UsingDeprecatedMethod, UsingDeprecatedType, VarargsConflict, VariableTypeCannotBeVoid, VariableTypeCannotBeVoidArray, VoidMethodReturnsValue, WildcardConstructorInvocation, WildcardFieldAssignment, WildcardMethodInvocation
 
Constructor Summary
CategorizedProblem()
           
 
Method Summary
abstract  int getCategoryID()
          Returns an integer identifying the category of this problem.
abstract  String getMarkerType()
          Returns the marker type associated to this problem, if it was persisted into a marker by the JavaBuilder Standard Java problems are associated to marker type "org.eclipse.jdt.core.problem"), standard tasks are associated to marker type "org.eclipse.jdt.core.task".
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.eclipse.jdt.core.compiler.IProblem
getArguments, getID, getMessage, getOriginatingFileName, getSourceEnd, getSourceLineNumber, getSourceStart, isError, isWarning, setSourceEnd, setSourceLineNumber, setSourceStart
 

Field Detail

CAT_UNSPECIFIED

public static final int CAT_UNSPECIFIED
List of standard category IDs used by Java problems, more categories will be added in the future.

See Also:
Constant Field Values

CAT_BUILDPATH

public static final int CAT_BUILDPATH
See Also:
Constant Field Values

CAT_SYNTAX

public static final int CAT_SYNTAX
See Also:
Constant Field Values

CAT_IMPORT

public static final int CAT_IMPORT
See Also:
Constant Field Values

CAT_TYPE

public static final int CAT_TYPE
See Also:
Constant Field Values

CAT_MEMBER

public static final int CAT_MEMBER
See Also:
Constant Field Values

CAT_JAVADOC

public static final int CAT_JAVADOC
See Also:
Constant Field Values

CAT_CODE_STYLE

public static final int CAT_CODE_STYLE
See Also:
Constant Field Values

CAT_POTENTIAL_PROGRAMMING_PROBLEM

public static final int CAT_POTENTIAL_PROGRAMMING_PROBLEM
See Also:
Constant Field Values

CAT_NAME_SHADOWING_CONFLICT

public static final int CAT_NAME_SHADOWING_CONFLICT
See Also:
Constant Field Values

CAT_DEPRECATION

public static final int CAT_DEPRECATION
See Also:
Constant Field Values

CAT_UNNECESSARY_CODE

public static final int CAT_UNNECESSARY_CODE
See Also:
Constant Field Values

CAT_UNCHECKED_RAW

public static final int CAT_UNCHECKED_RAW
See Also:
Constant Field Values

CAT_NLS

public static final int CAT_NLS
See Also:
Constant Field Values
Constructor Detail

CategorizedProblem

public CategorizedProblem()
Method Detail

getCategoryID

public abstract int getCategoryID()
Returns an integer identifying the category of this problem. Categories, like problem IDs are defined in the context of some marker type. Custom implementations of CategorizedProblem may choose arbitrary values for problem/category IDs, as long as they are associated with a different marker type. Standard Java problem markers (i.e. marker type is "org.eclipse.jdt.core.problem") carry an attribute "categoryId" persisting the originating problem category ID as defined by this method).

Returns:
id - an integer identifying the category of this problem

getMarkerType

public abstract String getMarkerType()
Returns the marker type associated to this problem, if it was persisted into a marker by the JavaBuilder Standard Java problems are associated to marker type "org.eclipse.jdt.core.problem"), standard tasks are associated to marker type "org.eclipse.jdt.core.task".

Returns:
the type of the marker which would be associated to the problem

Eclipse JDT
Release 3.1

Copyright (c) IBM Corp. and others 2000, 2005. All Rights Reserved.