test/tools/javac/annotations/typeAnnotations/newlocations/Lambda.java

Tue, 12 Mar 2013 17:39:34 +0100

author
jfranck
date
Tue, 12 Mar 2013 17:39:34 +0100
changeset 1629
f427043f8c65
parent 1563
bc456436c613
child 1755
ddb4a2bfcd82
permissions
-rw-r--r--

7196531: Duplicate error messages on repeating annotations
Reviewed-by: jjg

jjg@1563 1 /*
jjg@1563 2 * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
jjg@1563 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
jjg@1563 4 *
jjg@1563 5 * This code is free software; you can redistribute it and/or modify it
jjg@1563 6 * under the terms of the GNU General Public License version 2 only, as
jjg@1563 7 * published by the Free Software Foundation.
jjg@1563 8 *
jjg@1563 9 * This code is distributed in the hope that it will be useful, but WITHOUT
jjg@1563 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
jjg@1563 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
jjg@1563 12 * version 2 for more details (a copy is included in the LICENSE file that
jjg@1563 13 * accompanied this code).
jjg@1563 14 *
jjg@1563 15 * You should have received a copy of the GNU General Public License version
jjg@1563 16 * 2 along with this work; if not, write to the Free Software Foundation,
jjg@1563 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
jjg@1563 18 *
jjg@1563 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
jjg@1563 20 * or visit www.oracle.com if you need additional information or have any
jjg@1563 21 * questions.
jjg@1563 22 */
jjg@1563 23
jjg@1563 24 /*
jjg@1563 25 * @test
jjg@1563 26 * @bug 8008077
jjg@1563 27 * @summary new type annotation location: lambda expressions
jjg@1563 28 * @compile Lambda.java
jjg@1563 29 * @author Werner Dietl
jjg@1563 30 */
jjg@1563 31
jjg@1563 32 import java.lang.annotation.*;
jjg@1563 33
jjg@1563 34 public class Lambda {
jjg@1563 35
jjg@1563 36 interface LambdaInt {
jjg@1563 37 <S, T> void generic(S p1, T p2);
jjg@1563 38 }
jjg@1563 39
jjg@1563 40 static class LambdaImpl implements LambdaInt {
jjg@1563 41 <S, T> LambdaImpl(S p1, T p2) {}
jjg@1563 42 public <S, T> void generic(S p1, T p2) {}
jjg@1563 43 }
jjg@1563 44
jjg@1563 45 LambdaInt getMethodRefTA(LambdaImpl r) {
jjg@1563 46 return r::<@TA Object, @TB Object>generic;
jjg@1563 47 }
jjg@1563 48
jjg@1563 49 LambdaInt getConstructorRefTA() {
jjg@1563 50 return LambdaImpl::<@TA Object, @TB Object>new;
jjg@1563 51 }
jjg@1563 52
jjg@1563 53 }
jjg@1563 54
jjg@1563 55 @Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})
jjg@1563 56 @interface TA { }
jjg@1563 57
jjg@1563 58 @Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})
jjg@1563 59 @interface TB { }

mercurial