Community
Participate
Working Groups
I20071101-0010 IProblem.UnusedWarningToken has wrong CategorizedProblem.getCategoryID(). Is: CategorizedProblem.CAT_INTERNAL Expected: CategorizedProblem.CAT_UNNECESSARY_CODE
Created attachment 82522 [details] Proposed patch
Released for 3.4M4 Fixed Maxime - pls update the test you are adding to catch these.
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.
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.
The last 13 IDs got duplicated in your list. At first glance, this one should be in javadoc category : JavadocMessagePrefix
Verified for 3.4M4 using build I20071210-1800.