Wildcards.java revision 3233:b5d08bc0d224
11573Srgrimes/*
21573Srgrimes * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
31573Srgrimes * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
41573Srgrimes *
51573Srgrimes * This code is free software; you can redistribute it and/or modify it
61573Srgrimes * under the terms of the GNU General Public License version 2 only, as
71573Srgrimes * published by the Free Software Foundation.
81573Srgrimes *
91573Srgrimes * This code is distributed in the hope that it will be useful, but WITHOUT
101573Srgrimes * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
111573Srgrimes * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
121573Srgrimes * version 2 for more details (a copy is included in the LICENSE file that
131573Srgrimes * accompanied this code).
141573Srgrimes *
151573Srgrimes * You should have received a copy of the GNU General Public License version
161573Srgrimes * 2 along with this work; if not, write to the Free Software Foundation,
171573Srgrimes * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
181573Srgrimes *
191573Srgrimes * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
201573Srgrimes * or visit www.oracle.com if you need additional information or have any
211573Srgrimes * questions.
221573Srgrimes */
231573Srgrimes
241573Srgrimespackage typeannos;
251573Srgrimes
261573Srgrimesimport java.lang.annotation.*;
271573Srgrimes
281573Srgrimes/*
2950476Speter * This class is replicated from test/tools/javac/annotations/typeAnnotations/newlocations.
3048794Snik */
311573Srgrimesclass BoundTest {
321573Srgrimes    void wcExtends(MyList<? extends @WldA String> l) { }
331573Srgrimes    void wcSuper(MyList<? super @WldA String> l) { }
341573Srgrimes
351573Srgrimes    MyList<? extends @WldA String> returnWcExtends() { return null; }
361573Srgrimes    MyList<? super @WldA String> returnWcSuper() { return null; }
3759460Sphantom    MyList<? extends @WldA MyList<? super @WldB("m") String>> complex() { return null; }
3859460Sphantom}
391573Srgrimes
4084306Sruclass BoundWithValue {
4116601Sgpalmer    void wcExtends(MyList<? extends @WldB("m") String> l) { }
421573Srgrimes    void wcSuper(MyList<? super @WldB(value="m") String> l) { }
431573Srgrimes
441573Srgrimes    MyList<? extends @WldB("m") String> returnWcExtends() { return null; }
451573Srgrimes    MyList<? super @WldB(value="m") String> returnWcSuper() { return null; }
461573Srgrimes    MyList<? extends @WldB("m") MyList<? super @WldB("m") String>> complex() { return null; }
471573Srgrimes}
481573Srgrimes
491573Srgrimesclass SelfTest {
501573Srgrimes    void wcExtends(MyList<@WldA ?> l) { }
511573Srgrimes    void wcSuper(MyList<@WldA ?> l) { }
521573Srgrimes
5389323Scjc    MyList<@WldA ?> returnWcExtends() { return null; }
5489323Scjc    MyList<@WldA ?> returnWcSuper() { return null; }
551573Srgrimes    MyList<@WldA ? extends @WldA MyList<@WldB("m") ?>> complex() { return null; }
561573Srgrimes}
571573Srgrimes
581573Srgrimesclass SelfWithValue {
591573Srgrimes    void wcExtends(MyList<@WldB("m") ?> l) { }
6089323Scjc    void wcSuper(MyList<@WldB(value="m") ?> l) { }
6189323Scjc
6289323Scjc    MyList<@WldB("m") ?> returnWcExtends() { return null; }
6389428Sru    MyList<@WldB(value="m") ?> returnWcSuper() { return null; }
641573Srgrimes    MyList<@WldB("m") ? extends MyList<@WldB("m") ? super String>> complex() { return null; }
6589428Sru}
661573Srgrimes
6789428Sruclass MyList<K> { }
681573Srgrimes
6989323Scjc@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})
70122443Sghelmer@Documented
7167967Sasmodai@interface WldA { }
721573Srgrimes@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})
731573Srgrimes@Documented
7416601Sgpalmer@interface WldB { String value(); }
75122442Sghelmer