Skip to content

Latest commit

 

History

History
23 lines (16 loc) · 1004 Bytes

File metadata and controls

23 lines (16 loc) · 1004 Bytes

Clean Code rules for the JDK

Do not throw generic exceptions

Rule-ID: jdk.no-generic-exceptions

Do not throw generic exceptions like java.lang.Exception or java.lang.RuntimeException. Create your own exception types instead or use more concrete exceptions like IllegalArgumentException. This leads to more readable code and enables better exception handling.

Do not use JodaTime

Rule-ID: jdk.no-jodatime

Do not use JodaTime, instead use the Date API of Java 8.

Do not call BigDecimal constructor with double parameter

Rule-ID: jdk.bigdecimal-do-not-call-constructor-with-double-parameter

Do not use the double constructor for class BigDecimal. The results of this constructor can be somewhat unpredictable.

Instead, use kotlin-stdlib's extension function Double.toBigDecimal() or the String constructor.