This is an automated email from the ASF dual-hosted git repository.
jamesbognar pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/juneau.git
The following commit(s) were added to refs/heads/master by this push:
new f3b64cbc03 SonarQube bug fixes
f3b64cbc03 is described below
commit f3b64cbc03884208d8460c75e2a947cf19fc05dd
Author: James Bognar <[email protected]>
AuthorDate: Wed Feb 18 08:07:44 2026 -0500
SonarQube bug fixes
---
TODO.md | 4 +-
.../apache/juneau/bean/openapi3/SchemaInfo.java | 5 +-
.../org/apache/juneau/bean/swagger/SchemaInfo.java | 5 +-
.../java/org/apache/juneau/junit/bct/Swappers.java | 8 +-
.../apache/juneau/commons/function/Consumer2.java | 4 +-
.../apache/juneau/commons/function/Consumer3.java | 4 +-
.../apache/juneau/commons/function/Consumer4.java | 4 +-
.../apache/juneau/commons/function/Consumer5.java | 4 +-
.../apache/juneau/commons/function/Function3.java | 4 +-
.../apache/juneau/commons/function/Function4.java | 4 +-
.../apache/juneau/commons/function/Function5.java | 4 +-
.../juneau/commons/function/OptionalSupplier.java | 4 +-
.../commons/function/ResettableSupplier.java | 5 +-
.../juneau/commons/function/ThrowingConsumer2.java | 4 +-
.../juneau/commons/function/ThrowingConsumer3.java | 4 +-
.../juneau/commons/function/ThrowingConsumer4.java | 4 +-
.../juneau/commons/function/ThrowingConsumer5.java | 4 +-
.../juneau/commons/function/ThrowingFunction2.java | 4 +-
.../juneau/commons/function/ThrowingFunction3.java | 4 +-
.../juneau/commons/function/ThrowingFunction4.java | 4 +-
.../juneau/commons/function/ThrowingFunction5.java | 4 +-
.../apache/juneau/commons/lang/StringFormat.java | 4 +-
.../apache/juneau/commons/logging/LogRecord.java | 13 ++-
.../apache/juneau/commons/reflect/ClassInfo.java | 8 +-
.../apache/juneau/commons/settings/Settings.java | 17 +++-
.../juneau/commons/settings/StringSetting.java | 4 +-
.../juneau/commons/utils/CollectionUtils.java | 108 +++++++++++++++------
.../org/apache/juneau/commons/utils/FileUtils.java | 4 +-
.../apache/juneau/commons/utils/StringUtils.java | 96 +++++++++++++-----
.../org/apache/juneau/commons/utils/Utils.java | 51 +++++++---
.../org/apache/juneau/config/store/FileStore.java | 17 +++-
.../main/java/org/apache/juneau/BeanFilter.java | 16 ++-
.../src/main/java/org/apache/juneau/BeanMeta.java | 20 +++-
.../main/java/org/apache/juneau/BeanSession.java | 12 ++-
.../java/org/apache/juneau/annotation/Schema.java | 4 +-
.../apache/juneau/annotation/SchemaAnnotation.java | 52 +++++++---
.../org/apache/juneau/collections/JsonList.java | 20 +++-
.../org/apache/juneau/collections/JsonMap.java | 12 ++-
.../java/org/apache/juneau/cp/BasicBeanStore.java | 12 ++-
.../apache/juneau/html/HtmlSerializerSession.java | 8 +-
.../org/apache/juneau/httppart/HttpPartSchema.java | 52 +++++++---
.../org/apache/juneau/json/JsonParserSession.java | 26 +++--
.../juneau/objecttools/NumberMatcherFactory.java | 8 +-
.../main/java/org/apache/juneau/parser/Parser.java | 8 +-
.../org/apache/juneau/parser/ParserReader.java | 9 +-
.../java/org/apache/juneau/parser/ParserSet.java | 4 +-
.../org/apache/juneau/serializer/Serializer.java | 8 +-
.../apache/juneau/serializer/SerializerSet.java | 4 +-
.../org/apache/juneau/svl/VarResolverSession.java | 8 +-
.../java/org/apache/juneau/swaps/TemporalSwap.java | 4 +-
.../org/apache/juneau/uon/UonParserSession.java | 16 ++-
.../urlencoding/UrlEncodingParserSession.java | 12 ++-
.../org/apache/juneau/xml/XmlParserSession.java | 4 +-
.../apache/juneau/xml/XmlSerializerSession.java | 4 +-
.../apache/juneau/microservice/Microservice.java | 17 +++-
.../microservice/jetty/JettyMicroservice.java | 12 ++-
.../apache/juneau/rest/client/ResponseHeader.java | 4 +-
.../org/apache/juneau/rest/client/RestClient.java | 50 +++++++---
.../org/apache/juneau/rest/client/RestRequest.java | 8 +-
.../apache/juneau/rest/client/RestResponse.java | 8 +-
.../assertion/FluentResponseBodyAssertion.java | 4 +-
.../rest/client/remote/RemoteOperationMeta.java | 4 +-
.../java/org/apache/juneau/rest/RestContext.java | 12 ++-
.../java/org/apache/juneau/rest/RestOpContext.java | 12 ++-
.../java/org/apache/juneau/rest/RestResponse.java | 16 ++-
.../juneau/rest/httppart/RequestHeaders.java | 5 +-
.../juneau/rest/httppart/RequestPathParams.java | 9 +-
.../juneau/rest/httppart/RequestQueryParams.java | 5 +-
.../org/apache/juneau/rest/logger/CallLogger.java | 4 +-
.../apache/juneau/rest/logger/CallLoggerRule.java | 4 +-
.../apache/juneau/rest/servlet/RestServlet.java | 4 +-
.../rest/swagger/BasicSwaggerProviderSession.java | 8 +-
72 files changed, 690 insertions(+), 232 deletions(-)
diff --git a/TODO.md b/TODO.md
index 8396ee155c..a4ab7489c7 100644
--- a/TODO.md
+++ b/TODO.md
@@ -3,4 +3,6 @@
- Find all places where we have system properties defined for juneau and
convert them to use the new Settings class.
- Document "juneau.enableVerboseExceptions" setting.
- Change field names that start with underscore so that they end with
underscore (e.g. "_enum"->"enum_")
-- Investigate navlinks URL generation issue: Either
"request:?Accept=text/json&plainText=true" should be supported, or
"request:/?Accept=text/json&plainText=true" should not append '/' to the
request URL. Currently, "request:/?Accept=..." generates URLs like
"http://localhost:5000/rest/db/request:?Accept=..." which is incorrect.
\ No newline at end of file
+- Investigate navlinks URL generation issue: Either
"request:?Accept=text/json&plainText=true" should be supported, or
"request:/?Accept=text/json&plainText=true" should not append '/' to the
request URL. Currently, "request:/?Accept=..." generates URLs like
"http://localhost:5000/rest/db/request:?Accept=..." which is incorrect.
+- Determine if it's possible to add a "short" field to @Schema for AI purposes.
+- Ensure Juneau support record types for serializing/parsing.
\ No newline at end of file
diff --git
a/juneau-bean/juneau-bean-openapi-v3/src/main/java/org/apache/juneau/bean/openapi3/SchemaInfo.java
b/juneau-bean/juneau-bean-openapi-v3/src/main/java/org/apache/juneau/bean/openapi3/SchemaInfo.java
index 132f36aac7..3eef0daa24 100644
---
a/juneau-bean/juneau-bean-openapi-v3/src/main/java/org/apache/juneau/bean/openapi3/SchemaInfo.java
+++
b/juneau-bean/juneau-bean-openapi-v3/src/main/java/org/apache/juneau/bean/openapi3/SchemaInfo.java
@@ -96,7 +96,10 @@ import org.apache.juneau.commons.collections.*;
* <li class='link'><a class="doclink"
href="https://juneau.apache.org/docs/topics/JuneauBeanOpenApi3">juneau-bean-openapi-v3</a>
* </ul>
*/
-@SuppressWarnings({"java:S115", "java:S116"})
+@SuppressWarnings({
+ "java:S115", // Constants use UPPER_snakeCase convention
+ "java:S116" // Field names intentionally match JSON property names
+})
public class SchemaInfo extends OpenApiElement {
// Argument name constants for assertArgNotNull
diff --git
a/juneau-bean/juneau-bean-swagger-v2/src/main/java/org/apache/juneau/bean/swagger/SchemaInfo.java
b/juneau-bean/juneau-bean-swagger-v2/src/main/java/org/apache/juneau/bean/swagger/SchemaInfo.java
index 5442edce6e..a50b7f9e97 100644
---
a/juneau-bean/juneau-bean-swagger-v2/src/main/java/org/apache/juneau/bean/swagger/SchemaInfo.java
+++
b/juneau-bean/juneau-bean-swagger-v2/src/main/java/org/apache/juneau/bean/swagger/SchemaInfo.java
@@ -96,7 +96,10 @@ import org.apache.juneau.commons.collections.*;
* <li class='link'><a class="doclink"
href="https://juneau.apache.org/docs/topics/JuneauBeanSwagger2">juneau-bean-swagger-v2</a>
* </ul>
*/
-@SuppressWarnings({"java:S115", "java:S116"})
+@SuppressWarnings({
+ "java:S115", // Constants use UPPER_snakeCase convention
+ "java:S116" // Field names intentionally match JSON property names
+})
public class SchemaInfo extends SwaggerElement {
// Argument name constants for assertArgNotNull
diff --git
a/juneau-core/juneau-bct/src/main/java/org/apache/juneau/junit/bct/Swappers.java
b/juneau-core/juneau-bct/src/main/java/org/apache/juneau/junit/bct/Swappers.java
index a593837d0b..1ef9b3e465 100644
---
a/juneau-core/juneau-bct/src/main/java/org/apache/juneau/junit/bct/Swappers.java
+++
b/juneau-core/juneau-bct/src/main/java/org/apache/juneau/junit/bct/Swappers.java
@@ -66,7 +66,9 @@ import java.util.function.*;
* @see BasicBeanConverter.Builder#addSwapper(Class, Swapper)
* @see BasicBeanConverter.Builder#defaultSettings()
*/
-@SuppressWarnings("rawtypes")
+@SuppressWarnings({
+ "rawtypes" // Raw types necessary for generic type handling
+})
public class Swappers {
/**
@@ -170,7 +172,9 @@ public class Swappers {
* @return A {@link Swapper} for {@link Optional} objects
* @see Optional
*/
- @SuppressWarnings("unchecked")
+ @SuppressWarnings({
+ "unchecked" // Type erasure requires unchecked cast
+ })
public static Swapper<Optional> optionalSwapper() {
return (bc, optional) -> optional.orElse(null);
}
diff --git
a/juneau-core/juneau-commons/src/main/java/org/apache/juneau/commons/function/Consumer2.java
b/juneau-core/juneau-commons/src/main/java/org/apache/juneau/commons/function/Consumer2.java
index 263d2beb92..f77657f2a2 100644
---
a/juneau-core/juneau-commons/src/main/java/org/apache/juneau/commons/function/Consumer2.java
+++
b/juneau-core/juneau-commons/src/main/java/org/apache/juneau/commons/function/Consumer2.java
@@ -71,7 +71,9 @@ import static
org.apache.juneau.commons.utils.AssertionUtils.*;
* @param <B> The type of the second argument to the operation.
*/
@FunctionalInterface
-@SuppressWarnings("java:S115")
+@SuppressWarnings({
+ "java:S115" // Constants use UPPER_snakeCase convention
+})
public interface Consumer2<A,B> {
/** Argument name constant for assertArgNotNull. */
diff --git
a/juneau-core/juneau-commons/src/main/java/org/apache/juneau/commons/function/Consumer3.java
b/juneau-core/juneau-commons/src/main/java/org/apache/juneau/commons/function/Consumer3.java
index 1a9cd955ab..1dfc7d4bf9 100644
---
a/juneau-core/juneau-commons/src/main/java/org/apache/juneau/commons/function/Consumer3.java
+++
b/juneau-core/juneau-commons/src/main/java/org/apache/juneau/commons/function/Consumer3.java
@@ -69,7 +69,9 @@ import static
org.apache.juneau.commons.utils.AssertionUtils.*;
* @param <C> The type of the third argument to the operation.
*/
@FunctionalInterface
-@SuppressWarnings("java:S115")
+@SuppressWarnings({
+ "java:S115" // Constants use UPPER_snakeCase convention
+})
public interface Consumer3<A,B,C> {
/** Argument name constant for assertArgNotNull. */
diff --git
a/juneau-core/juneau-commons/src/main/java/org/apache/juneau/commons/function/Consumer4.java
b/juneau-core/juneau-commons/src/main/java/org/apache/juneau/commons/function/Consumer4.java
index f731f10775..3b370b5eae 100644
---
a/juneau-core/juneau-commons/src/main/java/org/apache/juneau/commons/function/Consumer4.java
+++
b/juneau-core/juneau-commons/src/main/java/org/apache/juneau/commons/function/Consumer4.java
@@ -70,7 +70,9 @@ import static
org.apache.juneau.commons.utils.AssertionUtils.*;
* @param <D> The type of the fourth argument to the operation.
*/
@FunctionalInterface
-@SuppressWarnings("java:S115")
+@SuppressWarnings({
+ "java:S115" // Constants use UPPER_snakeCase convention
+})
public interface Consumer4<A,B,C,D> {
/** Argument name constant for assertArgNotNull. */
diff --git
a/juneau-core/juneau-commons/src/main/java/org/apache/juneau/commons/function/Consumer5.java
b/juneau-core/juneau-commons/src/main/java/org/apache/juneau/commons/function/Consumer5.java
index 0f2cf0d784..e7322ce2c8 100644
---
a/juneau-core/juneau-commons/src/main/java/org/apache/juneau/commons/function/Consumer5.java
+++
b/juneau-core/juneau-commons/src/main/java/org/apache/juneau/commons/function/Consumer5.java
@@ -71,7 +71,9 @@ import static
org.apache.juneau.commons.utils.AssertionUtils.*;
* @param <E> The type of the fifth argument to the operation.
*/
@FunctionalInterface
-@SuppressWarnings("java:S115")
+@SuppressWarnings({
+ "java:S115" // Constants use UPPER_snakeCase convention
+})
public interface Consumer5<A,B,C,D,E> {
/** Argument name constant for assertArgNotNull. */
diff --git
a/juneau-core/juneau-commons/src/main/java/org/apache/juneau/commons/function/Function3.java
b/juneau-core/juneau-commons/src/main/java/org/apache/juneau/commons/function/Function3.java
index 981dcffb8b..a6c5f3b135 100644
---
a/juneau-core/juneau-commons/src/main/java/org/apache/juneau/commons/function/Function3.java
+++
b/juneau-core/juneau-commons/src/main/java/org/apache/juneau/commons/function/Function3.java
@@ -69,7 +69,9 @@ import java.util.function.*;
* @param <R> The type of the result of the function.
*/
@FunctionalInterface
-@SuppressWarnings("java:S115")
+@SuppressWarnings({
+ "java:S115" // Constants use UPPER_snakeCase convention
+})
public interface Function3<A,B,C,R> {
/** Argument name constant for assertArgNotNull. */
diff --git
a/juneau-core/juneau-commons/src/main/java/org/apache/juneau/commons/function/Function4.java
b/juneau-core/juneau-commons/src/main/java/org/apache/juneau/commons/function/Function4.java
index 38d18972b2..ed57e011d1 100644
---
a/juneau-core/juneau-commons/src/main/java/org/apache/juneau/commons/function/Function4.java
+++
b/juneau-core/juneau-commons/src/main/java/org/apache/juneau/commons/function/Function4.java
@@ -70,7 +70,9 @@ import java.util.function.*;
* @param <R> The type of the result of the function.
*/
@FunctionalInterface
-@SuppressWarnings("java:S115")
+@SuppressWarnings({
+ "java:S115" // Constants use UPPER_snakeCase convention
+})
public interface Function4<A,B,C,D,R> {
/** Argument name constant for assertArgNotNull. */
diff --git
a/juneau-core/juneau-commons/src/main/java/org/apache/juneau/commons/function/Function5.java
b/juneau-core/juneau-commons/src/main/java/org/apache/juneau/commons/function/Function5.java
index 46b733a2da..072bb0bbfd 100644
---
a/juneau-core/juneau-commons/src/main/java/org/apache/juneau/commons/function/Function5.java
+++
b/juneau-core/juneau-commons/src/main/java/org/apache/juneau/commons/function/Function5.java
@@ -71,7 +71,9 @@ import java.util.function.*;
* @param <R> The type of the result of the function.
*/
@FunctionalInterface
-@SuppressWarnings("java:S115")
+@SuppressWarnings({
+ "java:S115" // Constants use UPPER_snakeCase convention
+})
public interface Function5<A,B,C,D,E,R> {
/** Argument name constant for assertArgNotNull. */
diff --git
a/juneau-core/juneau-commons/src/main/java/org/apache/juneau/commons/function/OptionalSupplier.java
b/juneau-core/juneau-commons/src/main/java/org/apache/juneau/commons/function/OptionalSupplier.java
index 9eb1f55ca2..f504aa07bf 100644
---
a/juneau-core/juneau-commons/src/main/java/org/apache/juneau/commons/function/OptionalSupplier.java
+++
b/juneau-core/juneau-commons/src/main/java/org/apache/juneau/commons/function/OptionalSupplier.java
@@ -63,7 +63,9 @@ import java.util.function.*;
* @param <T> The type of value supplied by this supplier.
*/
@FunctionalInterface
-@SuppressWarnings("java:S115")
+@SuppressWarnings({
+ "java:S115" // Constants use UPPER_snakeCase convention
+})
public interface OptionalSupplier<T> extends Supplier<T> {
/** Argument name constant for assertArgNotNull. */
diff --git
a/juneau-core/juneau-commons/src/main/java/org/apache/juneau/commons/function/ResettableSupplier.java
b/juneau-core/juneau-commons/src/main/java/org/apache/juneau/commons/function/ResettableSupplier.java
index f1591873c2..a9231bda83 100644
---
a/juneau-core/juneau-commons/src/main/java/org/apache/juneau/commons/function/ResettableSupplier.java
+++
b/juneau-core/juneau-commons/src/main/java/org/apache/juneau/commons/function/ResettableSupplier.java
@@ -75,7 +75,10 @@ import java.util.function.*;
*
* @param <T> The type of value supplied.
*/
-@SuppressWarnings("java:S115")
+@SuppressWarnings({
+ "java:S115" // Constants use UPPER_snakeCase convention
+})
+// TODO - Rename to Memoizer
public class ResettableSupplier<T> implements OptionalSupplier<T> {
// Argument name constants for assertArgNotNull
diff --git
a/juneau-core/juneau-commons/src/main/java/org/apache/juneau/commons/function/ThrowingConsumer2.java
b/juneau-core/juneau-commons/src/main/java/org/apache/juneau/commons/function/ThrowingConsumer2.java
index 9962632729..7591dd72f1 100644
---
a/juneau-core/juneau-commons/src/main/java/org/apache/juneau/commons/function/ThrowingConsumer2.java
+++
b/juneau-core/juneau-commons/src/main/java/org/apache/juneau/commons/function/ThrowingConsumer2.java
@@ -82,7 +82,9 @@ import static
org.apache.juneau.commons.utils.ThrowableUtils.*;
* @param <B> The type of the second argument to the operation.
*/
@FunctionalInterface
-@SuppressWarnings("java:S115")
+@SuppressWarnings({
+ "java:S115" // Constants use UPPER_snakeCase convention
+})
public interface ThrowingConsumer2<A,B> extends Consumer2<A,B> {
/** Argument name constant for assertArgNotNull. */
diff --git
a/juneau-core/juneau-commons/src/main/java/org/apache/juneau/commons/function/ThrowingConsumer3.java
b/juneau-core/juneau-commons/src/main/java/org/apache/juneau/commons/function/ThrowingConsumer3.java
index ef5d6df4c1..1f56e2b041 100644
---
a/juneau-core/juneau-commons/src/main/java/org/apache/juneau/commons/function/ThrowingConsumer3.java
+++
b/juneau-core/juneau-commons/src/main/java/org/apache/juneau/commons/function/ThrowingConsumer3.java
@@ -87,7 +87,9 @@ import static
org.apache.juneau.commons.utils.ThrowableUtils.*;
* @param <C> The type of the third argument to the operation.
*/
@FunctionalInterface
-@SuppressWarnings("java:S115")
+@SuppressWarnings({
+ "java:S115" // Constants use UPPER_snakeCase convention
+})
public interface ThrowingConsumer3<A,B,C> extends Consumer3<A,B,C> {
/** Argument name constant for assertArgNotNull. */
diff --git
a/juneau-core/juneau-commons/src/main/java/org/apache/juneau/commons/function/ThrowingConsumer4.java
b/juneau-core/juneau-commons/src/main/java/org/apache/juneau/commons/function/ThrowingConsumer4.java
index 1db7bcb235..4a0dbf4120 100644
---
a/juneau-core/juneau-commons/src/main/java/org/apache/juneau/commons/function/ThrowingConsumer4.java
+++
b/juneau-core/juneau-commons/src/main/java/org/apache/juneau/commons/function/ThrowingConsumer4.java
@@ -88,7 +88,9 @@ import static
org.apache.juneau.commons.utils.ThrowableUtils.*;
* @param <D> The type of the fourth argument to the operation.
*/
@FunctionalInterface
-@SuppressWarnings("java:S115")
+@SuppressWarnings({
+ "java:S115" // Constants use UPPER_snakeCase convention
+})
public interface ThrowingConsumer4<A,B,C,D> extends Consumer4<A,B,C,D> {
/** Argument name constant for assertArgNotNull. */
diff --git
a/juneau-core/juneau-commons/src/main/java/org/apache/juneau/commons/function/ThrowingConsumer5.java
b/juneau-core/juneau-commons/src/main/java/org/apache/juneau/commons/function/ThrowingConsumer5.java
index 5e8b47309f..16d3bc8ca0 100644
---
a/juneau-core/juneau-commons/src/main/java/org/apache/juneau/commons/function/ThrowingConsumer5.java
+++
b/juneau-core/juneau-commons/src/main/java/org/apache/juneau/commons/function/ThrowingConsumer5.java
@@ -89,7 +89,9 @@ import static
org.apache.juneau.commons.utils.ThrowableUtils.*;
* @param <E> The type of the fifth argument to the operation.
*/
@FunctionalInterface
-@SuppressWarnings("java:S115")
+@SuppressWarnings({
+ "java:S115" // Constants use UPPER_snakeCase convention
+})
public interface ThrowingConsumer5<A,B,C,D,E> extends Consumer5<A,B,C,D,E> {
/** Argument name constant for assertArgNotNull. */
diff --git
a/juneau-core/juneau-commons/src/main/java/org/apache/juneau/commons/function/ThrowingFunction2.java
b/juneau-core/juneau-commons/src/main/java/org/apache/juneau/commons/function/ThrowingFunction2.java
index 6258de41d0..95e3c542cc 100644
---
a/juneau-core/juneau-commons/src/main/java/org/apache/juneau/commons/function/ThrowingFunction2.java
+++
b/juneau-core/juneau-commons/src/main/java/org/apache/juneau/commons/function/ThrowingFunction2.java
@@ -89,7 +89,9 @@ import java.util.function.*;
* @param <R> The type of the result of the function.
*/
@FunctionalInterface
-@SuppressWarnings("java:S115")
+@SuppressWarnings({
+ "java:S115" // Constants use UPPER_snakeCase convention
+})
public interface ThrowingFunction2<A,B,R> extends Function2<A,B,R> {
/** Argument name constant for assertArgNotNull. */
diff --git
a/juneau-core/juneau-commons/src/main/java/org/apache/juneau/commons/function/ThrowingFunction3.java
b/juneau-core/juneau-commons/src/main/java/org/apache/juneau/commons/function/ThrowingFunction3.java
index 2a9d360544..e807592225 100644
---
a/juneau-core/juneau-commons/src/main/java/org/apache/juneau/commons/function/ThrowingFunction3.java
+++
b/juneau-core/juneau-commons/src/main/java/org/apache/juneau/commons/function/ThrowingFunction3.java
@@ -90,7 +90,9 @@ import java.util.function.*;
* @param <R> The type of the result of the function.
*/
@FunctionalInterface
-@SuppressWarnings("java:S115")
+@SuppressWarnings({
+ "java:S115" // Constants use UPPER_snakeCase convention
+})
public interface ThrowingFunction3<A,B,C,R> extends Function3<A,B,C,R> {
/** Argument name constant for assertArgNotNull. */
diff --git
a/juneau-core/juneau-commons/src/main/java/org/apache/juneau/commons/function/ThrowingFunction4.java
b/juneau-core/juneau-commons/src/main/java/org/apache/juneau/commons/function/ThrowingFunction4.java
index e349da2cd2..863181bc70 100644
---
a/juneau-core/juneau-commons/src/main/java/org/apache/juneau/commons/function/ThrowingFunction4.java
+++
b/juneau-core/juneau-commons/src/main/java/org/apache/juneau/commons/function/ThrowingFunction4.java
@@ -91,7 +91,9 @@ import java.util.function.*;
* @param <R> The type of the result of the function.
*/
@FunctionalInterface
-@SuppressWarnings("java:S115")
+@SuppressWarnings({
+ "java:S115" // Constants use UPPER_snakeCase convention
+})
public interface ThrowingFunction4<A,B,C,D,R> extends Function4<A,B,C,D,R> {
/** Argument name constant for assertArgNotNull. */
diff --git
a/juneau-core/juneau-commons/src/main/java/org/apache/juneau/commons/function/ThrowingFunction5.java
b/juneau-core/juneau-commons/src/main/java/org/apache/juneau/commons/function/ThrowingFunction5.java
index a67c881683..f0a7eb1ec5 100644
---
a/juneau-core/juneau-commons/src/main/java/org/apache/juneau/commons/function/ThrowingFunction5.java
+++
b/juneau-core/juneau-commons/src/main/java/org/apache/juneau/commons/function/ThrowingFunction5.java
@@ -92,7 +92,9 @@ import java.util.function.*;
* @param <R> The type of the result of the function.
*/
@FunctionalInterface
-@SuppressWarnings("java:S115")
+@SuppressWarnings({
+ "java:S115" // Constants use UPPER_snakeCase convention
+})
public interface ThrowingFunction5<A,B,C,D,E,R> extends Function5<A,B,C,D,E,R>
{
/** Argument name constant for assertArgNotNull. */
diff --git
a/juneau-core/juneau-commons/src/main/java/org/apache/juneau/commons/lang/StringFormat.java
b/juneau-core/juneau-commons/src/main/java/org/apache/juneau/commons/lang/StringFormat.java
index 153d739cbd..6687f68cc0 100644
---
a/juneau-core/juneau-commons/src/main/java/org/apache/juneau/commons/lang/StringFormat.java
+++
b/juneau-core/juneau-commons/src/main/java/org/apache/juneau/commons/lang/StringFormat.java
@@ -94,7 +94,9 @@ import java.util.MissingFormatArgumentException;
*
* @see StringUtils#format(String, Object...)
*/
-@SuppressWarnings("java:S115")
+@SuppressWarnings({
+ "java:S115" // Constants use UPPER_snakeCase convention
+})
public final class StringFormat {
// Argument name constants for assertArgNotNull
diff --git
a/juneau-core/juneau-commons/src/main/java/org/apache/juneau/commons/logging/LogRecord.java
b/juneau-core/juneau-commons/src/main/java/org/apache/juneau/commons/logging/LogRecord.java
index b350774a48..ed91be17be 100644
---
a/juneau-core/juneau-commons/src/main/java/org/apache/juneau/commons/logging/LogRecord.java
+++
b/juneau-core/juneau-commons/src/main/java/org/apache/juneau/commons/logging/LogRecord.java
@@ -48,7 +48,10 @@ import org.apache.juneau.commons.utils.*;
* <li class='jc'>{@link java.util.logging.LogRecord}
* </ul>
*/
-@SuppressWarnings({ "java:S115", "java:S100" }) // Constants use
UPPER_snakeCase convention; class name intentionally matches
java.util.logging.LogRecord
+@SuppressWarnings({
+ "java:S115", // Constants use UPPER_snakeCase convention
+ "java:S100" // Class name intentionally matches
java.util.logging.LogRecord
+})
public class LogRecord extends java.util.logging.LogRecord {
private static final long serialVersionUID = 1L;
@@ -125,7 +128,9 @@ public class LogRecord extends java.util.logging.LogRecord {
return source.get().map(x -> x.getMethodName()).orElse(null);
}
- @SuppressWarnings("java:S3776")
+ @SuppressWarnings({
+ "java:S3776" // Cognitive complexity acceptable for stack trace
filtering
+ })
private static Optional<StackTraceElement> findSource() {
for (var e : new Throwable().getStackTrace()) {
var c = e.getClassName();
@@ -236,7 +241,9 @@ public class LogRecord extends java.util.logging.LogRecord {
* @see java.util.logging.SimpleFormatter
* @see java.util.Formatter
*/
- @SuppressWarnings("deprecation")
+ @SuppressWarnings({
+ "deprecation" // Date constructor is deprecated but needed for
compatibility
+ })
public String formatted(String format) {
var date = new Date(getMillis());
Supplier<String> sourceName = () -> getSourceClassName() + ' '
+ getSourceMethodName();
diff --git
a/juneau-core/juneau-commons/src/main/java/org/apache/juneau/commons/reflect/ClassInfo.java
b/juneau-core/juneau-commons/src/main/java/org/apache/juneau/commons/reflect/ClassInfo.java
index 1e04793786..41935ed9ea 100644
---
a/juneau-core/juneau-commons/src/main/java/org/apache/juneau/commons/reflect/ClassInfo.java
+++
b/juneau-core/juneau-commons/src/main/java/org/apache/juneau/commons/reflect/ClassInfo.java
@@ -1382,7 +1382,9 @@ public class ClassInfo extends ElementInfo implements
Annotatable, Type, Compara
* @param pt The parameterized type class containing the parameterized
type to resolve (e.g. <c>HashMap</c>).
* @return The resolved real class.
*/
- @SuppressWarnings("java:S3776")
+ @SuppressWarnings({
+ "java:S3776" // Cognitive complexity acceptable for parameter
type resolution
+ })
public Class<?> getParameterType(int index, Class<?> pt) {
assertArgNotNull(ARG_pt, pt);
@@ -2534,7 +2536,9 @@ public class ClassInfo extends ElementInfo implements
Annotatable, Type, Compara
return toString.get();
}
- @SuppressWarnings("java:S3776")
+ @SuppressWarnings({
+ "java:S3776" // Cognitive complexity acceptable for toString
method finding
+ })
private String findToString() {
var sb = new StringBuilder(256);
diff --git
a/juneau-core/juneau-commons/src/main/java/org/apache/juneau/commons/settings/Settings.java
b/juneau-core/juneau-commons/src/main/java/org/apache/juneau/commons/settings/Settings.java
index ab0367cbab..fe14d9c57c 100644
---
a/juneau-core/juneau-commons/src/main/java/org/apache/juneau/commons/settings/Settings.java
+++
b/juneau-core/juneau-commons/src/main/java/org/apache/juneau/commons/settings/Settings.java
@@ -129,7 +129,9 @@ import org.apache.juneau.commons.reflect.*;
* </p>
* </ul>
*/
-@SuppressWarnings("java:S115") // Constants use UPPER_snakeCase convention
(e.g., ARG_sources, MSG_globalDisabled)
+@SuppressWarnings({
+ "java:S115" // Constants use UPPER_snakeCase convention (e.g.,
ARG_sources, MSG_globalDisabled)
+})
public class Settings {
// Argument name constants for assertArgNoNulls
@@ -329,7 +331,9 @@ public class Settings {
}
private final ResettableSupplier<SettingStore> globalStore;
- @SuppressWarnings("java:S5164") // Cleanup method provided: cleanup()
+ @SuppressWarnings({
+ "java:S5164" // Cleanup method provided: cleanup()
+ })
private final ThreadLocal<SettingStore> localStore;
private final List<SettingSource> sources;
private final Map<Class<?>,Function<String,?>> toTypeFunctions;
@@ -421,7 +425,9 @@ public class Settings {
* @see #get(String)
* @see #toType(String, Class)
*/
- @SuppressWarnings("unchecked")
+ @SuppressWarnings({
+ "unchecked" // Type erasure requires unchecked cast
+ })
public <T> T get(String name, T def) {
assertArgNotNull(ARG_def, def);
return get(name).asType((Class<T>)def.getClass()).orElse(def);
@@ -598,7 +604,10 @@ public class Settings {
* @return The converted value.
* @throws RuntimeException If the type is not supported for conversion
(no static method or constructor found).
*/
- @SuppressWarnings({ "unchecked", "rawtypes" })
+ @SuppressWarnings({
+ "unchecked", // Type erasure requires unchecked cast
+ "rawtypes" // Raw types necessary for generic type handling
+ })
protected <T> T toType(String s, Class<T> c) {
assertArgNotNull(ARG_s, s);
assertArgNotNull(ARG_c, c);
diff --git
a/juneau-core/juneau-commons/src/main/java/org/apache/juneau/commons/settings/StringSetting.java
b/juneau-core/juneau-commons/src/main/java/org/apache/juneau/commons/settings/StringSetting.java
index 9a20efc2ce..38e84f6d96 100644
---
a/juneau-core/juneau-commons/src/main/java/org/apache/juneau/commons/settings/StringSetting.java
+++
b/juneau-core/juneau-commons/src/main/java/org/apache/juneau/commons/settings/StringSetting.java
@@ -33,7 +33,9 @@ import java.util.function.*;
* This class extends {@link Setting} with type-specific conversion methods
such as {@link #asInteger()},
* {@link #asBoolean()}, {@link #asCharset()}, etc.
*/
-@SuppressWarnings("java:S115")
+@SuppressWarnings({
+ "java:S115" // Constants use UPPER_snakeCase convention
+})
public class StringSetting extends Setting<String> {
// Argument name constants for assertArgNotNull
diff --git
a/juneau-core/juneau-commons/src/main/java/org/apache/juneau/commons/utils/CollectionUtils.java
b/juneau-core/juneau-commons/src/main/java/org/apache/juneau/commons/utils/CollectionUtils.java
index 7f9ef3939b..a4db36f0ea 100644
---
a/juneau-core/juneau-commons/src/main/java/org/apache/juneau/commons/utils/CollectionUtils.java
+++
b/juneau-core/juneau-commons/src/main/java/org/apache/juneau/commons/utils/CollectionUtils.java
@@ -123,7 +123,9 @@ import org.apache.juneau.commons.collections.*;
* <li class='link'><a class="doclink"
href="../../../../../index.html#juneau-commons">juneau-commons</a>
* </ul>
*/
-@SuppressWarnings("java:S115")
+@SuppressWarnings({
+ "java:S115" // Constants use UPPER_snakeCase convention
+})
public class CollectionUtils {
// Argument name constants for assertArgNotNull
@@ -203,7 +205,9 @@ public class CollectionUtils {
* @param o The object to traverse.
* @return A list containing all accumulated elements.
*/
- @SuppressWarnings("unchecked")
+ @SuppressWarnings({
+ "unchecked" // Type erasure requires unchecked casts
+ })
public static <T> List<T> accumulate(Object o) {
var l = list();
traverse(o, l::add);
@@ -297,7 +301,9 @@ public class CollectionUtils {
* @param newElements The new elements to append to the array.
* @return A new array with the specified elements appended.
*/
- @SuppressWarnings("unchecked")
+ @SuppressWarnings({
+ "unchecked" // Type erasure requires unchecked casts
+ })
public static <T> T[] addAll(T[] array, T...newElements) {
if (array == null)
return newElements;
@@ -365,7 +371,9 @@ public class CollectionUtils {
* @param length The length of the array.
* @return A new array of the specified type and length. Never
<jk>null</jk>.
*/
- @SuppressWarnings("unchecked")
+ @SuppressWarnings({
+ "unchecked" // Type erasure requires unchecked casts
+ })
public static <E> E[] array(Class<E> componentType, int length) {
return (E[])Array.newInstance(componentType, length);
}
@@ -378,7 +386,9 @@ public class CollectionUtils {
* @param componentType The component type of the array.
* @return A new array.
*/
- @SuppressWarnings("unchecked")
+ @SuppressWarnings({
+ "unchecked" // Type erasure requires unchecked casts
+ })
public static <E> E[] array(Collection<E> value, Class<E>
componentType) {
assertArgNotNull(ARG_value, value);
var array = (E[])Array.newInstance(componentType, value.size());
@@ -393,7 +403,9 @@ public class CollectionUtils {
* Returns null if the input is null.
* @throws IllegalArgumentException if the input is not an array.
*/
- @SuppressWarnings("java:S3776")
+ @SuppressWarnings({
+ "java:S3776" // Cognitive complexity acceptable for array
conversion
+ })
public static List<Object> arrayToList(Object array) {
assertArgNotNull(ARG_array, array);
assertArg(isArray(array), "Input must be an array but was {0}",
cn(array));
@@ -513,7 +525,9 @@ public class CollectionUtils {
* @param arrays Collection of arrays to combine.
* @return A new combined array, or <jk>null</jk> if all arrays are
<jk>null</jk>.
*/
- @SuppressWarnings("unchecked")
+ @SuppressWarnings({
+ "unchecked" // Type erasure requires unchecked casts
+ })
public static <E> E[] combine(E[]...arrays) {
assertArgNotNull(ARG_arrays, arrays);
int l = 0;
@@ -1094,7 +1108,9 @@ public class CollectionUtils {
* @param type The element type class.
* @return An empty list.
*/
- @SuppressWarnings("java:S1172") // Parameter type is used for type
inference, not runtime behavior
+ @SuppressWarnings({
+ "java:S1172" // Parameter type is used for type inference, not
runtime behavior
+ })
public static <T> List<T> liste(Class<T> type) {
return Collections.emptyList();
}
@@ -1106,7 +1122,9 @@ public class CollectionUtils {
* @param type The element type class.
* @return <jk>null</jk>.
*/
- @SuppressWarnings("java:S1172") // Parameter type is used for type
inference, not runtime behavior
+ @SuppressWarnings({
+ "java:S1172" // Parameter type is used for type inference, not
runtime behavior
+ })
public static <T> List<T> listn(Class<T> type) {
return null;
}
@@ -1225,7 +1243,9 @@ public class CollectionUtils {
* @param v4 Value 4.
* @return A new unmodifiable map.
*/
- @SuppressWarnings("java:S107")
+ @SuppressWarnings({
+ "java:S107" // Many parameters acceptable for convenience method
+ })
public static <K,V> Map<K,V> m(K k1, V v1, K k2, V v2, K k3, V v3, K
k4, V v4) {
return new SimpleMap<>(a(k1, k2, k3, k4), a(v1, v2, v3, v4));
}
@@ -1248,7 +1268,9 @@ public class CollectionUtils {
* @param v5 Value 5.
* @return A new unmodifiable map.
*/
- @SuppressWarnings("java:S107")
+ @SuppressWarnings({
+ "java:S107" // Many parameters acceptable for convenience method
+ })
public static <K,V> Map<K,V> m(K k1, V v1, K k2, V v2, K k3, V v3, K
k4, V v4, K k5, V v5) {
return new SimpleMap<>(a(k1, k2, k3, k4, k5), a(v1, v2, v3, v4,
v5));
}
@@ -1273,7 +1295,9 @@ public class CollectionUtils {
* @param v6 Value 6.
* @return A new unmodifiable map.
*/
- @SuppressWarnings("java:S107")
+ @SuppressWarnings({
+ "java:S107" // Many parameters acceptable for convenience method
+ })
public static <K,V> Map<K,V> m(K k1, V v1, K k2, V v2, K k3, V v3, K
k4, V v4, K k5, V v5, K k6, V v6) {
return new SimpleMap<>(a(k1, k2, k3, k4, k5, k6), a(v1, v2, v3,
v4, v5, v6));
}
@@ -1300,7 +1324,9 @@ public class CollectionUtils {
* @param v7 Value 7.
* @return A new unmodifiable map.
*/
- @SuppressWarnings("java:S107")
+ @SuppressWarnings({
+ "java:S107" // Many parameters acceptable for convenience method
+ })
public static <K,V> Map<K,V> m(K k1, V v1, K k2, V v2, K k3, V v3, K
k4, V v4, K k5, V v5, K k6, V v6, K k7, V v7) {
return new SimpleMap<>(a(k1, k2, k3, k4, k5, k6, k7), a(v1, v2,
v3, v4, v5, v6, v7));
}
@@ -1329,7 +1355,9 @@ public class CollectionUtils {
* @param v8 Value 8.
* @return A new unmodifiable map.
*/
- @SuppressWarnings("java:S107")
+ @SuppressWarnings({
+ "java:S107" // Many parameters acceptable for convenience method
+ })
public static <K,V> Map<K,V> m(K k1, V v1, K k2, V v2, K k3, V v3, K
k4, V v4, K k5, V v5, K k6, V v6, K k7, V v7, K k8, V v8) {
return new SimpleMap<>(a(k1, k2, k3, k4, k5, k6, k7, k8), a(v1,
v2, v3, v4, v5, v6, v7, v8));
}
@@ -1360,7 +1388,9 @@ public class CollectionUtils {
* @param v9 Value 9.
* @return A new unmodifiable map.
*/
- @SuppressWarnings("java:S107")
+ @SuppressWarnings({
+ "java:S107" // Many parameters acceptable for convenience method
+ })
public static <K,V> Map<K,V> m(K k1, V v1, K k2, V v2, K k3, V v3, K
k4, V v4, K k5, V v5, K k6, V v6, K k7, V v7, K k8, V v8, K k9, V v9) {
return new SimpleMap<>(a(k1, k2, k3, k4, k5, k6, k7, k8, k9),
a(v1, v2, v3, v4, v5, v6, v7, v8, v9));
}
@@ -1393,7 +1423,9 @@ public class CollectionUtils {
* @param v10 Value 10.
* @return A new unmodifiable map.
*/
- @SuppressWarnings("java:S107")
+ @SuppressWarnings({
+ "java:S107" // Many parameters acceptable for convenience method
+ })
public static <K,V> Map<K,V> m(K k1, V v1, K k2, V v2, K k3, V v3, K
k4, V v4, K k5, V v5, K k6, V v6, K k7, V v7, K k8, V v8, K k9, V v9, K k10, V
v10) {
return new SimpleMap<>(a(k1, k2, k3, k4, k5, k6, k7, k8, k9,
k10), a(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10));
}
@@ -1482,7 +1514,9 @@ public class CollectionUtils {
* @param v4 Value 4.
* @return A new modifiable map.
*/
- @SuppressWarnings("java:S107")
+ @SuppressWarnings({
+ "java:S107" // Many parameters acceptable for convenience method
+ })
public static <K,V> LinkedHashMap<K,V> map(K k1, V v1, K k2, V v2, K
k3, V v3, K k4, V v4) {
var m = new LinkedHashMap<K,V>();
m.put(k1, v1);
@@ -1509,7 +1543,9 @@ public class CollectionUtils {
* @param v5 Value 5.
* @return A new modifiable map.
*/
- @SuppressWarnings("java:S107")
+ @SuppressWarnings({
+ "java:S107" // Many parameters acceptable for convenience method
+ })
public static <K,V> LinkedHashMap<K,V> map(K k1, V v1, K k2, V v2, K
k3, V v3, K k4, V v4, K k5, V v5) {
var m = new LinkedHashMap<K,V>();
m.put(k1, v1);
@@ -1539,7 +1575,9 @@ public class CollectionUtils {
* @param v6 Value 6.
* @return A new modifiable map.
*/
- @SuppressWarnings("java:S107")
+ @SuppressWarnings({
+ "java:S107" // Many parameters acceptable for convenience method
+ })
public static <K,V> LinkedHashMap<K,V> map(K k1, V v1, K k2, V v2, K
k3, V v3, K k4, V v4, K k5, V v5, K k6, V v6) {
var m = new LinkedHashMap<K,V>();
m.put(k1, v1);
@@ -1572,7 +1610,9 @@ public class CollectionUtils {
* @param v7 Value 7.
* @return A new modifiable map.
*/
- @SuppressWarnings("java:S107")
+ @SuppressWarnings({
+ "java:S107" // Many parameters acceptable for convenience method
+ })
public static <K,V> LinkedHashMap<K,V> map(K k1, V v1, K k2, V v2, K
k3, V v3, K k4, V v4, K k5, V v5, K k6, V v6, K k7, V v7) {
var m = new LinkedHashMap<K,V>();
m.put(k1, v1);
@@ -1608,7 +1648,9 @@ public class CollectionUtils {
* @param v8 Value 8.
* @return A new modifiable map.
*/
- @SuppressWarnings("java:S107")
+ @SuppressWarnings({
+ "java:S107" // Many parameters acceptable for convenience method
+ })
public static <K,V> LinkedHashMap<K,V> map(K k1, V v1, K k2, V v2, K
k3, V v3, K k4, V v4, K k5, V v5, K k6, V v6, K k7, V v7, K k8, V v8) {
var m = new LinkedHashMap<K,V>();
m.put(k1, v1);
@@ -1647,7 +1689,9 @@ public class CollectionUtils {
* @param v9 Value 9.
* @return A new modifiable map.
*/
- @SuppressWarnings("java:S107")
+ @SuppressWarnings({
+ "java:S107" // Many parameters acceptable for convenience method
+ })
public static <K,V> LinkedHashMap<K,V> map(K k1, V v1, K k2, V v2, K
k3, V v3, K k4, V v4, K k5, V v5, K k6, V v6, K k7, V v7, K k8, V v8, K k9, V
v9) {
var m = new LinkedHashMap<K,V>();
m.put(k1, v1);
@@ -1689,7 +1733,9 @@ public class CollectionUtils {
* @param v10 Value 10.
* @return A new modifiable map.
*/
- @SuppressWarnings("java:S107")
+ @SuppressWarnings({
+ "java:S107" // Many parameters acceptable for convenience method
+ })
public static <K,V> LinkedHashMap<K,V> map(K k1, V v1, K k2, V v2, K
k3, V v3, K k4, V v4, K k5, V v5, K k6, V v6, K k7, V v7, K k8, V v8, K k9, V
v9, K k10, V v10) {
var m = new LinkedHashMap<K,V>();
m.put(k1, v1);
@@ -1724,7 +1770,9 @@ public class CollectionUtils {
* @return A new map builder.
* @see Maps
*/
- @SuppressWarnings("unchecked")
+ @SuppressWarnings({
+ "unchecked" // Type erasure requires unchecked casts
+ })
public static <K,V> Maps<K,V> mapb() {
return (Maps<K,V>)Maps.create().ordered();
}
@@ -1757,7 +1805,9 @@ public class CollectionUtils {
* @return A new map builder.
* @see Maps
*/
- @SuppressWarnings("java:S100") // Method name uses underscore convention
+ @SuppressWarnings({
+ "java:S100" // Method name uses underscore convention
+ })
public static Maps<String,Object> mapb_so() {
return Maps.create(String.class, Object.class).ordered();
}
@@ -1860,7 +1910,9 @@ public class CollectionUtils {
* @param type The component type class.
* @return <jk>null</jk>.
*/
- @SuppressWarnings("java:S1172") // Parameter type is used for type
inference, not runtime behavior
+ @SuppressWarnings({
+ "java:S1172" // Parameter type is used for type inference, not
runtime behavior
+ })
public static <T> T[] na(Class<T> type) {
return null;
}
@@ -2452,7 +2504,9 @@ public class CollectionUtils {
* @param o The object to traverse.
* @param c The consumer of the objects.
*/
- @SuppressWarnings("unchecked")
+ @SuppressWarnings({
+ "unchecked" // Type erasure requires unchecked casts
+ })
public static <T> void traverse(Object o, Consumer<T> c) {
if (o == null)
return;
diff --git
a/juneau-core/juneau-commons/src/main/java/org/apache/juneau/commons/utils/FileUtils.java
b/juneau-core/juneau-commons/src/main/java/org/apache/juneau/commons/utils/FileUtils.java
index e5889b1895..47001dd3d4 100644
---
a/juneau-core/juneau-commons/src/main/java/org/apache/juneau/commons/utils/FileUtils.java
+++
b/juneau-core/juneau-commons/src/main/java/org/apache/juneau/commons/utils/FileUtils.java
@@ -29,7 +29,9 @@ import java.nio.file.*;
* File utilities.
*
*/
-@SuppressWarnings("java:S115")
+@SuppressWarnings({
+ "java:S115" // Constants use UPPER_snakeCase convention
+})
public class FileUtils {
/**
diff --git
a/juneau-core/juneau-commons/src/main/java/org/apache/juneau/commons/utils/StringUtils.java
b/juneau-core/juneau-commons/src/main/java/org/apache/juneau/commons/utils/StringUtils.java
index 74ac7a410f..b81c41e1ab 100644
---
a/juneau-core/juneau-commons/src/main/java/org/apache/juneau/commons/utils/StringUtils.java
+++
b/juneau-core/juneau-commons/src/main/java/org/apache/juneau/commons/utils/StringUtils.java
@@ -28,7 +28,6 @@ import static org.apache.juneau.commons.utils.Utils.*;
import java.io.*;
import java.lang.reflect.*;
-import java.util.Objects;
import java.math.*;
import java.net.*;
import java.nio.*;
@@ -50,7 +49,11 @@ import org.apache.juneau.commons.reflect.*;
/**
* Reusable string utility methods.
*/
-@SuppressWarnings({"java:S115", "java:S1192", "java:S5843"}) // S115: Constant
names, S1192: Duplicated string literals (HTML entities), S5843: FP_REGEX
copied from JDK source for parsing consistency
+@SuppressWarnings({
+ "java:S115", // Constant names use UPPER_snakeCase convention
+ "java:S1192", // Duplicated string literals (HTML entities) are
intentional
+ "java:S5843" // FP_REGEX copied from JDK source for parsing consistency
+})
public class StringUtils {
// Argument name constants for assertArgNotNull
@@ -2036,7 +2039,9 @@ public class StringUtils {
* @return The URI with invalid characters encoded, or <jk>null</jk> if
input is <jk>null</jk>.
* @see #urlEncode(String)
*/
- @SuppressWarnings("null")
+ @SuppressWarnings({
+ "null" // Null analysis false positive - method handles null
input
+ })
public static String fixUrl(String in) {
if (in == null)
@@ -2198,7 +2203,9 @@ public class StringUtils {
* @param resolver The function that resolves variable names to values.
* @return The new string with variables replaced, or the original
string if it didn't have variables in it.
*/
- @SuppressWarnings("java:S3776")
+ @SuppressWarnings({
+ "java:S3776" // Cognitive complexity acceptable for string
formatting logic
+ })
public static String formatNamed(String s, Function<String,Object>
resolver) {
if (s == null)
@@ -2378,7 +2385,9 @@ public class StringUtils {
* @param s The URI string.
* @return Just the authority portion of the URI.
*/
- @SuppressWarnings("java:S3776") // Cognitive complexity is acceptable
for this state machine-based URI parser
+ @SuppressWarnings({
+ "java:S3776" // Cognitive complexity acceptable for state
machine-based URI parser
+ })
public static String getAuthorityUri(String s) {
// Use a state machine for maximum performance.
@@ -2468,7 +2477,9 @@ public class StringUtils {
* @return
* The time in milliseconds, or <c>-1</c> if the string is empty
or <jk>null</jk>.
*/
- @SuppressWarnings("java:S3776")
+ @SuppressWarnings({
+ "java:S3776" // Cognitive complexity acceptable for duration
parsing logic
+ })
public static long getDuration(String s) {
s = trim(s);
if (isEmpty(s))
@@ -2881,7 +2892,9 @@ public class StringUtils {
* @param s The string to test.
* @return <jk>true</jk> if it's an absolute path.
*/
- @SuppressWarnings("java:S3776") // Cognitive complexity is acceptable
for this state machine-based URI validator
+ @SuppressWarnings({
+ "java:S3776" // Cognitive complexity acceptable for state
machine-based URI validator
+ })
public static boolean isAbsoluteUri(String s) {
if (isEmpty(s))
@@ -3169,7 +3182,9 @@ public class StringUtils {
* @param s The string to check.
* @return <jk>true</jk> if the specified string is numeric.
*/
- @SuppressWarnings("java:S3776")
+ @SuppressWarnings({
+ "java:S3776" // Cognitive complexity acceptable for decimal
validation logic
+ })
public static boolean isDecimal(String s) {
if (s == null || s.isEmpty() || !
FIRST_NUMBER_CHARS.contains(s.charAt(0)))
return false;
@@ -3548,7 +3563,10 @@ public class StringUtils {
* @param s The string to test.
* @return <jk>true</jk> if it's an absolute path.
*/
- @SuppressWarnings({ "java:S3776", "java:S1126" }) // Cognitive
complexity is acceptable for this state machine-based URI validator. S1126:
State machine requires if-then-else structure
+ @SuppressWarnings({
+ "java:S3776", // Cognitive complexity acceptable for state
machine-based URI validator
+ "java:S1126" // State machine requires if-then-else structure
+ })
public static boolean isUri(String s) {
if (isEmpty(s))
@@ -4356,7 +4374,10 @@ public class StringUtils {
* @param str The string to generate a Metaphone code for. Can be
<jk>null</jk>.
* @return The Metaphone code, or <jk>null</jk> if input is
<jk>null</jk> or empty.
*/
- @SuppressWarnings({ "java:S3776", "java:S6541" })
+ @SuppressWarnings({
+ "java:S3776", // Cognitive complexity acceptable for metaphone
algorithm
+ "java:S6541" // Thread-safe singleton pattern acceptable
+ })
public static String metaphone(String str) {
if (isEmpty(str))
return null;
@@ -4584,7 +4605,9 @@ public class StringUtils {
* @param str2 The second string.
* @return A negative integer, zero, or a positive integer as the first
string is less than, equal to, or greater than the second.
*/
- @SuppressWarnings("java:S3776")
+ @SuppressWarnings({
+ "java:S3776" // Cognitive complexity acceptable for natural
comparison algorithm
+ })
public static int naturalCompare(String str1, String str2) {
if (str1 == str2)
return 0;
@@ -5251,7 +5274,9 @@ public class StringUtils {
* If <jk>null</jk> or <c>Number</c>, uses the best guess.
* @return The parsed number, or <jk>null</jk> if the string was null.
*/
- @SuppressWarnings("java:S3776")
+ @SuppressWarnings({
+ "java:S3776" // Cognitive complexity acceptable for number
parsing logic
+ })
public static Number parseNumber(String s, Class<? extends Number>
type) {
if (s == null)
return null;
@@ -6456,7 +6481,9 @@ public class StringUtils {
* @param trim Trim strings after parsing.
* @return The parsed map, or null if the string was null.
*/
- @SuppressWarnings("java:S3776")
+ @SuppressWarnings({
+ "java:S3776" // Cognitive complexity acceptable for map
splitting logic
+ })
public static Map<String,String> splitMap(String s, boolean trim) {
if (s == null)
@@ -6571,7 +6598,9 @@ public class StringUtils {
* The results, or <jk>null</jk> if the input was <jk>null</jk>.
* <br>An empty string results in an empty array.
*/
- @SuppressWarnings("java:S3776")
+ @SuppressWarnings({
+ "java:S3776" // Cognitive complexity acceptable for nested
string splitting
+ })
public static List<String> splitNested(String s) {
var escapeChars = getEscapeSet(',');
@@ -6627,7 +6656,9 @@ public class StringUtils {
* The results, or <jk>null</jk> if the input was <jk>null</jk>.
* <br>An empty string results in an empty array.
*/
- @SuppressWarnings("java:S3776")
+ @SuppressWarnings({
+ "java:S3776" // Cognitive complexity acceptable for nested
inner string splitting
+ })
public static List<String> splitNestedInner(String s) {
assertArg(nn(s), "String was null.");
assertArg(ne(s), "String was empty.");
@@ -6708,7 +6739,10 @@ public class StringUtils {
* The results, or <jk>null</jk> if the input was <jk>null</jk>.
* <br>An empty string results in an empty array.
*/
- @SuppressWarnings({"java:S3776", "java:S2583"}) // State variables
persist across loop iterations
+ @SuppressWarnings({
+ "java:S3776", // Cognitive complexity acceptable for quoted
string splitting
+ "java:S2583" // State variables persist across loop iterations
+ })
public static String[] splitQuoted(String s, boolean keepQuotes) {
if (s == null)
@@ -7447,7 +7481,9 @@ public class StringUtils {
* @param escaped The characters escaped.
* @return A new string if characters were removed, or the same string
if not or if the input was <jk>null</jk>.
*/
- @SuppressWarnings("java:S3776")
+ @SuppressWarnings({
+ "java:S3776" // Cognitive complexity acceptable for character
unescaping logic
+ })
public static String unescapeChars(String s, AsciiSet escaped) {
if (s == null || s.isEmpty())
return s;
@@ -7640,7 +7676,9 @@ public class StringUtils {
* @param o The object to encode.
* @return The URL encoded string, or <jk>null</jk> if the object was
null.
*/
- @SuppressWarnings("java:S3776")
+ @SuppressWarnings({
+ "java:S3776" // Cognitive complexity acceptable for URL path
encoding
+ })
public static String urlEncodePath(Object o) {
if (o == null)
@@ -7786,7 +7824,10 @@ public class StringUtils {
* @return The wrapped string, or <jk>null</jk> if input is
<jk>null</jk>.
* @throws IllegalArgumentException if wrapLength is <= 0 or newline
is <jk>null</jk>.
*/
- @SuppressWarnings({ "java:S3776", "java:S6541" })
+ @SuppressWarnings({
+ "java:S3776", // Cognitive complexity acceptable for text
wrapping algorithm
+ "java:S6541" // Thread-safe singleton pattern acceptable
+ })
public static String wrap(String str, int wrapLength, String newline) {
if (str == null)
return null;
@@ -7970,7 +8011,10 @@ public class StringUtils {
* @param ip The IPv6 address string to validate.
* @return <jk>true</jk> if the string is a valid IPv6 address format,
<jk>false</jk> otherwise.
*/
- @SuppressWarnings({ "java:S3776", "java:S6541" })
+ @SuppressWarnings({
+ "java:S3776", // Cognitive complexity acceptable for IPv6
validation
+ "java:S6541" // Thread-safe singleton pattern acceptable
+ })
public static boolean isValidIPv6Address(String ip) {
if (ip == null || ip.isEmpty())
return false;
@@ -8183,7 +8227,9 @@ public class StringUtils {
* @param value The numeric value.
* @return The value in milliseconds, or <c>-1</c> if the unit is
invalid.
*/
- @SuppressWarnings("java:S3776")
+ @SuppressWarnings({
+ "java:S3776" // Cognitive complexity acceptable for unit
parsing logic
+ })
private static long parseUnit(String unit, double value) {
if (isEmpty(unit)) {
// No unit means milliseconds
@@ -8247,7 +8293,9 @@ public class StringUtils {
* @param r The StringReader positioned at the start of a comment (at
the first <js>'/'</js>).
* @throws IOException If an I/O error occurs.
*/
- @SuppressWarnings("java:S3776")
+ @SuppressWarnings({
+ "java:S3776" // Cognitive complexity acceptable for comment
skipping logic
+ })
public static void skipComments(StringReader r) throws IOException {
var c = r.read();
// "/* */" style comments
@@ -8290,7 +8338,9 @@ public class StringUtils {
* @param str The string to split.
* @return A list of words, or empty list if input is null or empty.
*/
- @SuppressWarnings("java:S3776")
+ @SuppressWarnings({
+ "java:S3776" // Cognitive complexity acceptable for word
splitting logic
+ })
private static List<String> splitWords(String str) {
if (str == null || isEmpty(str))
return Collections.emptyList();
diff --git
a/juneau-core/juneau-commons/src/main/java/org/apache/juneau/commons/utils/Utils.java
b/juneau-core/juneau-commons/src/main/java/org/apache/juneau/commons/utils/Utils.java
index f2741f975a..e74bd57037 100644
---
a/juneau-core/juneau-commons/src/main/java/org/apache/juneau/commons/utils/Utils.java
+++
b/juneau-core/juneau-commons/src/main/java/org/apache/juneau/commons/utils/Utils.java
@@ -52,7 +52,10 @@ import org.apache.juneau.commons.settings.*;
* <li class='link'><a class="doclink"
href='../../../../../index.html#juneau-commons.utils'>Overview >
juneau-commons.utils</a>
* </ul>
*/
-@SuppressWarnings({"java:S115", "java:S1118"})
+@SuppressWarnings({
+ "java:S115", // Constants use UPPER_snakeCase convention
+ "java:S1118" // Utility class with static methods only
+})
public class Utils {
// Argument name constants for assertArgNotNull
@@ -242,7 +245,9 @@ public class Utils {
* @return <c>-1</c>, <c>0</c>, or <c>1</c> if <c>o1</c> is less-than,
equal, or greater-than <c>o2</c>.
* Returns <c>0</c> if objects are not of the same type or do
not implement the {@link Comparable} interface.
*/
- @SuppressWarnings("unchecked")
+ @SuppressWarnings({
+ "unchecked" // Type erasure requires unchecked casts
+ })
public static int cmp(Object o1, Object o2) {
if (o1 == null) {
if (o2 == null)
@@ -378,7 +383,9 @@ public class Utils {
* @param type The component type class.
* @return An empty array of the specified type.
*/
- @SuppressWarnings("unchecked")
+ @SuppressWarnings({
+ "unchecked" // Type erasure requires unchecked cast for array
creation
+ })
public static <T> T[] ea(Class<T> type) {
return (T[])Array.newInstance(type, 0);
}
@@ -507,14 +514,14 @@ public class Utils {
* Tests two objects for equality, gracefully handling nulls and arrays.
*
* <p>
- * This method handles annotations specially by delegating to {@link
org.apache.juneau.commons.utils.AnnotationUtils#equals(java.lang.annotation.Annotation,
java.lang.annotation.Annotation)}
+ * This method handles annotations specially by delegating to {@link
AnnotationUtils#equals(java.lang.annotation.Annotation,
java.lang.annotation.Annotation)}
* to ensure proper annotation comparison according to the annotation
equality contract.
*
* @param <T> The value types.
* @param o1 Object 1.
* @param o2 Object 2.
* @return <jk>true</jk> if both objects are equal based on the {@link
Object#equals(Object)} method.
- * @see
org.apache.juneau.commons.utils.AnnotationUtils#equals(java.lang.annotation.Annotation,
java.lang.annotation.Annotation)
+ * @see AnnotationUtils#equals(java.lang.annotation.Annotation,
java.lang.annotation.Annotation)
*/
public static <T> boolean eq(T o1, T o2) {
// Handle annotations specially
@@ -884,7 +891,9 @@ public class Utils {
* @param value The number.
* @return The absolute value.
*/
- @SuppressWarnings("unchecked")
+ @SuppressWarnings({
+ "unchecked" // Type erasure requires unchecked cast for Number
types
+ })
public static <T extends Number> T abs(T value) {
if (value == null)
return null;
@@ -954,7 +963,7 @@ public class Utils {
* <p>
* Special handling is provided for:
* <ul>
- * <li><b>Annotations:</b> Uses {@link
org.apache.juneau.commons.utils.AnnotationUtils#hash(java.lang.annotation.Annotation)}
to ensure consistent hashing
+ * <li><b>Annotations:</b> Uses {@link
AnnotationUtils#hash(java.lang.annotation.Annotation)} to ensure consistent
hashing
* according to the {@link
java.lang.annotation.Annotation#hashCode()} contract.
* <li><b>Arrays:</b> Uses content-based hashing via {@link
java.util.Arrays#hashCode(Object[])}
* instead of identity-based hashing.
@@ -981,7 +990,7 @@ public class Utils {
* @param values The values to hash.
* @return A hash code value for the given values.
* @see HashCode#of(Object...)
- * @see
org.apache.juneau.commons.utils.AnnotationUtils#hash(java.lang.annotation.Annotation)
+ * @see AnnotationUtils#hash(java.lang.annotation.Annotation)
* @see Objects#hash(Object...)
*/
public static final int h(Object...values) {
@@ -1488,7 +1497,9 @@ public class Utils {
* @param type The type class (unused, but helps with type inference).
* @return <jk>null</jk>.
*/
- @SuppressWarnings("java:S1172") // Parameter type is used for type
inference, not runtime behavior
+ @SuppressWarnings({
+ "java:S1172" // Parameter type is used for type inference, not
runtime behavior
+ })
public static <T> T no(Class<T> type) {
return null;
}
@@ -1737,7 +1748,9 @@ public class Utils {
*
* @param snippet The snippet of code to run.
*/
- @SuppressWarnings("java:S1181") // Need to catch Throwable to handle
all exception types including Error
+ @SuppressWarnings({
+ "java:S1181" // Need to catch Throwable to handle all exception
types including Error
+ })
public static void safe(Snippet snippet) {
try {
snippet.run();
@@ -1769,7 +1782,9 @@ public class Utils {
* @see #safe(Snippet)
* @see #safeOpt(ThrowingSupplier)
*/
- @SuppressWarnings("java:S1181") // Need to catch Throwable to handle
all exception types including Error
+ @SuppressWarnings({
+ "java:S1181" // Need to catch Throwable to handle all exception
types including Error
+ })
public static void quiet(Snippet snippet) {
try {
snippet.run();
@@ -1795,7 +1810,9 @@ public class Utils {
* @param exceptionMapper A function that converts the thrown throwable
into a runtime exception.
* @throws RuntimeException The exception returned by the exception
mapper if the snippet throws a throwable.
*/
- @SuppressWarnings("java:S1181") // Need to catch Throwable to handle
all exception types including Error
+ @SuppressWarnings({
+ "java:S1181" // Need to catch Throwable to handle all exception
types including Error
+ })
public static void safe(Snippet snippet, Function<Throwable,
RuntimeException> exceptionMapper) {
try {
snippet.run();
@@ -1815,7 +1832,9 @@ public class Utils {
* @param s The supplier that may throw an exception.
* @return The result of the supplier execution.
*/
- @SuppressWarnings("java:S1181") // Need to catch Throwable to handle
all exception types including Error
+ @SuppressWarnings({
+ "java:S1181" // Need to catch Throwable to handle all exception
types including Error
+ })
public static <T> T safe(ThrowingSupplier<T> s) {
try {
return s.get();
@@ -1831,7 +1850,7 @@ public class Utils {
*
* <p>
* This method allows you to define a function that converts any thrown
exception into a runtime exception.
- * This is useful when you need to wrap exceptions in a specific
runtime exception type (e.g., {@link
org.apache.juneau.commons.reflect.ExecutableException}).
+ * This is useful when you need to wrap exceptions in a specific
runtime exception type (e.g., {@link ExecutableException}).
*
* <h5 class='section'>Example:</h5>
* <p class='bjava'>
@@ -1851,7 +1870,9 @@ public class Utils {
* @return The result of the supplier execution.
* @throws RuntimeException The exception returned by the exception
mapper if the supplier throws an exception or error.
*/
- @SuppressWarnings("java:S1181") // Need to catch Throwable to handle
all exception types including Error
+ @SuppressWarnings({
+ "java:S1181" // Need to catch Throwable to handle all exception
types including Error
+ })
public static <T> T safe(ThrowingSupplier<T> s, Function<Throwable,
RuntimeException> exceptionMapper) {
try {
return s.get();
diff --git
a/juneau-core/juneau-config/src/main/java/org/apache/juneau/config/store/FileStore.java
b/juneau-core/juneau-config/src/main/java/org/apache/juneau/config/store/FileStore.java
index ca3983620b..993c719846 100644
---
a/juneau-core/juneau-config/src/main/java/org/apache/juneau/config/store/FileStore.java
+++
b/juneau-core/juneau-config/src/main/java/org/apache/juneau/config/store/FileStore.java
@@ -47,7 +47,10 @@ import org.apache.juneau.commons.collections.FluentMap;
* <li class='note'>This class is thread safe and reusable.
* </ul>
*/
-@SuppressWarnings({"resource", "java:S115"})
+@SuppressWarnings({
+ "resource", // Resources are managed by caller
+ "java:S115" // Constants use UPPER_snakeCase convention
+})
public class FileStore extends ConfigStore {
// Argument name constants for assertArgNotNull
@@ -366,7 +369,9 @@ public class FileStore extends ConfigStore {
}
}
- @SuppressWarnings("unchecked")
+ @SuppressWarnings({
+ "unchecked" // Type erasure requires unchecked casts
+ })
@Override /* Overridden from Thread */
public void run() {
try {
@@ -511,7 +516,9 @@ public class FileStore extends ConfigStore {
}
@Override /* Overridden from ConfigStore */
- @SuppressWarnings("java:S3776")
+ @SuppressWarnings({
+ "java:S3776" // Cognitive complexity acceptable for file
writing logic
+ })
public synchronized String write(String name, String expectedContents,
String newContents) throws IOException {
name = resolveName(name);
@@ -613,7 +620,9 @@ public class FileStore extends ConfigStore {
}
@Override
- @SuppressWarnings("java:S3776")
+ @SuppressWarnings({
+ "java:S3776" // Cognitive complexity acceptable for name
resolution logic
+ })
protected String resolveName(String name) {
if (! nameCache.containsKey(name)) {
String n = null;
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/BeanFilter.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/BeanFilter.java
index 36b1820045..d9d8ecee5f 100644
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/BeanFilter.java
+++
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/BeanFilter.java
@@ -75,7 +75,9 @@ import org.apache.juneau.swap.*;
* <li class='jc'>{@link PropertyNamer}
* </ul>
*/
-@SuppressWarnings("rawtypes")
+@SuppressWarnings({
+ "rawtypes" // Raw types necessary for generic type handling
+})
public class BeanFilter {
/**
@@ -113,7 +115,9 @@ public class BeanFilter {
* @param annotations The annotations to apply.
* @return This object.
*/
- @SuppressWarnings("java:S3776")
+ @SuppressWarnings({
+ "java:S3776" // Cognitive complexity acceptable for
annotation application
+ })
public Builder applyAnnotations(List<Bean> annotations) {
annotations.forEach(x -> {
@@ -997,7 +1001,9 @@ public class BeanFilter {
* @param value The value just extracted from calling the bean getter.
* @return The value to serialize. Default is just to return the
existing value.
*/
- @SuppressWarnings("unchecked")
+ @SuppressWarnings({
+ "unchecked" // Type erasure requires unchecked casts
+ })
public Object readProperty(Object bean, String name, Object value) {
return interceptor.readProperty(bean, name, value);
}
@@ -1010,7 +1016,9 @@ public class BeanFilter {
* @param value The value just parsed.
* @return The value to serialize. Default is just to return the
existing value.
*/
- @SuppressWarnings("unchecked")
+ @SuppressWarnings({
+ "unchecked" // Type erasure requires unchecked casts
+ })
public Object writeProperty(Object bean, String name, Object value) {
return interceptor.writeProperty(bean, name, value);
}
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/BeanMeta.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/BeanMeta.java
index 25f6730dd8..fa16d57ac3 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/BeanMeta.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/BeanMeta.java
@@ -66,7 +66,9 @@ import org.apache.juneau.commons.utils.*;
*
* @param <T> The class type that this metadata applies to.
*/
-@SuppressWarnings("java:S115") // Constants use UPPER_snakeCase convention
(e.g., PROP_class)
+@SuppressWarnings({
+ "java:S115" // Constants use UPPER_snakeCase convention (e.g.,
PROP_class)
+})
public class BeanMeta<T> {
// Property name constants
@@ -389,7 +391,9 @@ public class BeanMeta<T> {
* @param pNames Explicit list of property names and order. If
<jk>null</jk>, properties are determined automatically.
* @param implClass Optional implementation class constructor to use if
one cannot be found. Can be <jk>null</jk>.
*/
- @SuppressWarnings("java:S3776")
+ @SuppressWarnings({
+ "java:S3776" // Cognitive complexity acceptable for bean
metadata initialization
+ })
protected BeanMeta(ClassMeta<T> cm, BeanFilter bf, String[] pNames,
ClassInfo implClass) {
classMeta = cm;
beanContext = cm.getBeanContext();
@@ -902,7 +906,9 @@ public class BeanMeta<T> {
* @return A new instance of this bean if possible, or <jk>null</jk> if
not.
* @throws ExecutableException Exception occurred on invoked
constructor/method/field.
*/
- @SuppressWarnings("unchecked")
+ @SuppressWarnings({
+ "unchecked" // Type erasure requires unchecked cast
+ })
protected T newBean(Object outer) throws ExecutableException {
if (classMeta.isMemberClass() && classMeta.isNotStatic()) {
if (hasConstructor())
@@ -955,7 +961,9 @@ public class BeanMeta<T> {
* the number of properties specified in {@link Beanc @Beanc}
doesn't match the number of constructor parameters,
* or if parameter names cannot be determined from the bytecode.
*/
- @SuppressWarnings("java:S3776")
+ @SuppressWarnings({
+ "java:S3776" // Cognitive complexity acceptable for constructor
finding logic
+ })
private BeanConstructor findBeanConstructor() {
var ap = beanContext.getAnnotationProvider();
var vis = beanContext.getBeanConstructorVisibility();
@@ -1068,7 +1076,9 @@ public class BeanMeta<T> {
*
* @return A list of {@link BeanMethod} objects representing all found
bean methods.
*/
- @SuppressWarnings("java:S3776")
+ @SuppressWarnings({
+ "java:S3776" // Cognitive complexity acceptable for bean method
finding logic
+ })
private List<BeanMethod> findBeanMethods() {
var l = new LinkedList<BeanMethod>();
var ap = beanContext.getAnnotationProvider();
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/BeanSession.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/BeanSession.java
index 60f7772ff6..210a68198f 100644
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/BeanSession.java
+++
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/BeanSession.java
@@ -1133,7 +1133,9 @@ public class BeanSession extends ContextSession {
* @param propertyNamer The property namer to use.
* @return The wrapped object.
*/
- @SuppressWarnings("java:S1172") // Parameter propertyNamer is unused
but kept for API consistency
+ @SuppressWarnings({
+ "java:S1172" // Parameter propertyNamer is unused but kept for
API consistency
+ })
public final <T> BeanMap<T> toBeanMap(T o, PropertyNamer propertyNamer)
{
return this.toBeanMap(o, (Class<T>)o.getClass());
}
@@ -1605,7 +1607,9 @@ public class BeanSession extends ContextSession {
return array;
}
- @SuppressWarnings("java:S3776") // Cognitive complexity is acceptable
for this type conversion method
+ @SuppressWarnings({
+ "java:S3776" // Cognitive complexity is acceptable for this
type conversion method
+ })
private <T> T convertToMapType(Object outer, Object value, ClassMeta<?>
from, ClassMeta<T> to) {
try {
if (from.isMap()) {
@@ -1637,7 +1641,9 @@ public class BeanSession extends ContextSession {
}
}
- @SuppressWarnings("java:S3776") // Cognitive complexity is acceptable
for this type conversion method
+ @SuppressWarnings({
+ "java:S3776" // Cognitive complexity is acceptable for this
type conversion method
+ })
private <T> T convertToCollectionType(Object outer, Object value,
ClassMeta<?> from, ClassMeta<T> to) {
try {
Collection l;
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/annotation/Schema.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/annotation/Schema.java
index 496144bbb9..ec0f28b8ea 100644
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/annotation/Schema.java
+++
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/annotation/Schema.java
@@ -98,7 +98,9 @@ import org.apache.juneau.oapi.*;
@Retention(RUNTIME)
@Repeatable(SchemaAnnotation.Array.class)
@ContextApply(SchemaAnnotation.Apply.class)
-@SuppressWarnings("java:S100") // Annotation methods use underscore suffix or
$ prefix to match JSON Schema keywords (e.g., default_, enum_, $ref)
+@SuppressWarnings({
+ "java:S100" // Annotation methods use underscore suffix or $ prefix to
match JSON Schema keywords (e.g., default_, enum_, $ref)
+})
public @interface Schema {
/**
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/annotation/SchemaAnnotation.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/annotation/SchemaAnnotation.java
index 20051579fa..53a36ce1fa 100644
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/annotation/SchemaAnnotation.java
+++
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/annotation/SchemaAnnotation.java
@@ -38,7 +38,9 @@ import org.apache.juneau.svl.*;
* Utility classes and methods for the {@link Schema @Schema} annotation.
*
*/
-@SuppressWarnings("java:S115") // Constants use UPPER_snakeCase convention
(e.g., PROP_additionalProperties)
+@SuppressWarnings({
+ "java:S115" // Constants use UPPER_snakeCase convention (e.g.,
PROP_additionalProperties)
+})
public class SchemaAnnotation {
// Property name constants
@@ -142,7 +144,9 @@ public class SchemaAnnotation {
* <li class='jm'>{@link
org.apache.juneau.BeanContext.Builder#annotations(Annotation...)}
* </ul>
*/
- @SuppressWarnings("java:S116")
+ @SuppressWarnings({
+ "java:S116" // Field names intentionally match JSON property
names
+ })
public static class Builder extends AppliedAnnotationObject.BuilderTMF {
private boolean aev;
@@ -233,7 +237,9 @@ public class SchemaAnnotation {
* @param value The new value for this property.
* @return This object.
*/
- @SuppressWarnings("java:S100") // Method name uses underscore
suffix to match JSON Schema keyword
+ @SuppressWarnings({
+ "java:S100" // Method name uses underscore suffix to
match JSON Schema keyword
+ })
public Builder const_(String...value) {
const_ = value;
return this;
@@ -245,7 +251,9 @@ public class SchemaAnnotation {
* @param value The new value for this property.
* @return This object.
*/
- @SuppressWarnings("java:S100") // Method name uses underscore
suffix to avoid Java keyword conflict
+ @SuppressWarnings({
+ "java:S100" // Method name uses underscore suffix to
avoid Java keyword conflict
+ })
public Builder default_(String...value) {
default_ = value;
return this;
@@ -257,7 +265,9 @@ public class SchemaAnnotation {
* @param value The new value for this property.
* @return This object.
*/
- @SuppressWarnings("java:S100") // Method name uses underscore
suffix to avoid Java keyword conflict
+ @SuppressWarnings({
+ "java:S100" // Method name uses underscore suffix to
avoid Java keyword conflict
+ })
public Builder else_(String...value) {
else_ = value;
return this;
@@ -269,7 +279,9 @@ public class SchemaAnnotation {
* @param value The new value for this property.
* @return This object.
*/
- @SuppressWarnings("java:S100") // Method name uses underscore
suffix to avoid Java keyword conflict
+ @SuppressWarnings({
+ "java:S100" // Method name uses underscore suffix to
avoid Java keyword conflict
+ })
public Builder enum_(String...value) {
enum_ = value;
return this;
@@ -281,7 +293,9 @@ public class SchemaAnnotation {
* @param value The new value for this property.
* @return This object.
*/
- @SuppressWarnings("java:S100") // Method name uses underscore
suffix to avoid Java keyword conflict
+ @SuppressWarnings({
+ "java:S100" // Method name uses underscore suffix to
avoid Java keyword conflict
+ })
public Builder if_(String...value) {
if_ = value;
return this;
@@ -293,7 +307,9 @@ public class SchemaAnnotation {
* @param value The new value for this property.
* @return This object.
*/
- @SuppressWarnings("java:S100") // Method name uses underscore
suffix to avoid Java keyword conflict
+ @SuppressWarnings({
+ "java:S100" // Method name uses underscore suffix to
avoid Java keyword conflict
+ })
public Builder then_(String...value) {
then_ = value;
return this;
@@ -305,7 +321,9 @@ public class SchemaAnnotation {
* @param value The new value for this property.
* @return This object.
*/
- @SuppressWarnings("java:S100") // Method name uses $ prefix to
match JSON Schema keyword
+ @SuppressWarnings({
+ "java:S100" // Method name uses $ prefix to match JSON
Schema keyword
+ })
public Builder $comment(String...value) {
this.$comment = value;
return this;
@@ -317,7 +335,9 @@ public class SchemaAnnotation {
* @param value The new value for this property.
* @return This object.
*/
- @SuppressWarnings("java:S100") // Method name uses $ prefix to
match JSON Schema keyword
+ @SuppressWarnings({
+ "java:S100" // Method name uses $ prefix to match JSON
Schema keyword
+ })
public Builder $defs(String...value) {
this.$defs = value;
return this;
@@ -329,7 +349,9 @@ public class SchemaAnnotation {
* @param value The new value for this property.
* @return This object.
*/
- @SuppressWarnings("java:S100") // Method name uses $ prefix to
match JSON Schema keyword
+ @SuppressWarnings({
+ "java:S100" // Method name uses $ prefix to match JSON
Schema keyword
+ })
public Builder $id(String value) {
this.$id = value;
return this;
@@ -341,7 +363,9 @@ public class SchemaAnnotation {
* @param value The new value for this property.
* @return This object.
*/
- @SuppressWarnings("java:S100") // Method name uses $ prefix to
match JSON Schema keyword
+ @SuppressWarnings({
+ "java:S100" // Method name uses $ prefix to match JSON
Schema keyword
+ })
public Builder $ref(String value) {
this.$ref = value;
return this;
@@ -1120,7 +1144,9 @@ public class SchemaAnnotation {
}
- @SuppressWarnings("java:S116")
+ @SuppressWarnings({
+ "java:S116" // Field names intentionally match JSON property
names
+ })
private static class Object extends AppliedOnClassAnnotationObject
implements Schema {
private final String[] description;
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/collections/JsonList.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/collections/JsonList.java
index d1d61b281e..7401a6f895 100644
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/collections/JsonList.java
+++
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/collections/JsonList.java
@@ -110,13 +110,19 @@ import org.apache.juneau.serializer.*;
*
* @serial exclude
*/
-@SuppressWarnings("java:S110")
+@SuppressWarnings({
+ "java:S110" // Class has many fields, acceptable for collection
implementation
+})
public class JsonList extends LinkedList<Object> {
- @SuppressWarnings("java:S110")
+ @SuppressWarnings({
+ "java:S110" // Inner class has many fields, acceptable for
collection implementation
+ })
private static class UnmodifiableJsonList extends JsonList {
private static final long serialVersionUID = 1L;
- @SuppressWarnings("synthetic-access")
+ @SuppressWarnings({
+ "synthetic-access" // Access to outer class members is
intentional
+ })
UnmodifiableJsonList(JsonList contents) {
if (nn(contents))
contents.forEach(super::add);
@@ -147,7 +153,9 @@ public class JsonList extends LinkedList<Object> {
*
* @serial exclude
*/
- @SuppressWarnings("java:S110")
+ @SuppressWarnings({
+ "java:S110" // Anonymous class has many fields, acceptable for
collection implementation
+ })
public static final JsonList EMPTY_LIST = new JsonList() {
private static final long serialVersionUID = 1L;
@@ -304,7 +312,9 @@ public class JsonList extends LinkedList<Object> {
* @return A new list or <jk>null</jk> if the input was <jk>null</jk>.
* @throws ParseException Malformed input encountered.
*/
- @SuppressWarnings("java:S1172") // Parameter p is unused but kept for
API consistency
+ @SuppressWarnings({
+ "java:S1172" // Parameter p is unused but kept for API
consistency
+ })
public static JsonList ofText(Reader in, Parser p) throws
ParseException {
return in == null ? null : new JsonList(in);
}
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/collections/JsonMap.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/collections/JsonMap.java
index 09ef01a869..4709df0f9b 100644
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/collections/JsonMap.java
+++
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/collections/JsonMap.java
@@ -108,7 +108,9 @@ public class JsonMap extends LinkedHashMap<String,Object> {
private static class UnmodifiableJsonMap extends JsonMap {
private static final long serialVersionUID = 1L;
- @SuppressWarnings("synthetic-access")
+ @SuppressWarnings({
+ "synthetic-access" // Access to outer class members is
intentional
+ })
UnmodifiableJsonMap(JsonMap contents) {
if (nn(contents))
contents.forEach(super::put);
@@ -283,7 +285,9 @@ public class JsonMap extends LinkedHashMap<String,Object> {
* @return A new map or <jk>null</jk> if the input was <jk>null</jk>.
* @throws ParseException Malformed input encountered.
*/
- @SuppressWarnings("java:S1172") // Parameter p is unused but kept for
API consistency
+ @SuppressWarnings({
+ "java:S1172" // Parameter p is unused but kept for API
consistency
+ })
public static JsonMap ofText(Reader in, Parser p) throws ParseException
{
return in == null ? null : new JsonMap(in);
}
@@ -556,7 +560,9 @@ public class JsonMap extends LinkedHashMap<String,Object> {
* @throws ClassCastException
* If the <js>"_type"</js> entry is present and not assignable
from <c>type</c>
*/
- @SuppressWarnings("unchecked")
+ @SuppressWarnings({
+ "unchecked" // Type erasure requires unchecked casts
+ })
public <T> T cast(Class<T> type) {
BeanSession bs = bs();
ClassMeta<?> c2 = bs.getClassMeta(type);
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/cp/BasicBeanStore.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/cp/BasicBeanStore.java
index 2ccbad66ec..38c4347026 100644
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/cp/BasicBeanStore.java
+++
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/cp/BasicBeanStore.java
@@ -78,7 +78,9 @@ import org.apache.juneau.commons.reflect.*;
* </ul>
*
*/
-@SuppressWarnings("java:S115")
+@SuppressWarnings({
+ "java:S115" // Constants use UPPER_snakeCase convention
+})
public class BasicBeanStore {
// Argument name constants for assertArgNotNull
@@ -387,7 +389,9 @@ public class BasicBeanStore {
* @param beanType The type of bean to return.
* @return The bean.
*/
- @SuppressWarnings("unchecked")
+ @SuppressWarnings({
+ "unchecked" // Type erasure requires unchecked cast
+ })
public <T> Optional<T> getBean(Class<T> beanType) {
try (var x = lock.read()) {
var e = (Entry<T>)unnamedEntries.get(beanType);
@@ -407,7 +411,9 @@ public class BasicBeanStore {
* @param name The bean name. Can be <jk>null</jk>.
* @return The bean.
*/
- @SuppressWarnings("unchecked")
+ @SuppressWarnings({
+ "unchecked" // Type erasure requires unchecked cast
+ })
public <T> Optional<T> getBean(Class<T> beanType, String name) {
try (var x = lock.read()) {
var e = (Entry<T>)entries.stream().filter(x2 ->
x2.matches(beanType, name)).findFirst().orElse(null);
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/html/HtmlSerializerSession.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/html/HtmlSerializerSession.java
index 3e16366aca..c459329817 100644
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/html/HtmlSerializerSession.java
+++
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/html/HtmlSerializerSession.java
@@ -397,7 +397,9 @@ public class HtmlSerializerSession extends
XmlSerializerSession {
return bm.keySet().toArray(new String[bm.size()]);
}
- @SuppressWarnings("java:S3776")
+ @SuppressWarnings({
+ "java:S3776" // Cognitive complexity acceptable for bean map
serialization
+ })
private void serializeBeanMap(XmlWriter out, BeanMap<?> m, ClassMeta<?>
eType, BeanPropertyMeta ppMeta) throws SerializeException {
HtmlClassMeta cHtml = getHtmlClassMeta(m.getClassMeta());
@@ -655,7 +657,9 @@ public class HtmlSerializerSession extends
XmlSerializerSession {
out.ie(i).eTag(TAG_table).nl(i);
}
- @SuppressWarnings("rawtypes")
+ @SuppressWarnings({
+ "rawtypes" // Raw types necessary for generic type handling
+ })
private void serializeMapEntry(XmlWriter out, Map.Entry e, ClassMeta<?>
keyType, ClassMeta<?> valueType, int i, BeanPropertyMeta ppMeta) throws
SerializeException {
Object key = generalize(e.getKey(), keyType);
Object value = null;
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/httppart/HttpPartSchema.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/httppart/HttpPartSchema.java
index 583e2dab34..4d41325ecd 100644
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/httppart/HttpPartSchema.java
+++
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/httppart/HttpPartSchema.java
@@ -142,7 +142,9 @@ public class HttpPartSchema {
/**
* Builder class.
*/
- @SuppressWarnings("java:S116")
+ @SuppressWarnings({
+ "java:S116" // Field names intentionally match JSON property
names
+ })
public static class Builder {
String name;
String default_;
@@ -191,7 +193,9 @@ public class HttpPartSchema {
* The new value for this property.
* @return This object.
*/
- @SuppressWarnings("java:S100") // Method name uses underscore
suffix to match JSON Schema keyword
+ @SuppressWarnings({
+ "java:S100" // Method name uses underscore suffix to
match JSON Schema keyword
+ })
public Builder const_(String value) {
const_ = value;
return this;
@@ -218,7 +222,9 @@ public class HttpPartSchema {
* <br>Ignored if value is <jk>null</jk>.
* @return This object.
*/
- @SuppressWarnings("java:S100") // Method name uses underscore
suffix to avoid Java keyword conflict
+ @SuppressWarnings({
+ "java:S100" // Method name uses underscore suffix to
avoid Java keyword conflict
+ })
public Builder default_(String value) {
if (ne(value))
default_ = value;
@@ -245,7 +251,9 @@ public class HttpPartSchema {
* <br>Ignored if value is <jk>null</jk> or an empty set.
* @return This object.
*/
- @SuppressWarnings("java:S100") // Method name uses underscore
suffix to avoid Java keyword conflict
+ @SuppressWarnings({
+ "java:S100" // Method name uses underscore suffix to
avoid Java keyword conflict
+ })
public Builder enum_(Set<String> value) {
if (nn(value) && ! value.isEmpty())
enum_ = value;
@@ -263,7 +271,9 @@ public class HttpPartSchema {
* <br>Ignored if value is empty.
* @return This object.
*/
- @SuppressWarnings("java:S100") // Method name uses underscore
suffix to avoid Java keyword conflict
+ @SuppressWarnings({
+ "java:S100" // Method name uses underscore suffix to
avoid Java keyword conflict
+ })
public Builder enum_(String...values) {
return enum_(set(values));
}
@@ -2916,7 +2926,9 @@ public class HttpPartSchema {
* @return This object.
* @since 9.2.0
*/
- @SuppressWarnings("java:S3776")
+ @SuppressWarnings({
+ "java:S3776" // Cognitive complexity acceptable for
Jakarta validation application
+ })
Builder applyJakartaValidation(Annotation a) {
String simpleName = cns(a.annotationType());
@@ -3701,7 +3713,9 @@ public class HttpPartSchema {
final Number exclusiveMaximumValue;
final Number exclusiveMinimumValue;
- @SuppressWarnings("java:S3776")
+ @SuppressWarnings({
+ "java:S3776" // Cognitive complexity acceptable for schema
construction
+ })
HttpPartSchema(Builder b) {
name = b.name;
default_ = b.default_;
@@ -4256,7 +4270,9 @@ public class HttpPartSchema {
* @return The same object passed in.
* @throws SchemaValidationException if the specified pre-parsed input
does not validate against this schema.
*/
- @SuppressWarnings("java:S3776")
+ @SuppressWarnings({
+ "java:S3776" // Cognitive complexity acceptable for input
validation
+ })
public String validateInput(String in) throws SchemaValidationException
{
if (! isValidRequired(in))
throw new SchemaValidationException("No value
specified.");
@@ -4288,7 +4304,9 @@ public class HttpPartSchema {
* @return The same object passed in.
* @throws SchemaValidationException if the specified parsed output
does not validate against this schema.
*/
- @SuppressWarnings("java:S3776")
+ @SuppressWarnings({
+ "java:S3776" // Cognitive complexity acceptable for output
validation
+ })
public <T> T validateOutput(T o, BeanContext bc) throws
SchemaValidationException {
if (o == null) {
if (! isValidRequired(o))
@@ -4519,7 +4537,9 @@ public class HttpPartSchema {
return x.isEmpty() || x.matches("^(/[^/]*)*$");
}
- @SuppressWarnings("java:S3776")
+ @SuppressWarnings({
+ "java:S3776" // Cognitive complexity acceptable for maximum
validation
+ })
private boolean isValidMaximum(Number x) {
// Check Draft 2020-12 exclusiveMaximumValue first (takes
precedence)
if (nn(exclusiveMaximumValue)) {
@@ -4564,7 +4584,9 @@ public class HttpPartSchema {
return maxProperties == null || x.size() <= maxProperties;
}
- @SuppressWarnings("java:S3776")
+ @SuppressWarnings({
+ "java:S3776" // Cognitive complexity acceptable for minimum
validation
+ })
private boolean isValidMinimum(Number x) {
// Check Draft 2020-12 exclusiveMinimumValue first (takes
precedence)
if (nn(exclusiveMinimumValue)) {
@@ -4673,7 +4695,9 @@ public class HttpPartSchema {
return true;
}
- @SuppressWarnings("unused")
+ @SuppressWarnings({
+ "unused" // Method kept for future use or API completeness
+ })
private static boolean isValidUri(String x) {
// RFC 3986 URI validation
try {
@@ -4684,7 +4708,9 @@ public class HttpPartSchema {
}
}
- @SuppressWarnings("unused")
+ @SuppressWarnings({
+ "unused" // Method kept for future use or API completeness
+ })
private static boolean isValidUriReference(String x) {
// RFC 3986 URI reference (can be relative)
try {
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/json/JsonParserSession.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/json/JsonParserSession.java
index 47eb57c3e8..c7aecd4829 100644
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/json/JsonParserSession.java
+++
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/json/JsonParserSession.java
@@ -48,7 +48,11 @@ import org.apache.juneau.swap.*;
* </ul>
*/
-@SuppressWarnings({ "unchecked", "rawtypes", "resource" })
+@SuppressWarnings({
+ "unchecked", // Type erasure requires unchecked casts
+ "rawtypes", // Raw types necessary for generic type handling
+ "resource" // ParserReader is managed by caller
+})
public class JsonParserSession extends ReaderParserSession {
/**
@@ -195,7 +199,9 @@ public class JsonParserSession extends ReaderParserSession {
ctx = builder.ctx;
}
- @SuppressWarnings("java:S3776")
+ @SuppressWarnings({
+ "java:S3776" // Cognitive complexity acceptable for parser
state machine
+ })
private <T> T parseAnything(ClassMeta<?> eType, ParserReader r, Object
outer, BeanPropertyMeta pMeta) throws IOException, ParseException,
ExecutableException {
if (eType == null)
@@ -357,7 +363,9 @@ public class JsonParserSession extends ReaderParserSession {
throw new ParseException(this, "Could not find the end of the
field name.");
}
- @SuppressWarnings("java:S3776")
+ @SuppressWarnings({
+ "java:S3776" // Cognitive complexity acceptable for parser
state machine
+ })
private <T> BeanMap<T> parseIntoBeanMap2(ParserReader r, BeanMap<T> m)
throws IOException, ParseException, ExecutableException {
// S1: Looking for outer {
@@ -622,7 +630,9 @@ public class JsonParserSession extends ReaderParserSession {
return parseNumber(r, r.parseNumberString(), type);
}
- @SuppressWarnings("java:S3776")
+ @SuppressWarnings({
+ "java:S3776" // Cognitive complexity acceptable for number
parsing logic
+ })
private Number parseNumber(ParserReader r, String s, Class<? extends
Number> type) throws ParseException {
// JSON has slightly different number rules from Java.
@@ -754,7 +764,9 @@ public class JsonParserSession extends ReaderParserSession {
* Doesn't actually parse anything, but when positioned at the
beginning of comment,
* it will move the pointer to the last character in the comment.
*/
- @SuppressWarnings("java:S3776")
+ @SuppressWarnings({
+ "java:S3776" // Cognitive complexity acceptable for comment
parsing logic
+ })
private void skipComments(ParserReader r) throws ParseException,
IOException {
int c = r.read();
// "/* */" style comments
@@ -820,7 +832,9 @@ public class JsonParserSession extends ReaderParserSession {
* Doesn't actually parse anything, but moves the position beyond the
construct "{wrapperAttr:" when
* the @Json(wrapperAttr) annotation is used on a class.
*/
- @SuppressWarnings("java:S3776")
+ @SuppressWarnings({
+ "java:S3776" // Cognitive complexity acceptable for wrapper
attribute parsing
+ })
private void skipWrapperAttrStart(ParserReader r, String wrapperAttr)
throws IOException, ParseException {
// S1: Looking for outer '{'
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/objecttools/NumberMatcherFactory.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/objecttools/NumberMatcherFactory.java
index 15bed7ce51..21f4d61513 100644
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/objecttools/NumberMatcherFactory.java
+++
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/objecttools/NumberMatcherFactory.java
@@ -43,7 +43,9 @@ import org.apache.juneau.commons.lang.*;
* <li class='link'><a class="doclink"
href="https://juneau.apache.org/docs/topics/ObjectTools">Object Tools</a>
* </ul>
*/
-@SuppressWarnings("java:S6541") // Stateless utility, singleton for convenience
+@SuppressWarnings({
+ "java:S6541" // Stateless utility, singleton for convenience
+})
public class NumberMatcherFactory extends MatcherFactory {
/**
@@ -311,7 +313,9 @@ public class NumberMatcherFactory extends MatcherFactory {
/**
* Default reusable matcher.
*/
- @SuppressWarnings("java:S6541") // Stateless factory, singleton for
convenience
+ @SuppressWarnings({
+ "java:S6541" // Stateless factory, singleton for convenience
+ })
public static final NumberMatcherFactory DEFAULT = new
NumberMatcherFactory();
@Override
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/parser/Parser.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/parser/Parser.java
index e2e6e8a74a..35874684e5 100644
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/parser/Parser.java
+++
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/parser/Parser.java
@@ -138,7 +138,9 @@ import org.apache.juneau.xml.*;
* </ul>
*/
-@SuppressWarnings("java:S115") // Constants use UPPER_snakeCase convention
(e.g., PROP_autoCloseStreams)
+@SuppressWarnings({
+ "java:S115" // Constants use UPPER_snakeCase convention (e.g.,
PROP_autoCloseStreams)
+})
public class Parser extends BeanContextable {
// Property name constants
@@ -970,7 +972,9 @@ public class Parser extends BeanContextable {
* Represents no Parser.
*/
public abstract static class Null extends Parser {
- @SuppressWarnings("java:S1186") // Constructor required by
Parser parent class, even though Null is abstract and never instantiated
directly
+ @SuppressWarnings({
+ "java:S1186" // Constructor required by Parser parent
class, even though Null is abstract and never instantiated directly
+ })
private Null(Builder builder) {
super(builder);
}
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/parser/ParserReader.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/parser/ParserReader.java
index f5a3e36144..216d87a4c4 100644
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/parser/ParserReader.java
+++
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/parser/ParserReader.java
@@ -42,7 +42,10 @@ import org.apache.juneau.commons.io.*;
* </ul>
*/
-@SuppressWarnings({ "resource", "java:S115" }) // Constants use
UPPER_snakeCase convention (e.g., MSG_bufferUnderflow)
+@SuppressWarnings({
+ "resource", // ParserReader is managed by caller
+ "java:S115" // Constants use UPPER_snakeCase convention (e.g.,
MSG_bufferUnderflow)
+})
public class ParserReader extends Reader implements Positionable {
// Error message constants
@@ -377,7 +380,9 @@ public class ParserReader extends Reader implements
Positionable {
return this;
}
- @SuppressWarnings("java:S3776")
+ @SuppressWarnings({
+ "java:S3776" // Cognitive complexity acceptable for buffer
reading logic
+ })
private final int readFromBuff() throws IOException {
while (iCurrent >= iEnd) {
if (endReached)
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/parser/ParserSet.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/parser/ParserSet.java
index b29f703771..21db79aabf 100644
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/parser/ParserSet.java
+++
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/parser/ParserSet.java
@@ -396,7 +396,9 @@ public class ParserSet {
return ci.newInstance();
// Check for builder.
- @SuppressWarnings("unchecked")
+ @SuppressWarnings({
+ "unchecked" // Type erasure requires
unchecked casts
+ })
Parser.Builder b =
Parser.createParserBuilder((Class<? extends Parser>)o);
if (nn(bcBuilder))
b.beanContext(bcBuilder);
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/serializer/Serializer.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/serializer/Serializer.java
index 9203553c95..e1ea855975 100644
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/serializer/Serializer.java
+++
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/serializer/Serializer.java
@@ -70,7 +70,9 @@ import org.apache.juneau.soap.*;
* </ul>
*/
-@SuppressWarnings("java:S115")
+@SuppressWarnings({
+ "java:S115" // Constants use UPPER_snakeCase convention
+})
public class Serializer extends BeanTraverseContext {
// Property name constants
@@ -1266,7 +1268,9 @@ public class Serializer extends BeanTraverseContext {
* Represents no Serializer.
*/
public abstract static class Null extends Serializer {
- @SuppressWarnings("java:S1186") // Constructor required by
Serializer parent class, even though Null is abstract and never instantiated
directly
+ @SuppressWarnings({
+ "java:S1186" // Constructor required by Serializer
parent class, even though Null is abstract and never instantiated directly
+ })
private Null(Builder builder) {
super(builder);
}
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/serializer/SerializerSet.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/serializer/SerializerSet.java
index 17ffb8aff3..230a52ccab 100644
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/serializer/SerializerSet.java
+++
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/serializer/SerializerSet.java
@@ -391,7 +391,9 @@ public class SerializerSet {
return ci.newInstance();
// Check for builder create method.
- @SuppressWarnings("unchecked")
+ @SuppressWarnings({
+ "unchecked" // Type erasure requires
unchecked casts
+ })
Serializer.Builder b =
Serializer.createSerializerBuilder((Class<? extends Serializer>)o);
if (nn(bcBuilder))
b.beanContext(bcBuilder);
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/svl/VarResolverSession.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/svl/VarResolverSession.java
index 5d48599325..2d8e57d783 100644
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/svl/VarResolverSession.java
+++
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/svl/VarResolverSession.java
@@ -94,7 +94,9 @@ public class VarResolverSession {
* Checks to see if string is of the simple form "$X{...}" with no
embedded variables.
* This is a common case, and we can avoid using StringWriters.
*/
- @SuppressWarnings("java:S3776")
+ @SuppressWarnings({
+ "java:S3776" // Cognitive complexity acceptable for variable
resolution state machine
+ })
private static boolean isSimpleVar(String s) {
// S1: Not in variable, looking for $
// S2: Found $, Looking for {
@@ -185,7 +187,9 @@ public class VarResolverSession {
* The new string with all variables resolved, or the same string
if no variables were found.
* <br>Returns <jk>null</jk> if the input was <jk>null</jk>.
*/
- @SuppressWarnings("java:S3776")
+ @SuppressWarnings({
+ "java:S3776" // Cognitive complexity acceptable for variable
resolution
+ })
public String resolve(String s) {
if (s == null || s.isEmpty() || (s.indexOf('$') == -1 &&
s.indexOf('\\') == -1))
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/swaps/TemporalSwap.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/swaps/TemporalSwap.java
index 379a07dd58..47741dcffa 100644
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/swaps/TemporalSwap.java
+++
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/swaps/TemporalSwap.java
@@ -373,7 +373,9 @@ public class TemporalSwap extends StringSwap<Temporal> {
return formatter.format(o);
}
- @SuppressWarnings("unchecked")
+ @SuppressWarnings({
+ "unchecked" // Type erasure requires unchecked casts
+ })
@Override /* Overridden from ObjectSwap */
public Temporal unswap(BeanSession session, String f, ClassMeta<?>
hint) throws Exception {
if (f == null)
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/uon/UonParserSession.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/uon/UonParserSession.java
index bcc272bd29..93b11a7785 100644
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/uon/UonParserSession.java
+++
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/uon/UonParserSession.java
@@ -574,7 +574,9 @@ public class UonParserSession extends ReaderParserSession
implements HttpPartPar
return null; // Unreachable.
}
- @SuppressWarnings("java:S3776")
+ @SuppressWarnings({
+ "java:S3776" // Cognitive complexity acceptable for parser
state machine
+ })
private <E> Collection<E> parseIntoCollection(UonReader r,
Collection<E> l, ClassMeta<E> type, boolean isUrlParamValue, BeanPropertyMeta
pMeta)
throws IOException, ParseException, ExecutableException {
@@ -610,7 +612,9 @@ public class UonParserSession extends ReaderParserSession
implements HttpPartPar
if (c == ')') {
if (state == S2) {
// argIndex++ increment
is necessary for expression evaluation to get correct argument index, even
though incremented value is unused after return
-
@SuppressWarnings("java:S1854")
+ @SuppressWarnings({
+ "java:S1854" //
argIndex++ increment is necessary for expression evaluation to get correct
argument index, even though incremented value is unused after return
+ })
var argIdx = argIndex;
argIndex++;
l.add((E)parseAnything(type.isArgs() ? type.getArg(argIdx) :
type.getElementType(), r.unread(), l, false, pMeta));
@@ -666,7 +670,9 @@ public class UonParserSession extends ReaderParserSession
implements HttpPartPar
return null; // Unreachable.
}
- @SuppressWarnings("java:S3776")
+ @SuppressWarnings({
+ "java:S3776" // Cognitive complexity acceptable for parser
state machine
+ })
private <K,V> Map<K,V> parseIntoMap(UonReader r, Map<K,V> m,
ClassMeta<K> keyType, ClassMeta<V> valueType, BeanPropertyMeta pMeta) throws
IOException, ParseException, ExecutableException {
if (keyType == null)
@@ -875,7 +881,9 @@ public class UonParserSession extends ReaderParserSession
implements HttpPartPar
* @throws IOException Exception thrown by underlying stream.
* @throws ParseException Attribute name was malformed.
*/
- @SuppressWarnings("java:S3776")
+ @SuppressWarnings({
+ "java:S3776" // Cognitive complexity acceptable for parser
state machine
+ })
protected final String parseAttrName(UonReader r, boolean encoded)
throws IOException, ParseException {
// If string is of form 'xxx', we're looking for ' at the end.
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/urlencoding/UrlEncodingParserSession.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/urlencoding/UrlEncodingParserSession.java
index 1751c6bcda..3f9cd17594 100644
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/urlencoding/UrlEncodingParserSession.java
+++
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/urlencoding/UrlEncodingParserSession.java
@@ -53,7 +53,9 @@ public class UrlEncodingParserSession extends
UonParserSession {
/**
* Builder class.
*/
- @SuppressWarnings("java:S110")
+ @SuppressWarnings({
+ "java:S110" // Builder class has many fields, acceptable for
builder pattern
+ })
public static class Builder extends UonParserSession.Builder {
private UrlEncodingParser ctx;
@@ -211,7 +213,9 @@ public class UrlEncodingParserSession extends
UonParserSession {
return false;
}
- @SuppressWarnings("java:S3776")
+ @SuppressWarnings({
+ "java:S3776" // Cognitive complexity acceptable for parser
state machine
+ })
private <T> T parseAnything(ClassMeta<T> eType, UonReader r, Object
outer) throws IOException, ParseException, ExecutableException {
if (eType == null)
@@ -419,7 +423,9 @@ public class UrlEncodingParserSession extends
UonParserSession {
return null; // Unreachable.
}
- @SuppressWarnings("java:S3776")
+ @SuppressWarnings({
+ "java:S3776" // Cognitive complexity acceptable for parser
state machine
+ })
private <K,V> Map<K,V> parseIntoMap2(UonReader r, Map<K,V> m,
ClassMeta<?> type, Object outer) throws IOException, ParseException,
ExecutableException {
var keyType = (ClassMeta<K>)(type.isArgs() ||
type.isCollectionOrArray() ? getClassMeta(Integer.class) : type.getKeyType());
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xml/XmlParserSession.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xml/XmlParserSession.java
index ba4076ff4a..4b7ebce8e2 100644
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xml/XmlParserSession.java
+++
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xml/XmlParserSession.java
@@ -554,7 +554,9 @@ public class XmlParserSession extends ReaderParserSession {
return l;
}
- @SuppressWarnings("java:S3776")
+ @SuppressWarnings({
+ "java:S3776" // Cognitive complexity acceptable for parser
state machine
+ })
private <K,V> Map<K,V> parseIntoMap(XmlReader r, Map<K,V> m,
ClassMeta<K> keyType, ClassMeta<V> valueType, BeanPropertyMeta pMeta)
throws IOException, ParseException, ExecutableException,
XMLStreamException {
int depth = 0;
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xml/XmlSerializerSession.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xml/XmlSerializerSession.java
index 562f663d7a..6eb4d0372b 100644
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xml/XmlSerializerSession.java
+++
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xml/XmlSerializerSession.java
@@ -191,7 +191,9 @@ public class XmlSerializerSession extends
WriterSerializerSession {
/**
* Identifies what the contents were of a serialized bean.
*/
- @SuppressWarnings("javadoc")
+ @SuppressWarnings({
+ "javadoc" // Enum values are self-documenting
+ })
public enum ContentResult {
CR_VOID, // No content...append "/>" to the start tag.
CR_EMPTY, // No content...append "/>" to the start tag if
XML, "/></end>" if HTML.
diff --git
a/juneau-microservice/juneau-microservice-core/src/main/java/org/apache/juneau/microservice/Microservice.java
b/juneau-microservice/juneau-microservice-core/src/main/java/org/apache/juneau/microservice/Microservice.java
index 76e24ef397..97db431793 100755
---
a/juneau-microservice/juneau-microservice-core/src/main/java/org/apache/juneau/microservice/Microservice.java
+++
b/juneau-microservice/juneau-microservice-core/src/main/java/org/apache/juneau/microservice/Microservice.java
@@ -279,7 +279,9 @@ public class Microservice implements ConfigEventListener {
* @return This object.
* @throws ExecutableException Exception occurred on invoked
constructor/method/field.
*/
- @SuppressWarnings("unchecked")
+ @SuppressWarnings({
+ "unchecked" // Type erasure requires unchecked cast for
varargs
+ })
public Builder consoleCommands(Class<? extends
ConsoleCommand>...consoleCommands) throws ExecutableException {
try {
for (var cc : consoleCommands)
@@ -458,7 +460,9 @@ public class Microservice implements ConfigEventListener {
* @param vars The set of variables to append to the var
resolver builder.
* @return This object.
*/
- @SuppressWarnings("unchecked")
+ @SuppressWarnings({
+ "unchecked" // Type erasure requires unchecked cast for
varargs
+ })
public Builder vars(Class<? extends Var>...vars) {
varResolver.vars(vars);
return this;
@@ -561,7 +565,10 @@ public class Microservice implements ConfigEventListener {
* @throws IOException Problem occurred reading file.
* @throws ParseException Malformed input encountered.
*/
- @SuppressWarnings({ "resource", "java:S3776" })
+ @SuppressWarnings({
+ "resource", // Resources are managed by caller
+ "java:S3776" // Cognitive complexity acceptable for
microservice initialization
+ })
protected Microservice(Builder builder) throws IOException,
ParseException {
setInstance(this);
this.builder = builder.copy();
@@ -1036,7 +1043,9 @@ public class Microservice implements ConfigEventListener {
* @param messageKey The message key.
* @param args Optional {@link MessageFormat}-style arguments.
*/
- @SuppressWarnings("resource")
+ @SuppressWarnings({
+ "resource" // Resource is managed by caller
+ })
public void out(Messages mb, String messageKey, Object...args) {
var msg = mb.getString(messageKey, args);
if (consoleEnabled)
diff --git
a/juneau-microservice/juneau-microservice-jetty/src/main/java/org/apache/juneau/microservice/jetty/JettyMicroservice.java
b/juneau-microservice/juneau-microservice-jetty/src/main/java/org/apache/juneau/microservice/jetty/JettyMicroservice.java
index 9fc527365d..7e04a2694c 100644
---
a/juneau-microservice/juneau-microservice-jetty/src/main/java/org/apache/juneau/microservice/jetty/JettyMicroservice.java
+++
b/juneau-microservice/juneau-microservice-jetty/src/main/java/org/apache/juneau/microservice/jetty/JettyMicroservice.java
@@ -62,7 +62,9 @@ import jakarta.servlet.*;
* <li class='link'><a class="doclink"
href="https://juneau.apache.org/docs/topics/JuneauMicroserviceJettyBasics">juneau-microservice-jetty
Basics</a>
* </ul>
*/
-@SuppressWarnings("java:S115") // Constants use UPPER_snakeCase convention
(e.g., KEY_SERVLET_CONTEXT_HANDLER)
+@SuppressWarnings({
+ "java:S115" // Constants use UPPER_snakeCase convention (e.g.,
KEY_SERVLET_CONTEXT_HANDLER)
+})
public class JettyMicroservice extends Microservice {
/**
@@ -372,7 +374,9 @@ public class JettyMicroservice extends Microservice {
}
@Override /* Overridden from MicroserviceBuilder */
- @SuppressWarnings("unchecked")
+ @SuppressWarnings({
+ "unchecked" // Type erasure requires unchecked cast for
varargs
+ })
public Builder vars(Class<? extends Var>...vars) {
super.vars(vars);
return this;
@@ -540,7 +544,9 @@ public class JettyMicroservice extends Microservice {
* @throws IOException File could not be read.
* @throws ExecutableException Exception occurred on invoked
constructor/method/field.
*/
- @SuppressWarnings("java:S3776")
+ @SuppressWarnings({
+ "java:S3776" // Cognitive complexity acceptable for server
creation logic
+ })
public Server createServer() throws ParseException, IOException,
ExecutableException {
listener.onCreateServer(this);
diff --git
a/juneau-rest/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/ResponseHeader.java
b/juneau-rest/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/ResponseHeader.java
index 43a7a43a5b..5571056d00 100644
---
a/juneau-rest/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/ResponseHeader.java
+++
b/juneau-rest/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/ResponseHeader.java
@@ -164,7 +164,9 @@ public class ResponseHeader extends BasicHeader {
* @param args The type parameters.
* @return This object.
*/
- @SuppressWarnings("unchecked")
+ @SuppressWarnings({
+ "unchecked" // Type erasure requires unchecked casts
+ })
public <T> RestResponse as(Value<T> value, Type type, Type...args) {
value.set((T)as(type, args).orElse(null));
return response;
diff --git
a/juneau-rest/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/RestClient.java
b/juneau-rest/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/RestClient.java
index 852f769d0b..b5000b1eef 100644
---
a/juneau-rest/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/RestClient.java
+++
b/juneau-rest/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/RestClient.java
@@ -3017,7 +3017,9 @@ public class RestClient extends BeanContextable
implements HttpClient, Closeable
* <br>Can contain <jk>null</jk> values (ignored).
* @return This object.
*/
- @SuppressWarnings("java:S3776")
+ @SuppressWarnings({
+ "java:S3776" // Cognitive complexity acceptable for
interceptor configuration
+ })
public Builder interceptors(Object...value) {
List<RestCallInterceptor> l = list();
for (var o : value) {
@@ -3904,7 +3906,9 @@ public class RestClient extends BeanContextable
implements HttpClient, Closeable
* <br>The default value is {@link JsonParser#DEFAULT}.
* @return This object.
*/
- @SuppressWarnings("unchecked")
+ @SuppressWarnings({
+ "unchecked" // Type erasure requires unchecked casts
+ })
public Builder parser(Class<? extends Parser> value) {
return parsers(value);
}
@@ -3987,7 +3991,9 @@ public class RestClient extends BeanContextable
implements HttpClient, Closeable
* <br>The default value is {@link JsonParser#DEFAULT}.
* @return This object.
*/
- @SuppressWarnings("unchecked")
+ @SuppressWarnings({
+ "unchecked" // Type erasure requires unchecked casts
+ })
public Builder parsers(Class<? extends Parser>...value) {
assertArgNoNulls(ARG_value, value);
parsers().add(value);
@@ -4766,7 +4772,9 @@ public class RestClient extends BeanContextable
implements HttpClient, Closeable
* <br>The default is {@link JsonSerializer}.
* @return This object.
*/
- @SuppressWarnings("unchecked")
+ @SuppressWarnings({
+ "unchecked" // Type erasure requires unchecked casts
+ })
public Builder serializer(Class<? extends Serializer> value) {
return serializers(value);
}
@@ -4849,7 +4857,9 @@ public class RestClient extends BeanContextable
implements HttpClient, Closeable
* <br>The default is {@link JsonSerializer}.
* @return This object.
*/
- @SuppressWarnings("unchecked")
+ @SuppressWarnings({
+ "unchecked" // Type erasure requires unchecked casts
+ })
public Builder serializers(Class<? extends Serializer>...value)
{
assertArgNoNulls(ARG_value, value);
serializers().add(value);
@@ -5529,7 +5539,9 @@ public class RestClient extends BeanContextable
implements HttpClient, Closeable
*
* @return This object.
*/
- @SuppressWarnings("unchecked")
+ @SuppressWarnings({
+ "unchecked" // Type erasure requires unchecked casts
+ })
public Builder universal() {
// @formatter:off
return
@@ -6292,7 +6304,9 @@ public class RestClient extends BeanContextable
implements HttpClient, Closeable
* as a parsed object.
* @throws RestCallException REST call failed.
*/
- @SuppressWarnings("java:S3776")
+ @SuppressWarnings({
+ "java:S3776" // Cognitive complexity acceptable for callback
parsing state machine
+ })
public RestRequest callback(String callString) throws RestCallException
{
callString = emptyIfNull(callString);
@@ -6333,7 +6347,9 @@ public class RestClient extends BeanContextable
implements HttpClient, Closeable
if (! isWhitespace(c)) {
mark = i;
// State machine requires state
transition to S5, SonarLint reports false positive
- @SuppressWarnings("java:S1854")
+ @SuppressWarnings({
+ "java:S1854" // State machine
requires state transition to S5, SonarLint reports false positive
+ })
var unused = (state = S5);
}
} else /* (state == S5) */ {
@@ -6970,8 +6986,10 @@ public class RestClient extends BeanContextable
implements HttpClient, Closeable
final RemoteMeta rm = new RemoteMeta(interfaceClass);
@Override /* Overridden from InvocationHandler */
- @SuppressWarnings("java:S3776")
- public Object invoke(Object proxy, Method method,
Object[] args) throws Throwable {
+ @SuppressWarnings({
+ "java:S3776" // Cognitive complexity acceptable for
proxy invocation handler
+ })
+ public Object invoke(Object proxy, Method method, Object[]
args) throws Throwable {
var rom = rm.getOperationMeta(method);
var uri = rom.getFullPath();
@@ -8047,13 +8065,17 @@ public class RestClient extends BeanContextable
implements HttpClient, Closeable
return callHandler.run(target, request, context);
}
- @SuppressWarnings("java:S3776")
+ @SuppressWarnings({
+ "java:S3776" // Cognitive complexity acceptable for remote
execution logic
+ })
Object executeRemote(Class<?> interfaceClass, RestRequest rc, Method
method, RemoteOperationMeta rom) throws Exception {
RemoteOperationReturn ror = rom.getReturns();
try {
Object ret = null;
- @SuppressWarnings("java:S1854") // res is assigned in
all branches before use, SonarLint false positive
+ @SuppressWarnings({
+ "java:S1854" // res is assigned in all branches
before use, SonarLint false positive
+ })
RestResponse res;
rc.rethrow(RuntimeException.class);
rom.forEachException(rc::rethrow);
@@ -8113,7 +8135,9 @@ public class RestClient extends BeanContextable
implements HttpClient, Closeable
}
}
- @SuppressWarnings("unchecked")
+ @SuppressWarnings({
+ "unchecked" // Type erasure requires unchecked casts
+ })
<T extends Context> T getInstance(Class<T> c) {
var o = requestContexts.computeIfAbsent(c, k -> {
if (Serializer.class.isAssignableFrom(k)) {
diff --git
a/juneau-rest/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/RestRequest.java
b/juneau-rest/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/RestRequest.java
index 6229fd1ed1..95899a54ac 100644
---
a/juneau-rest/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/RestRequest.java
+++
b/juneau-rest/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/RestRequest.java
@@ -188,7 +188,9 @@ public class RestRequest extends BeanSession implements
HttpUriRequest, Configur
return
NameValuePair.class.isAssignableFrom(o.getClass().getComponentType());
}
- @SuppressWarnings("unchecked")
+ @SuppressWarnings({
+ "unchecked" // Type erasure requires unchecked casts
+ })
private static Map<Object,Object> toMap(Object o) {
return (Map<Object,Object>)o;
}
@@ -1858,7 +1860,9 @@ public class RestRequest extends BeanSession implements
HttpUriRequest, Configur
* <br>Null elements are ignored (only non-null classes that
extend {@link Throwable} are added).
* @return This object.
*/
- @SuppressWarnings("unchecked")
+ @SuppressWarnings({
+ "unchecked" // Type erasure requires unchecked casts
+ })
public RestRequest rethrow(Class<?>...values) {
if (rethrow == null)
rethrow = list();
diff --git
a/juneau-rest/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/RestResponse.java
b/juneau-rest/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/RestResponse.java
index fe68520151..9e36cf369d 100644
---
a/juneau-rest/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/RestResponse.java
+++
b/juneau-rest/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/RestResponse.java
@@ -389,7 +389,9 @@ public class RestResponse implements HttpResponse,
AutoCloseable {
* </ul>
*/
@Override /* Overridden from AutoCloseable */
- @SuppressWarnings("java:S3776")
+ @SuppressWarnings({
+ "java:S3776" // Cognitive complexity acceptable for resource
cleanup
+ })
public void close() {
if (isClosed)
return;
@@ -909,7 +911,9 @@ public class RestResponse implements HttpResponse,
AutoCloseable {
return partParserSessions.computeIfAbsent(parser,
HttpPartParser::getPartSession);
}
- @SuppressWarnings("unchecked")
+ @SuppressWarnings({
+ "unchecked" // Type erasure requires unchecked casts
+ })
<T> T as(ResponseBeanMeta rbm) {
var c = (Class<T>)rbm.getClassMeta().inner();
final RestClient rc = this.client;
diff --git
a/juneau-rest/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/assertion/FluentResponseBodyAssertion.java
b/juneau-rest/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/assertion/FluentResponseBodyAssertion.java
index 8a10e0800b..5db60b243b 100644
---
a/juneau-rest/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/assertion/FluentResponseBodyAssertion.java
+++
b/juneau-rest/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/assertion/FluentResponseBodyAssertion.java
@@ -102,7 +102,9 @@ import org.apache.juneau.serializer.*;
*
* @param <R> The return type.
*/
-@SuppressWarnings("java:S115") // Constants use UPPER_snakeCase convention
(e.g., MSG_exceptionDuringCall)
+@SuppressWarnings({
+ "java:S115" // Constants use UPPER_snakeCase convention (e.g.,
MSG_exceptionDuringCall)
+})
public class FluentResponseBodyAssertion<R> extends
FluentObjectAssertion<ResponseContent,R> {
// Error message constants
diff --git
a/juneau-rest/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/remote/RemoteOperationMeta.java
b/juneau-rest/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/remote/RemoteOperationMeta.java
index b159274374..6f08f1cf2a 100644
---
a/juneau-rest/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/remote/RemoteOperationMeta.java
+++
b/juneau-rest/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/remote/RemoteOperationMeta.java
@@ -67,7 +67,9 @@ public class RemoteOperationMeta {
String contentDefault = null;
static final AnnotationProvider AP =
AnnotationProvider.INSTANCE;
- @SuppressWarnings("java:S3776")
+ @SuppressWarnings({
+ "java:S3776" // Cognitive complexity acceptable for
operation metadata construction
+ })
Builder(String parentPath, Method m, String defaultMethod) {
var mi = MethodInfo.of(m);
diff --git
a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestContext.java
b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestContext.java
index 1c665aab24..e9c987d41c 100644
---
a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestContext.java
+++
b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestContext.java
@@ -4535,7 +4535,9 @@ public class RestContext extends Context {
* @return A new REST children list.
* @throws Exception If a problem occurred instantiating one of
the child rest contexts.
*/
- @SuppressWarnings("java:S3776")
+ @SuppressWarnings({
+ "java:S3776" // Cognitive complexity acceptable for
REST children creation
+ })
protected RestChildren.Builder
createRestChildren(BasicBeanStore beanStore, Supplier<?> resource, RestContext
restContext) throws Exception {
// Default value.
@@ -4641,7 +4643,9 @@ public class RestContext extends Context {
* @return A new REST operations list.
* @throws ServletException If a problem occurred instantiating
one of the child rest contexts.
*/
- @SuppressWarnings("java:S3776")
+ @SuppressWarnings({
+ "java:S3776" // Cognitive complexity acceptable for
REST operations creation
+ })
protected RestOperations.Builder
createRestOperations(BasicBeanStore beanStore, Supplier<?> resource,
RestContext restContext) throws ServletException {
// Default value.
@@ -5197,7 +5201,9 @@ public class RestContext extends Context {
* @throws ServletException General servlet exception.
* @throws IOException Thrown by underlying stream.
*/
- @SuppressWarnings("java:S3776")
+ @SuppressWarnings({
+ "java:S3776" // Cognitive complexity acceptable for request
execution logic
+ })
public void execute(Object resource, HttpServletRequest r1,
HttpServletResponse r2) throws ServletException, IOException {
// Must be careful not to bleed thread-locals.
diff --git
a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestOpContext.java
b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestOpContext.java
index 1a08262908..50cac948cc 100644
---
a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestOpContext.java
+++
b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestOpContext.java
@@ -80,7 +80,9 @@ import jakarta.servlet.http.*;
* <li class='link'><a class="doclink"
href="https://juneau.apache.org/docs/topics/RestOpContext">RestOpContext</a>
* </ul>
*/
-@SuppressWarnings("java:S115") // Constants use UPPER_snakeCase convention
(e.g., PROP_defaultRequestFormData)
+@SuppressWarnings({
+ "java:S115" // Constants use UPPER_snakeCase convention (e.g.,
PROP_defaultRequestFormData)
+})
public class RestOpContext extends Context implements
Comparable<RestOpContext> {
// Property name constants
@@ -1982,7 +1984,9 @@ public class RestOpContext extends Context implements
Comparable<RestOpContext>
*
* @return The path matchers for this method.
*/
- @SuppressWarnings("java:S3776")
+ @SuppressWarnings({
+ "java:S3776" // Cognitive complexity acceptable for
path matcher creation
+ })
protected UrlPathMatcherList getPathMatchers() {
var v = Value.of(UrlPathMatcherList.create());
@@ -2043,7 +2047,9 @@ public class RestOpContext extends Context implements
Comparable<RestOpContext>
* <p>
* This includes: {@link Header}, {@link Query}, {@link
FormData}.
*/
- @SuppressWarnings("java:S3776")
+ @SuppressWarnings({
+ "java:S3776" // Cognitive complexity acceptable for
HTTP parts configuration
+ })
protected void processParameterAnnotations() {
for (var aa : restMethod.getParameterAnnotations()) {
diff --git
a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestResponse.java
b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestResponse.java
index 0f88bb91c8..87f2d83793 100644
---
a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestResponse.java
+++
b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestResponse.java
@@ -107,7 +107,9 @@ import jakarta.servlet.http.*;
* </ul>
*
*/
-@SuppressWarnings("resource")
+@SuppressWarnings({
+ "resource" // HttpServletResponseWrapper is managed by servlet container
+})
public class RestResponse extends HttpServletResponseWrapper {
private static final String HEADER_ContentType = "Content-Type";
@@ -130,7 +132,9 @@ public class RestResponse extends
HttpServletResponseWrapper {
/**
* Constructor.
*/
- @SuppressWarnings("java:S3776")
+ @SuppressWarnings({
+ "java:S3776" // Cognitive complexity acceptable for response
initialization
+ })
RestResponse(RestOpContext opContext, RestSession session, RestRequest
req) throws Exception {
super(session.getResponse());
@@ -299,7 +303,9 @@ public class RestResponse extends
HttpServletResponseWrapper {
* @param c The class to cast to.
* @return This value cast to the specified class, or <jk>null</jk> if
the object doesn't exist or isn't the specified type.
*/
- @SuppressWarnings("unchecked")
+ @SuppressWarnings({
+ "unchecked" // Type erasure requires unchecked cast
+ })
public <T> T getContent(Class<T> c) {
if (isContentOfType(c))
return (T)getRawOutput();
@@ -376,7 +382,9 @@ public class RestResponse extends
HttpServletResponseWrapper {
* @throws NotAcceptable If unsupported Accept-Encoding value specified.
* @throws IOException Thrown by underlying stream.
*/
- @SuppressWarnings("java:S3776")
+ @SuppressWarnings({
+ "java:S3776" // Cognitive complexity acceptable for content
negotiation
+ })
public FinishableServletOutputStream getNegotiatedOutputStream() throws
NotAcceptable, IOException {
if (os == null) {
Encoder encoder = null;
diff --git
a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/httppart/RequestHeaders.java
b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/httppart/RequestHeaders.java
index 32bfc158ec..d945fca392 100644
---
a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/httppart/RequestHeaders.java
+++
b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/httppart/RequestHeaders.java
@@ -16,7 +16,6 @@
*/
package org.apache.juneau.rest.httppart;
-import static java.util.stream.Collectors.toList;
import static org.apache.juneau.commons.utils.AssertionUtils.*;
import static org.apache.juneau.commons.utils.CollectionUtils.*;
import static org.apache.juneau.commons.utils.ThrowableUtils.*;
@@ -109,7 +108,9 @@ import org.apache.juneau.svl.*;
* <li class='link'><a class="doclink"
href="https://juneau.apache.org/docs/topics/HttpParts">HTTP Parts</a>
* </ul>
*/
-@SuppressWarnings("java:S115")
+@SuppressWarnings({
+ "java:S115" // Constants use UPPER_snakeCase convention
+})
public class RequestHeaders extends ArrayList<RequestHeader> {
// Argument name constants for assertArgNotNull
diff --git
a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/httppart/RequestPathParams.java
b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/httppart/RequestPathParams.java
index fadf2ceb58..38e5307cfa 100644
---
a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/httppart/RequestPathParams.java
+++
b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/httppart/RequestPathParams.java
@@ -16,7 +16,6 @@
*/
package org.apache.juneau.rest.httppart;
-import static java.util.stream.Collectors.toList;
import static org.apache.juneau.commons.utils.AssertionUtils.*;
import static org.apache.juneau.commons.utils.CollectionUtils.*;
import static org.apache.juneau.commons.utils.StringUtils.*;
@@ -105,7 +104,9 @@ import org.apache.juneau.svl.*;
* <li class='link'><a class="doclink"
href="https://juneau.apache.org/docs/topics/HttpParts">HTTP Parts</a>
* </ul>
*/
-@SuppressWarnings("java:S115")
+@SuppressWarnings({
+ "java:S115" // Constants use UPPER_snakeCase convention
+})
public class RequestPathParams extends ArrayList<RequestPathParam> {
// Argument name constants for assertArgNotNull
@@ -134,7 +135,9 @@ public class RequestPathParams extends
ArrayList<RequestPathParam> {
this.vs = req.getVarResolverSession();
// Add parameters from parent context if any.
- @SuppressWarnings("unchecked")
+ @SuppressWarnings({
+ "unchecked" // Type erasure requires unchecked cast
+ })
var parentVars =
(Map<String,String>)req.getAttribute("juneau.pathVars").orElse(mape());
for (var e : parentVars.entrySet())
add(e.getKey(), e.getValue());
diff --git
a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/httppart/RequestQueryParams.java
b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/httppart/RequestQueryParams.java
index ff8918de16..3ff31d9c52 100644
---
a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/httppart/RequestQueryParams.java
+++
b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/httppart/RequestQueryParams.java
@@ -16,7 +16,6 @@
*/
package org.apache.juneau.rest.httppart;
-import static java.util.stream.Collectors.toList;
import static org.apache.juneau.commons.utils.AssertionUtils.*;
import static org.apache.juneau.commons.utils.CollectionUtils.*;
import static org.apache.juneau.commons.utils.StringUtils.*;
@@ -120,7 +119,9 @@ import org.apache.juneau.svl.*;
* <li class='link'><a class="doclink"
href="https://juneau.apache.org/docs/topics/HttpParts">HTTP Parts</a>
* </ul>
*/
-@SuppressWarnings("java:S115")
+@SuppressWarnings({
+ "java:S115" // Constants use UPPER_snakeCase convention
+})
public class RequestQueryParams extends ArrayList<RequestQueryParam> {
// Argument name constants for assertArgNotNull
diff --git
a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/logger/CallLogger.java
b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/logger/CallLogger.java
index 57c6f88bda..3d3f49dc28 100644
---
a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/logger/CallLogger.java
+++
b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/logger/CallLogger.java
@@ -94,7 +94,9 @@ import jakarta.servlet.http.*;
* <li class='link'><a class="doclink"
href="https://juneau.apache.org/docs/topics/RestServerLoggingAndDebugging">Logging
/ Debugging</a>
* </ul>
*/
-@SuppressWarnings("java:S115") // Constants use UPPER_snakeCase convention
(e.g., PROP_debugRules)
+@SuppressWarnings({
+ "java:S115" // Constants use UPPER_snakeCase convention (e.g.,
PROP_debugRules)
+})
public class CallLogger {
// Property name constants
diff --git
a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/logger/CallLoggerRule.java
b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/logger/CallLoggerRule.java
index a14bf963a8..dcc27b84d3 100644
---
a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/logger/CallLoggerRule.java
+++
b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/logger/CallLoggerRule.java
@@ -35,7 +35,9 @@ import jakarta.servlet.http.*;
* <li class='link'><a class="doclink"
href="https://juneau.apache.org/docs/topics/RestServerLoggingAndDebugging">Logging
/ Debugging</a>
* </ul>
*/
-@SuppressWarnings("java:S115") // Constants use UPPER_snakeCase convention
(e.g., PROP_codeFilter)
+@SuppressWarnings({
+ "java:S115" // Constants use UPPER_snakeCase convention (e.g.,
PROP_codeFilter)
+})
public class CallLoggerRule {
// Property name constants
diff --git
a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/servlet/RestServlet.java
b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/servlet/RestServlet.java
index c8f3a7ffc5..053fe99480 100644
---
a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/servlet/RestServlet.java
+++
b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/servlet/RestServlet.java
@@ -64,7 +64,9 @@ import jakarta.servlet.http.*;
*
* @serial exclude
*/
-@SuppressWarnings("java:S115") // Constants use UPPER_snakeCase convention
(e.g., MSG_servletInitError)
+@SuppressWarnings({
+ "java:S115" // Constants use UPPER_snakeCase convention (e.g.,
MSG_servletInitError)
+})
public abstract class RestServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
diff --git
a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/swagger/BasicSwaggerProviderSession.java
b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/swagger/BasicSwaggerProviderSession.java
index 69a86f0dc6..e8f355472c 100644
---
a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/swagger/BasicSwaggerProviderSession.java
+++
b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/swagger/BasicSwaggerProviderSession.java
@@ -674,7 +674,9 @@ public class BasicSwaggerProviderSession {
// @formatter:on
}
- @SuppressWarnings("java:S3776")
+ @SuppressWarnings({
+ "java:S3776" // Cognitive complexity acceptable for example
generation logic
+ })
private void addBodyExamples(RestOpContext sm, JsonMap piri, boolean
response, Type type, Locale locale) throws Exception {
var sex = piri.getString(SWAGGER_example);
@@ -732,7 +734,9 @@ public class BasicSwaggerProviderSession {
piri.put(examplesKey, examples);
}
- @SuppressWarnings("java:S1172") // Parameter type is unused but kept
for API consistency
+ @SuppressWarnings({
+ "java:S1172" // Parameter type is unused but kept for API
consistency
+ })
private static void addParamExample(RestOpContext sm, JsonMap piri,
RestPartType in, Type type) {
var s = piri.getString(SWAGGER_example);