Wed, 18 Sep 2013 22:47:06 -0700
8024096: some javadoc tests may contain false positive results
Reviewed-by: jjg
1 /*
2 * Copyright (c) 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 */
24 package typeannos;
26 import java.lang.annotation.*;
28 /*
29 * This class is replicated from test/tools/javac/annotations/typeAnnotations/newlocations.
30 */
31 class DefaultUnmodified {
32 void plain(@RcvrA DefaultUnmodified this) { }
33 <T> void generic(@RcvrA DefaultUnmodified this) { }
34 void withException(@RcvrA DefaultUnmodified this) throws Exception { }
35 String nonVoid(@RcvrA @RcvrB("m") DefaultUnmodified this) { return null; }
36 <T extends Runnable> void accept(@RcvrA DefaultUnmodified this, T r) throws Exception { }
37 }
39 class PublicModified {
40 public final void plain(@RcvrA PublicModified this) { }
41 public final <T> void generic(@RcvrA PublicModified this) { }
42 public final void withException(@RcvrA PublicModified this) throws Exception { }
43 public final String nonVoid(@RcvrA PublicModified this) { return null; }
44 public final <T extends Runnable> void accept(@RcvrA PublicModified this, T r) throws Exception { }
45 }
47 class WithValue {
48 void plain(@RcvrB("m") WithValue this) { }
49 <T> void generic(@RcvrB("m") WithValue this) { }
50 void withException(@RcvrB("m") WithValue this) throws Exception { }
51 String nonVoid(@RcvrB("m") WithValue this) { return null; }
52 <T extends Runnable> void accept(@RcvrB("m") WithValue this, T r) throws Exception { }
53 }
55 class WithFinal {
56 void plain(final @RcvrB("m") WithFinal this) { }
57 <T> void generic(final @RcvrB("m") WithFinal this) { }
58 void withException(final @RcvrB("m") WithFinal this) throws Exception { }
59 String nonVoid(final @RcvrB("m") WithFinal this) { return null; }
60 <T extends Runnable> void accept(final @RcvrB("m") WithFinal this, T r) throws Exception { }
61 }
63 class WithBody {
64 Object f;
66 void field(@RcvrA WithBody this) {
67 this.f = null;
68 }
69 void meth(@RcvrA WithBody this) {
70 this.toString();
71 }
72 }
74 class Generic1<X> {
75 void test1(Generic1<X> this) {}
76 void test2(@RcvrA Generic1<X> this) {}
77 void test3(Generic1<@RcvrA X> this) {}
78 void test4(@RcvrA Generic1<@RcvrA X> this) {}
79 }
81 class Generic2<@RcvrA X> {
82 void test1(Generic2<X> this) {}
83 void test2(@RcvrA Generic2<X> this) {}
84 void test3(Generic2<@RcvrA X> this) {}
85 void test4(@RcvrA Generic2<@RcvrA X> this) {}
86 }
88 class Generic3<X extends @RcvrA Object> {
89 void test1(Generic3<X> this) {}
90 void test2(@RcvrA Generic3<X> this) {}
91 void test3(Generic3<@RcvrA X> this) {}
92 void test4(@RcvrA Generic3<@RcvrA X> this) {}
93 }
95 class Generic4<X extends @RcvrA Object> {
96 <Y> void test1(Generic4<X> this) {}
97 <Y> void test2(@RcvrA Generic4<X> this) {}
98 <Y> void test3(Generic4<@RcvrA X> this) {}
99 <Y> void test4(@RcvrA Generic4<@RcvrA X> this) {}
100 }
102 class Outer {
103 class Inner {
104 void none(Outer.Inner this) {}
105 void outer(@RcvrA Outer.Inner this) {}
106 void inner(Outer. @RcvrB("i") Inner this) {}
107 void both(@RcvrA Outer.@RcvrB("i") Inner this) {}
109 void innerOnlyNone(Inner this) {}
110 void innerOnly(@RcvrA Inner this) {}
111 }
112 }
114 class GenericOuter<S, T> {
115 class GenericInner<U, V> {
116 void none(GenericOuter<S, T>.GenericInner<U, V> this) {}
117 void outer(@RcvrA GenericOuter<S, T>.GenericInner<U, V> this) {}
118 void inner(GenericOuter<S, T>. @RcvrB("i") GenericInner<U, V> this) {}
119 void both(@RcvrA GenericOuter<S, T>.@RcvrB("i") GenericInner<U, V> this) {}
121 void innerOnlyNone(GenericInner<U, V> this) {}
122 void innerOnly(@RcvrA GenericInner<U, V> this) {}
123 }
124 }
126 @Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})
127 @Documented
128 @interface RcvrA {}
129 @Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})
130 @Documented
131 @interface RcvrB { String value(); }