/******************************************************************************* * Copyright © 2000, 2013 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * IBM Corporation - initial API and implementation * *******************************************************************************/ package org.eclipse.edt.ide.core.model; /** * Description of a EGL problem, as detected by the compiler or some of the underlying * technology reusing the compiler. * A problem provides access to: * <ul> * <li> its location (originating source file name, source position, line number), </li> * <li> its message description and a predicate to check its severity (warning or error). </li> * <li> its ID : an number identifying the very nature of this problem. All possible IDs are listed * as constants on this interface. </li> * </ul> * * Note: the compiler produces IProblems internally, which are turned into markers by the EGLBuilder * so as to persist problem descriptions. This explains why there is no API allowing to reach IProblem detected * when compiling. However, the EGL problem markers carry equivalent information to IProblem, in particular * their ID (attribute "id") is set to one of the IDs defined on this interface. * * @since 2.0 */ public interface IProblem { /** * Answer back the original arguments recorded into the problem. * @return the original arguments recorded into the problem */ String[] getArguments(); /** * Returns the problem id * * @return the problem id */ int getID(); /** * Answer a localized, human-readable message string which describes the problem. * * @return a localized, human-readable message string which describes the problem */ String getMessage(); /** * Answer the file name in which the problem was found. * * @return the file name in which the problem was found */ char[] getOriginatingFileName(); /** * Answer the end position of the problem (inclusive), or -1 if unknown. * * @return the end position of the problem (inclusive), or -1 if unknown */ int getSourceEnd(); /** * Answer the line number in source where the problem begins. * * @return the line number in source where the problem begins */ int getSourceLineNumber(); /** * Answer the start position of the problem (inclusive), or -1 if unknown. * * @return the start position of the problem (inclusive), or -1 if unknown */ int getSourceStart(); /** * Checks the severity to see if the Error bit is set. * * @return true if the Error bit is set for the severity, false otherwise */ boolean isError(); /** * Checks the severity to see if the Error bit is not set. * * @return true if the Error bit is not set for the severity, false otherwise */ boolean isWarning(); /** * Set the end position of the problem (inclusive), or -1 if unknown. * Used for shifting problem positions. * * @param sourceEnd the given end position */ void setSourceEnd(int sourceEnd); /** * Set the line number in source where the problem begins. * * @param lineNumber the given line number */ void setSourceLineNumber(int lineNumber); /** * Set the start position of the problem (inclusive), or -1 if unknown. * Used for shifting problem positions. * * @param the given start position */ void setSourceStart(int sourceStart); /** * Problem Categories * The high bits of a problem ID contains information about the category of a problem. * For example, (problemID & PartRelated) != 0, indicates that this problem is type related. * * A problem category can help to implement custom problem filters. Indeed, when numerous problems * are listed, focusing on import related problems first might be relevant. * * When a problem is tagged as Internal, it means that no change other than a local source code change * can fix the corresponding problem. */ int PartRelated = 0x01000000; int FieldRelated = 0x02000000; int MethodRelated = 0x04000000; int ConstructorRelated = 0x08000000; int ImportRelated = 0x10000000; int Internal = 0x20000000; int Syntax = 0x40000000; /** * Mask to use in order to filter out the category portion of the problem ID. */ int IgnoreCategoriesMask = 0xFFFFFF; /** * Below are listed all available problem IDs. Note that this list could be augmented in the future, * as new features are added to the EGL core implementation. */ /** * ID reserved for referencing an internal error inside the EGLCore implementation which * may be surfaced as a problem associated with the compilation unit which caused it to occur. */ int Unclassified = 0; /** * Generic type related problems */ int ObjectHasNoSuperclass = PartRelated + 1; int UndefinedType = PartRelated + 2; int NotVisibleType = PartRelated + 3; int AmbiguousType = PartRelated + 4; int UsingDeprecatedType = PartRelated + 5; int InternalTypeNameProvided = PartRelated + 6; /** @since 2.1 */ int UnusedPrivateType = Internal + PartRelated + 7; int IncompatibleTypesInEqualityOperator = PartRelated + 15; int IncompatibleTypesInConditionalOperator = PartRelated + 16; int TypeMismatch = PartRelated + 17; /** * Inner types related problems */ int MissingEnclosingInstanceForConstructorCall = PartRelated + 20; int MissingEnclosingInstance = PartRelated + 21; int IncorrectEnclosingInstanceReference = PartRelated + 22; int IllegalEnclosingInstanceSpecification = PartRelated + 23; int CannotDefineStaticInitializerInLocalType = Internal + 24; int OuterLocalMustBeFinal = Internal + 25; int CannotDefineInterfaceInLocalType = Internal + 26; int IllegalPrimitiveOrArrayTypeForEnclosingInstance = PartRelated + 27; /** @since 2.1 */ int EnclosingInstanceInConstructorCall = Internal + 28; int AnonymousClassCannotExtendFinalClass = PartRelated + 29; // variables int UndefinedName = 50; int UninitializedLocalVariable = Internal + 51; int VariableTypeCannotBeVoid = Internal + 52; int VariableTypeCannotBeVoidArray = Internal + 53; int CannotAllocateVoidArray = Internal + 54; // local variables int RedefinedLocal = Internal + 55; int RedefinedArgument = Internal + 56; // final local variables int DuplicateFinalLocalInitialization = Internal + 57; /** @since 2.1 */ int NonBlankFinalLocalAssignment = Internal + 58; int FinalOuterLocalAssignment = Internal + 60; int LocalVariableIsNeverUsed = Internal + 61; int ArgumentIsNeverUsed = Internal + 62; int BytecodeExceeds64KLimit = Internal + 63; int BytecodeExceeds64KLimitForClinit = Internal + 64; int TooManyArgumentSlots = Internal + 65; int TooManyLocalVariableSlots = Internal + 66; /** @since 2.1 */ int TooManySyntheticArgumentSlots = Internal + 67; /** @since 2.1 */ int TooManyArrayDimensions = Internal + 68; /** @since 2.1 */ int BytecodeExceeds64KLimitForConstructor = Internal + 69; // fields int UndefinedField = FieldRelated + 70; int NotVisibleField = FieldRelated + 71; int AmbiguousField = FieldRelated + 72; int UsingDeprecatedField = FieldRelated + 73; int NonStaticFieldFromStaticInvocation = FieldRelated + 74; int ReferenceToForwardField = FieldRelated + Internal + 75; /** @since 2.1 */ int NonStaticAccessToStaticField = Internal + FieldRelated + 76; /** @since 2.1 */ int UnusedPrivateField = Internal + FieldRelated + 77; // blank final fields int FinalFieldAssignment = FieldRelated + 80; int UninitializedBlankFinalField = FieldRelated + 81; int DuplicateBlankFinalFieldInitialization = FieldRelated + 82; // methods int UndefinedMethod = MethodRelated + 100; int NotVisibleMethod = MethodRelated + 101; int AmbiguousMethod = MethodRelated + 102; int UsingDeprecatedMethod = MethodRelated + 103; int DirectInvocationOfAbstractMethod = MethodRelated + 104; int VoidMethodReturnsValue = MethodRelated + 105; int MethodReturnsVoid = MethodRelated + 106; int MethodRequiresBody = Internal + MethodRelated + 107; int ShouldReturnValue = Internal + MethodRelated + 108; int MethodButWithConstructorName = MethodRelated + 110; int MissingReturnType = PartRelated + 111; int BodyForNativeMethod = Internal + MethodRelated + 112; int BodyForAbstractMethod = Internal + MethodRelated + 113; int NoMessageSendOnBaseType = MethodRelated + 114; int ParameterMismatch = MethodRelated + 115; int NoMessageSendOnArrayType = MethodRelated + 116; /** @since 2.1 */ int NonStaticAccessToStaticMethod = Internal + MethodRelated + 117; /** @since 2.1 */ int UnusedPrivateMethod = Internal + MethodRelated + 118; // constructors int UndefinedConstructor = ConstructorRelated + 130; int NotVisibleConstructor = ConstructorRelated + 131; int AmbiguousConstructor = ConstructorRelated + 132; int UsingDeprecatedConstructor = ConstructorRelated + 133; /** @since 2.1 */ int UnusedPrivateConstructor = Internal + MethodRelated + 134; // explicit constructor calls int InstanceFieldDuringConstructorInvocation = ConstructorRelated + 135; int InstanceMethodDuringConstructorInvocation = ConstructorRelated + 136; int RecursiveConstructorInvocation = ConstructorRelated + 137; int ThisSuperDuringConstructorInvocation = ConstructorRelated + 138; // implicit constructor calls int UndefinedConstructorInDefaultConstructor = ConstructorRelated + 140; int NotVisibleConstructorInDefaultConstructor = ConstructorRelated + 141; int AmbiguousConstructorInDefaultConstructor = ConstructorRelated + 142; int UndefinedConstructorInImplicitConstructorCall = ConstructorRelated + 143; int NotVisibleConstructorInImplicitConstructorCall = ConstructorRelated + 144; int AmbiguousConstructorInImplicitConstructorCall = ConstructorRelated + 145; int UnhandledExceptionInDefaultConstructor = PartRelated + 146; int UnhandledExceptionInImplicitConstructorCall = PartRelated + 147; // expressions int ArrayReferenceRequired = Internal + 150; int NoImplicitStringConversionForCharArrayExpression = Internal + 151; // constant expressions int StringConstantIsExceedingUtf8Limit = Internal + 152; int NonConstantExpression = 153; int NumericValueOutOfRange = Internal + 154; // cast expressions int IllegalCast = PartRelated + 156; // allocations int InvalidClassInstantiation = PartRelated + 157; int CannotDefineDimensionExpressionsWithInit = Internal + 158; int MustDefineEitherDimensionExpressionsOrInitializer = Internal + 159; // operators int InvalidOperator = Internal + 160; // statements int CodeCannotBeReached = Internal + 161; int CannotReturnInInitializer = Internal + 162; int InitializerMustCompleteNormally = Internal + 163; // assert int InvalidVoidExpression = Internal + 164; // try int MaskedCatch = PartRelated + 165; int DuplicateDefaultCase = 166; int UnreachableCatch = PartRelated + MethodRelated + 167; int UnhandledException = PartRelated + 168; // switch int IncorrectSwitchType = PartRelated + 169; int DuplicateCase = FieldRelated + 170; // labelled int DuplicateLabel = Internal + 171; int InvalidBreak = Internal + 172; int InvalidContinue = Internal + 173; int UndefinedLabel = Internal + 174; //synchronized int InvalidTypeToSynchronized = Internal + 175; int InvalidNullToSynchronized = Internal + 176; // throw int CannotThrowNull = Internal + 177; // assignment /** @since 2.1 */ int AssignmentHasNoEffect = Internal + 178; // inner emulation int NeedToEmulateFieldReadAccess = FieldRelated + 190; int NeedToEmulateFieldWriteAccess = FieldRelated + 191; int NeedToEmulateMethodAccess = MethodRelated + 192; int NeedToEmulateConstructorAccess = MethodRelated + 193; //inherited name hides enclosing name (sort of ambiguous) int InheritedMethodHidesEnclosingName = MethodRelated + 195; int InheritedFieldHidesEnclosingName = FieldRelated + 196; int InheritedTypeHidesEnclosingName = PartRelated + 197; // miscellaneous int ThisInStaticContext = Internal + 200; int StaticMethodRequested = Internal + MethodRelated + 201; int IllegalDimension = Internal + 202; int InvalidTypeExpression = Internal + 203; int ParsingError = Syntax + Internal + 204; int ParsingErrorNoSuggestion = Syntax + Internal + 205; int InvalidUnaryExpression = Syntax + Internal + 206; // syntax errors int InterfaceCannotHaveConstructors = Syntax + Internal + 207; int ArrayConstantsOnlyInArrayInitializers = Syntax + Internal + 208; int ParsingErrorOnKeyword = Syntax + Internal + 209; int ParsingErrorOnKeywordNoSuggestion = Syntax + Internal + 210; int UnmatchedBracket = Syntax + Internal + 220; int NoFieldOnBaseType = FieldRelated + 221; int InvalidExpressionAsStatement = Syntax + Internal + 222; /** @since 2.1 */ int ExpressionShouldBeAVariable = Syntax + Internal + 223; /** @since 2.1 */ int MissingSemiColon = Syntax + Internal + 224; /** @since 2.1 */ int InvalidParenthesizedExpression = Syntax + Internal + 225; // scanner errors int EndOfSource = Syntax + Internal + 250; int InvalidHexa = Syntax + Internal + 251; int InvalidOctal = Syntax + Internal + 252; int InvalidCharacterConstant = Syntax + Internal + 253; int InvalidEscape = Syntax + Internal + 254; int InvalidInput = Syntax + Internal + 255; int InvalidUnicodeEscape = Syntax + Internal + 256; int InvalidFloat = Syntax + Internal + 257; int NullSourceString = Syntax + Internal + 258; int UnterminatedString = Syntax + Internal + 259; int UnterminatedComment = Syntax + Internal + 260; // type related problems int InterfaceCannotHaveInitializers = PartRelated + 300; int DuplicateModifierForType = PartRelated + 301; int IllegalModifierForClass = PartRelated + 302; int IllegalModifierForInterface = PartRelated + 303; int IllegalModifierForMemberClass = PartRelated + 304; int IllegalModifierForMemberInterface = PartRelated + 305; int IllegalModifierForLocalClass = PartRelated + 306; int IllegalModifierCombinationFinalAbstractForClass = PartRelated + 308; int IllegalVisibilityModifierForInterfaceMemberType = PartRelated + 309; int IllegalVisibilityModifierCombinationForMemberType = PartRelated + 310; int IllegalStaticModifierForMemberType = PartRelated + 311; int SuperclassMustBeAClass = PartRelated + 312; int ClassExtendFinalClass = PartRelated + 313; int DuplicateSuperInterface = PartRelated + 314; int SuperInterfaceMustBeAnInterface = PartRelated + 315; int HierarchyCircularitySelfReference = PartRelated + 316; int HierarchyCircularity = PartRelated + 317; int HidingEnclosingType = PartRelated + 318; int DuplicateNestedType = PartRelated + 319; int CannotThrowType = PartRelated + 320; int PackageCollidesWithType = PartRelated + 321; int TypeCollidesWithPackage = PartRelated + 322; int DuplicateTypes = PartRelated + 323; int IsClassPathCorrect = PartRelated + 324; int PublicClassMustMatchFileName = PartRelated + 325; int MustSpecifyPackage = 326; int HierarchyHasProblems = PartRelated + 327; int PackageIsNotExpectedPackage = 328; /** @since 2.1 */ int ObjectCannotHaveSuperTypes = 329; // field related problems int DuplicateField = FieldRelated + 340; int DuplicateModifierForField = FieldRelated + 341; int IllegalModifierForField = FieldRelated + 342; int IllegalModifierForInterfaceField = FieldRelated + 343; int IllegalVisibilityModifierCombinationForField = FieldRelated + 344; int IllegalModifierCombinationFinalVolatileForField = FieldRelated + 345; int UnexpectedStaticModifierForField = FieldRelated + 346; // method related problems int DuplicateMethod = MethodRelated + 355; int IllegalModifierForArgument = MethodRelated + 356; int DuplicateModifierForMethod = MethodRelated + 357; int IllegalModifierForMethod = MethodRelated + 358; int IllegalModifierForInterfaceMethod = MethodRelated + 359; int IllegalVisibilityModifierCombinationForMethod = MethodRelated + 360; int UnexpectedStaticModifierForMethod = MethodRelated + 361; int IllegalAbstractModifierCombinationForMethod = MethodRelated + 362; int AbstractMethodInAbstractClass = MethodRelated + 363; int ArgumentTypeCannotBeVoid = MethodRelated + 364; int ArgumentTypeCannotBeVoidArray = MethodRelated + 365; int ReturnTypeCannotBeVoidArray = MethodRelated + 366; int NativeMethodsCannotBeStrictfp = MethodRelated + 367; int DuplicateModifierForArgument = MethodRelated + 368; // import related problems int ConflictingImport = ImportRelated + 385; int DuplicateImport = ImportRelated + 386; int CannotImportPackage = ImportRelated + 387; int UnusedImport = ImportRelated + 388; // local variable related problems int DuplicateModifierForVariable = MethodRelated + 395; int IllegalModifierForVariable = MethodRelated + 396; // method verifier problems int AbstractMethodMustBeImplemented = MethodRelated + 400; int FinalMethodCannotBeOverridden = MethodRelated + 401; int IncompatibleExceptionInThrowsClause = MethodRelated + 402; int IncompatibleExceptionInInheritedMethodThrowsClause = MethodRelated + 403; int IncompatibleReturnType = MethodRelated + 404; int InheritedMethodReducesVisibility = MethodRelated + 405; int CannotOverrideAStaticMethodWithAnInstanceMethod = MethodRelated + 406; int CannotHideAnInstanceMethodWithAStaticMethod = MethodRelated + 407; int StaticInheritedMethodConflicts = MethodRelated + 408; int MethodReducesVisibility = MethodRelated + 409; int OverridingNonVisibleMethod = MethodRelated + 410; int AbstractMethodCannotBeOverridden = MethodRelated + 411; int OverridingDeprecatedMethod = MethodRelated + 412; /** @since 2.1 */ int IncompatibleReturnTypeForNonInheritedInterfaceMethod = MethodRelated + 413; /** @since 2.1 */ int IncompatibleExceptionInThrowsClauseForNonInheritedInterfaceMethod = MethodRelated + 414; // code snippet support int CodeSnippetMissingClass = Internal + 420; int CodeSnippetMissingMethod = Internal + 421; int NonExternalizedStringLiteral = Internal + 261; int CannotUseSuperInCodeSnippet = Internal + 422; //constant pool int TooManyConstantsInConstantPool = Internal + 430; /** @since 2.1 */ int TooManyBytesForStringConstant = Internal + 431; // static constraints /** @since 2.1 */ int TooManyFields = Internal + 432; /** @since 2.1 */ int TooManyMethods = Internal + 433; // 1.4 features // assertion warning int UseAssertAsAnIdentifier = Internal + 440; // detected task /** @since 2.1 */ int Task = Internal + 450; }