Переглянути джерело

Help Eclipse infering lambda parameter types (#40747)

The Eclipse compiler (4.10, Photon) cannot build this test because it cannot
correctly infer the type arguments of the functions. Explicitely adding them
helps in this case.
Christoph Büscher 6 роки тому
батько
коміт
c09603e75a

+ 3 - 2
server/src/test/java/org/elasticsearch/BuildTests.java

@@ -162,8 +162,9 @@ public class BuildTests extends ESTestCase {
         EqualsHashCodeTestUtils.checkEqualsAndHashCode(new WriteableBuild(new Build(
                 randomFrom(Build.Flavor.values()), randomFrom(Build.Type.values()),
                 randomAlphaOfLength(6), randomAlphaOfLength(6), randomBoolean(), randomAlphaOfLength(6))),
-            b -> copyWriteable(b, writableRegistry(), WriteableBuild::new, Version.CURRENT),
-            b -> {
+            // Note: the cast of the Copy- and MutateFunction is needed for some IDE (specifically Eclipse 4.10.0) to infer the right type
+            (WriteableBuild b) -> copyWriteable(b, writableRegistry(), WriteableBuild::new, Version.CURRENT),
+            (WriteableBuild b) -> {
                 switch (randomIntBetween(1, 6)) {
                     case 1:
                         return new WriteableBuild(new Build(