From a9e696e607bf44faa751b1592b43176bf15b2558 Mon Sep 17 00:00:00 2001 From: Tomasz Tylenda Date: Thu, 28 Nov 2024 16:11:56 +0100 Subject: [PATCH] Modify rule S115: explain that CONST_CASE applies to String, primitives, and boxed types. --- rules/S115/java/rule.adoc | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/rules/S115/java/rule.adoc b/rules/S115/java/rule.adoc index 5da90f44be5..3245d887303 100644 --- a/rules/S115/java/rule.adoc +++ b/rules/S115/java/rule.adoc @@ -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 myList = new ArrayList<>(); + +// call with side-effects +log.info("message") + +// mutating an object +myList.add(28); +---- + == Resources === External coding guidelines