> For the complete documentation index, see [llms.txt](https://petozoltan.gitbook.io/simplecode/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://petozoltan.gitbook.io/simplecode/clean-code/clean-code-outline/special-cases.md).

# Special Cases

### Warnings

* Do not ignore compiler/IDE warnings
* Each warning is a potential/existing bug
* Do not suppress warnings - *Find the correct solution instead*
* Use the capabilities of your IDE - *Turn on most of the possible warnings*
* Do not add new code with warnings!
* Use code checkers - *CheckStyle, FindBugs, PMD, Sonar, etc.*

Example: Bad: Suppressed warnings

```java
// Many tricks for one unused parameter

// CHECKSTYLE:OFF
@SuppressWarnings("unused")
private void addDescription(Type type, Contract contract, String comment) { // NOSONAR
    contract.setDescription(createDescription(contract.getType(), comment));
}
// CHECKSTYLE:ON
```

Example: Good: Fixed problems

```java
private void addDescription(Contract contract, String comment) {
    contract.setDescription(createDescription(contract.getType(), comment));
}
```

### Logging

* Use correct logging levels
* Log stack trace only for unexpected program errors
* Create (concatenate) expensive message only if logged - *see SLF4J capabilities*

### Java

* Never use raw types - *always use generics correctly*
* Avoid using reflection
* Know you API - *use utility methods*
