From 07364b226e4028639f0f20feee1dcf07268a6299 Mon Sep 17 00:00:00 2001 From: kaklakariada Date: Sun, 10 Dec 2023 11:40:56 +0100 Subject: [PATCH] Fix build for Java 21 --- build.gradle | 2 +- .../java/org/itsallcode/jdbc/resultset/RowMapper.java | 5 ++++- .../jdbc/resultset/DelegatingResultSetTest.java | 11 +++++------ 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/build.gradle b/build.gradle index e0e1dc7..20c1de0 100644 --- a/build.gradle +++ b/build.gradle @@ -18,7 +18,7 @@ dependencies { java { toolchain { - languageVersion = JavaLanguageVersion.of(getPropertyWithDefault('javaVersion', '17')) + languageVersion = JavaLanguageVersion.of(getPropertyWithDefault('javaVersion', '21')) } withJavadocJar() withSourcesJar() diff --git a/src/main/java/org/itsallcode/jdbc/resultset/RowMapper.java b/src/main/java/org/itsallcode/jdbc/resultset/RowMapper.java index 9104d19..677bcda 100644 --- a/src/main/java/org/itsallcode/jdbc/resultset/RowMapper.java +++ b/src/main/java/org/itsallcode/jdbc/resultset/RowMapper.java @@ -64,7 +64,8 @@ public static RowMapper create(final SimpleRowMapper mapper) { /** * Converts a single row from a {@link ResultSet} to a generic row type. *

- * Use this interface if you don't need the {@link Context}. + * Use this interface with method {@link RowMapper#create(SimpleRowMapper)} if + * you don't need the {@link Context}. * * @param generic row type */ @@ -83,6 +84,8 @@ public interface SimpleRowMapper { /** * A simplified row mapper that gets a list of column values as input. + * + * @param generic row type */ @FunctionalInterface public interface ColumnValuesConverter { diff --git a/src/test/java/org/itsallcode/jdbc/resultset/DelegatingResultSetTest.java b/src/test/java/org/itsallcode/jdbc/resultset/DelegatingResultSetTest.java index 64d9325..ab1b4cf 100644 --- a/src/test/java/org/itsallcode/jdbc/resultset/DelegatingResultSetTest.java +++ b/src/test/java/org/itsallcode/jdbc/resultset/DelegatingResultSetTest.java @@ -8,8 +8,7 @@ import java.io.*; import java.math.BigDecimal; -import java.net.MalformedURLException; -import java.net.URL; +import java.net.*; import java.sql.*; import java.sql.Date; import java.util.*; @@ -869,15 +868,15 @@ void getTimestampLabelCal() throws SQLException { } @Test - void getURLIndex() throws SQLException, MalformedURLException { - final URL url = new URL("https://example.com"); + void getURLIndex() throws SQLException, MalformedURLException, URISyntaxException { + final URL url = new URI("https://example.com").toURL(); when(resultSetMock.getURL(COL_INDEX)).thenReturn(url); assertSame(url, testee().getURL(COL_INDEX)); } @Test - void getURLLabel() throws SQLException, MalformedURLException { - final URL url = new URL("https://example.com"); + void getURLLabel() throws SQLException, MalformedURLException, URISyntaxException { + final URL url = new URI("https://example.com").toURL(); when(resultSetMock.getURL(COL_LABEL)).thenReturn(url); assertSame(url, testee().getURL(COL_LABEL)); }