[PATCH] LambdaTranslationTest[1|2] may fail when executed with other locale than US (original) (raw)

Andrej Golovnin andrej.golovnin at gmail.com
Sat Jun 21 22:17:27 UTC 2014


Hi Joel,

as I already wrote [1] the tests

jdk/lambda/LambdaTranslationTest1.java jdk/lambda/LambdaTranslationTest2.java

fails when they are executed with other locale than US. The tests make use of Locale sensitive APIs and assume that the current Locale has the same formatting rules as Locale.US.

The test LambdaTranslationTest1 fails with the message:

test LambdaTranslationTest1.testMethodRefs(): failure java.lang.AssertionError: expected [d:1234.000000] but found [d:1234,000000]

The test LambdaTranslationTest2 fails with the message:

test LambdaTranslationTest2.testBoxing(): failure java.lang.AssertionError: expected [b1 s2 cA i4 j5 ztrue f6,000000 d7,000000] but found [b1 s2 cA i4 j5 ztrue f6.000000 d7.000000]

To reproduce the failure you should execute following commands in the shell (tested only on Linux):

export LANG=de_DE.utf8 export LC_PAPER=de_DE.utf8 export LC_MONETARY=de_DE.utf8 export LC_NUMERIC=de_DE.utf8 export LC_MEASUREMENT=de_DE.utf8 export LC_TIME=de_DE.utf8 make test TEST=jdk_lang

I have created patch to fix this problem. The patch is attached to this mail.

Best regards, Andrej Golovnin

[1] http://mail.openjdk.java.net/pipermail/core-libs-dev/2014-June/027194.html -------------- next part -------------- diff --git a/test/jdk/lambda/LambdaTranslationTest1.java b/test/jdk/lambda/LambdaTranslationTest1.java --- a/test/jdk/lambda/LambdaTranslationTest1.java +++ b/test/jdk/lambda/LambdaTranslationTest1.java @@ -21,6 +21,7 @@

+import java.util.Locale; import java.util.function.Consumer;

import org.testng.annotations.Test; @@ -54,15 +55,15 @@ }

 static void eye(Integer i) {

@@ -87,37 +88,37 @@ }

     cntxt = "blah";

@@ -159,7 +160,7 @@ private int that = 1234;

     void doInner() {

@@ -168,7 +169,7 @@ assertResult("fruitfruit");

         cntxt = "human";

@@ -179,16 +180,16 @@ System.out.printf("c5: %s\n", c5.call() ); **/

diff --git a/test/jdk/lambda/LambdaTranslationTest2.java b/test/jdk/lambda/LambdaTranslationTest2.java --- a/test/jdk/lambda/LambdaTranslationTest2.java +++ b/test/jdk/lambda/LambdaTranslationTest2.java @@ -25,6 +25,7 @@

import java.util.ArrayList; import java.util.List; +import java.util.Locale; import java.util.function.Function; import java.util.function.Predicate;

@@ -160,39 +161,39 @@ }

 static String pb(Byte a0, Short a1, Character a2, Integer a3, Long a4, Boolean a5, Float a6, Double a7) {

@@ -216,7 +217,7 @@ }

 static String pu(byte a0, short a1, char a2, int a3, long a4, boolean a5, float a6, double a7) {


More information about the core-libs-dev mailing list