# 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*


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://petozoltan.gitbook.io/clearcode/clean-code/clean-code-outline/special-cases.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
