Skip to content

Commit

Permalink
Modify rule S115: explain that CONST_CASE applies to String, primitiv…
Browse files Browse the repository at this point in the history
…es, and boxed types.
  • Loading branch information
tomasz-tylenda-sonarsource committed Nov 28, 2024
1 parent fef1801 commit a9e696e
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions rules/S115/java/rule.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,23 @@ public enum MyEnum {
}
----

=== Exceptions

The rule applies to fields of primitive types (for example, ``float``), boxed primitives (``Float``), and Strings.
We do not apply it to other types, which can be mutated, or have methods with side effects.

[source,java]
----
public static final Logger log = getLogger(MyClass.class);
public static final List<Integer> myList = new ArrayList<>();
// call with side-effects
log.info("message")
// mutating an object
myList.add(28);
----

== Resources

=== External coding guidelines
Expand Down

0 comments on commit a9e696e

Please sign in to comment.