BACK TO LIST

Java rules

The Codiga Code Analysis engine supports hundreds of rules for Java, checking that your code is safe and secure. Start using Codiga today to check your code and automate your code reviews to find issues in every pull request and merge with confidence.

AssignmentToNonFinalStatic

Error prone
Warning

Possible unsafe assignment to a non-final static field in a constructor.

Learn more

AvoidDecimalLiteralsInBigDecimalConstructor

Error prone
Warning

Avoid creating BigDecimal with a decimal (float/double) literal. Use a String literal

AvoidInstanceofChecksInCatchClause

Error prone
Warning

An instanceof check is being performed on the caught exception. Create a separate catch clause for this exception type.

AvoidUsingOctalValues

Error prone
Warning

Do not start a literal by 0 unless its an octal value

BadComparison

Error prone
Warning

Avoid equality comparisons with Double.NaN

CheckSkipResult

Error prone
Warning

Check the value returned by the skip() method of an InputStream to see if the requested number of bytes has been skipped.

ClassCastExceptionWithToArray

Error prone
Warning

This usage of the Collection.toArray() method will throw a ClassCastException.

CloseResource

Error prone
Warning

Ensure that resources like this PipedWriter object are closed after use

CompareObjectsWithEquals

Error prone
Warning

Use equals() to compare object references.

DontUseFloatTypeForLoopIndices

Error prone
Warning

Dont use floating point for loop indices. If you must use floating point

IdempotentOperations

Error prone
Warning

Avoid idempotent operations (like assigning a variable to itself).

JumbledIncrementer

Error prone
Warning

Avoid modifying an outer loop incrementer in an inner loop for update expression

MisplacedNullCheck

Error prone
Warning

The null check here is misplaced; if the variable is null there will be a NullPointerException

MissingBreakInSwitch

Error prone
Warning

A switch statement does not contain a break

MissingStaticMethodInNonInstantiatableClass

Error prone
Warning

Class cannot be instantiated and does not provide any static methods or fields

NonCaseLabelInSwitchStatement

Error prone
Warning

A non-case label was present in a switch statement

NonStaticInitializer

Error prone
Warning

Non-static initializers are confusing

OverrideBothEqualsAndHashcode

Error prone
Warning

Ensure you override both equals() and hashCode()

ReturnFromFinallyBlock

Error prone
Warning

Avoid returning from a finally block

SimpleDateFormatNeedsLocale

Error prone
Warning

When instantiating a SimpleDateFormat object

UnconditionalIfStatement

Error prone
Warning

Do not use if statements that are always true or always false

UseLocaleWithCaseConversions

Error prone
Warning

Use explicit locale when doing a String.toLowerCase()/toUpperCase() call

We use cookies to improve your site experience, including analytics cookies to understand how you use our product and design better experiences. Please read our Cookie Policy.