test/tools/javac/lambda/methodReference/SamConversion.java

changeset 1510
7873d37f5b37
parent 1435
9b26c96f5138
child 2227
998b10c43157
equal deleted inserted replaced
1509:1985e35e97b2 1510:7873d37f5b37
147 test2(A::method1, 2); 147 test2(A::method1, 2);
148 test2(new A()::method2, 3); 148 test2(new A()::method2, 3);
149 test2(A::method3, 4); 149 test2(A::method3, 4);
150 test2(new A()::method4, 5); 150 test2(new A()::method4, 5);
151 test2(new A()::method5, 6); 151 test2(new A()::method5, 6);
152 A a = new A(A::method1); //A(Foo f) called
153 assertTrue(a.method2(1) == 11);
154 assertTrue(a.method4(1) == 11);
155 assertTrue(a.method5(1) == 11);
156 A a2 = new A(new A()::method2); //A(Bar b) called
157 assertTrue(a2.method2(1) == 12);
158 assertTrue(a2.method4(1) == 12);
159 assertTrue(a2.method5(1) == 12);
160 } 152 }
161 153
162 /** 154 /**
163 * Test SAM conversion of method reference in return statement context 155 * Test SAM conversion of method reference in return statement context
164 */ 156 */
277 testArrayInitializer(); 269 testArrayInitializer();
278 testConditionalExpression(true); 270 testConditionalExpression(true);
279 testConditionalExpression(false); 271 testConditionalExpression(false);
280 testLambdaExpressionBody(); 272 testLambdaExpressionBody();
281 273
282 assertTrue(assertionCount == 38); 274 assertTrue(assertionCount == 32);
283 } 275 }
284 276
285 static class MyException extends Exception {} 277 static class MyException extends Exception {}
286 278
287 static class A { 279 static class A {

mercurial