-
-
Notifications
You must be signed in to change notification settings - Fork 351
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix:Set the type of a parameter declared in a lambda to Object instea…
…d of ommitting them when unknown. (#1108) * Set the type of a parameter declared in a lambda to Object if unknown. * Added some tests.
- Loading branch information
1 parent
41b2895
commit 21657c6
Showing
5 changed files
with
103 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
src/test/resources/noclasspath/lambdas/MultiParameterLambda.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import java.util.Map; | ||
import java.util.HashMap; | ||
|
||
import test.Unknown; | ||
|
||
public class MultiParameterLambda { | ||
|
||
public void stringLambda() { | ||
final Map<String, String> map = new HashMap<>(); | ||
map.put("a", "A"); | ||
map.put("b", "B"); | ||
map.put("c", "C"); | ||
map.forEach((key, value) -> System.out.println(key + ", " + value)); | ||
} | ||
|
||
public void integerLambda() { | ||
final Map<Integer, Integer> map = new HashMap<>(); | ||
map.put(1, 100); | ||
map.put(2, 200); | ||
map.put(3, 300); | ||
map.forEach((key, value) -> System.out.println(key + ", " + value)); | ||
} | ||
|
||
public void unknownLambda() { | ||
final Map<Unknown, Unknown> map = new HashMap<>(); | ||
map.put(new Unknown(), new Unknown()); | ||
map.put(new Unknown(), new Unknown()); | ||
map.put(new Unknown(), new Unknown()); | ||
map.forEach((key, value) -> System.out.println(key + ", " + value)); | ||
} | ||
} |