diff --git a/SimpleAPI/pom.xml b/SimpleAPI/pom.xml
index 153fdb1..b65f0ed 100644
--- a/SimpleAPI/pom.xml
+++ b/SimpleAPI/pom.xml
@@ -15,7 +15,7 @@
NOTSET
com.mysql
mysql-connector-j
- 9.5.0
+ 26.7.0
21
21
21
@@ -262,7 +262,7 @@
org.spigotmc
spigot-api
- 26.2-R0.1-SNAPSHOT
+ 26.3-R0.1-SNAPSHOT
provided
@@ -298,7 +298,7 @@
org.junit.jupiter
junit-jupiter-engine
- 6.1.2
+ 6.1.3
test
@@ -310,7 +310,7 @@
org.mockito
mockito-core
- 5.23.0
+ 5.24.0
test
@@ -425,7 +425,7 @@
org.apache.maven.plugins
maven-deploy-plugin
- 3.1.4
+ 3.2.0
true
@@ -516,7 +516,7 @@
org.apache.maven.plugins
maven-deploy-plugin
- 3.1.4
+ 3.2.0
true
diff --git a/SimpleAPI/src/test/java/com/bencodez/simpleapi/tests/packaging/FullArtifactTest.java b/SimpleAPI/src/test/java/com/bencodez/simpleapi/tests/packaging/FullArtifactTest.java
index c28ac29..b06d88c 100644
--- a/SimpleAPI/src/test/java/com/bencodez/simpleapi/tests/packaging/FullArtifactTest.java
+++ b/SimpleAPI/src/test/java/com/bencodez/simpleapi/tests/packaging/FullArtifactTest.java
@@ -3,6 +3,8 @@
import static org.junit.jupiter.api.Assertions.*;
import java.io.File;
+import java.io.StringWriter;
+import java.net.URLClassLoader;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
@@ -10,6 +12,8 @@
import java.util.jar.Attributes;
import java.util.jar.JarFile;
+import javax.tools.ToolProvider;
+
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.io.TempDir;
@@ -19,6 +23,55 @@
public class FullArtifactTest {
@TempDir Path temporary;
+ @Test void legacyRedisConsumerCompilesAndLinksAgainstOnlyTheFullJar() throws Exception {
+ Path full = fullJar();
+ Path source = temporary.resolve("LegacyRedisConsumer.java");
+ Files.writeString(source, """
+ import java.util.Set;
+ import redis.clients.jedis.HostAndPort;
+ import redis.clients.jedis.JedisClientConfig;
+ import redis.clients.jedis.JedisPooled;
+ import redis.clients.jedis.JedisSentineled;
+ import redis.clients.jedis.UnifiedJedis;
+
+ public final class LegacyRedisConsumer {
+ // Compile the established constructor calls without opening a connection.
+ public static Object[] construct(HostAndPort endpoint, JedisClientConfig config,
+ Set sentinels) {
+ return new Object[] {
+ new JedisPooled(endpoint, config),
+ new JedisSentineled("synthetic-master", config, sentinels, config),
+ new UnifiedJedis(endpoint, config)
+ };
+ }
+
+ public static int link() throws Exception {
+ JedisPooled.class.getConstructor(HostAndPort.class, JedisClientConfig.class);
+ JedisSentineled.class.getConstructor(String.class, JedisClientConfig.class,
+ Set.class, JedisClientConfig.class);
+ UnifiedJedis.class.getConstructor(HostAndPort.class, JedisClientConfig.class);
+ return 3;
+ }
+ }
+ """);
+ var compiler = ToolProvider.getSystemJavaCompiler();
+ assertNotNull(compiler, "Packaged API verification requires the build JDK");
+ StringWriter diagnostics = new StringWriter();
+ try (var files = compiler.getStandardFileManager(null, null, StandardCharsets.UTF_8)) {
+ boolean compiled = compiler.getTask(diagnostics, files, null,
+ java.util.List.of("--release", "21", "-proc:none", "-classpath", full.toString(),
+ "-d", temporary.toString()), null,
+ files.getJavaFileObjects(source.toFile())).call();
+ assertTrue(compiled, "Legacy Redis consumer must compile using only the packaged JAR: " + diagnostics);
+ }
+ // Platform parent excludes every Maven dependency, including any older Jedis on the test classpath.
+ try (var loader = new URLClassLoader(new java.net.URL[] {
+ temporary.toUri().toURL(), full.toUri().toURL() }, ClassLoader.getPlatformClassLoader())) {
+ Class> consumer = Class.forName("LegacyRedisConsumer", true, loader);
+ assertEquals(3, consumer.getMethod("link").invoke(null));
+ }
+ }
+
@Test void omitsExternalCryptoProvider() throws Exception {
Path full = fullJar();
try (JarFile output = new JarFile(full.toFile())) {