sorald.processor.CollectionsEmptyConstantsProcessor.md Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of sorald Show documentation
Show all versions of sorald Show documentation
An automatic repair system for static code analysis warnings from Sonar Java.
The `EMPTY_...` fields from `Collections` return raw types, so they are replaced by the `empty...()` methods that return generic ones.
Example:
```diff
- List collection1 = Collections.EMPTY_LIST; // Noncompliant
- Map collection2 = Collections.EMPTY_MAP; // Noncompliant
- Set collection3 = Collections.EMPTY_SET; // Noncompliant
+ List collection1 = Collections.emptyList();
+ Map collection2 = Collections.emptyMap();
+ Set collection3 = Collections.emptySet();
```
© 2015 - 2025 Weber Informatics LLC | Privacy Policy