From 15813464cc7763a6c94e41cd21ef30b0703da72d Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Thu, 2 Mar 2023 12:54:53 -0500 Subject: [PATCH] Enable -Wconversion in the java server. (#25405) Note https://github.com/project-chip/connectedhomeip/issues/25403 tracking whether this is in fact the right fix. --- src/app/server/java/BUILD.gn | 2 ++ src/app/server/java/ChipFabricProvider-JNI.cpp | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/app/server/java/BUILD.gn b/src/app/server/java/BUILD.gn index 905257607e7178..fa3a49f8be2737 100644 --- a/src/app/server/java/BUILD.gn +++ b/src/app/server/java/BUILD.gn @@ -43,6 +43,8 @@ static_library("jni") { ] public_configs = [ "${chip_root}/src:includes" ] + + cflags = [ "-Wconversion" ] } android_library("java") { diff --git a/src/app/server/java/ChipFabricProvider-JNI.cpp b/src/app/server/java/ChipFabricProvider-JNI.cpp index ae7aac3ce75af0..8fea4d4c9ba47b 100644 --- a/src/app/server/java/ChipFabricProvider-JNI.cpp +++ b/src/app/server/java/ChipFabricProvider-JNI.cpp @@ -99,7 +99,7 @@ CHIP_ERROR ReadFabricList(JNIEnv * env, jobject & self) VerifyOrExit(jlabel != nullptr, err = CHIP_JNI_ERROR_FIELD_NOT_FOUND); env->SetIntField(jFabric, jvendorId, fabricInfo.GetVendorId()); - env->SetLongField(jFabric, jnodeId, fabricInfo.GetNodeId()); + env->SetLongField(jFabric, jnodeId, static_cast(fabricInfo.GetNodeId())); env->SetShortField(jFabric, jfabricIndex, fabricInfo.GetFabricIndex()); UtfString jLabelStr(env, fabricInfo.GetFabricLabel()); env->SetObjectField(jFabric, jlabel, jLabelStr.jniValue());