Skip to content

Commit 95cb621

Browse files
author
Jason Desrosiers
committed
Fix problem with ordering of Koans in AboutLambdas
There are two Koans that jump to the front of the line and don't get executed in order like the rest. The problem seems to be in the way they are named. My best guess is that Java reflection is ordering them first because a member variable with the same name comes above it. However, adding characters to the end of the name doesn't fix the problem, you have the change something else. It's possible that this is a problem with Java reflection and there isn't anything else that can be done, but I suspect there might be a bug in the Koans library that could explain the odd behavior. Fixing that could help avoid similar issues elsewhere.
1 parent e391a7b commit 95cb621

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

‎koans/src/java8/AboutLambdas.java‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ public String toString() {
2323
static String str = "";
2424

2525
//lambda has access to "this"
26-
Caps lambdaField = s -> this.toString();
26+
Caps thisLambdaField = s -> this.toString();
2727
//lambda has access to object methods
28-
Caps lambdaField2 = s -> toString();
28+
Caps toStringLambdaField = s -> toString();
2929

3030
@Koan
3131
public void verySimpleLambda() throws InterruptedException {
@@ -55,12 +55,12 @@ public void simpleSuccinctLambda() {
5555

5656
@Koan
5757
public void lambdaField() {
58-
assertEquals(lambdaField.capitalize(""), __);
58+
assertEquals(thisLambdaField.capitalize(""), __);
5959
}
6060

6161
@Koan
6262
public void lambdaField2() {
63-
assertEquals(lambdaField2.capitalize(""), __);
63+
assertEquals(toStringLambdaField.capitalize(""), __);
6464
}
6565

6666
@Koan

0 commit comments

Comments
 (0)