langtools/test/tools/javac/lambda/lambdaExecution/LambdaTranslationTest2.java
author alundblad
Wed, 26 Aug 2015 09:02:02 +0200
changeset 32337 c9d3ab9f601c
parent 14554 4e29b285c723
permissions -rw-r--r--
8133671: langtools tests have bad license Summary: Dropped classpath exception from copyright notice in tests. Reviewed-by: jjg
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
14554
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
     1
/*
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
     2
 * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
     4
 *
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
32337
c9d3ab9f601c 8133671: langtools tests have bad license
alundblad
parents: 14554
diff changeset
     7
 * published by the Free Software Foundation.
14554
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
     8
 *
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
    13
 * accompanied this code).
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
    14
 *
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
    18
 *
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
    21
 * questions.
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
    22
 */
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
    23
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
    24
/**
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
    25
 * @test
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
    26
 * @bug 8003639
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
    27
 * @summary convert lambda testng tests to jtreg and add them
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
    28
 * @run testng LambdaTranslationTest2
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
    29
 */
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
    30
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
    31
import org.testng.annotations.Test;
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
    32
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
    33
import java.util.ArrayList;
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
    34
import java.util.List;
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
    35
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
    36
import static org.testng.Assert.assertEquals;
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
    37
import static org.testng.Assert.assertTrue;
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
    38
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
    39
/**
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
    40
 * LambdaTranslationTest2 -- end-to-end smoke tests for lambda evaluation
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
    41
 */
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
    42
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
    43
@Test
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
    44
public class LambdaTranslationTest2 {
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
    45
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
    46
    final String dummy = "dummy";
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
    47
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
    48
    public void testLambdas() {
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
    49
        TPredicate<String> isEmpty = s -> s.isEmpty();
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
    50
        assertTrue(isEmpty.test(""));
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
    51
        assertTrue(!isEmpty.test("foo"));
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
    52
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
    53
        TPredicate<Object> oIsEmpty = s -> ((String) s).isEmpty();
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
    54
        assertTrue(oIsEmpty.test(""));
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
    55
        assertTrue(!oIsEmpty.test("foo"));
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
    56
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
    57
        TPredicate<Object> alwaysTrue = o -> true;
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
    58
        assertTrue(alwaysTrue.test(""));
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
    59
        assertTrue(alwaysTrue.test(null));
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
    60
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
    61
        TPredicate<Object> alwaysFalse = o -> false;
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
    62
        assertTrue(!alwaysFalse.test(""));
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
    63
        assertTrue(!alwaysFalse.test(null));
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
    64
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
    65
        // tests local capture
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
    66
        String foo = "foo";
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
    67
        TPredicate<String> equalsFoo = s -> s.equals(foo);
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
    68
        assertTrue(!equalsFoo.test(""));
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
    69
        assertTrue(equalsFoo.test("foo"));
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
    70
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
    71
        // tests instance capture
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
    72
        TPredicate<String> equalsDummy = s -> s.equals(dummy);
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
    73
        assertTrue(!equalsDummy.test(""));
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
    74
        assertTrue(equalsDummy.test("dummy"));
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
    75
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
    76
        TMapper<Object, Object> ident = s -> s;
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
    77
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
    78
        assertEquals("blarf", ident.map("blarf"));
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
    79
        assertEquals("wooga", ident.map("wooga"));
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
    80
        assertTrue("wooga" == ident.map("wooga"));
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
    81
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
    82
        // constant capture
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
    83
        TMapper<Object, Object> prefixer = s -> "p" + s;
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
    84
        assertEquals("pblarf", prefixer.map("blarf"));
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
    85
        assertEquals("pwooga", prefixer.map("wooga"));
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
    86
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
    87
        // instance capture
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
    88
        TMapper<Object, Object> prefixer2 = s -> dummy + s;
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
    89
        assertEquals("dummyblarf", prefixer2.map("blarf"));
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
    90
        assertEquals("dummywooga", prefixer2.map("wooga"));
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
    91
    }
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
    92
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
    93
    interface Factory<T> {
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
    94
        T make();
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
    95
    }
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
    96
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
    97
    interface StringFactory extends Factory<String> { }
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
    98
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
    99
    interface StringFactory2 extends Factory<String> {
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   100
        String make();
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   101
    }
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   102
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   103
    public void testBridges() {
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   104
        Factory<String> of = () -> "y";
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   105
        Factory<?> ef = () -> "z";
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   106
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   107
        assertEquals("y", of.make());
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   108
        assertEquals("y", ((Factory<?>) of).make());
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   109
        assertEquals("y", ((Factory) of).make());
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   110
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   111
        assertEquals("z", ef.make());
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   112
        assertEquals("z", ((Factory) ef).make());
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   113
    }
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   114
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   115
    public void testBridgesImplicitSpecialization() {
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   116
        StringFactory sf = () -> "x";
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   117
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   118
        assertEquals("x", sf.make());
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   119
        assertEquals("x", ((Factory<String>) sf).make());
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   120
        assertEquals("x", ((Factory<?>) sf).make());
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   121
        assertEquals("x", ((Factory) sf).make());
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   122
    }
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   123
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   124
    public void testBridgesExplicitSpecialization() {
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   125
        StringFactory2 sf = () -> "x";
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   126
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   127
        assertEquals("x", sf.make());
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   128
        assertEquals("x", ((Factory<String>) sf).make());
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   129
        assertEquals("x", ((Factory<?>) sf).make());
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   130
        assertEquals("x", ((Factory) sf).make());
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   131
    }
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   132
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   133
    public void testSuperCapture() {
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   134
        class A {
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   135
            String make() { return "x"; }
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   136
        }
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   137
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   138
        class B extends A {
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   139
            void testSuperCapture() {
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   140
                StringFactory sf = () -> super.make();
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   141
                assertEquals("x", sf.make());
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   142
            }
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   143
        }
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   144
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   145
        new B().testSuperCapture();
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   146
    }
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   147
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   148
    interface WidenD {
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   149
        public String m(float a0, double a1);
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   150
    }
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   151
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   152
    interface WidenS {
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   153
        public String m(byte a0, short a1);
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   154
    }
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   155
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   156
    interface WidenI {
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   157
        public String m(byte a0, short a1, char a2, int a3);
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   158
    }
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   159
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   160
    interface WidenL {
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   161
        public String m(byte a0, short a1, char a2, int a3, long a4);
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   162
    }
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   163
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   164
    interface Box {
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   165
        public String m(byte a0, short a1, char a2, int a3, long a4, boolean a5, float a6, double a7);
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   166
    }
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   167
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   168
    static String pb(Byte a0, Short a1, Character a2, Integer a3, Long a4, Boolean a5, Float a6, Double a7) {
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   169
        return String.format("b%d s%d c%c i%d j%d z%b f%f d%f", a0, a1, a2, a3, a4, a5, a6, a7);
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   170
    }
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   171
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   172
    static String pwI1(int a0, int a1, int a2, int a3) {
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   173
        return String.format("b%d s%d c%d i%d", a0, a1, a2, a3);
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   174
    }
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   175
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   176
    static String pwI2(Integer a0, Integer a1, Integer a2, Integer a3) {
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   177
        return String.format("b%d s%d c%d i%d", a0, a1, a2, a3);
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   178
    }
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   179
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   180
    static String pwL1(long a0, long a1, long a2, long a3, long a4) {
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   181
        return String.format("b%d s%d c%d i%d j%d", a0, a1, a2, a3, a4);
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   182
    }
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   183
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   184
    static String pwL2(Long a0, Long a1, Long a2, Long a3, Long a4) {
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   185
        return String.format("b%d s%d c%d i%d j%d", a0, a1, a2, a3, a4);
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   186
    }
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   187
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   188
    static String pwS1(short a0, short a1) {
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   189
        return String.format("b%d s%d", a0, a1);
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   190
    }
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   191
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   192
    static String pwS2(Short a0, Short a1) {
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   193
        return String.format("b%d s%d", a0, a1);
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   194
    }
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   195
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   196
    static String pwD1(double a0, double a1) {
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   197
        return String.format("f%f d%f", a0, a1);
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   198
    }
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   199
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   200
    static String pwD2(Double a0, Double a1) {
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   201
        return String.format("f%f d%f", a0, a1);
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   202
    }
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   203
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   204
    public void testPrimitiveWidening() {
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   205
        WidenS ws1 = LambdaTranslationTest2::pwS1;
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   206
        assertEquals("b1 s2", ws1.m((byte) 1, (short) 2));
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   207
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   208
        WidenD wd1 = LambdaTranslationTest2::pwD1;
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   209
        assertEquals("f1.000000 d2.000000", wd1.m(1.0f, 2.0));
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   210
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   211
        WidenI wi1 = LambdaTranslationTest2::pwI1;
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   212
        assertEquals("b1 s2 c3 i4", wi1.m((byte) 1, (short) 2, (char) 3, 4));
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   213
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   214
        WidenL wl1 = LambdaTranslationTest2::pwL1;
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   215
        assertEquals("b1 s2 c3 i4 j5", wl1.m((byte) 1, (short) 2, (char) 3, 4, 5L));
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   216
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   217
        // @@@ TODO: clarify spec on widen+box conversion
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   218
    }
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   219
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   220
    interface Unbox {
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   221
        public String m(Byte a0, Short a1, Character a2, Integer a3, Long a4, Boolean a5, Float a6, Double a7);
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   222
    }
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   223
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   224
    static String pu(byte a0, short a1, char a2, int a3, long a4, boolean a5, float a6, double a7) {
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   225
        return String.format("b%d s%d c%c i%d j%d z%b f%f d%f", a0, a1, a2, a3, a4, a5, a6, a7);
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   226
    }
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   227
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   228
    public void testUnboxing() {
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   229
        Unbox u = LambdaTranslationTest2::pu;
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   230
        assertEquals("b1 s2 cA i4 j5 ztrue f6.000000 d7.000000", u.m((byte)1, (short) 2, 'A', 4, 5L, true, 6.0f, 7.0));
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   231
    }
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   232
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   233
    public void testBoxing() {
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   234
        Box b = LambdaTranslationTest2::pb;
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   235
        assertEquals("b1 s2 cA i4 j5 ztrue f6.000000 d7.000000", b.m((byte) 1, (short) 2, 'A', 4, 5L, true, 6.0f, 7.0));
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   236
    }
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   237
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   238
    static boolean cc(Object o) {
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   239
        return ((String) o).equals("foo");
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   240
    }
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   241
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   242
    public void testArgCastingAdaptation() {
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   243
        TPredicate<String> p = LambdaTranslationTest2::cc;
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   244
        assertTrue(p.test("foo"));
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   245
        assertTrue(!p.test("bar"));
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   246
    }
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   247
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   248
    interface SonOfPredicate<T> extends TPredicate<T> { }
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   249
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   250
    public void testExtendsSAM() {
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   251
        SonOfPredicate<String> p = s -> s.isEmpty();
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   252
        assertTrue(p.test(""));
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   253
        assertTrue(!p.test("foo"));
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   254
    }
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   255
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   256
    public void testConstructorRef() {
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   257
        Factory<List<String>> lf = ArrayList<String>::new;
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   258
        List<String> list = lf.make();
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   259
        assertTrue(list instanceof ArrayList);
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   260
        assertTrue(list != lf.make());
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   261
        list.add("a");
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   262
        assertEquals("[a]", list.toString());
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   263
    }
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   264
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   265
    private static String privateMethod() {
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   266
        return "private";
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   267
    }
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   268
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   269
    public void testPrivateMethodRef() {
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   270
        Factory<String> sf = LambdaTranslationTest2::privateMethod;
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   271
        assertEquals("private", sf.make());
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   272
    }
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   273
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   274
    private interface PrivateIntf {
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   275
        String make();
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   276
    }
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   277
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   278
    public void testPrivateIntf() {
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   279
        PrivateIntf p = () -> "foo";
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   280
        assertEquals("foo", p.make());
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   281
    }
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   282
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   283
    interface Op<T> {
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   284
        public T op(T a, T b);
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   285
    }
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   286
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   287
    public void testBoxToObject() {
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   288
        Op<Integer> maxer = Math::max;
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   289
        for (int i=-100000; i < 100000; i += 100)
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   290
            for (int j=-100000; j < 100000; j += 99) {
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   291
                assertEquals((int) maxer.op(i,j), Math.max(i,j));
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   292
            }
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   293
    }
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   294
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   295
    protected static String protectedMethod() {
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   296
        return "protected";
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   297
    }
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   298
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   299
    public void testProtectedMethodRef() {
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   300
        Factory<String> sf = LambdaTranslationTest2::protectedMethod;
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   301
        assertEquals("protected", sf.make());
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   302
    }
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   303
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   304
    class Inner1 {
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   305
        String m1() {
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   306
            return "Inner1.m1()";
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   307
        }
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   308
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   309
        class Inner2 {
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   310
            public String m1() {
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   311
                return "Inner1.Inner2.m1()";
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   312
            }
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   313
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   314
            protected String m2() {
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   315
                return "Inner1.Inner2.m2()";
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   316
            }
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   317
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   318
            String m3() {
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   319
                return "Inner1.Inner2.m3()";
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   320
            }
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   321
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   322
            class Inner3<T> {
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   323
                T t = null;
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   324
                Inner3(T t) {
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   325
                    this.t = t;
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   326
                }
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   327
                T m1() {
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   328
                    return t;
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   329
                }
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   330
            }
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   331
        }
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   332
    }
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   333
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   334
    public void testInnerClassMethodRef() {
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   335
        Factory<String> fs = new Inner1()::m1;
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   336
        assertEquals("Inner1.m1()", fs.make());
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   337
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   338
        fs = new Inner1().new Inner2()::m1;
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   339
        assertEquals("Inner1.Inner2.m1()", fs.make());
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   340
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   341
        fs = new Inner1().new Inner2()::m2;
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   342
        assertEquals("Inner1.Inner2.m2()", fs.make());
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   343
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   344
        fs = new Inner1().new Inner2()::m3;
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   345
        assertEquals("Inner1.Inner2.m3()", fs.make());
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   346
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   347
        fs = new Inner1().new Inner2().new Inner3<String>("Inner1.Inner2.Inner3")::m1;
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   348
        assertEquals("Inner1.Inner2.Inner3", fs.make());
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   349
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   350
        Factory<Integer> fsi = new Inner1().new Inner2().new Inner3<Integer>(100)::m1;
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   351
        assertEquals(100, (int)fsi.make());
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   352
    }
4e29b285c723 8003639: convert lambda testng tests to jtreg and add them
rfield
parents:
diff changeset
   353
}