langtools/test/tools/javac/lambda/LambdaConv01.java
changeset 18662 1cac45e71eb9
parent 14547 86d8d242b0c4
child 22448 a85fbad9d687
equal deleted inserted replaced
18661:9dedda2ba49a 18662:1cac45e71eb9
    65         //Assignment conversion:
    65         //Assignment conversion:
    66         VoidToInt f1 = ()-> 3;
    66         VoidToInt f1 = ()-> 3;
    67         assertTrue(3 == f1.foo());
    67         assertTrue(3 == f1.foo());
    68         //Covariant returns:
    68         //Covariant returns:
    69         TU<Number, Integer> f2 = (Integer x) -> x;
    69         TU<Number, Integer> f2 = (Integer x) -> x;
    70         assertTrue(3 == f2.foo(3));
    70         assertTrue(3 == f2.foo(3).intValue());
    71         //Method resolution with boxing:
    71         //Method resolution with boxing:
    72         int res = LambdaConv01.<Integer,Integer>exec((Integer x) -> x, 3);
    72         int res = LambdaConv01.<Integer,Integer>exec((Integer x) -> x, 3);
    73         assertTrue(3 == res);
    73         assertTrue(3 == res);
    74         //Runtime exception transparency:
    74         //Runtime exception transparency:
    75         try {
    75         try {
    84         //Assignment conversion:
    84         //Assignment conversion:
    85         VoidToInt f1 = ()-> 3;
    85         VoidToInt f1 = ()-> 3;
    86         assertTrue(3 == f1.foo());
    86         assertTrue(3 == f1.foo());
    87         //Covariant returns:
    87         //Covariant returns:
    88         TU<Number, Integer> f2 = (Integer x) -> x;
    88         TU<Number, Integer> f2 = (Integer x) -> x;
    89         assertTrue(3 == f2.foo(3));
    89         assertTrue(3 == f2.foo(3).intValue());
    90         //Method resolution with boxing:
    90         //Method resolution with boxing:
    91         int res = LambdaConv01.<Integer,Integer>exec((Integer x) -> x, 3);
    91         int res = LambdaConv01.<Integer,Integer>exec((Integer x) -> x, 3);
    92         assertTrue(3 == res);
    92         assertTrue(3 == res);
    93         //Runtime exception transparency:
    93         //Runtime exception transparency:
    94         try {
    94         try {
   103         //Assignment conversion:
   103         //Assignment conversion:
   104         VoidToInt f1 = ()-> 3;
   104         VoidToInt f1 = ()-> 3;
   105         assertTrue(3 == f1.foo());
   105         assertTrue(3 == f1.foo());
   106         //Covariant returns:
   106         //Covariant returns:
   107         TU<Number, Integer> f2 = (Integer x) -> x;
   107         TU<Number, Integer> f2 = (Integer x) -> x;
   108         assertTrue(3 == f2.foo(3));
   108         assertTrue(3 == f2.foo(3).intValue());
   109         //Method resolution with boxing:
   109         //Method resolution with boxing:
   110         int res = LambdaConv01.<Integer,Integer>exec((Integer x) -> x, 3);
   110         int res = LambdaConv01.<Integer,Integer>exec((Integer x) -> x, 3);
   111         assertTrue(3 == res);
   111         assertTrue(3 == res);
   112         //Runtime exception transparency:
   112         //Runtime exception transparency:
   113         try {
   113         try {
   122         //Assignment conversion:
   122         //Assignment conversion:
   123         VoidToInt f1 = ()-> 3;
   123         VoidToInt f1 = ()-> 3;
   124         assertTrue(3 == f1.foo());
   124         assertTrue(3 == f1.foo());
   125         //Covariant returns:
   125         //Covariant returns:
   126         TU<Number, Integer> f2 = (Integer x) -> x;
   126         TU<Number, Integer> f2 = (Integer x) -> x;
   127         assertTrue(3 == f2.foo(3));
   127         assertTrue(3 == f2.foo(3).intValue());
   128         //Method resolution with boxing:
   128         //Method resolution with boxing:
   129         int res = LambdaConv01.<Integer,Integer>exec((Integer x) -> x, 3);
   129         int res = LambdaConv01.<Integer,Integer>exec((Integer x) -> x, 3);
   130         assertTrue(3 == res);
   130         assertTrue(3 == res);
   131         //Runtime exception transparency:
   131         //Runtime exception transparency:
   132         try {
   132         try {