From 4ebacb393999f12ed80baf96c376b09226a46779 Mon Sep 17 00:00:00 2001 From: Alexander Kriegisch Date: Fri, 8 Oct 2021 07:23:44 +0200 Subject: [PATCH] Fix Java17PreviewFeaturesTests (locale-specific floating-point output) The test worked on my local workstation with German locale, but not on GitHub with English locale. Signed-off-by: Alexander Kriegisch --- tests/features198/java17/SwitchPatternAspect.aj | 3 ++- tests/features198/java17/SwitchPatternOK.java | 3 ++- .../test/resources/org/aspectj/systemtest/ajc198/ajc198.xml | 4 ++-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/tests/features198/java17/SwitchPatternAspect.aj b/tests/features198/java17/SwitchPatternAspect.aj index 5a3eeeb30..bf19b8468 100644 --- a/tests/features198/java17/SwitchPatternAspect.aj +++ b/tests/features198/java17/SwitchPatternAspect.aj @@ -1,4 +1,5 @@ import java.util.List; +import java.util.Locale; aspect SwitchPatternAspect { Object around(Object o) : execution(* doSomethingWithObject(*)) && args(o) { @@ -6,7 +7,7 @@ aspect SwitchPatternAspect { case null -> "null"; case Integer i -> String.format("int %d", i); case Long l -> String.format("long %d", l); - case Double d -> String.format("double %f", d); + case Double d -> String.format(Locale.ENGLISH, "double %f", d); case String s -> String.format("String %s", s); default -> o.toString(); }); diff --git a/tests/features198/java17/SwitchPatternOK.java b/tests/features198/java17/SwitchPatternOK.java index 26c1cf755..586dfe020 100644 --- a/tests/features198/java17/SwitchPatternOK.java +++ b/tests/features198/java17/SwitchPatternOK.java @@ -1,4 +1,5 @@ import java.util.List; +import java.util.Locale; /** * Inspired by examples in https://openjdk.java.net/jeps/406 @@ -26,7 +27,7 @@ public class SwitchPatternOK { case null -> "null"; case Integer i -> String.format("int %d", i); case Long l -> String.format("long %d", l); - case Double d -> String.format("double %f", d); + case Double d -> String.format(Locale.ENGLISH, "double %f", d); case String s -> String.format("String %s", s); default -> o.toString(); }; diff --git a/tests/src/test/resources/org/aspectj/systemtest/ajc198/ajc198.xml b/tests/src/test/resources/org/aspectj/systemtest/ajc198/ajc198.xml index 9937413a9..c182b58b9 100644 --- a/tests/src/test/resources/org/aspectj/systemtest/ajc198/ajc198.xml +++ b/tests/src/test/resources/org/aspectj/systemtest/ajc198/ajc198.xml @@ -42,7 +42,7 @@ - + @@ -63,7 +63,7 @@ - + -- 2.39.5