You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by li...@apache.org on 2026/04/27 01:13:35 UTC

(arrow-adbc) branch main updated: build(java): enable `-Wall -Werror` for JNI code (#4268)

This is an automated email from the ASF dual-hosted git repository.

lidavidm pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow-adbc.git


The following commit(s) were added to refs/heads/main by this push:
     new 85dd5c941 build(java): enable `-Wall -Werror` for JNI code (#4268)
85dd5c941 is described below

commit 85dd5c941b758a0633718ac8c0b4e80ac708fcc3
Author: David Li <li...@gmail.com>
AuthorDate: Mon Apr 27 10:13:30 2026 +0900

    build(java): enable `-Wall -Werror` for JNI code (#4268)
---
 java/CMakeLists.txt                         | 6 ++++++
 java/driver/jni/src/main/cpp/jni_wrapper.cc | 3 ++-
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/java/CMakeLists.txt b/java/CMakeLists.txt
index 34083624d..49b68c7f1 100644
--- a/java/CMakeLists.txt
+++ b/java/CMakeLists.txt
@@ -31,6 +31,12 @@ if("${CMAKE_CXX_STANDARD}" STREQUAL "")
 endif()
 set(CMAKE_CXX_STANDARD_REQUIRED ON)
 
+if(MSVC)
+  add_compile_options(/W4 /WX)
+else()
+  add_compile_options(-Wall -Wextra -pedantic -Werror)
+endif()
+
 include(GNUInstallDirs)
 
 # Dependencies
diff --git a/java/driver/jni/src/main/cpp/jni_wrapper.cc b/java/driver/jni/src/main/cpp/jni_wrapper.cc
index 0cb128f84..562ddf3fb 100644
--- a/java/driver/jni/src/main/cpp/jni_wrapper.cc
+++ b/java/driver/jni/src/main/cpp/jni_wrapper.cc
@@ -194,7 +194,8 @@ extern "C" {
 
 JNIEXPORT jobject JNICALL
 Java_org_apache_arrow_adbc_driver_jni_impl_NativeAdbc_openDatabase(
-    JNIEnv* env, [[maybe_unused]] jclass self, jint version, jobjectArray parameters) {
+    JNIEnv* env, [[maybe_unused]] jclass self, [[maybe_unused]] jint version,
+    jobjectArray parameters) {
   try {
     struct AdbcError error = ADBC_ERROR_INIT;
     auto db = std::make_unique<struct AdbcDatabase>();