Bug 208383 - IProblem.UnusedWarningToken has wrong category
Summary: IProblem.UnusedWarningToken has wrong category
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.4   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.4 M4   Edit
Assignee: Philipe Mulet CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-11-01 07:29 EDT by Markus Keller CLA
Modified: 2008-02-19 21:13 EST (History)
5 users (show)

See Also:


Attachments
Proposed patch (998 bytes, patch)
2007-11-09 04:01 EST, Philipe Mulet CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Markus Keller CLA 2007-11-01 07:29:32 EDT
I20071101-0010

IProblem.UnusedWarningToken has wrong CategorizedProblem.getCategoryID().

Is: CategorizedProblem.CAT_INTERNAL
Expected: CategorizedProblem.CAT_UNNECESSARY_CODE
Comment 1 Philipe Mulet CLA 2007-11-09 04:01:01 EST
Created attachment 82522 [details]
Proposed patch
Comment 2 Philipe Mulet CLA 2007-11-09 04:02:00 EST
Released for 3.4M4
Fixed

Maxime - pls update the test you are adding to catch these.
Comment 3 Maxime Daniel CLA 2007-11-14 03:01:58 EST
CompilerInvocationTests#002 was obviously meant to catch situations where an error would (inadvertently) have an unspecified category. We must have changed the way we do this in the interim, since no error gets the CAT_UNSPECIFIED category any more, which was not the case when the test was introduced. I will modify it so that it barks if any error is introduced that has a CAT_UNSPECIFIED category, just to guard us, but this leads us to consider that the initial problem has been shifted to CAT_INTERNAL (that is, new errors get categorized as CAT_INTERNAL if the committer doesn't tell the code to do otherwise). I'll introduce a new test in CompilerInvocationTests that will bark if any non deprecated IProblem#id gets a category different from the one assigned to it in a specific table (we should also review the table for other potential mismatches), or if it misses from the said table (the idea here is to demand that the committer visits the test and makes a decision). As discussed separately with Philippe, the said table will be augmented with other checkpoints to allow for a more systematic approach of error addition.
Comment 4 Maxime Daniel CLA 2007-11-14 05:42:46 EST
Added CompilerInvocationTests#11. 
Current CAT_INTERNAL problems are:
	CannotDefineStaticInitializerInLocalType
	OuterLocalMustBeFinal
	CannotDefineInterfaceInLocalType
	EnclosingInstanceInConstructorCall
	CannotDefineAnnotationInLocalType
	CannotDefineEnumInLocalType
	NonStaticContextForEnumMemberType
	UninitializedLocalVariable
	VariableTypeCannotBeVoid
	CannotAllocateVoidArray
	RedefinedLocal
	RedefinedArgument
	DuplicateFinalLocalInitialization
	NonBlankFinalLocalAssignment
	FinalOuterLocalAssignment
	BytecodeExceeds64KLimit
	BytecodeExceeds64KLimitForClinit
	TooManyArgumentSlots
	TooManyLocalVariableSlots
	TooManySyntheticArgumentSlots
	TooManyArrayDimensions
	BytecodeExceeds64KLimitForConstructor
	ArrayReferenceRequired
	StringConstantIsExceedingUtf8Limit
	NonConstantExpression
	NumericValueOutOfRange
	CannotDefineDimensionExpressionsWithInit
	MustDefineEitherDimensionExpressionsOrInitializer
	InvalidOperator
	CodeCannotBeReached
	CannotReturnInInitializer
	InitializerMustCompleteNormally
	InvalidVoidExpression
	DuplicateDefaultCase
	DuplicateLabel
	InvalidBreak
	InvalidContinue
	UndefinedLabel
	InvalidTypeToSynchronized
	InvalidNullToSynchronized
	CannotThrowNull
	ThisInStaticContext
	IllegalDimension
	InvalidTypeExpression
	MustSpecifyPackage
	PackageIsNotExpectedPackage
	ObjectCannotHaveSuperTypes
	ObjectMustBeClass
	CodeSnippetMissingClass
	CodeSnippetMissingMethod
	CannotUseSuperInCodeSnippet
	TooManyConstantsInConstantPool
	TooManyBytesForStringConstant
	TooManyFields
	TooManyMethods
	Task
	JavadocMessagePrefix
	DuplicateTypeVariable
	IllegalTypeVariableSuperReference
	NonStaticTypeFromStaticInvocation
	ObjectCannotBeGeneric
	UndefinedTypeVariable
	IllegalInstanceofParameterizedType
	IllegalInstanceofTypeParameter
	InvalidTypeForCollection
	DuplicateAnnotationMember
	AnnotationValueMustBeClassLiteral
	AnnotationValueMustBeConstant
	IllegalModifierForAnnotationField
	DuplicateTargetInTargetAnnotation
	AnnotationValueMustBeAnnotation
	AnnotationValueMustBeArrayInitializer
	AnnotationValueMustBeAnEnumConstant
	InvalidEncoding
	CannotReadSource
	ExternalProblemNotFixable
	ExternalProblemFixable
	DuplicateAnnotationMember
	AnnotationValueMustBeClassLiteral
	AnnotationValueMustBeConstant
	AnnotationFieldNeedConstantInitialization
	IllegalModifierForAnnotationField
	DuplicateTargetInTargetAnnotation
	AnnotationValueMustBeAnnotation
	AnnotationValueMustBeArrayInitializer
	AnnotationValueMustBeAnEnumConstant
	InvalidEncoding
	CannotReadSource
	ExternalProblemNotFixable
	ExternalProblemFixable
This may need some revision. Note though that while compiler problems may be related to syntax and internal, the reported category will be syntax (e.g. InvalidUsageOfTypeParameters). Hence internal reported at the categorized problem level should be somewhat rare, being a catcher for errors that are not precisely classified. 
Note also some problems like 'ExternalProblemNotFixable' that are attached to CAT_INTERNAL, which sounds somewhat odd.

We may want to step back and give the categories issue a fresh look.
Comment 5 Philipe Mulet CLA 2007-11-14 12:59:12 EST
The last 13 IDs got duplicated in your list.

At first glance, this one should be in javadoc category : JavadocMessagePrefix
Comment 6 Kent Johnson CLA 2007-12-11 11:54:19 EST
Verified for 3.4M4 using build I20071210-1800.