<< Chrome - a new rich client platform? | Home | The method of proposal >>

List of SuppressWarnings arguments

I hate compiler warnings showing in my IDE. It's messy, and it usually indicates that something is bad. But not always. Sometimes, when working with third party libraries, you can't avoid warnings like unchecked assignments. These are easy to get around though, by using the @SuppressWarnings annotation. The unchecked assignment warning is a standard Java compiler warning. A quick Google will reveal that the name of the unchecked assignment warning to pass to @SuppressWarnings is "unchecked".

IDE's however tend to flag warnings for much more than what the Java compiler flags warnings for. An example that I encountered today is in unit tests, if you have no assertions in your unit test, IDEA will flag a warning telling you so. In my case however, I was using mockito, and my assertions were in the form of verify calls. IDEA does not yet understand mockito, so I am faced with compiler warnings in my code, which, as I said before, I hate. Surely I can use @SuppressWarnings to suppress this warning, but what's its name? Google didn't help me at all here, so I decided to do a little investigation.

After writing a quick shell script that unpacked IDEAs jar files and grepped for the description of the warning, I found that the code that generates these warnings is an IDEA plugin called InspectionGadgets. I found that each warning was checked for by sub classes of com.siyeh.ig.BaseInspection, and that the name of the warning, and its description, can be obtained by instantiating each sub class, and calling methods on them. In the case of my test method with no assertions warning, the class that flagged this was com.siyeh.ig.junit.TestMethodWithoutAssertionInspection, and the name of the warning was JUnitTestMethodWithNoAssertions. I can now suppress my warning.

All that work was probably too much to do for each time that I want to suppress an IDEA warning. So I decided to find every warning, and store it in a table. Obviously I wasn't going to do this manually, so using this neat utility for finding all the classes on the classpath, with a few modifications to limit where it searched, I was able to generate a table of every warning that IDEA can flag. Here it is, sorted in alphabetical order of the description:

Warning DescriptionWarning Name
"Magic character"MagicCharacter
"Magic number"MagicNumber
'Comparator.compare()' method does not use parameterComparatorMethodParameterNotUsed
'Connection.prepare*()' call with non-constant stringJDBCPrepareStatementWithNonConstantString
'Iterator.hasNext()' which calls 'next()'IteratorHasNextCallsIteratorNext
'Iterator.next()' which can't throw 'NoSuchElementException'IteratorNextCanNotThrowNoSuchElementException
'Statement.execute()' call with non-constant stringJDBCExecuteWithNonConstantString
'String.equals("")'StringEqualsEmptyString
'StringBuffer' may be 'StringBuilder' (JDK 5.0 only)StringBufferMayBeStringBuilder
'StringBuffer.toString()' in concatenationStringBufferToStringInConcatenation
'assert' statementAssertStatement
'assertEquals()' between objects of inconvertible typesAssertEqualsBetweenInconvertibleTypes
'await()' not in loopAwaitNotInLoop
'await()' without corresponding 'signal()'AwaitWithoutCorrespondingSignal
'break' statementBreakStatement
'break' statement with labelBreakStatementWithLabel
'catch' generic classCatchGenericClass
'clone()' does not call 'super.clone()'CloneDoesntCallSuperClone
'clone()' does not declare 'CloneNotSupportedException'CloneDoesntDeclareCloneNotSupportedException
'clone()' instantiates objects with constructorCloneCallsConstructors
'clone()' method in non-Cloneable classCloneInNonCloneableClass
'compareto()' instead of 'compareTo()'MisspelledCompareTo
'continue' or 'break' inside 'finally' blockContinueOrBreakFromFinallyBlock
'continue' statementContinueStatement
'continue' statement with labelContinueStatementWithLabel
'default' not last case in 'switch'DefaultNotLastCaseInSwitch
'equal()' instead of 'equals()'MisspelledEquals
'equals()' between objects of inconvertible typesEqualsBetweenInconvertibleTypes
'equals()' called on array typeArrayEquals
'equals()' called on java.math.BigDecimalBigDecimalEquals
'equals()' method which does not check class of parameterEqualsWhichDoesntCheckParameterClass
'equals()' or 'hashCode()' called on java.net.URL objectEqualsHashCodeCalledOnUrl
'final' classFinalClass
'final' methodFinalMethod
'final' method in 'final' classFinalMethodInFinalClass
'finalize()' called explicitlyFinalizeCalledExplicitly
'finalize()' declarationFinalizeDeclaration
'finalize()' does not call 'super.finalize()'FinalizeDoesntCallSuperFinalize
'finalize()' not declared 'protected'FinalizeNotProtected
'finally' block which can not complete normallyfinally
'for' loop may be replaced by 'while' loopForLoopReplaceableByWhile
'for' loop replaceable by 'for each'ForLoopReplaceableByForEach
'for' loop where update or condition does not use loop variableForLoopThatDoesntUseLoopVariable
'for' loop with missing componentsForLoopWithMissingComponent
'hashcode()' instead of 'hashCode()'MisspelledHashcode
'if' statement with identical branchesIfStatementWithIdenticalBranches
'if' statement with negated conditionIfStatementWithNegatedCondition
'if' statement with too many branchesIfStatementWithTooManyBranches
'indexOf()' expression is replaceable by 'contains()'ListIndexOfReplaceableByContains
'instanceof' a concrete classInstanceofInterfaces
'instanceof' check for 'this'InstanceofThis
'instanceof' on 'catch' parameterInstanceofCatchParameter
'instanceof' with incompatible interfaceInstanceofIncompatibleInterface
'notify()' or 'notifyAll()' called on java.util.concurrent.locks.Condition objectNotifyCalledOnCondition
'notify()' or 'notifyAll()' while not syncedNotifyNotInSynchronizedContext
'notify()' or 'notifyAll()' without corresponding state changeNakedNotify
'notify()' without corresponding 'wait()'NotifyWithoutCorrespondingWait
'private' method declared 'final'FinalPrivateMethod
'protected' member in 'final' classProtectedMemberInFinalClass
'public' constructor in non-public classPublicConstructorInNonPublicClass
'readObject()' or 'writeObject()' not declared 'private'NonPrivateSerializationMethod
'readResolve()' or 'writeReplace()' not declared 'protected'ReadResolveAndWriteReplaceProtected
'return' inside 'finally' blockReturnInsideFinallyBlock
'serialPersistentFields' field not declared 'private static final ObjectStreamField[]'SerialPersistentFieldsWithWrongSignature
'serialVersionUID' field not declared 'private static final long'SerialVersionUIDWithWrongSignature
'setUp()' does not call 'super.setUp()'SetUpDoesntCallSuperSetUp
'setUp()' with incorrect signatureSetUpWithIncorrectSignature
'setup()' instead of 'setUp()'MisspelledSetUp
'signal()' without corresponding 'await()'SignalWithoutCorrespondingAwait
'size() == 0' replaceable by 'isEmpty()'SizeReplaceableByIsEmpty
'static' method declared 'final'FinalStaticMethod
'static', non-'final' fieldStaticNonFinalField
'suite()' method not declared 'static'SuiteNotDeclaredStatic
'switch' statementSwitchStatement
'switch' statement with too few branchesSwitchStatementWithTooFewBranches
'switch' statement with too low of a branch densitySwitchStatementDensity
'switch' statement with too many branchesSwitchStatementWithTooManyBranches
'switch' statement without 'default' branchSwitchStatementWithoutDefaultBranch
'synchronized' methodSynchronizedMethod
'tearDown()' does not call 'super.tearDown()'TearDownDoesntCallSuperTearDown
'tearDown()' with incorrect signatureTearDownWithIncorrectSignature
'teardown()' instead of 'tearDown()'MisspelledTearDown
'this' reference escaped in object constructionThisEscapedInObjectConstruction
'throw' caught by containing 'try' statementThrowCaughtLocally
'throw' inside 'catch' block which ignores the caught exceptionThrowInsideCatchBlockWhichIgnoresCaughtException
'throw' inside 'finally' blockThrowFromFinallyBlock
'tostring()' instead of 'toString()'MisspelledToString
'wait()' called on java.util.concurrent.locks.Condition objectWaitCalledOnCondition
'wait()' not in loopWaitNotInLoop
'wait()' or 'await()' without timeoutWaitOrAwaitWithoutTimeout
'wait()' while holding two locksWaitWhileHoldingTwoLocks
'wait()' while not syncedWaitWhileNotSynced
'wait()' without corresponding 'notify()'WaitWithoutCorrespondingNotify
'while' loop replaceable by 'for each'WhileLoopReplaceableByForEach
* importOnDemandImport
Abstract class extends concrete classAbstractClassExtendsConcreteClass
Abstract class which has no concrete subclassAbstractClassNeverImplemented
Abstract class which has only one direct inheritorAbstractClassWithOnlyOneDirectInheritor
Abstract class without abstract methodsAbstractClassWithoutAbstractMethods
Abstract method call in constructorAbstractMethodCallInConstructor
Abstract method overrides abstract methodAbstractMethodOverridesAbstractMethod
Abstract method overrides concrete methodAbstractMethodOverridesConcreteMethod
Abstract method with missing implementationsAbstractMethodWithMissingImplementations
Access of system propertiesAccessOfSystemProperties
Access to non thread-safe static field from instanceAccessToNonThreadSafeStaticFieldFromInstance
Access to static field locked on instance dataAccessToStaticFieldLockedOnInstance
Accessing a non-public field of another objectAccessingNonPublicFieldOfAnotherObject
AnnotationAnnotation
Annotation classAnnotationClass
Annotation naming conventionAnnotationNamingConvention
Anonymous class variable hides variable in containing methodAnonymousClassVariableHidesContainingMethodVariable
Anonymous inner classAnonymousInnerClass
Anonymous inner class may be a named static inner classAnonymousInnerClassMayBeStatic
Anonymous inner class with too many methodsAnonymousInnerClassWithTooManyMethods
Arithmetic operation on volatile fieldArithmeticOnVolatileField
Array.length in loop conditionArrayLengthInLoopCondition
Assignment replaceable with operator assignmentAssignmentReplaceableWithOperatorAssignment
Assignment to 'for' loop parameterAssignmentToForLoopParameter
Assignment to 'null'AssignmentToNull
Assignment to Collection or array field from parameterAssignmentToCollectionOrArrayFieldFromParameter
Assignment to Date or Calendar field from parameterAssignmentToDateFieldFromParameter
Assignment to catch block parameterAssignmentToCatchBlockParameter
Assignment to method parameterAssignmentToMethodParameter
Assignment to static field from instance methodAssignmentToStaticFieldFromInstanceMethod
Assignment used as conditionAssignmentUsedAsCondition
Auto-boxingAutoBoxing
Auto-unboxingAutoUnboxing
Boolean constructor callBooleanConstructorCall
Boolean method name must start with question wordBooleanMethodNameMustStartWithQuestion
Busy waitBusyWait
C-style array declarationCStyleArrayDeclaration
Call to 'Collection.toArray()' with zero-length array argumentToArrayCallWithZeroLengthArrayArgument
Call to 'Date.toString()'CallToDateToString
Call to 'Runtime.exec()'CallToRuntimeExecWithNonConstantString
Call to 'String.compareTo()'CallToStringCompareTo
Call to 'String.concat()' can be replaced by '+'CallToStringConcatCanBeReplacedByOperator
Call to 'String.equals()'CallToStringEquals
Call to 'String.equalsIgnoreCase()'CallToStringEqualsIgnoreCase
Call to 'String.toUpperCase()' or 'toLowerCase()' without a LocaleStringToUpperCaseOrToLowerCaseWithoutLocale
Call to 'System.exit()' or related methodsCallToSystemExit
Call to 'System.getenv()'CallToSystemGetenv
Call to 'System.loadLibrary()' with non-constant stringLoadLibraryWithNonConstantString
Call to 'System.runFinalizersOnExit()'CallToSystemRunFinalizersOnExit
Call to 'System.setSecurityManager()'CallToSystemSetSecurityManager
Call to 'Thread.dumpStack()'CallToThreadDumpStack
Call to 'Thread.run()'CallToThreadRun
Call to 'Thread.setPriority()'CallToThreadSetPriority
Call to 'Thread.sleep()' while synchronizedSleepWhileHoldingLock
Call to 'Thread.start()' during object constructionCallToThreadStartDuringObjectConstruction
Call to 'Thread.stop()', 'suspend()' or 'resume()'CallToThreadStopSuspendOrResumeManager
Call to 'Thread.yield()'CallToThreadYield
Call to 'Time.toString()'CallToTimeToString
Call to 'intern()' on String constantConstantStringIntern
Call to 'notify()' instead of 'notifyAll()'CallToNotifyInsteadOfNotifyAll
Call to 'printStackTrace()'CallToPrintStackTrace
Call to 'signal()' instead of 'signalAll()'CallToSignalInsteadOfSignalAll
Call to Numeric 'toString()'CallToNumericToString
Call to String.replaceAll(".", ...)ReplaceAllDot
Call to a native method while lockedCallToNativeMethodWhileLocked
Call to default 'toString()'ObjectToString
Call to simple getter from within classCallToSimpleGetterFromWithinClass
Call to simple setter from within classCallToSimpleSetterFromWithinClass
Calls to 'System.gc()' or 'Runtime.gc()'CallToSystemGC
Cast conflicts with 'instanceof'CastConflictsWithInstanceof
Cast to a concrete classCastToConcreteClass
Casting to incompatible interfaceCastToIncompatibleInterface
Caught exception is immediately rethrownCaughtExceptionImmediatelyRethrown
Chain of 'instanceof' checksChainOfInstanceofChecks
Chained equality comparisonsChainedEqualityComparisons
Chained method callsChainedMethodCall
Channel opened but not safely closedChannelOpenedButNotSafelyClosed
Character comparisonCharacterComparison
Checked exception classCheckedExceptionClass
Class escapes defined scopeClassEscapesDefinedScope
Class explicitly extends a Collection classClassExtendsConcreteCollection
Class explicitly extends java.lang.ObjectClassExplicitlyExtendsObject
Class explicitly extends java.lang.ThreadClassExplicitlyExtendsThread
Class extends annotation interfaceClassExplicitlyAnnotation
Class extends utility classExtendsUtilityClass
Class may be interfaceClassMayBeInterface
Class name differs from file nameClassNameDiffersFromFileName
Class name prefixed with package nameClassNamePrefixedWithPackageName
Class name same as ancestor nameClassNameSameAsAncestorName
Class naming conventionClassNamingConvention
Class references one of its subclassesClassReferencesSubclass
Class too deep in inheritance treeClassTooDeepInInheritanceTree
Class with multiple loggersClassWithMultipleLoggers
Class with too many constructorsClassWithTooManyConstructors
Class with too many fieldsClassWithTooManyFields
Class with too many methodsClassWithTooManyMethods
Class without 'toString()'ClassWithoutToString
Class without constructorClassWithoutConstructor
Class without loggerClassWithoutLogger
Class without no-arg constructorClassWithoutNoArgConstructor
Class without package statementClassWithoutPackageStatement
ClassLoader instantiationClassLoaderInstantiation
Cloneable class in secure contextCloneableClassInSecureContext
Cloneable class without 'clone()'CloneableClassWithoutClone
Collection added to selfCollectionAddedToSelf
Collection declared by class, not interfaceCollectionDeclaredAsConcreteClass
Collection without initial capacityCollectionWithoutInitialCapacity
Comparable implemented but 'equals()' not overriddenComparableImplementedButEqualsNotOverridden
Comparator class not declared SerializableComparatorNotSerializable
Comparison of 'short' and 'char' valuesComparisonOfShortAndChar
Comparison to Double.NaN or Float.NaNComparisonToNaN
Concatenation with empty stringConcatenationWithEmptyString
Conditional expression (?:)ConditionalExpression
Conditional expression with identical branchesConditionalExpressionWithIdenticalBranches
Conditional expression with negated conditionConditionalExpressionWithNegatedCondition
Conditional that can be simplified to && or ||SimplifiableConditionalExpression
Confusing 'else' branchConfusingElseBranch
Confusing 'main()' methodConfusingMainMethod
Confusing 'null' argument to var-arg methodNullArgumentToVariableArgMethod
Confusing floating-point literalConfusingFloatingPointLiteral
Confusing octal escape sequenceConfusingOctalEscapeSequence
Confusing primitive array argument to var-arg methodPrimitiveArrayArgumentToVariableArgMethod
Connection opened but not safely closedConnectionOpenedButNotSafelyClosed
Constant StringBuffer may be StringStringBufferReplaceableByString
Constant call to java.lang.Math or StrictMathConstantMathCall
Constant conditional expressionConstantConditionalExpression
Constant declared in abstract classConstantDeclaredInAbstractClass
Constant declared in interfaceConstantDeclaredInInterface
Constant if statementConstantIfStatement
Constant naming conventionConstantNamingConvention
Constant on left side of comparisonConstantOnLeftSideOfComparison
Constant on right side of comparisonConstantOnRightSideOfComparison
Constructor not 'protected' in 'abstract' classConstructorNotProtectedInAbstractClass
Constructor with too many parametersConstructorWithTooManyParameters
Control flow statement without bracesControlFlowStatementWithoutBraces
Covariant 'compareTo()'CovariantCompareTo
Covariant 'equals()'CovariantEquals
Custom ClassLoaderCustomClassloader
Custom SecurityManagerCustomSecurityManager
Deserializable class in secure contextDeserializableClassInSecureContext
Design for extensionDesignForExtension
Division by zerodivzero
Double negationDoubleNegation
Double-checked lockingDoubleCheckedLocking
Duplicate condition in 'if' statementDuplicateCondition
Duplicate condition on '&&' or '||'DuplicateBooleanBranch
Empty 'catch' blockEmptyCatchBlock
Empty 'finally' blockEmptyFinallyBlock
Empty 'synchronized' statementEmptySynchronizedStatement
Empty 'try' blockEmptyTryBlock
Empty classEmptyClass
Empty class initializerEmptyClassInitializer
Enum 'switch' statement that misses caseEnumSwitchStatementWhichMissesCases
Enumerated classEnumClass
Enumerated class naming conventionEnumeratedClassNamingConvention
Enumerated constant naming conventionEnumeratedConstantNamingConvention
Enumeration can be iterationEnumerationCanBeIteration
Exception class name does not end with 'Exception'ExceptionClassNameDoesntEndWithException
Extended 'for' statementForeachStatement
Externalizable class with 'readObject()' or 'writeObject()'ExternalizableClassWithSerializationMethods
Fallthrough in 'switch' statementfallthrough
Feature envyFeatureEnvy
Field accessed in both synchronized and unsynchronized contextsFieldAccessedSynchronizedAndUnsynchronized
Field has setter but no getterFieldHasSetterButNoGetter
Field may be 'static'FieldMayBeStatic
Field name hides field in superclassFieldNameHidesFieldInSuperclass
Field repeatedly accessed in methodFieldRepeatedlyAccessedInMethod
Floating point equality comparisonFloatingPointEquality
Hardcoded file separatorHardcodedFileSeparator
Hardcoded line separatorHardcodedLineSeparator
Hibernate resource opened but not safely closedHibernateResourceOpenedButNotSafelyClosed
I/O resource opened but not safely closedIOResourceOpenedButNotSafelyClosed
If statement may be replaced by && or || expressionSimplifiableIfStatement
Implicit call to 'super()'ImplicitCallToSuper
Implicit call to array '.toString()'ImplicitArrayToString
Implicit numeric conversionImplicitNumericConversion
Import from same packageSamePackageImport
Incompatible bitwise mask operationIncompatibleBitwiseMaskOperation
Infinite loop statementInfiniteLoopStatement
Infinite recursionInfiniteRecursion
Inner class field hides outer class fieldInnerClassFieldHidesOuterClassField
Inner class may be 'static'InnerClassMayBeStatic
Inner class of interfaceInnerClassOfInterface
Inner class too deeply nestedInnerClassTooDeeplyNested
Insecure random number generationUnsecureRandomNumberGeneration
Inspection suppression annotationSuppressionAnnotation
Instance method naming conventionInstanceMethodNamingConvention
Instance variable may not be initializedInstanceVariableMayNotBeInitialized
Instance variable may not be initialized by 'readObject()'InstanceVariableMayNotBeInitializedByReadObject
Instance variable naming conventionInstanceVariableNamingConvention
Instance variable of concrete classInstanceVariableOfConcreteClass
Instance variable used before initializedInstanceVariableUsedBeforeInitialized
Instantiating a SimpleDateFormat without a LocaleSimpleDateFormatWithoutLocale
Instantiating a Thread with default 'run()' methodInstantiatingAThreadWithDefaultRunMethod
Instantiating object to get Class objectInstantiatingObjectToGetClassObject
Instantiation of utility classInstantiationOfUtilityClass
Integer division in floating point contextIntegerDivisionInFloatingPointContext
Integer multiplication or shift implicitly cast to longIntegerMultiplicationImplicitCastToLong
Interface naming conventionInterfaceNamingConvention
Interface which has no concrete subclassInterfaceNeverImplemented
Interface which has only one direct inheritorInterfaceWithOnlyOneDirectInheritor
JDBC resource opened but not safely closedJDBCResourceOpenedButNotSafelyClosed
JNDI resource opened but not safely closedJNDIResourceOpenedButNotSafelyClosed
JUnit TestCase in product sourceJUnitTestCaseInProductSource
JUnit TestCase with non-trivial constructorsJUnitTestCaseWithNonTrivialConstructors
JUnit abstract test class naming conventionJUnitAbstractTestClassNamingConvention
JUnit test case with no testsJUnitTestCaseWithNoTests
JUnit test class naming conventionJUnitTestClassNamingConvention
JUnit test method in product sourceJUnitTestMethodInProductSource
JUnit test method without any assertionsJUnitTestMethodWithNoAssertions
Labeled statementLabeledStatement
Large array allocation with no OutOfMemoryError checkCheckForOutOfMemoryOnLargeArrayAllocation
Limited-scope inner classLimitedScopeInnerClass
Local variable hides member variableLocalVariableHidesMemberVariable
Local variable naming conventionLocalVariableNamingConvention
Local variable of concrete classLocalVariableOfConcreteClass
Local variable used and declared in different 'switch' branchesLocalVariableUsedAndDeclaredInDifferentSwitchBranches
Lock acquired but not safely unlockedLockAcquiredButNotSafelyReleased
Long literal ending with 'l' instead of 'L'LongLiteralEndingWithLowercaseL
Loop statement that does not loopLoopStatementThatDoesntLoop
Loop variable not updated inside loopLoopConditionNotUpdatedInsideLoop
Loop with implicit termination conditionLoopWithImplicitTerminationCondition
Malformed @Before or @After methodBeforeOrAfterWithIncorrectSignature
Malformed @BeforeClass or @AfterClass methodBeforeOrAfterWithIncorrectSignature
Malformed XPath expressionMalformedXPath
Malformed format stringMalformedFormatString
Malformed regular expressionMalformedRegex
Manual array copyManualArrayCopy
Manual array to collection copyManualArrayToCollectionCopy
Map or Set may contain java.net.URL objectsCollectionContainsUrl
Map replaceable by EnumMapMapReplaceableByEnumMap
Marker interfaceMarkerInterface
Message missing on JUnit assertionMessageMissingOnJUnitAssertion
Method call in loop conditionMethodCallInLoopCondition
Method call violates Law of DemeterLawOfDemeter
Method is identical to its super methodRedundantMethodOverride
Method may be 'static'MethodMayBeStatic
Method name same as class nameMethodNameSameAsClassName
Method name same as parent class nameMethodNameSameAsParentName
Method names differing only by caseMethodNamesDifferingOnlyByCase
Method overloads method of superclassMethodOverloadsMethodOfSuperclass
Method overrides package local method of superclass located in other packageMethodOverridesPrivateMethodOfSuperclass
Method overrides private method of superclassMethodOverridesPrivateMethodOfSuperclass
Method overrides static method of superclassMethodOverridesStaticMethodOfSuperclass
Method parameter naming conventionMethodParameterNamingConvention
Method parameter of concrete classMethodParameterOfConcreteClass
Method return of concrete classMethodReturnOfConcreteClass
Method with more than three negationsMethodWithMoreThanThreeNegations
Method with multiple loopsMethodWithMultipleLoops
Method with multiple return points.MethodWithMultipleReturnPoints
Method with synchronized block could be synchronized methodMethodMayBeSynchronized
Method with too many exceptions declaredMethodWithTooExceptionsDeclared
Method with too many parametersMethodWithTooManyParameters
Mismatched query and update of collectionMismatchedQueryAndUpdateOfCollection
Mismatched read and write of arrayMismatchedReadAndWriteOfArray
Misordered 'assertEquals()' parametersMisorderedAssertEqualsParameters
Missing @Deprecated annotationMissingDeprecatedAnnotation
Missing @Override annotationoverride
Missorted modifersMissortedModifiers
Multiple top level classes in single fileMultipleTopLevelClassesInFile
Multiple variables in one declarationMultipleVariablesInDeclaration
Multiply or divide by power of twoMultiplyOrDivideByPowerOfTwo
Native methodNativeMethod
Nested 'switch' statementNestedSwitchStatement
Nested 'synchronized' statementNestedSynchronizedStatement
Nested 'try' statementNestedTryStatement
Nested assignmentNestedAssignment
Nested conditional expressionNestedConditionalExpression
Nested method callNestedMethodCall
No-op method in abstract classNoopMethodInAbstractClass
Non-boolean method name must not start with question wordNonBooleanMethodNameMayNotStartWithQuestion
Non-constant String should be StringBufferNonConstantStringShouldBeStringBuffer
Non-constant field with upper-case nameNonConstantFieldWithUpperCaseName
Non-constant loggerNonConstantLogger
Non-exception class name ends with 'Exception'NonExceptionNameEndsWithException
Non-final 'clone()' in secure contextNonFinalClone
Non-final field of exception classNonFinalFieldOfException
Non-final field referenced in 'compareTo()'CompareToUsesNonFinalVariable
Non-final field referenced in 'equals()'NonFinalFieldReferenceInEquals
Non-final field referenced in 'hashCode()'NonFinalFieldReferencedInHashCode
Non-final static variable is used during class initializationNonFinalStaticVariableUsedInClassInitialization
Non-private field accessed in synchronized contextNonPrivateFieldAccessedInSynchronizedContext
Non-reproducible call to java.lang.MathNonReproducibleMathCall
Non-serializable class with 'readObject()' or 'writeObject()'NonSerializableClassWithSerializationMethods
Non-serializable class with 'serialVersionUID'NonSerializableClassWithSerialVersionUID
Non-serializable field in a Serializable classNonSerializableFieldInSerializableClass
Non-serializable object bound to HttpSessionNonSerializableObjectBoundToHttpSession
Non-serializable object passed to ObjectOutputStreamNonSerializableObjectPassedToObjectStream
Non-short-circuit boolean expressionNonShortCircuitBooleanExpression
Non-static initializerNonStaticInitializer
Non-static inner class in secure contextNonStaticInnerClassInSecureContext
Non-synchronized method overrides synchronized methodNonSynchronizedMethodOverridesSynchronizedMethod
Number comparison using '==', instead of 'equals()'NumberEquality
Number constructor call with primitive argumentCachedNumberConstructorCall
Numeric cast that loses precisionNumericCastThatLosesPrecision
Object allocation in loopObjectAllocationInLoop
Object comparison using ==, instead of 'equals()'ObjectEquality
Object.equals(null)ObjectEqualsNull
Octal and decimal integers in same arrayOctalAndDecimalIntegersInSameArray
Octal integerOctalInteger
Overloaded methods with same number of parametersOverloadedMethodsWithSameNumberOfParameters
Overloaded variable argument methodOverloadedVarargsMethod
Overly broad 'catch' blockOverlyBroadCatchBlock
Overly complex anonymous inner classOverlyComplexAnonymousInnerClass
Overly complex arithmetic expressionOverlyComplexArithmeticExpression
Overly complex boolean expressionOverlyComplexBooleanExpression
Overly complex classOverlyComplexClass
Overly complex methodOverlyComplexMethod
Overly coupled classOverlyCoupledClass
Overly coupled methodOverlyCoupledMethod
Overly large initializer for array of primitive typeOverlyLargePrimitiveArrayInitializer
Overly long methodOverlyLongMethod
Overly nested methodOverlyNestedMethod
Overly-strong type castOverlyStrongTypeCast
Overridable method call during object constructionOverridableMethodCallDuringObjectConstruction
Overridden method call during object constructionOverriddenMethodCallDuringObjectConstruction
Package-visible fieldPackageVisibleField
Package-visible inner classPackageVisibleInnerClass
Parameter hides member variableParameterHidesMemberVariable
Parameter name differs from parameter in overridden methodParameterNameDiffersFromOverriddenParameter
Pointless 'indexOf()' comparisonPointlessIndexOfComparison
Pointless arithmetic expressionPointlessArithmeticExpression
Pointless bitwise expressionPointlessBitwiseExpression
Pointless boolean expressionPointlessBooleanExpression
Private member access between outer and inner classesPrivateMemberAccessBetweenOuterAndInnerClass
Private method only used from inner classMethodOnlyUsedFromInnerClass
Prohibited exception caughtProhibitedExceptionCaught
Prohibited exception declaredProhibitedExceptionDeclared
Prohibited exception thrownProhibitedExceptionThrown
Protected fieldProtectedField
Protected inner classProtectedInnerClass
Public fieldPublicField
Public inner classPublicInnerClass
Public method not exposed in interfacePublicMethodNotExposedInInterface
Public method without loggingPublicMethodWithoutLogging
Public static array fieldPublicStaticArrayField
Public static collection fieldPublicStaticCollectionField
Questionable nameQuestionableName
Raw use of parameterized classRawUseOfParameterizedType
RecordStore opened but not safely closedRecordStoreOpenedButNotSafelyClosed
Redundant '.substring(0)'SubstringZero
Redundant 'String.toString()'RedundantStringToString
Redundant 'if' statementRedundantIfStatement
Redundant String constructor callRedundantStringConstructorCall
Redundant conditional expressionRedundantConditionalExpression
Redundant field initializationRedundantFieldInitialization
Redundant importRedundantImport
Redundant interface declarationRedundantInterfaceDeclaration
Redundant local variableUnnecessaryLocalVariable
Redundant no-arg constructorRedundantNoArgConstructor
Reflective access to a source-only annotationReflectionForUnavailableAnnotation
Refused bequestRefusedBequest
Result of method call ignoredResultOfMethodCallIgnored
Result of object allocation ignoredResultOfObjectAllocationIgnored
Return of 'null'ReturnOfNull
Return of 'this'ReturnOfThis
Return of Collection or array fieldReturnOfCollectionOrArrayField
Return of Date or Calendar fieldReturnOfDateField
Reuse of local variableReuseOfLocalVariable
Scope of variable is too broadTooBroadScope
Serializable class in secure contextSerializableClassInSecureContext
Serializable class with unconstructable ancestorSerializableClassWithUnconstructableAncestor
Serializable class without 'readObject()' and 'writeObject()'SerializableHasSerializationMethods
Serializable class without 'serialVersionUID'serial
Serializable non-static inner class with non-Serializable outer classSerializableInnerClassWithNonSerializableOuterClass
Serializable non-static inner class without 'serialVersionUID'SerializableNonStaticInnerClassWithoutSerialVersionUID
Set replaceable by EnumSetSetReplaceableByEnumSet
Shift operation by inappropriate constantShiftOutOfRange
Simplifiable JUnit assertionSimplifiableJUnitAssertion
Single character 'startsWith()' or 'endsWith()'SingleCharacterStartsWith
Single character string concatenationSingleCharacterStringConcatenation
Single character string parameter in 'String.indexOf()' callSingleCharacterStringConcatenation
Single class importSingleClassImport
SingletonSingleton
Socket opened but not safely closedSocketOpenedButNotSafelyClosed
Standard variable namesStandardVariableNames
Statement with empty bodyStatementWithEmptyBody
Static collectionStaticCollection
Static field referenced via subclassStaticFieldReferencedViaSubclass
Static importStaticImport
Static inheritanceStaticInheritance
Static method naming conventionStaticMethodNamingConvention
Static method only used from one other classStaticMethodOnlyUsedInOneClass
Static method referenced via subclassStaticMethodReferencedViaSubclass
Static variable may not be initializedStaticVariableMayNotBeInitialized
Static variable naming conventionStaticVariableNamingConvention
Static variable of concrete classStaticVariableOfConcreteClass
Static variable used before initializationStaticVariableUsedBeforeInitialization
String comparison using '==', instead of 'equals()'StringEquality
String concatenationStringConcatenation
String concatenation in loopStringContatenationInLoop
String concatenation inside 'StringBuffer.append()'StringConcatenationInsideStringBufferAppend
StringBuffer constructor call with 'char' argumentNewStringBufferWithCharArgument
StringBuffer fieldStringBufferField
StringBuffer or StringBuilder without initial capacityStringBufferWithoutInitialCapacity
Subtraction in compareTo()SubtractionInCompareTo
Suspicious 'Collections.toArray()' callSuspiciousToArrayCall
Suspicious 'System.arraycopy()' callSuspiciousSystemArraycopy
Suspicious indentation after control statement without bracesSuspiciousIndentAfterControlStatement
Suspicious test for oddnessBadOddness
Synchronization on 'this'SynchronizeOnThis
Synchronization on a Lock objectSynchroniziationOnLockObject
Synchronization on a non-final fieldSynchronizeOnNonFinalField
Synchronization on an object initialized with a literalSynchronizedOnLiteralObject
TODO commentTodoComment
Tail recursionTailRecursion
Test method with incorrect signatureTestMethodWithIncorrectSignature
Text label in 'switch' statementTextLabelInSwitchStatement
Throwable instance not thrownThrowableInstanceNeverThrown
Transient field in non-serializable classTransientFieldInNonSerializableClass
Transient field is not initialized on deserializationTransientFieldNotInitialized
Type may be weakenedTypeMayBeWeakened
Type parameter explicitly extends 'java.lang.Object'TypeParameterExplicitlyExtendsObject
Type parameter extends final classTypeParameterExtendsFinalClass
Type parameter hides visible typeTypeParameterHidesVisibleType
Type parameter naming conventionTypeParameterNamingConvention
Unary plusUnaryPlus
Unchecked exception classUncheckedExceptionClass
Unconditional 'wait()' callUnconditionalWait
Unconstructable JUnit TestCaseUnconstructableJUnitTestCase
Unnecessarily qualified static usageUnnecessarilyQualifiedStaticUsage
Unnecessary 'continue' statementUnnecessaryContinue
Unnecessary 'default' for enum switch statementUnnecessaryDefault
Unnecessary 'final' for local variableUnnecessaryFinalOnLocalVariable
Unnecessary 'final' for method parameterUnnecessaryFinalForMethodParameter
Unnecessary 'return' statementUnnecessaryReturnStatement
Unnecessary 'this' qualifierUnnecessaryThis
Unnecessary boxingUnnecessaryBoxing
Unnecessary call to 'super()'UnnecessaryCallToSuper
Unnecessary code blockUnnecessaryCodeBlock
Unnecessary enum modifierUnnecessaryEnumModifier
Unnecessary fully qualified nameUnnecessaryFullyQualifiedName
Unnecessary interface modifierUnnecessaryInterfaceModifier
Unnecessary label on 'break' statementUnnecessaryLabelOnBreakStatement
Unnecessary label on 'continue' statementUnnecessaryLabelOnContinueStatement
Unnecessary parenthesesUnnecessaryParentheses
Unnecessary qualifier for 'this'UnnecessaryQualifierForThis
Unnecessary semicolonUnnecessarySemicolon
Unnecessary temporary object in conversion from StringUnnecessaryTemporaryOnConversionFromString
Unnecessary temporary object in conversion to StringUnnecessaryTemporaryOnConversionToString
Unnecessary unary minusUnnecessaryUnaryMinus
Unnecessary unboxingUnnecessaryUnboxing
Unpredictable BigDecimal constructor callUnpredictableBigDecimalConstructorCall
Unqualified instance field accessUnqualifiedFieldAccess
Unqualified static usageUnqualifiedStaticUsage
Unsafe lazy initialization of static fieldNonThreadSafeLazyInitialization
Unused 'catch' parameterUnusedCatchParameter
Unused importUnusedImport
Unused labelUnusedLabel
Use of '$' in identifierDollarSignInName
Use of 'assert' as identifierAssertAsIdentifier
Use of 'enum' as identifierEnumAsIdentifier
Use of AWT peer classUseOfAWTPeerClass
Use of DriverManager to get JDBC connectionCallToDriverManagerGetConnection
Use of Properties object as a HashtableUseOfPropertiesAsHashtable
Use of StringTokenizerUseOfStringTokenizer
Use of System.out or System.errUseOfSystemOutOrSystemErr
Use of archaic system property accessorsUseOfArchaicSystemPropertyAccessors
Use of concrete JDBC driver classUseOfJDBCDriverClass
Use of index 0 in JDBC ResultSetUseOfIndexZeroInJDBCResultSet
Use of java.lang.ProcessBuilder classUseOfProcessBuilder
Use of java.lang.reflectJavaLangReflect
Use of obsolete collection typeUseOfObsoleteCollectionType
Use of sun.* classesUseOfSunClasses
Using 'Random.nextDouble()' to get random integerUsingRandomNextDoubleForRandomInteger
Utility classUtilityClass
Utility class with public constructorUtilityClassWithPublicConstructor
Utility class without private constructorUtilityClassWithoutPrivateConstructor
Value of ++ or -- usedValueOfIncrementOrDecrementUsed
Variable argument methodVariableArgumentMethod
Variables of different types in one declarationVariablesOfDifferentTypesInDeclaration
Volatile array fieldVolatileArrayField
Volatile long or double fieldVolatileLongOrDoubleField
While loop spins on fieldWhileLoopSpinsOnField
Zero-length array allocationZeroLengthArrayAllocation
expression.equals("literal") rather than "literal".equals(expression)LiteralAsArgToStringEquals
java.lang importJavaLangImport
java.lang.Error not rethrownErrorNotRethrown
java.lang.ThreadDeath not rethrownThreadDeathNotRethrown
Tags :


Re: List of SuppressWarnings arguments

Hmm, IDEA doesn't have an option on the GUI to control the compiler errors/warnings?

In Eclipse you can select the severity of some optional compiler problems - Ignore, Warning or Error.

I can only see this being useful if you want to turn the warning off for a particular block of code..?

Avatar: James Roper

Re: List of SuppressWarnings arguments

Yes, IDEA does allow you to configure what warnings display on a global and per project basis, but it's the per block warnings that I want to turn off, many of the warnings I think are very good to have, generally I want a test that doesn't have assertions to be flagged, because a test without assertions is a very bad thing.  Using SuppressWarnings means that I have explicitly acknowledged the problem and have deemed it acceptable.  Another example I found is on a generated equals() method, IDEA flagged it as overly complex, but clearly I don't care because it's generated, when I want to change it I will delete and regenerate it.  However, I don't want the overly complex inspection turned off altogether, because it's good at flagging methods that should be refactored for readablities sake.

Re: List of SuppressWarnings arguments

thank you, very useful as the place I work have some ridiculous inspection rules and i have to use suppresswarning alot.

Thanks!

Dude, this is an incredibly helpful table. Thanks for compiling it!


Add a comment Send a TrackBack