langtools/test/tools/javac/annotations/typeAnnotations/referenceinfos/Lambda.java
author akulyakh
Thu, 21 May 2015 11:41:04 -0700
changeset 30730 d3ce7619db2c
parent 26532 aa84b6606229
child 30846 2b3f379840f0
permissions -rw-r--r--
8076543: Add @modules as needed to the langtools tests Reviewed-by: jjg, shurailine
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
15718
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
     1
/*
30730
d3ce7619db2c 8076543: Add @modules as needed to the langtools tests
akulyakh
parents: 26532
diff changeset
     2
 * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
15718
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
     4
 *
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
     7
 * published by the Free Software Foundation.
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
     8
 *
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
    13
 * accompanied this code).
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
    14
 *
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
    18
 *
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
    21
 * questions.
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
    22
 */
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
    23
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
    24
/*
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
    25
 * @test
24896
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
    26
 * @bug 8008077 8029721 8042451 8043974
15718
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
    27
 * @summary Test population of reference info for lambda expressions
26532
aa84b6606229 8056021: checkin for JDK-8027262 breaks Checker Framework
jfranck
parents: 24896
diff changeset
    28
 *          javac crash for annotated parameter type of lambda in a field
30730
d3ce7619db2c 8076543: Add @modules as needed to the langtools tests
akulyakh
parents: 26532
diff changeset
    29
 * @modules jdk.compiler/com.sun.tools.classfile
26532
aa84b6606229 8056021: checkin for JDK-8027262 breaks Checker Framework
jfranck
parents: 24896
diff changeset
    30
 * @ignore 8057687 emit correct byte code an attributes for type annotations
15718
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
    31
 * @compile -g Driver.java ReferenceInfoUtil.java Lambda.java
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
    32
 * @run main Driver Lambda
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
    33
 * @author Werner Dietl
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
    34
 */
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
    35
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
    36
import static com.sun.tools.classfile.TypeAnnotation.TargetType.*;
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
    37
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
    38
public class Lambda {
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
    39
24896
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
    40
    @TADescription(annotation = "TA", type = METHOD_REFERENCE,
15718
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
    41
                offset = ReferenceInfoUtil.IGNORE_VALUE)
24896
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
    42
    @TADescription(annotation = "TB", type = METHOD_REFERENCE,
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
    43
                offset = ReferenceInfoUtil.IGNORE_VALUE)
15718
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
    44
    public String returnMethodRef1() {
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
    45
        return
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
    46
                "class Lambda {" +
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
    47
                "  public String getName() { return \"Lambda!\"; }" +
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
    48
                "}" +
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
    49
24896
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
    50
                "class %TEST_CLASS_NAME% {" +
15718
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
    51
                "  java.util.function.Function<Lambda, String> lambda() {" +
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
    52
                "    return @TA @TB Lambda::getName;" +
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
    53
                "  }" +
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
    54
                "}";
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
    55
    }
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
    56
24896
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
    57
    @TADescription(annotation = "TA", type = METHOD_REFERENCE,
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
    58
                offset = ReferenceInfoUtil.IGNORE_VALUE)
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
    59
    @TADescription(annotation = "TB", type = METHOD_REFERENCE,
15718
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
    60
                offset = ReferenceInfoUtil.IGNORE_VALUE,
24896
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
    61
                genericLocation = { 3, 0 })
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
    62
    @TADescription(annotation = "TC", type = METHOD_REFERENCE,
15718
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
    63
                offset = ReferenceInfoUtil.IGNORE_VALUE,
24896
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
    64
                genericLocation = { 3, 0 })
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
    65
    @TADescription(annotation = "TD", type = METHOD_REFERENCE,
15718
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
    66
                offset = ReferenceInfoUtil.IGNORE_VALUE,
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
    67
                genericLocation = { 3, 1 })
24896
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
    68
    @TADescription(annotation = "TE", type = METHOD_REFERENCE,
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
    69
                offset = ReferenceInfoUtil.IGNORE_VALUE,
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
    70
                genericLocation = { 3, 1})
15718
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
    71
    public String returnMethodRef2() {
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
    72
        return
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
    73
                "class Lambda<S, T> {" +
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
    74
                "  public String getName() { return \"Lambda!\"; }" +
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
    75
                "}" +
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
    76
24896
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
    77
                "class %TEST_CLASS_NAME% {" +
15718
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
    78
                "  java.util.function.Function<Lambda<Integer, Float>, String> lambda() {" +
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
    79
                "    return @TA Lambda<@TB @TC Integer, @TD @TE Float>::getName;" +
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
    80
                "  }" +
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
    81
                "}";
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
    82
    }
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
    83
24896
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
    84
    @TADescription(annotation = "CTA", type = METHOD_REFERENCE,
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
    85
                offset = ReferenceInfoUtil.IGNORE_VALUE)
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
    86
    @TADescription(annotation = "CTB", type = METHOD_REFERENCE,
15718
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
    87
                offset = ReferenceInfoUtil.IGNORE_VALUE,
24896
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
    88
                genericLocation = { 3, 0 })
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
    89
    @TADescription(annotation = "CTC", type = METHOD_REFERENCE,
15718
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
    90
                offset = ReferenceInfoUtil.IGNORE_VALUE,
24896
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
    91
                genericLocation = { 3, 1    })
15718
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
    92
    public String returnMethodRef3() {
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
    93
        return
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
    94
                "class Lambda<S, T> {" +
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
    95
                "  public String getName() { return \"Lambda!\"; }" +
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
    96
                "}" +
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
    97
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
    98
                "@Target(ElementType.TYPE_USE)" +
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
    99
                "@interface CTA {" +
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   100
                "  String value();" +
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   101
                "}" +
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   102
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   103
                "@Target(ElementType.TYPE_USE)" +
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   104
                "@interface CTB {" +
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   105
                "  int age();" +
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   106
                "}" +
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   107
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   108
                "@Target(ElementType.TYPE_USE)" +
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   109
                "@interface CTC {" +
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   110
                "  String name();" +
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   111
                "}" +
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   112
24896
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   113
                "class %TEST_CLASS_NAME% {" +
15718
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   114
                "  java.util.function.Function<Lambda<Integer, Float>, String> lambda() {" +
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   115
                "    return @CTA(\"x\") Lambda<@CTB(age = 5) Integer, @CTC(name = \"y\") Float>::getName;" +
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   116
                "  }" +
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   117
                "}";
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   118
    }
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   119
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   120
24896
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   121
    @TADescription(annotation = "TA", type = CONSTRUCTOR_REFERENCE,
15718
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   122
                offset = ReferenceInfoUtil.IGNORE_VALUE)
24896
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   123
    @TADescription(annotation = "TB", type = CONSTRUCTOR_REFERENCE,
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   124
                offset = ReferenceInfoUtil.IGNORE_VALUE)
15718
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   125
    public String returnConstructorRef1() {
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   126
        return
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   127
                "class Lambda {" +
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   128
                "  Lambda() { }" +
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   129
                "}" +
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   130
24896
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   131
                "class %TEST_CLASS_NAME% {" +
15718
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   132
                "  Runnable lambda() {" +
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   133
                "    return @TA @TB Lambda::new;" +
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   134
                "  }" +
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   135
                "}";
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   136
    }
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   137
24896
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   138
    @TADescription(annotation = "TA", type = CONSTRUCTOR_REFERENCE,
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   139
                offset = ReferenceInfoUtil.IGNORE_VALUE)
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   140
    @TADescription(annotation = "TB", type = CONSTRUCTOR_REFERENCE,
15718
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   141
                offset = ReferenceInfoUtil.IGNORE_VALUE,
24896
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   142
                genericLocation = { 3, 0 })
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   143
    @TADescription(annotation = "TC", type = CONSTRUCTOR_REFERENCE,
15718
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   144
                offset = ReferenceInfoUtil.IGNORE_VALUE,
24896
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   145
                genericLocation = { 3, 0 })
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   146
    @TADescription(annotation = "TD", type = CONSTRUCTOR_REFERENCE,
15718
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   147
                offset = ReferenceInfoUtil.IGNORE_VALUE,
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   148
                genericLocation = { 3, 1 })
24896
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   149
    @TADescription(annotation = "TE", type = CONSTRUCTOR_REFERENCE,
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   150
                offset = ReferenceInfoUtil.IGNORE_VALUE,
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   151
                genericLocation = { 3, 1    })
15718
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   152
    public String returnConstructorRef2() {
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   153
        return
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   154
                "class Lambda<S, T> {" +
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   155
                "  Lambda() { }" +
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   156
                "}" +
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   157
24896
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   158
                "class %TEST_CLASS_NAME% {" +
15718
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   159
                "  Runnable lambda() {" +
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   160
                "    return @TA Lambda<@TB @TC Integer, @TD @TE Float>::new;" +
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   161
                "  }" +
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   162
                "}";
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   163
    }
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   164
24896
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   165
    @TADescription(annotation = "CTA", type = CONSTRUCTOR_REFERENCE,
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   166
                offset = ReferenceInfoUtil.IGNORE_VALUE)
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   167
    @TADescription(annotation = "CTB", type = CONSTRUCTOR_REFERENCE,
15718
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   168
                offset = ReferenceInfoUtil.IGNORE_VALUE,
24896
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   169
                genericLocation = { 3, 0 })
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   170
    @TADescription(annotation = "CTC", type = CONSTRUCTOR_REFERENCE,
15718
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   171
                offset = ReferenceInfoUtil.IGNORE_VALUE,
24896
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   172
                genericLocation = { 3, 1    })
15718
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   173
    public String returnConstructorRef3() {
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   174
        return
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   175
                "class Lambda<S, T> {" +
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   176
                "  Lambda() { }" +
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   177
                "}" +
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   178
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   179
                "@Target(ElementType.TYPE_USE)" +
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   180
                "@interface CTA {" +
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   181
                "  String value();" +
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   182
                "}" +
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   183
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   184
                "@Target(ElementType.TYPE_USE)" +
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   185
                "@interface CTB {" +
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   186
                "  int age();" +
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   187
                "}" +
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   188
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   189
                "@Target(ElementType.TYPE_USE)" +
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   190
                "@interface CTC {" +
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   191
                "  String name();" +
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   192
                "}" +
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   193
24896
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   194
                "class %TEST_CLASS_NAME% {" +
15718
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   195
                "  Runnable lambda() {" +
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   196
                "    return @CTA(\"x\") Lambda<@CTB(age = 5) Integer, @CTC(name = \"y\") Float>::new;" +
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   197
                "  }" +
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   198
                "}";
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   199
    }
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   200
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   201
24896
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   202
    @TADescription(annotation = "TA", type = METHOD_REFERENCE_TYPE_ARGUMENT,
15718
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   203
                 offset = ReferenceInfoUtil.IGNORE_VALUE,
24896
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   204
                 typeIndex = 0)
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   205
    @TADescription(annotation = "TB", type = METHOD_REFERENCE_TYPE_ARGUMENT,
15718
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   206
                 offset = ReferenceInfoUtil.IGNORE_VALUE,
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   207
                 typeIndex = 1)
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   208
    public String returnMethodRefTA1() {
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   209
        return
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   210
                "interface Lambda {" +
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   211
                "  <S, T> void generic(S p1, T p2);" +
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   212
                "}" +
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   213
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   214
                "class LambdaImpl implements Lambda {" +
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   215
                "  public <S, T> void generic(S p1, T p2) {}" +
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   216
                "}" +
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   217
24896
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   218
                "class %TEST_CLASS_NAME% {" +
15718
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   219
                "  Lambda lambda(LambdaImpl r) {" +
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   220
                "    return r::<@TA Object, @TB Object>generic;" +
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   221
                "  }" +
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   222
                "}";
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   223
    }
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   224
24896
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   225
    @TADescription(annotation = "TA", type = CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT,
15718
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   226
                 offset = ReferenceInfoUtil.IGNORE_VALUE,
24896
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   227
                 typeIndex = 0)
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   228
    @TADescription(annotation = "TB", type = CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT,
15718
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   229
                 offset = ReferenceInfoUtil.IGNORE_VALUE,
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   230
                 typeIndex = 1)
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   231
    public String returnConstructorRefTA2() {
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   232
        return
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   233
                "interface Lambda {" +
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   234
                "  <S, T> void generic(S p1, T p2);" +
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   235
                "}" +
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   236
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   237
                "class LambdaImpl implements Lambda {" +
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   238
                "  <S, T> LambdaImpl(S p1, T p2) {}" +
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   239
                "  public <S, T> void generic(S p1, T p2) {}" +
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   240
                "}" +
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   241
24896
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   242
                "class %TEST_CLASS_NAME% {" +
15718
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   243
                "  Lambda lambda() {" +
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   244
                "    return LambdaImpl::<@TA Object, @TB Object>new;" +
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   245
                "  }" +
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   246
                "}";
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   247
    }
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   248
24896
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   249
    @TADescription(annotation = "TA", type = METHOD_FORMAL_PARAMETER,
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   250
                paramIndex = 0)
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   251
    @TADescription(annotation = "TB", type = METHOD_FORMAL_PARAMETER,
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   252
                paramIndex = 1)
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   253
    @TADescription(annotation = "TC", type = METHOD_FORMAL_PARAMETER,
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   254
                paramIndex = 1, genericLocation = { 3, 0 })
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   255
    @TADescription(annotation = "TD", type = LOCAL_VARIABLE,
17578
46ac954e4a84 8013852: update reference impl for type-annotations
jjg
parents: 15718
diff changeset
   256
                lvarOffset = ReferenceInfoUtil.IGNORE_VALUE,
46ac954e4a84 8013852: update reference impl for type-annotations
jjg
parents: 15718
diff changeset
   257
                lvarLength = ReferenceInfoUtil.IGNORE_VALUE,
24896
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   258
                lvarIndex = ReferenceInfoUtil.IGNORE_VALUE)
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   259
    @TADescription(annotation = "TE", type = CAST,
17578
46ac954e4a84 8013852: update reference impl for type-annotations
jjg
parents: 15718
diff changeset
   260
                offset = ReferenceInfoUtil.IGNORE_VALUE,
46ac954e4a84 8013852: update reference impl for type-annotations
jjg
parents: 15718
diff changeset
   261
                typeIndex = 0)
46ac954e4a84 8013852: update reference impl for type-annotations
jjg
parents: 15718
diff changeset
   262
    public String returnLambdaExpr1() {
46ac954e4a84 8013852: update reference impl for type-annotations
jjg
parents: 15718
diff changeset
   263
        return
46ac954e4a84 8013852: update reference impl for type-annotations
jjg
parents: 15718
diff changeset
   264
                "interface LambdaInt {" +
46ac954e4a84 8013852: update reference impl for type-annotations
jjg
parents: 15718
diff changeset
   265
                "  void lambda(Object p1, List<Object> p2);" +
46ac954e4a84 8013852: update reference impl for type-annotations
jjg
parents: 15718
diff changeset
   266
                "}" +
24896
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   267
                "class %TEST_CLASS_NAME% {" +
17578
46ac954e4a84 8013852: update reference impl for type-annotations
jjg
parents: 15718
diff changeset
   268
                "  LambdaInt getLambda() {" +
46ac954e4a84 8013852: update reference impl for type-annotations
jjg
parents: 15718
diff changeset
   269
                "    return (@TA Object x, @TB List<@TC Object> y) -> { @TD Object l = null; System.out.println((@TE Object) l); };" +
46ac954e4a84 8013852: update reference impl for type-annotations
jjg
parents: 15718
diff changeset
   270
                "  }" +
46ac954e4a84 8013852: update reference impl for type-annotations
jjg
parents: 15718
diff changeset
   271
                "}";
46ac954e4a84 8013852: update reference impl for type-annotations
jjg
parents: 15718
diff changeset
   272
    }
22162
3b3e23e67329 8029721: javac crash for annotated parameter type of lambda in a field
vromero
parents: 17578
diff changeset
   273
24896
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   274
    @TADescription(annotation = "TA", type = METHOD_FORMAL_PARAMETER,
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   275
            paramIndex = 0)
22162
3b3e23e67329 8029721: javac crash for annotated parameter type of lambda in a field
vromero
parents: 17578
diff changeset
   276
    public String lambdaField1() {
3b3e23e67329 8029721: javac crash for annotated parameter type of lambda in a field
vromero
parents: 17578
diff changeset
   277
        return
24896
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   278
            "class %TEST_CLASS_NAME% {" +
22162
3b3e23e67329 8029721: javac crash for annotated parameter type of lambda in a field
vromero
parents: 17578
diff changeset
   279
                " java.util.function.IntUnaryOperator field = (@TA int y) -> 1;" +
3b3e23e67329 8029721: javac crash for annotated parameter type of lambda in a field
vromero
parents: 17578
diff changeset
   280
            "}";
3b3e23e67329 8029721: javac crash for annotated parameter type of lambda in a field
vromero
parents: 17578
diff changeset
   281
    }
3b3e23e67329 8029721: javac crash for annotated parameter type of lambda in a field
vromero
parents: 17578
diff changeset
   282
24896
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   283
    @TADescription(annotation = "TA", type = METHOD_FORMAL_PARAMETER,
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   284
            paramIndex = 0)
22162
3b3e23e67329 8029721: javac crash for annotated parameter type of lambda in a field
vromero
parents: 17578
diff changeset
   285
    public String lambdaField2() {
3b3e23e67329 8029721: javac crash for annotated parameter type of lambda in a field
vromero
parents: 17578
diff changeset
   286
        return
24896
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   287
            "class %TEST_CLASS_NAME% {" +
22162
3b3e23e67329 8029721: javac crash for annotated parameter type of lambda in a field
vromero
parents: 17578
diff changeset
   288
                " static java.util.function.IntUnaryOperator field = (@TA int y) -> 1;" +
3b3e23e67329 8029721: javac crash for annotated parameter type of lambda in a field
vromero
parents: 17578
diff changeset
   289
            "}";
3b3e23e67329 8029721: javac crash for annotated parameter type of lambda in a field
vromero
parents: 17578
diff changeset
   290
    }
24896
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   291
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   292
    @TADescription(annotation = "RTAs", type = METHOD_REFERENCE,
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   293
            offset = ReferenceInfoUtil.IGNORE_VALUE)
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   294
    public String returnMethodRefRepeatableAnnotation1() {
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   295
        return
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   296
                "class Lambda {" +
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   297
                        "  public String getName() { return \"Lambda!\"; }" +
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   298
                        "}" +
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   299
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   300
                        "class %TEST_CLASS_NAME% {" +
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   301
                        "  java.util.function.Function<Lambda, String> lambda() {" +
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   302
                        "    return @RTA @RTA Lambda::getName;" +
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   303
                        "  }" +
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   304
                        "}";
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   305
    }
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   306
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   307
    @TADescription(annotation = "RTAs", type = METHOD_REFERENCE,
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   308
            offset = ReferenceInfoUtil.IGNORE_VALUE)
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   309
    @TADescription(annotation = "RTBs", type = METHOD_REFERENCE,
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   310
            offset = ReferenceInfoUtil.IGNORE_VALUE,
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   311
            genericLocation = { 3, 0 })
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   312
    @TADescription(annotation = "RTCs", type = METHOD_REFERENCE,
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   313
            offset = ReferenceInfoUtil.IGNORE_VALUE,
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   314
            genericLocation = { 3, 0 })
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   315
    @TADescription(annotation = "RTDs", type = METHOD_REFERENCE,
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   316
            offset = ReferenceInfoUtil.IGNORE_VALUE,
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   317
            genericLocation = { 3, 1 })
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   318
    @TADescription(annotation = "RTEs", type = METHOD_REFERENCE,
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   319
            offset = ReferenceInfoUtil.IGNORE_VALUE,
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   320
            genericLocation = { 3, 1})
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   321
    public String returnMethodRefRepeatableAnnotation2() {
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   322
        return
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   323
                "class Lambda<S, T> {" +
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   324
                        "  public String getName() { return \"Lambda!\"; }" +
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   325
                        "}" +
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   326
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   327
                        "class %TEST_CLASS_NAME% {" +
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   328
                        "  java.util.function.Function<Lambda<Integer, Float>, String> lambda() {" +
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   329
                        "    return @RTA @RTA Lambda<@RTB @RTB @RTC @RTC Integer, @RTD @RTD @RTE @RTE Float>::getName;" +
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   330
                        "  }" +
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   331
                        "}";
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   332
    }
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   333
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   334
    @TADescription(annotation = "RTAs", type = CONSTRUCTOR_REFERENCE,
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   335
            offset = ReferenceInfoUtil.IGNORE_VALUE)
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   336
    public String returnConstructorRefRepeatable1() {
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   337
        return
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   338
                "class Lambda {" +
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   339
                        "  Lambda() { }" +
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   340
                        "}" +
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   341
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   342
                        "class %TEST_CLASS_NAME% {" +
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   343
                        "  Runnable lambda() {" +
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   344
                        "    return @RTA @RTA Lambda::new;" +
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   345
                        "  }" +
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   346
                        "}";
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   347
    }
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   348
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   349
    @TADescription(annotation = "RTAs", type = CONSTRUCTOR_REFERENCE,
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   350
            offset = ReferenceInfoUtil.IGNORE_VALUE)
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   351
    @TADescription(annotation = "RTBs", type = CONSTRUCTOR_REFERENCE,
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   352
            offset = ReferenceInfoUtil.IGNORE_VALUE,
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   353
            genericLocation = { 3, 0 })
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   354
    @TADescription(annotation = "RTCs", type = CONSTRUCTOR_REFERENCE,
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   355
            offset = ReferenceInfoUtil.IGNORE_VALUE,
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   356
            genericLocation = { 3, 1    })
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   357
    public String returnConstructorRefRepeatable2() {
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   358
        return
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   359
                "class Lambda<S, T> {" +
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   360
                        "  Lambda() { }" +
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   361
                        "}" +
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   362
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   363
                        "class %TEST_CLASS_NAME% {" +
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   364
                        "  Runnable lambda() {" +
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   365
                        "    return @RTA @RTA Lambda<@RTB @RTB Integer, @RTC @RTC Float>::new;" +
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   366
                        "  }" +
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   367
                        "}";
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   368
    }
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   369
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   370
    @TADescription(annotation = "RTAs", type = METHOD_REFERENCE_TYPE_ARGUMENT,
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   371
            offset = ReferenceInfoUtil.IGNORE_VALUE,
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   372
            typeIndex = 0)
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   373
    @TADescription(annotation = "RTBs", type = METHOD_REFERENCE_TYPE_ARGUMENT,
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   374
            offset = ReferenceInfoUtil.IGNORE_VALUE,
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   375
            typeIndex = 1)
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   376
    public String returnMethodRefTARepeatableAnnotation1() {
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   377
        return
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   378
                "interface Lambda {" +
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   379
                        "  <S, T> void generic(S p1, T p2);" +
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   380
                        "}" +
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   381
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   382
                        "class LambdaImpl implements Lambda {" +
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   383
                        "  public <S, T> void generic(S p1, T p2) {}" +
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   384
                        "}" +
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   385
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   386
                        "class %TEST_CLASS_NAME% {" +
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   387
                        "  Lambda lambda(LambdaImpl r) {" +
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   388
                        "    return r::<@RTA @RTA Object, @RTB @RTB Object>generic;" +
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   389
                        "  }" +
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   390
                        "}";
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   391
    }
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   392
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   393
    @TADescription(annotation = "RTAs", type = CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT,
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   394
            offset = ReferenceInfoUtil.IGNORE_VALUE,
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   395
            typeIndex = 0)
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   396
    @TADescription(annotation = "RTBs", type = CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT,
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   397
            offset = ReferenceInfoUtil.IGNORE_VALUE,
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   398
            typeIndex = 1)
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   399
    public String returnConstructorRefTARepeatableAnnotation2() {
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   400
        return
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   401
                "interface Lambda {" +
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   402
                        "  <S, T> void generic(S p1, T p2);" +
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   403
                        "}" +
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   404
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   405
                        "class LambdaImpl implements Lambda {" +
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   406
                        "  <S, T> LambdaImpl(S p1, T p2) {}" +
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   407
                        "  public <S, T> void generic(S p1, T p2) {}" +
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   408
                        "}" +
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   409
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   410
                        "class %TEST_CLASS_NAME% {" +
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   411
                        "  Lambda lambda() {" +
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   412
                        "    return LambdaImpl::<@RTA @RTA Object, @RTB @RTB Object>new;" +
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   413
                        "  }" +
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   414
                        "}";
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   415
    }
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   416
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   417
    @TADescription(annotation = "RTAs", type = METHOD_FORMAL_PARAMETER,
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   418
            paramIndex = 0)
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   419
    @TADescription(annotation = "RTBs", type = METHOD_FORMAL_PARAMETER,
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   420
            paramIndex = 1)
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   421
    @TADescription(annotation = "RTCs", type = METHOD_FORMAL_PARAMETER,
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   422
            paramIndex = 1, genericLocation = { 3, 0 })
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   423
    @TADescription(annotation = "RTDs", type = LOCAL_VARIABLE,
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   424
            lvarOffset = ReferenceInfoUtil.IGNORE_VALUE,
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   425
            lvarLength = ReferenceInfoUtil.IGNORE_VALUE,
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   426
            lvarIndex = ReferenceInfoUtil.IGNORE_VALUE)
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   427
    @TADescription(annotation = "RTEs", type = CAST,
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   428
            offset = ReferenceInfoUtil.IGNORE_VALUE,
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   429
            typeIndex = 0)
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   430
    public String returnLambdaExprRepeatableAnnotation1() {
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   431
        return
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   432
                "interface LambdaInt {" +
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   433
                        "  void lambda(Object p1, List<Object> p2);" +
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   434
                        "}" +
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   435
                        "class %TEST_CLASS_NAME% {" +
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   436
                        "  LambdaInt getLambda() {" +
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   437
                        "    return (@RTA @RTA Object x, @RTB @RTB List<@RTC @RTC Object> y) ->" +
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   438
                        " { @RTD @RTD Object l = null; System.out.println((@RTE @RTE Object) l); };" +
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   439
                        "  }" +
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   440
                        "}";
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   441
    }
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   442
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   443
    @TADescription(annotation = "RTAs", type = METHOD_FORMAL_PARAMETER,
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   444
            paramIndex = 0)
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   445
    public String lambdaFieldRepeatableAnnotation1() {
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   446
        return
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   447
                "class %TEST_CLASS_NAME% {" +
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   448
                        " java.util.function.IntUnaryOperator field = (@RTA @RTA int y) -> 1;" +
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   449
                        "}";
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   450
    }
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   451
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   452
    @TADescription(annotation = "RTAs", type = METHOD_FORMAL_PARAMETER,
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   453
            paramIndex = 0)
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   454
    public String lambdaFieldRepeatableAnnotation2() {
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   455
        return
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   456
                "class %TEST_CLASS_NAME% {" +
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   457
                        " static java.util.function.IntUnaryOperator field = (@RTA @RTA int y) -> 1;" +
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   458
                        "}";
986d876a9121 8042451: Write tests for all possible kinds of type annotation
aeremeev
parents: 22162
diff changeset
   459
    }
15718
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   460
}