TICS Coding Standard Viewer 
TIOBE Software Quality Framework
Print-friendly version
©TIOBE Software www.tiobe.com
 
TIOBE - Java Coding Standard
Search

Category: Basic

Synopsis:The Basic Ruleset contains a collection of good practices which everyone should follow.


Description:
The Basic Ruleset contains a collection of good practices which everyone should follow.

Coding Rules

NameCheckedSynopsis
Basic1 Checked automatically with code checker Avoid empty catch blocks
Basic2 Checked automatically with code checker Avoid empty 'if' statements
Basic3 Checked automatically with code checker Avoid empty 'while' statements
Basic4 Checked automatically with code checker Avoid empty try blocks
Basic5 Checked automatically with code checker Avoid empty finally blocks
Basic6 Checked automatically with code checker Avoid empty switch statements
Basic7 Checked automatically with code checker Avoid modifying an outer loop incrementer in an inner loop for update expression
Basic8 Checked automatically with code checker This for loop could be simplified to a while loop
Basic9 Checked automatically with code checker Avoid unnecessary temporaries when converting primitives to Strings
Basic10 Checked automatically with code checker Ensure you override both equals() and hashCode()
Basic11 Checked automatically with code checker Double checked locking is not thread safe in Java
Basic12 Checked automatically with code checker Avoid returning from a finally block
Basic13 Checked automatically with code checker Avoid empty synchronized blocks
Basic14 Checked automatically with code checker Avoid unnecessary return statements
Basic15 Checked automatically with code checker Empty static initializer was found
Basic16 Checked automatically with code checker Do not use 'if' statements that are always true or always false
Basic17 Checked automatically with code checker An empty statement (semicolon) not part of a loop
Basic18 Checked automatically with code checker Avoid instantiating Boolean objects; reference Boolean.TRUE or Boolean.FALSE
Basic19 Checked automatically with code checker Unnecessary modifier used
Basic20 Checked automatically with code checker These nested if statements could be combined
Basic21 Checked automatically with code checker Overriding method merely calls super
Basic22 Checked automatically with code checker This usage of the Collection.toArray() method will throw a ClassCastException
Basic23 Checked automatically with code checker Avoid creating BigDecimal with a decimal (float/double) literal. Use a String literal
Basic24 Checked automatically with code checker An operation on an Immutable object (BigDecimal or BigInteger) won't change the object itself
Basic25 Checked automatically with code checker The null check here is misplaced; if the variable is null there'll be a NullPointerException
Basic26 Checked automatically with code checker Invoke equals() on the object you've already ensured is not null
Basic27 Checked automatically with code checker Avoid using ThreadGroup; it is not thread safe
Basic28 Checked automatically with code checker Method call on object which may be null
Basic29 Checked automatically with code checker Don't create instances of already existing BigInteger and BigDecimal (ZERO, ONE, TEN)
Basic30 Checked automatically with code checker Do not start a literal by 0 unless it's an octal value
Basic31 Checked automatically with code checker Replace for loop by for each loop
Basic32 Checked automatically with code checker Use @Override annotation if applicable
Basic33 Checked automatically with code checker Merge identical catch branches
Basic34 Checked automatically with code checker Don't use unclear do/while loops
Basic100 Checked automatically with code checker Each variable should have an initializer.
Basic101 Checked automatically with code checker Use standard brace style.
Basic102 Checked automatically with code checker Avoid implicit allocation of objects
Basic103 Checked automatically with code checker Don't modify control variables within a for block