From 65f99cd302aee279d1a68219d5751e86192bcdb6 Mon Sep 17 00:00:00 2001 From: Magnus Persson <1431685+magnusp@users.noreply.github.com> Date: Sun, 25 Oct 2026 10:39:22 +0100 Subject: [PATCH] chore(jdbc): suppress expected compiler warnings The build runs -Xlint:all, so tests that exercise deprecated JDBC methods and the vendored xerial tree report warnings on every run. Suppress only those expected diagnostics, and document why the parameter metadata view cannot trigger the this-escape warning. --- libsql-conformance/pom.xml | 17 +++++++++++++++++ .../libsql/jdbc/LibsqlPreparedStatement.java | 3 +++ .../jdbc/LibsqlPreparedStatementTest.java | 2 ++ .../libsql/jdbc/LibsqlResultSetTest.java | 2 ++ 4 files changed, 24 insertions(+) diff --git a/libsql-conformance/pom.xml b/libsql-conformance/pom.xml index be72925..2d05827 100644 --- a/libsql-conformance/pom.xml +++ b/libsql-conformance/pom.xml @@ -163,6 +163,23 @@ + + + org.apache.maven.plugins + maven-compiler-plugin + + + default-testCompile + + + -Xlint:-deprecation + -XDsuppressNotes + + + + + org.apache.maven.plugins maven-surefire-plugin diff --git a/libsql-jdbc/src/main/java/com/github/magnusp/libsql/jdbc/LibsqlPreparedStatement.java b/libsql-jdbc/src/main/java/com/github/magnusp/libsql/jdbc/LibsqlPreparedStatement.java index a954611..808f25d 100644 --- a/libsql-jdbc/src/main/java/com/github/magnusp/libsql/jdbc/LibsqlPreparedStatement.java +++ b/libsql-jdbc/src/main/java/com/github/magnusp/libsql/jdbc/LibsqlPreparedStatement.java @@ -52,6 +52,9 @@ public class LibsqlPreparedStatement extends LibsqlStatement implements Prepared // Sequential list indexed by JDBC parameter position; no map or boxing overhead. private final List parameters = new ArrayList<>(); + // ParameterMetaDataView only stores this reference and calls checkClosed() after construction, + // so no subclass method can run against a half-built statement. + @SuppressWarnings("this-escape") public LibsqlPreparedStatement(LibsqlConnection connection, String sql) { super(connection); this.sql = sql; diff --git a/libsql-jdbc/src/test/java/com/github/magnusp/libsql/jdbc/LibsqlPreparedStatementTest.java b/libsql-jdbc/src/test/java/com/github/magnusp/libsql/jdbc/LibsqlPreparedStatementTest.java index f574042..dd2a3ba 100644 --- a/libsql-jdbc/src/test/java/com/github/magnusp/libsql/jdbc/LibsqlPreparedStatementTest.java +++ b/libsql-jdbc/src/test/java/com/github/magnusp/libsql/jdbc/LibsqlPreparedStatementTest.java @@ -409,6 +409,8 @@ void unsetParametersBindNullArguments() throws SQLException { .containsExactly(Value.of(7L), Value.ofNull()); } + // The deprecated Unicode stream setter is part of the local-conversion contract. + @SuppressWarnings("deprecation") @Test void streamSettersBindLocalConversions() throws SQLException { RecordingConnection connection = new RecordingConnection(NO_ROWS); diff --git a/libsql-jdbc/src/test/java/com/github/magnusp/libsql/jdbc/LibsqlResultSetTest.java b/libsql-jdbc/src/test/java/com/github/magnusp/libsql/jdbc/LibsqlResultSetTest.java index 41cb4d7..7c03cea 100644 --- a/libsql-jdbc/src/test/java/com/github/magnusp/libsql/jdbc/LibsqlResultSetTest.java +++ b/libsql-jdbc/src/test/java/com/github/magnusp/libsql/jdbc/LibsqlResultSetTest.java @@ -457,6 +457,8 @@ void findColumnRejectsNullLabel() { .hasMessageContaining("null"); } + // The deprecated Unicode stream getters are part of the unsupported-method contract. + @SuppressWarnings("deprecation") @Test void everyUnsupportedMethodThrowsSqlFeatureNotSupportedException() throws SQLException { LibsqlResultSet rs = resultSet(new Value.Integer(1));