Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 92134 Details for
Bug 218603
[api] provide a mapping from problem id to preference key
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Draft fix + test case
patch_02.txt (text/plain), 15.64 KB, created by
Maxime Daniel
on 2008-03-11 04:30:27 EDT
(
hide
)
Description:
Draft fix + test case
Filename:
MIME Type:
Creator:
Maxime Daniel
Created:
2008-03-11 04:30:27 EDT
Size:
15.64 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core >Index: model/org/eclipse/jdt/core/JavaCore.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/core/JavaCore.java,v >retrieving revision 1.608 >diff -u -r1.608 JavaCore.java >--- model/org/eclipse/jdt/core/JavaCore.java 10 Mar 2008 13:52:05 -0000 1.608 >+++ model/org/eclipse/jdt/core/JavaCore.java 11 Mar 2008 08:20:35 -0000 >@@ -117,6 +117,7 @@ > import org.eclipse.core.runtime.SubProgressMonitor; > import org.eclipse.core.runtime.jobs.ISchedulingRule; > import org.eclipse.jdt.core.compiler.CharOperation; >+import org.eclipse.jdt.core.compiler.IProblem; > import org.eclipse.jdt.core.search.IJavaSearchConstants; > import org.eclipse.jdt.core.search.IJavaSearchScope; > import org.eclipse.jdt.core.search.SearchEngine; >@@ -124,6 +125,7 @@ > import org.eclipse.jdt.core.search.TypeNameRequestor; > import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; > import org.eclipse.jdt.internal.compiler.impl.CompilerOptions; >+import org.eclipse.jdt.internal.compiler.problem.ProblemReporter; > import org.eclipse.jdt.internal.compiler.util.SuffixConstants; > import org.eclipse.jdt.internal.core.*; > import org.eclipse.jdt.internal.core.builder.JavaBuilder; >@@ -2852,6 +2854,22 @@ > } > > /** >+ * Returns the option that can be used to tune the severity of the compiler >+ * problem identified by problemID if any, null otherwise. Non-null return >+ * values are taken from the constants defined by this class which names >+ * start with COMPILER_PB and for which the possible values of the option >+ * are defined by <code>{ "error", "warning", "ignore" }</code>. A null >+ * return value means that the problemID is unknown or that it matches a >+ * problem which severity cannot be tuned. >+ * @param problemID one of the problem IDs defined by {@link IProblem} >+ * @return the option that can be used to tune the severity of the compiler >+ * problem identified by problemID if any, null otherwise >+ */ >+ public static String getCompilerProblemSeverityTuningOption(int problemID) { >+ return CompilerOptions.optionKeyFromIrritant(ProblemReporter.getIrritant(problemID)); >+ } >+ >+ /** > * Returns a table of all known configurable options with their default values. > * These options allow to configure the behaviour of the underlying components. > * The client may safely use the result as a template that they can modify and >#P org.eclipse.jdt.core.tests.compiler >Index: src/org/eclipse/jdt/core/tests/compiler/regression/CompilerInvocationTests.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/CompilerInvocationTests.java,v >retrieving revision 1.13 >diff -u -r1.13 CompilerInvocationTests.java >--- src/org/eclipse/jdt/core/tests/compiler/regression/CompilerInvocationTests.java 22 Feb 2008 09:54:21 -0000 1.13 >+++ src/org/eclipse/jdt/core/tests/compiler/regression/CompilerInvocationTests.java 11 Mar 2008 08:20:52 -0000 >@@ -902,4 +902,1132 @@ > } > return (String) categoryNames.get(new Integer(category)); > } >+// compiler problems tuning >+// https://bugs.eclipse.org/bugs/show_bug.cgi?id=218603 >+public void testONLY_012_compiler_problems_tuning() { >+ try { >+ class ProblemAttributes { >+ boolean skip; >+ String option; >+ ProblemAttributes(String option) { >+ this.option = option; >+ } >+ ProblemAttributes(boolean skip) { >+ this.skip = skip; >+ } >+ } >+ ProblemAttributes SKIP = new ProblemAttributes(true); >+ Map expectedProblemAttributes = new HashMap(); >+ expectedProblemAttributes.put("ObjectHasNoSuperclass", SKIP); >+ expectedProblemAttributes.put("UndefinedType", SKIP); >+ expectedProblemAttributes.put("NotVisibleType", SKIP); >+ expectedProblemAttributes.put("AmbiguousType", SKIP); >+ expectedProblemAttributes.put("UsingDeprecatedType", new ProblemAttributes(JavaCore.COMPILER_PB_DEPRECATION)); >+ expectedProblemAttributes.put("InternalTypeNameProvided", SKIP); >+ expectedProblemAttributes.put("UnusedPrivateType", new ProblemAttributes(JavaCore.COMPILER_PB_UNUSED_PRIVATE_MEMBER)); >+ expectedProblemAttributes.put("IncompatibleTypesInEqualityOperator", SKIP); >+ expectedProblemAttributes.put("IncompatibleTypesInConditionalOperator", SKIP); >+ expectedProblemAttributes.put("TypeMismatch", SKIP); >+ expectedProblemAttributes.put("IndirectAccessToStaticType", new ProblemAttributes(JavaCore.COMPILER_PB_INDIRECT_STATIC_ACCESS)); >+ expectedProblemAttributes.put("MissingEnclosingInstanceForConstructorCall", SKIP); >+ expectedProblemAttributes.put("MissingEnclosingInstance", SKIP); >+ expectedProblemAttributes.put("IncorrectEnclosingInstanceReference", SKIP); >+ expectedProblemAttributes.put("IllegalEnclosingInstanceSpecification", SKIP); >+ expectedProblemAttributes.put("CannotDefineStaticInitializerInLocalType", SKIP); >+ expectedProblemAttributes.put("OuterLocalMustBeFinal", SKIP); >+ expectedProblemAttributes.put("CannotDefineInterfaceInLocalType", SKIP); >+ expectedProblemAttributes.put("IllegalPrimitiveOrArrayTypeForEnclosingInstance", SKIP); >+ expectedProblemAttributes.put("EnclosingInstanceInConstructorCall", SKIP); >+ expectedProblemAttributes.put("AnonymousClassCannotExtendFinalClass", SKIP); >+ expectedProblemAttributes.put("CannotDefineAnnotationInLocalType", SKIP); >+ expectedProblemAttributes.put("CannotDefineEnumInLocalType", SKIP); >+ expectedProblemAttributes.put("NonStaticContextForEnumMemberType", SKIP); >+ expectedProblemAttributes.put("TypeHidingType", new ProblemAttributes(JavaCore.COMPILER_PB_TYPE_PARAMETER_HIDING)); >+ expectedProblemAttributes.put("UndefinedName", SKIP); >+ expectedProblemAttributes.put("UninitializedLocalVariable", SKIP); >+ expectedProblemAttributes.put("VariableTypeCannotBeVoid", SKIP); >+ expectedProblemAttributes.put("VariableTypeCannotBeVoidArray", SKIP); >+ expectedProblemAttributes.put("CannotAllocateVoidArray", SKIP); >+ expectedProblemAttributes.put("RedefinedLocal", SKIP); >+ expectedProblemAttributes.put("RedefinedArgument", SKIP); >+ expectedProblemAttributes.put("DuplicateFinalLocalInitialization", SKIP); >+ expectedProblemAttributes.put("NonBlankFinalLocalAssignment", SKIP); >+ expectedProblemAttributes.put("ParameterAssignment", new ProblemAttributes(JavaCore.COMPILER_PB_PARAMETER_ASSIGNMENT)); >+ expectedProblemAttributes.put("FinalOuterLocalAssignment", SKIP); >+ expectedProblemAttributes.put("LocalVariableIsNeverUsed", new ProblemAttributes(JavaCore.COMPILER_PB_UNUSED_LOCAL)); >+ expectedProblemAttributes.put("ArgumentIsNeverUsed", new ProblemAttributes(JavaCore.COMPILER_PB_UNUSED_PARAMETER)); >+ expectedProblemAttributes.put("BytecodeExceeds64KLimit", SKIP); >+ expectedProblemAttributes.put("BytecodeExceeds64KLimitForClinit", SKIP); >+ expectedProblemAttributes.put("TooManyArgumentSlots", SKIP); >+ expectedProblemAttributes.put("TooManyLocalVariableSlots", SKIP); >+ expectedProblemAttributes.put("TooManySyntheticArgumentSlots", SKIP); >+ expectedProblemAttributes.put("TooManyArrayDimensions", SKIP); >+ expectedProblemAttributes.put("BytecodeExceeds64KLimitForConstructor", SKIP); >+ expectedProblemAttributes.put("UndefinedField", SKIP); >+ expectedProblemAttributes.put("NotVisibleField", SKIP); >+ expectedProblemAttributes.put("AmbiguousField", SKIP); >+ expectedProblemAttributes.put("UsingDeprecatedField", new ProblemAttributes(JavaCore.COMPILER_PB_DEPRECATION)); >+ expectedProblemAttributes.put("NonStaticFieldFromStaticInvocation", SKIP); >+ expectedProblemAttributes.put("ReferenceToForwardField", SKIP); >+ expectedProblemAttributes.put("NonStaticAccessToStaticField", new ProblemAttributes(JavaCore.COMPILER_PB_STATIC_ACCESS_RECEIVER)); >+ expectedProblemAttributes.put("UnusedPrivateField", new ProblemAttributes(JavaCore.COMPILER_PB_UNUSED_PRIVATE_MEMBER)); >+ expectedProblemAttributes.put("IndirectAccessToStaticField", new ProblemAttributes(JavaCore.COMPILER_PB_INDIRECT_STATIC_ACCESS)); >+ expectedProblemAttributes.put("UnqualifiedFieldAccess", new ProblemAttributes(JavaCore.COMPILER_PB_UNQUALIFIED_FIELD_ACCESS)); >+ expectedProblemAttributes.put("FinalFieldAssignment", SKIP); >+ expectedProblemAttributes.put("UninitializedBlankFinalField", SKIP); >+ expectedProblemAttributes.put("DuplicateBlankFinalFieldInitialization", SKIP); >+ expectedProblemAttributes.put("LocalVariableHidingLocalVariable", new ProblemAttributes(JavaCore.COMPILER_PB_LOCAL_VARIABLE_HIDING)); >+ expectedProblemAttributes.put("LocalVariableHidingField", new ProblemAttributes(JavaCore.COMPILER_PB_LOCAL_VARIABLE_HIDING)); >+ expectedProblemAttributes.put("FieldHidingLocalVariable", new ProblemAttributes(JavaCore.COMPILER_PB_FIELD_HIDING)); >+ expectedProblemAttributes.put("FieldHidingField", new ProblemAttributes(JavaCore.COMPILER_PB_FIELD_HIDING)); >+ expectedProblemAttributes.put("ArgumentHidingLocalVariable", new ProblemAttributes(JavaCore.COMPILER_PB_LOCAL_VARIABLE_HIDING)); >+ expectedProblemAttributes.put("ArgumentHidingField", new ProblemAttributes(JavaCore.COMPILER_PB_LOCAL_VARIABLE_HIDING)); >+ expectedProblemAttributes.put("MissingSerialVersion", new ProblemAttributes(JavaCore.COMPILER_PB_MISSING_SERIAL_VERSION)); >+ expectedProblemAttributes.put("UndefinedMethod", SKIP); >+ expectedProblemAttributes.put("NotVisibleMethod", SKIP); >+ expectedProblemAttributes.put("AmbiguousMethod", SKIP); >+ expectedProblemAttributes.put("UsingDeprecatedMethod", new ProblemAttributes(JavaCore.COMPILER_PB_DEPRECATION)); >+ expectedProblemAttributes.put("DirectInvocationOfAbstractMethod", SKIP); >+ expectedProblemAttributes.put("VoidMethodReturnsValue", SKIP); >+ expectedProblemAttributes.put("MethodReturnsVoid", SKIP); >+ expectedProblemAttributes.put("MethodRequiresBody", SKIP); >+ expectedProblemAttributes.put("ShouldReturnValue", SKIP); >+ expectedProblemAttributes.put("MethodButWithConstructorName", new ProblemAttributes(JavaCore.COMPILER_PB_METHOD_WITH_CONSTRUCTOR_NAME)); >+ expectedProblemAttributes.put("MissingReturnType", SKIP); >+ expectedProblemAttributes.put("BodyForNativeMethod", SKIP); >+ expectedProblemAttributes.put("BodyForAbstractMethod", SKIP); >+ expectedProblemAttributes.put("NoMessageSendOnBaseType", SKIP); >+ expectedProblemAttributes.put("ParameterMismatch", SKIP); >+ expectedProblemAttributes.put("NoMessageSendOnArrayType", SKIP); >+ expectedProblemAttributes.put("NonStaticAccessToStaticMethod", new ProblemAttributes(JavaCore.COMPILER_PB_STATIC_ACCESS_RECEIVER)); >+ expectedProblemAttributes.put("UnusedPrivateMethod", new ProblemAttributes(JavaCore.COMPILER_PB_UNUSED_PRIVATE_MEMBER)); >+ expectedProblemAttributes.put("IndirectAccessToStaticMethod", new ProblemAttributes(JavaCore.COMPILER_PB_INDIRECT_STATIC_ACCESS)); >+ expectedProblemAttributes.put("MissingTypeInMethod", SKIP); >+ expectedProblemAttributes.put("MissingTypeInConstructor", SKIP); >+ expectedProblemAttributes.put("UndefinedConstructor", SKIP); >+ expectedProblemAttributes.put("NotVisibleConstructor", SKIP); >+ expectedProblemAttributes.put("AmbiguousConstructor", SKIP); >+ expectedProblemAttributes.put("UsingDeprecatedConstructor", new ProblemAttributes(JavaCore.COMPILER_PB_DEPRECATION)); >+ expectedProblemAttributes.put("UnusedPrivateConstructor", new ProblemAttributes(JavaCore.COMPILER_PB_UNUSED_PRIVATE_MEMBER)); >+ expectedProblemAttributes.put("InstanceFieldDuringConstructorInvocation", SKIP); >+ expectedProblemAttributes.put("InstanceMethodDuringConstructorInvocation", SKIP); >+ expectedProblemAttributes.put("RecursiveConstructorInvocation", SKIP); >+ expectedProblemAttributes.put("ThisSuperDuringConstructorInvocation", SKIP); >+ expectedProblemAttributes.put("InvalidExplicitConstructorCall", SKIP); >+ expectedProblemAttributes.put("UndefinedConstructorInDefaultConstructor", SKIP); >+ expectedProblemAttributes.put("NotVisibleConstructorInDefaultConstructor", SKIP); >+ expectedProblemAttributes.put("AmbiguousConstructorInDefaultConstructor", SKIP); >+ expectedProblemAttributes.put("UndefinedConstructorInImplicitConstructorCall", SKIP); >+ expectedProblemAttributes.put("NotVisibleConstructorInImplicitConstructorCall", SKIP); >+ expectedProblemAttributes.put("AmbiguousConstructorInImplicitConstructorCall", SKIP); >+ expectedProblemAttributes.put("UnhandledExceptionInDefaultConstructor", SKIP); >+ expectedProblemAttributes.put("UnhandledExceptionInImplicitConstructorCall", SKIP); >+ expectedProblemAttributes.put("ArrayReferenceRequired", SKIP); >+ expectedProblemAttributes.put("NoImplicitStringConversionForCharArrayExpression", new ProblemAttributes(JavaCore.COMPILER_PB_CHAR_ARRAY_IN_STRING_CONCATENATION)); >+ expectedProblemAttributes.put("StringConstantIsExceedingUtf8Limit", SKIP); >+ expectedProblemAttributes.put("NonConstantExpression", SKIP); >+ expectedProblemAttributes.put("NumericValueOutOfRange", SKIP); >+ expectedProblemAttributes.put("IllegalCast", SKIP); >+ expectedProblemAttributes.put("InvalidClassInstantiation", SKIP); >+ expectedProblemAttributes.put("CannotDefineDimensionExpressionsWithInit", SKIP); >+ expectedProblemAttributes.put("MustDefineEitherDimensionExpressionsOrInitializer", SKIP); >+ expectedProblemAttributes.put("InvalidOperator", SKIP); >+ expectedProblemAttributes.put("CodeCannotBeReached", SKIP); >+ expectedProblemAttributes.put("CannotReturnInInitializer", SKIP); >+ expectedProblemAttributes.put("InitializerMustCompleteNormally", SKIP); >+ expectedProblemAttributes.put("InvalidVoidExpression", SKIP); >+ expectedProblemAttributes.put("MaskedCatch", new ProblemAttributes(JavaCore.COMPILER_PB_HIDDEN_CATCH_BLOCK)); >+ expectedProblemAttributes.put("DuplicateDefaultCase", SKIP); >+ expectedProblemAttributes.put("UnreachableCatch", SKIP); >+ expectedProblemAttributes.put("UnhandledException", SKIP); >+ expectedProblemAttributes.put("IncorrectSwitchType", SKIP); >+ expectedProblemAttributes.put("DuplicateCase", SKIP); >+ expectedProblemAttributes.put("DuplicateLabel", SKIP); >+ expectedProblemAttributes.put("InvalidBreak", SKIP); >+ expectedProblemAttributes.put("InvalidContinue", SKIP); >+ expectedProblemAttributes.put("UndefinedLabel", SKIP); >+ expectedProblemAttributes.put("InvalidTypeToSynchronized", SKIP); >+ expectedProblemAttributes.put("InvalidNullToSynchronized", SKIP); >+ expectedProblemAttributes.put("CannotThrowNull", SKIP); >+ expectedProblemAttributes.put("AssignmentHasNoEffect", new ProblemAttributes(JavaCore.COMPILER_PB_NO_EFFECT_ASSIGNMENT)); >+ expectedProblemAttributes.put("PossibleAccidentalBooleanAssignment", new ProblemAttributes(JavaCore.COMPILER_PB_POSSIBLE_ACCIDENTAL_BOOLEAN_ASSIGNMENT)); >+ expectedProblemAttributes.put("SuperfluousSemicolon", new ProblemAttributes(JavaCore.COMPILER_PB_EMPTY_STATEMENT)); >+ expectedProblemAttributes.put("UnnecessaryCast", new ProblemAttributes(JavaCore.COMPILER_PB_UNNECESSARY_TYPE_CHECK)); >+ expectedProblemAttributes.put("UnnecessaryArgumentCast", SKIP); >+ expectedProblemAttributes.put("UnnecessaryInstanceof", new ProblemAttributes(JavaCore.COMPILER_PB_UNNECESSARY_TYPE_CHECK)); >+ expectedProblemAttributes.put("FinallyMustCompleteNormally", new ProblemAttributes(JavaCore.COMPILER_PB_FINALLY_BLOCK_NOT_COMPLETING)); >+ expectedProblemAttributes.put("UnusedMethodDeclaredThrownException", new ProblemAttributes(JavaCore.COMPILER_PB_UNUSED_DECLARED_THROWN_EXCEPTION_WHEN_OVERRIDING)); >+ expectedProblemAttributes.put("UnusedConstructorDeclaredThrownException", new ProblemAttributes(JavaCore.COMPILER_PB_UNUSED_DECLARED_THROWN_EXCEPTION_WHEN_OVERRIDING)); >+ expectedProblemAttributes.put("InvalidCatchBlockSequence", SKIP); >+ expectedProblemAttributes.put("EmptyControlFlowStatement", new ProblemAttributes(JavaCore.COMPILER_PB_EMPTY_STATEMENT));
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 218603
:
92134
|
92180
|
92551