langtools/test/tools/javac/annotations/typeAnnotations/referenceinfos/Lambda.java
author jjg
Tue, 12 Feb 2013 17:15:29 -0800
changeset 15718 8e54c8e43d38
child 17578 46ac954e4a84
permissions -rw-r--r--
8008077: update reference impl for type-annotations Reviewed-by: jjg Contributed-by: wmdietl@cs.washington.edu
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
15718
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
     1
/*
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
     2
 * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
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
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
    26
 * @bug 8008077
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
    27
 * @summary Test population of reference info for lambda expressions
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
    28
 * @compile -g Driver.java ReferenceInfoUtil.java Lambda.java
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
    29
 * @run main Driver Lambda
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
    30
 * @author Werner Dietl
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
    31
 */
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
    32
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
    33
import static com.sun.tools.classfile.TypeAnnotation.TargetType.*;
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
public class Lambda {
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
    36
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
    37
    @TADescriptions({
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
    38
        @TADescription(annotation = "TA", type = METHOD_REFERENCE,
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
    39
                offset = ReferenceInfoUtil.IGNORE_VALUE),
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
    40
        @TADescription(annotation = "TB", type = METHOD_REFERENCE,
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
    41
                offset = ReferenceInfoUtil.IGNORE_VALUE)
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
    42
    })
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
    43
    public String returnMethodRef1() {
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
    44
        return
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
    45
                "class Lambda {" +
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
    46
                "  public String getName() { return \"Lambda!\"; }" +
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
    47
                "}" +
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
                "class Test {" +
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
    50
                "  java.util.function.Function<Lambda, String> lambda() {" +
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
    51
                "    return @TA @TB Lambda::getName;" +
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
    52
                "  }" +
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
    @TADescriptions({
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
    57
        @TADescription(annotation = "TA", type = METHOD_REFERENCE,
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
    58
                offset = ReferenceInfoUtil.IGNORE_VALUE),
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
    59
        @TADescription(annotation = "TB", type = METHOD_REFERENCE,
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
    60
                offset = ReferenceInfoUtil.IGNORE_VALUE,
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
    61
                genericLocation = { 3, 0 }),
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
    62
        @TADescription(annotation = "TC", type = METHOD_REFERENCE,
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
    63
                offset = ReferenceInfoUtil.IGNORE_VALUE,
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
    64
                genericLocation = { 3, 0 }),
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
    65
        @TADescription(annotation = "TD", type = METHOD_REFERENCE,
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 }),
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
    68
        @TADescription(annotation = "TE", type = METHOD_REFERENCE,
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
    69
                offset = ReferenceInfoUtil.IGNORE_VALUE,
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
    70
                genericLocation = { 3, 1 })
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
    71
    })
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
    72
    public String returnMethodRef2() {
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
    73
        return
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
    74
                "class Lambda<S, T> {" +
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
    75
                "  public String getName() { return \"Lambda!\"; }" +
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
    76
                "}" +
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
    77
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
    78
                "class Test {" +
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
    79
                "  java.util.function.Function<Lambda<Integer, Float>, String> lambda() {" +
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
    80
                "    return @TA Lambda<@TB @TC Integer, @TD @TE Float>::getName;" +
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
    }
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
    84
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
    85
    @TADescriptions({
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
    86
        @TADescription(annotation = "CTA", type = METHOD_REFERENCE,
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
    87
                offset = ReferenceInfoUtil.IGNORE_VALUE),
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
    88
        @TADescription(annotation = "CTB", type = METHOD_REFERENCE,
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
    89
                offset = ReferenceInfoUtil.IGNORE_VALUE,
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
    90
                genericLocation = { 3, 0 }),
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
    91
        @TADescription(annotation = "CTC", type = METHOD_REFERENCE,
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
    92
                offset = ReferenceInfoUtil.IGNORE_VALUE,
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
    93
                genericLocation = { 3, 1 })
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
    94
    })
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
    95
    public String returnMethodRef3() {
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
    96
        return
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
    97
                "class Lambda<S, T> {" +
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
    98
                "  public String getName() { return \"Lambda!\"; }" +
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
    99
                "}" +
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   100
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   101
                "@Target(ElementType.TYPE_USE)" +
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   102
                "@interface CTA {" +
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   103
                "  String value();" +
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   104
                "}" +
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   105
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   106
                "@Target(ElementType.TYPE_USE)" +
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   107
                "@interface CTB {" +
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   108
                "  int age();" +
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   109
                "}" +
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   110
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   111
                "@Target(ElementType.TYPE_USE)" +
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   112
                "@interface CTC {" +
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   113
                "  String name();" +
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   114
                "}" +
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   115
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   116
                "class Test {" +
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   117
                "  java.util.function.Function<Lambda<Integer, Float>, String> lambda() {" +
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   118
                "    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
   119
                "  }" +
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   120
                "}";
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   121
    }
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   122
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   123
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   124
    @TADescriptions({
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   125
        @TADescription(annotation = "TA", type = CONSTRUCTOR_REFERENCE,
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   126
                offset = ReferenceInfoUtil.IGNORE_VALUE),
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   127
        @TADescription(annotation = "TB", type = CONSTRUCTOR_REFERENCE,
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   128
                offset = ReferenceInfoUtil.IGNORE_VALUE)
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
    public String returnConstructorRef1() {
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   131
        return
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   132
                "class Lambda {" +
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   133
                "  Lambda() { }" +
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
                "class Test {" +
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   137
                "  Runnable lambda() {" +
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   138
                "    return @TA @TB Lambda::new;" +
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   139
                "  }" +
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   140
                "}";
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   141
    }
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   142
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   143
    @TADescriptions({
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   144
        @TADescription(annotation = "TA", type = CONSTRUCTOR_REFERENCE,
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   145
                offset = ReferenceInfoUtil.IGNORE_VALUE),
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   146
        @TADescription(annotation = "TB", type = CONSTRUCTOR_REFERENCE,
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, 0 }),
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   149
        @TADescription(annotation = "TC", type = CONSTRUCTOR_REFERENCE,
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   150
                offset = ReferenceInfoUtil.IGNORE_VALUE,
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   151
                genericLocation = { 3, 0 }),
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   152
        @TADescription(annotation = "TD", type = CONSTRUCTOR_REFERENCE,
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   153
                offset = ReferenceInfoUtil.IGNORE_VALUE,
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   154
                genericLocation = { 3, 1 }),
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   155
        @TADescription(annotation = "TE", type = CONSTRUCTOR_REFERENCE,
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   156
                offset = ReferenceInfoUtil.IGNORE_VALUE,
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   157
                genericLocation = { 3, 1 })
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   158
    })
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   159
    public String returnConstructorRef2() {
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   160
        return
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   161
                "class Lambda<S, T> {" +
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   162
                "  Lambda() { }" +
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
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   165
                "class Test {" +
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   166
                "  Runnable lambda() {" +
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   167
                "    return @TA Lambda<@TB @TC Integer, @TD @TE Float>::new;" +
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   168
                "  }" +
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   169
                "}";
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   170
    }
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   171
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   172
    @TADescriptions({
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   173
        @TADescription(annotation = "CTA", type = CONSTRUCTOR_REFERENCE,
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   174
                offset = ReferenceInfoUtil.IGNORE_VALUE),
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   175
        @TADescription(annotation = "CTB", type = CONSTRUCTOR_REFERENCE,
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   176
                offset = ReferenceInfoUtil.IGNORE_VALUE,
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   177
                genericLocation = { 3, 0 }),
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   178
        @TADescription(annotation = "CTC", type = CONSTRUCTOR_REFERENCE,
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   179
                offset = ReferenceInfoUtil.IGNORE_VALUE,
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   180
                genericLocation = { 3, 1 })
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   181
    })
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   182
    public String returnConstructorRef3() {
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   183
        return
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   184
                "class Lambda<S, T> {" +
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   185
                "  Lambda() { }" +
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   186
                "}" +
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
                "@Target(ElementType.TYPE_USE)" +
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   189
                "@interface CTA {" +
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   190
                "  String value();" +
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   191
                "}" +
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
                "@Target(ElementType.TYPE_USE)" +
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   194
                "@interface CTB {" +
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   195
                "  int age();" +
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   196
                "}" +
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
                "@Target(ElementType.TYPE_USE)" +
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   199
                "@interface CTC {" +
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   200
                "  String name();" +
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   201
                "}" +
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   202
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   203
                "class Test {" +
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   204
                "  Runnable lambda() {" +
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   205
                "    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
   206
                "  }" +
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   207
                "}";
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   208
    }
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   209
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   210
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   211
    @TADescriptions({
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   212
        @TADescription(annotation = "TA", type = METHOD_REFERENCE_TYPE_ARGUMENT,
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   213
                 offset = ReferenceInfoUtil.IGNORE_VALUE,
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   214
                 typeIndex = 0),
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   215
        @TADescription(annotation = "TB", type = METHOD_REFERENCE_TYPE_ARGUMENT,
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   216
                 offset = ReferenceInfoUtil.IGNORE_VALUE,
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   217
                 typeIndex = 1)
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   218
    })
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   219
    public String returnMethodRefTA1() {
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   220
        return
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   221
                "interface Lambda {" +
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   222
                "  <S, T> void generic(S p1, T p2);" +
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
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   225
                "class LambdaImpl implements Lambda {" +
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   226
                "  public <S, T> void generic(S p1, T p2) {}" +
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   227
                "}" +
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   228
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   229
                "class Test {" +
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   230
                "  Lambda lambda(LambdaImpl r) {" +
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   231
                "    return r::<@TA Object, @TB Object>generic;" +
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   232
                "  }" +
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   233
                "}";
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   234
    }
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
    @TADescriptions({
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   237
        @TADescription(annotation = "TA", type = CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT,
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   238
                 offset = ReferenceInfoUtil.IGNORE_VALUE,
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   239
                 typeIndex = 0),
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   240
        @TADescription(annotation = "TB", type = CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT,
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   241
                 offset = ReferenceInfoUtil.IGNORE_VALUE,
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   242
                 typeIndex = 1)
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   243
    })
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   244
    public String returnConstructorRefTA2() {
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   245
        return
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   246
                "interface Lambda {" +
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   247
                "  <S, T> void generic(S p1, T p2);" +
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   248
                "}" +
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   249
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   250
                "class LambdaImpl implements Lambda {" +
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   251
                "  <S, T> LambdaImpl(S p1, T p2) {}" +
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   252
                "  public <S, T> void generic(S p1, T p2) {}" +
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   253
                "}" +
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   254
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   255
                "class Test {" +
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   256
                "  Lambda lambda() {" +
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   257
                "    return LambdaImpl::<@TA Object, @TB Object>new;" +
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   258
                "  }" +
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   259
                "}";
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   260
    }
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   261
8e54c8e43d38 8008077: update reference impl for type-annotations
jjg
parents:
diff changeset
   262
}