From ab13924e02bb59f23881db2a8dcbc917d66b2b2b Mon Sep 17 00:00:00 2001 From: Tim203 Date: Sun, 11 Feb 2024 23:07:30 +0100 Subject: [PATCH] Applied forbiddenApi fixes --- .../configurate/interfaces/processor/TestUtils.java | 4 ++++ .../configurate/interfaces/InterfaceMiddleware.java | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/extra/interface/ap/src/test/java/org/spongepowered/configurate/interfaces/processor/TestUtils.java b/extra/interface/ap/src/test/java/org/spongepowered/configurate/interfaces/processor/TestUtils.java index 2832dc0c..c6dc4459 100644 --- a/extra/interface/ap/src/test/java/org/spongepowered/configurate/interfaces/processor/TestUtils.java +++ b/extra/interface/ap/src/test/java/org/spongepowered/configurate/interfaces/processor/TestUtils.java @@ -23,6 +23,9 @@ import com.google.common.io.Resources; import com.google.testing.compile.Compilation; import com.google.testing.compile.JavaFileObjects; + +import java.util.Locale; + import org.spongepowered.configurate.interfaces.Constants; import java.io.IOException; @@ -90,6 +93,7 @@ private static List readOrGenerateMappings(final String sourceResourceNa // we only support generating simple (not nested) configs, // for complexer configs we need a mappings file return Collections.singletonList(String.format( + Locale.ROOT, "%s=%s", sourceResourceName.replace('/', '.'), targetResourceName.replace('/', '.') diff --git a/extra/interface/src/main/java/org/spongepowered/configurate/interfaces/InterfaceMiddleware.java b/extra/interface/src/main/java/org/spongepowered/configurate/interfaces/InterfaceMiddleware.java index 013cb3b4..9b238155 100644 --- a/extra/interface/src/main/java/org/spongepowered/configurate/interfaces/InterfaceMiddleware.java +++ b/extra/interface/src/main/java/org/spongepowered/configurate/interfaces/InterfaceMiddleware.java @@ -30,6 +30,8 @@ import org.spongepowered.configurate.objectmapping.meta.Processor; import org.spongepowered.configurate.serialize.SerializationException; +import java.util.Locale; + final class InterfaceMiddleware { private InterfaceMiddleware() { @@ -54,6 +56,7 @@ private static Constraint.Factory decimalRange() { final double value = number.doubleValue(); if (!(data.from() >= value && data.to() <= value)) { throw new SerializationException(String.format( + Locale.ROOT, "'%s' is not in the allowed range of from: %s, to: %s!", value, data.from(), data.to() )); @@ -71,6 +74,7 @@ private static Constraint.Factory numericRange() { final long value = number.longValue(); if (!(data.from() >= value && data.to() <= value)) { throw new SerializationException(String.format( + Locale.ROOT, "'%s' is not in the allowed range of from: %s, to: %s!", value, data.from(), data.to() )); @@ -88,6 +92,7 @@ private static Constraint.Factory stringRange() { final int length = string.length(); if (!(data.from() >= length && data.to() <= length)) { throw new SerializationException(String.format( + Locale.ROOT, "'%s' is not in the allowed string length range of from: %s, to: %s!", length, data.from(), data.to() ));