|
1 /* |
|
2 * Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved. |
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
|
4 * |
|
5 * This code is free software; you can redistribute it and/or modify it |
|
6 * under the terms of the GNU General Public License version 2 only, as |
|
7 * published by the Free Software Foundation. |
|
8 * |
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
|
13 * accompanied this code). |
|
14 * |
|
15 * You should have received a copy of the GNU General Public License version |
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
18 * |
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
|
20 * or visit www.oracle.com if you need additional information or have any |
|
21 * questions. |
|
22 */ |
|
23 |
|
24 import java.lang.annotation.*; |
|
25 |
|
26 /* |
|
27 * @test |
|
28 * @bug 6843077 8006775 |
|
29 * @summary new type annotation location: wildcard bound |
|
30 * @author Mahmood Ali |
|
31 * @compile Wildcards.java |
|
32 */ |
|
33 class BoundTest { |
|
34 void wcExtends(MyList<? extends @A String> l) { } |
|
35 void wcSuper(MyList<? super @A String> l) { } |
|
36 |
|
37 MyList<? extends @A String> returnWcExtends() { return null; } |
|
38 MyList<? super @A String> returnWcSuper() { return null; } |
|
39 MyList<? extends @A MyList<? super @B("m") String>> complex() { return null; } |
|
40 } |
|
41 |
|
42 class BoundWithValue { |
|
43 void wcExtends(MyList<? extends @B("m") String> l) { } |
|
44 void wcSuper(MyList<? super @B(value="m") String> l) { } |
|
45 |
|
46 MyList<? extends @B("m") String> returnWcExtends() { return null; } |
|
47 MyList<? super @B(value="m") String> returnWcSuper() { return null; } |
|
48 MyList<? extends @B("m") MyList<? super @B("m") String>> complex() { return null; } |
|
49 } |
|
50 |
|
51 class SelfTest { |
|
52 void wcExtends(MyList<@A ?> l) { } |
|
53 void wcSuper(MyList<@A ?> l) { } |
|
54 |
|
55 MyList<@A ?> returnWcExtends() { return null; } |
|
56 MyList<@A ?> returnWcSuper() { return null; } |
|
57 MyList<@A ? extends @A MyList<@B("m") ?>> complex() { return null; } |
|
58 } |
|
59 |
|
60 class SelfWithValue { |
|
61 void wcExtends(MyList<@B("m") ?> l) { } |
|
62 void wcSuper(MyList<@B(value="m") ?> l) { } |
|
63 |
|
64 MyList<@B("m") ?> returnWcExtends() { return null; } |
|
65 MyList<@B(value="m") ?> returnWcSuper() { return null; } |
|
66 MyList<@B("m") ? extends MyList<@B("m") ? super String>> complex() { return null; } |
|
67 } |
|
68 |
|
69 class MyList<K> { } |
|
70 |
|
71 @Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER}) |
|
72 @interface A { } |
|
73 @Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER}) |
|
74 @interface B { String value(); } |