From 4cb3cbcc7d82286d9bdd38151b2f878e0275230f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Pomyka=C5=82a?= Date: Fri, 24 Jul 2026 19:09:07 +0200 Subject: [PATCH 1/3] Fix native image reflection config missing mappings classes Configuration file loading fails in the native binary with NoSuchMethodException: Mappings.() because reflect-config.json was missing entries for the Mappings and LanguageTransform classes that SnakeYAML instantiates via reflection when parsing the mappings.lang section. This only surfaced in the GraalVM native image, not in JVM/test runs, since native-image restricts reflection to explicitly registered classes. Co-Authored-By: Claude Sonnet 5 --- reflect-config.json | 14 ++++++++ .../ConfigurationLoaderTest.java | 36 +++++++++++++++++++ 2 files changed, 50 insertions(+) diff --git a/reflect-config.json b/reflect-config.json index 70c1469..504cd08 100644 --- a/reflect-config.json +++ b/reflect-config.json @@ -76,6 +76,20 @@ "allDeclaredMethods" : true, "allPublicMethods" : true }, + { + "name" : "io.simplelocalize.cli.client.dto.proxy.Mappings", + "allDeclaredConstructors" : true, + "allPublicConstructors" : true, + "allDeclaredMethods" : true, + "allPublicMethods" : true + }, + { + "name" : "io.simplelocalize.cli.client.dto.proxy.LanguageTransform", + "allDeclaredConstructors" : true, + "allPublicConstructors" : true, + "allDeclaredMethods" : true, + "allPublicMethods" : true + }, { "name" : "io.simplelocalize.cli.client.dto.proxy.DownloadableFile", "allDeclaredConstructors" : true, diff --git a/src/test/java/io/simplelocalize/cli/configuration/ConfigurationLoaderTest.java b/src/test/java/io/simplelocalize/cli/configuration/ConfigurationLoaderTest.java index c3eaa16..2a3140a 100644 --- a/src/test/java/io/simplelocalize/cli/configuration/ConfigurationLoaderTest.java +++ b/src/test/java/io/simplelocalize/cli/configuration/ConfigurationLoaderTest.java @@ -114,6 +114,42 @@ void shouldLoadConfiguration() throws Exception Assertions.assertThat(configuration.getIgnoreKeys()).containsExactlyInAnyOrder("key one", "key_two"); } + @Test + void shouldLoadLanguageMappingsFromConfiguration() throws Exception + { + //given + ClassLoader classLoader = getClass().getClassLoader(); + String pathToConfig = classLoader.getResource("simplelocalize.yml").toURI().toString().replace("file:", ""); + Path configurationFilePath = Path.of(pathToConfig); + + //when + Configuration configuration = loader.loadOrGetDefault(configurationFilePath); + + //then + Assertions.assertThat(configuration.getMappings()).isNotNull(); + Assertions.assertThat(configuration.getMappings().getLang()) + .extracting(LanguageTransform::getLanguageKey, LanguageTransform::getPlaceholder) + .containsExactlyInAnyOrder( + Tuple.tuple("en", "english"), + Tuple.tuple("pl_PL", "polish")); + } + + @Test + void shouldDefaultToEmptyMappingsWhenNotProvidedInConfiguration() throws Exception + { + //given + ClassLoader classLoader = getClass().getClassLoader(); + String pathToConfig = classLoader.getResource("simplelocalize-upload-download.yml").toURI().toString().replace("file:", ""); + Path configurationFilePath = Path.of(pathToConfig); + + //when + Configuration configuration = loader.loadOrGetDefault(configurationFilePath); + + //then + Assertions.assertThat(configuration.getMappings()).isNotNull(); + Assertions.assertThat(configuration.getMappings().getLang()).isEmpty(); + } + @Test void shouldThrowErrorWhenInvalidFile() throws Exception { From 7dc0a918a4cf3a1814215ad852bbe34502f2c82f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Pomyka=C5=82a?= Date: Fri, 24 Jul 2026 19:09:47 +0200 Subject: [PATCH 2/3] Add reflection config --- simplelocalize-sample.yml | 2 +- .../java/io/simplelocalize/cli/SimplelocalizeCliCommand.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/simplelocalize-sample.yml b/simplelocalize-sample.yml index 9047411..728a94b 100644 --- a/simplelocalize-sample.yml +++ b/simplelocalize-sample.yml @@ -20,7 +20,7 @@ uploadFormat: multi-language-json # Upload options are options that are passed to the upload command. # Supported options: https://simplelocalize.io/docs/general/options/ uploadOptions: - - 'REPLACE_TRANSLATION_IF_FOUND' # overwrite translation for given a key and namespace if found + - 'UPDATE_TRANSLATIONS' ################################### diff --git a/src/main/java/io/simplelocalize/cli/SimplelocalizeCliCommand.java b/src/main/java/io/simplelocalize/cli/SimplelocalizeCliCommand.java index ea8dcd6..e310f3b 100644 --- a/src/main/java/io/simplelocalize/cli/SimplelocalizeCliCommand.java +++ b/src/main/java/io/simplelocalize/cli/SimplelocalizeCliCommand.java @@ -159,7 +159,7 @@ public void upload( if (Boolean.TRUE.equals(updateTranslations)) { - effectiveUploadOptions.add("REPLACE_TRANSLATION_IF_FOUND"); + effectiveUploadOptions.add("UPDATE_TRANSLATIONS"); } if (Boolean.TRUE.equals(delete)) From 5b5b629a2213f358e39d6b3a573396fc086acb02 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Pomyka=C5=82a?= Date: Fri, 24 Jul 2026 19:12:14 +0200 Subject: [PATCH 3/3] Bump version to 2.11.1 Patch release fixing the native image reflection config for the mappings feature (Mappings/LanguageTransform could not be loaded from simplelocalize.yml in the compiled binary). Co-Authored-By: Claude Sonnet 5 --- pom.xml | 2 +- src/main/java/io/simplelocalize/cli/Version.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 1e7f3b7..be043fd 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ 4.0.0 io.simplelocalize simplelocalize-cli - 2.11.0 + 2.11.1 jar simplelocalize-cli Official SimpleLocalize Command Line Interface diff --git a/src/main/java/io/simplelocalize/cli/Version.java b/src/main/java/io/simplelocalize/cli/Version.java index eef50f3..dcf3642 100644 --- a/src/main/java/io/simplelocalize/cli/Version.java +++ b/src/main/java/io/simplelocalize/cli/Version.java @@ -3,7 +3,7 @@ public class Version { - public static final String NUMBER = "2.11.0"; + public static final String NUMBER = "2.11.1"; private Version() {