Tue, 09 Apr 2013 14:18:22 -0700
8005091: javadoc should be able to return the receiver type
Reviewed-by: jjg
1.1 --- a/src/share/classes/com/sun/javadoc/ExecutableMemberDoc.java Mon Apr 08 11:57:37 2013 -0700 1.2 +++ b/src/share/classes/com/sun/javadoc/ExecutableMemberDoc.java Tue Apr 09 14:18:22 2013 -0700 1.3 @@ -88,6 +88,14 @@ 1.4 Parameter[] parameters(); 1.5 1.6 /** 1.7 + * Get the receiver type of this executable element. 1.8 + * 1.9 + * @return the receiver type of this executable element. 1.10 + * @since 1.8 1.11 + */ 1.12 + Type receiverType(); 1.13 + 1.14 + /** 1.15 * Get the receiver annotations of this executable element. 1.16 * Return an empty array if there are none. 1.17 *
2.1 --- a/src/share/classes/com/sun/tools/doclets/formats/html/AbstractExecutableMemberWriter.java Mon Apr 08 11:57:37 2013 -0700 2.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/AbstractExecutableMemberWriter.java Tue Apr 09 14:18:22 2013 -0700 2.3 @@ -139,12 +139,24 @@ 2.4 } 2.5 } 2.6 2.7 - protected void addReceiverAnnotations(ExecutableMemberDoc member, 2.8 - Content tree) { 2.9 - if (member.receiverAnnotations().length > 0) { 2.10 - tree.addContent(writer.getSpace()); 2.11 - writer.addReceiverAnnotationInfo(member, tree); 2.12 - } 2.13 + /** 2.14 + * Add the receiver annotations information. 2.15 + * 2.16 + * @param member the member to write receiver annotations for. 2.17 + * @param rcvrType the receiver type. 2.18 + * @param descList list of annotation description. 2.19 + * @param tree the content tree to which the information will be added. 2.20 + */ 2.21 + protected void addReceiverAnnotations(ExecutableMemberDoc member, Type rcvrType, 2.22 + AnnotationDesc[] descList, Content tree) { 2.23 + writer.addReceiverAnnotationInfo(member, descList, tree); 2.24 + tree.addContent(writer.getSpace()); 2.25 + tree.addContent(rcvrType.typeName()); 2.26 + LinkInfoImpl linkInfo = new LinkInfoImpl(configuration, 2.27 + LinkInfoImpl.CONTEXT_CLASS_SIGNATURE, rcvrType); 2.28 + tree.addContent(new RawHtml(writer.getTypeParameterLinks(linkInfo))); 2.29 + tree.addContent(writer.getSpace()); 2.30 + tree.addContent("this"); 2.31 } 2.32 2.33 2.34 @@ -168,14 +180,24 @@ 2.35 protected void addParameters(ExecutableMemberDoc member, 2.36 boolean includeAnnotations, Content htmltree) { 2.37 htmltree.addContent("("); 2.38 + String sep = ""; 2.39 Parameter[] params = member.parameters(); 2.40 String indent = makeSpace(writer.displayLength); 2.41 if (configuration.linksource) { 2.42 //add spaces to offset indentation changes caused by link. 2.43 indent+= makeSpace(member.name().length()); 2.44 } 2.45 + Type rcvrType = member.receiverType(); 2.46 + if (includeAnnotations && rcvrType instanceof AnnotatedType) { 2.47 + AnnotationDesc[] descList = rcvrType.asAnnotatedType().annotations(); 2.48 + if (descList.length > 0) { 2.49 + addReceiverAnnotations(member, rcvrType, descList, htmltree); 2.50 + sep = "," + DocletConstants.NL + indent; 2.51 + } 2.52 + } 2.53 int paramstart; 2.54 for (paramstart = 0; paramstart < params.length; paramstart++) { 2.55 + htmltree.addContent(sep); 2.56 Parameter param = params[paramstart]; 2.57 if (!param.name().startsWith("this$")) { 2.58 if (includeAnnotations) {
3.1 --- a/src/share/classes/com/sun/tools/doclets/formats/html/ConstructorWriterImpl.java Mon Apr 08 11:57:37 2013 -0700 3.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/ConstructorWriterImpl.java Tue Apr 09 14:18:22 2013 -0700 3.3 @@ -137,7 +137,6 @@ 3.4 addName(constructor.name(), pre); 3.5 } 3.6 addParameters(constructor, pre); 3.7 - writer.addReceiverAnnotationInfo(constructor, pre); 3.8 addExceptions(constructor, pre); 3.9 return pre; 3.10 }
4.1 --- a/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java Mon Apr 08 11:57:37 2013 -0700 4.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java Tue Apr 09 14:18:22 2013 -0700 4.3 @@ -1860,11 +1860,13 @@ 4.4 * Add the annotation types of the executable receiver. 4.5 * 4.6 * @param method the executable to write the receiver annotations for. 4.7 + * @param descList list of annotation description. 4.8 * @param htmltree the documentation tree to which the annotation info will be 4.9 * added 4.10 */ 4.11 - public void addReceiverAnnotationInfo(ExecutableMemberDoc method, Content htmltree) { 4.12 - addAnnotationInfo(method, method.receiverAnnotations(), htmltree); 4.13 + public void addReceiverAnnotationInfo(ExecutableMemberDoc method, AnnotationDesc[] descList, 4.14 + Content htmltree) { 4.15 + addAnnotationInfo(0, method, descList, false, htmltree); 4.16 } 4.17 4.18 /** 4.19 @@ -1915,13 +1917,16 @@ 4.20 private boolean addAnnotationInfo(int indent, Doc doc, 4.21 AnnotationDesc[] descList, boolean lineBreak, Content htmltree) { 4.22 List<String> annotations = getAnnotations(indent, descList, lineBreak); 4.23 + String sep =""; 4.24 if (annotations.size() == 0) { 4.25 return false; 4.26 } 4.27 Content annotationContent; 4.28 for (Iterator<String> iter = annotations.iterator(); iter.hasNext();) { 4.29 + htmltree.addContent(sep); 4.30 annotationContent = new RawHtml(iter.next()); 4.31 htmltree.addContent(annotationContent); 4.32 + sep = " "; 4.33 } 4.34 return true; 4.35 }
5.1 --- a/src/share/classes/com/sun/tools/doclets/formats/html/MethodWriterImpl.java Mon Apr 08 11:57:37 2013 -0700 5.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/MethodWriterImpl.java Tue Apr 09 14:18:22 2013 -0700 5.3 @@ -130,7 +130,6 @@ 5.4 addName(method.name(), pre); 5.5 } 5.6 addParameters(method, pre); 5.7 - addReceiverAnnotations(method, pre); 5.8 addExceptions(method, pre); 5.9 return pre; 5.10 }
6.1 --- a/src/share/classes/com/sun/tools/javadoc/ExecutableMemberDocImpl.java Mon Apr 08 11:57:37 2013 -0700 6.2 +++ b/src/share/classes/com/sun/tools/javadoc/ExecutableMemberDocImpl.java Tue Apr 09 14:18:22 2013 -0700 6.3 @@ -199,6 +199,17 @@ 6.4 return result; 6.5 } 6.6 6.7 + /** 6.8 + * Get the receiver type of this executable element. 6.9 + * 6.10 + * @return the receiver type of this executable element. 6.11 + * @since 1.8 6.12 + */ 6.13 + public com.sun.javadoc.Type receiverType() { 6.14 + Type recvtype = sym.type.asMethodType().recvtype; 6.15 + return (recvtype != null) ? TypeMaker.getType(env, recvtype, false, true) : null; 6.16 + } 6.17 + 6.18 public AnnotationDesc[] receiverAnnotations() { 6.19 // TODO: change how receiver annotations are output! 6.20 Type recvtype = sym.type.asMethodType().recvtype;
7.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 7.2 +++ b/test/com/sun/javadoc/testTypeAnnotations/TestTypeAnnotations.java Tue Apr 09 14:18:22 2013 -0700 7.3 @@ -0,0 +1,259 @@ 7.4 +/* 7.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. 7.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 7.7 + * 7.8 + * This code is free software; you can redistribute it and/or modify it 7.9 + * under the terms of the GNU General Public License version 2 only, as 7.10 + * published by the Free Software Foundation. 7.11 + * 7.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 7.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 7.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 7.15 + * version 2 for more details (a copy is included in the LICENSE file that 7.16 + * accompanied this code). 7.17 + * 7.18 + * You should have received a copy of the GNU General Public License version 7.19 + * 2 along with this work; if not, write to the Free Software Foundation, 7.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 7.21 + * 7.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 7.23 + * or visit www.oracle.com if you need additional information or have any 7.24 + * questions. 7.25 + */ 7.26 + 7.27 +/* 7.28 + * @test 7.29 + * @bug 8005091 7.30 + * @summary Make sure that type annotations are displayed correctly 7.31 + * @author Bhavesh Patel 7.32 + * @library ../lib/ 7.33 + * @build JavadocTester TestTypeAnnotations 7.34 + * @run main TestTypeAnnotations 7.35 + */ 7.36 + 7.37 +public class TestTypeAnnotations extends JavadocTester { 7.38 + 7.39 + //Test information. 7.40 + private static final String BUG_ID = "8005091"; 7.41 + 7.42 + //Javadoc arguments. 7.43 + private static final String[] ARGS = new String[] { 7.44 + "-d", BUG_ID, "-sourcepath", SRC_DIR, "-private", "typeannos" 7.45 + }; 7.46 + 7.47 + //Input for string search tests. 7.48 + private static final String[][] NEGATED_TEST = NO_TEST; 7.49 + private static final String[][] TEST = { 7.50 + // Test for type annotations on Class Extends (ClassExtends.java). 7.51 + {BUG_ID + FS + "typeannos" + FS + "MyClass.html", 7.52 + "implements <a href=\"../typeannos/ClassExtB.html\" title=\"" + 7.53 + "annotation in typeannos\">@ClassExtB</a> java.lang.CharSequence, " + 7.54 + "<a href=\"../typeannos/ParameterizedInterface.html\" title=\"" + 7.55 + "interface in typeannos\">ParameterizedInterface</a><java.lang.String></pre>" 7.56 + }, 7.57 + {BUG_ID + FS + "typeannos" + FS + "MyInterface.html", 7.58 + "extends <a href=\"../typeannos/ParameterizedInterface.html\" title" + 7.59 + "=\"interface in typeannos\">ParameterizedInterface</a><java." + 7.60 + "lang.String>, <a href=\"../typeannos/ClassExtB.html\" title=\"" + 7.61 + "annotation in typeannos\">@ClassExtB</a> java.lang.CharSequence</pre>" 7.62 + }, 7.63 + 7.64 + // Test for type annotations on Class Parameters (ClassParameters.java). 7.65 + {BUG_ID + FS + "typeannos" + FS + "ExtendsBound.html", 7.66 + "class <span class=\"strong\">ExtendsBound<K extends <a " + 7.67 + "href=\"../typeannos/ClassParamA.html\" title=\"annotation in " + 7.68 + "typeannos\">@ClassParamA</a> java.lang.String></span>" 7.69 + }, 7.70 + {BUG_ID + FS + "typeannos" + FS + "TwoBounds.html", 7.71 + "class <span class=\"strong\">TwoBounds<K extends <a href=\"" + 7.72 + "../typeannos/ClassParamA.html\" title=\"annotation in typeannos\">" + 7.73 + "@ClassParamA</a> java.lang.String,V extends <a href=\"../typeannos" + 7.74 + "/ClassParamB.html\" title=\"annotation in typeannos\">@ClassParamB" + 7.75 + "</a> java.lang.String></span>" 7.76 + }, 7.77 + {BUG_ID + FS + "typeannos" + FS + "Complex1.html", 7.78 + "class <span class=\"strong\">Complex1<K extends <a href=\"../" + 7.79 + "typeannos/ClassParamA.html\" title=\"annotation in typeannos\">" + 7.80 + "@ClassParamA</a> java.lang.String & java.lang.Runnable></span>" 7.81 + }, 7.82 + {BUG_ID + FS + "typeannos" + FS + "Complex2.html", 7.83 + "class <span class=\"strong\">Complex2<K extends java.lang." + 7.84 + "String & <a href=\"../typeannos/ClassParamB.html\" title=\"" + 7.85 + "annotation in typeannos\">@ClassParamB</a> java.lang.Runnable></span>" 7.86 + }, 7.87 + {BUG_ID + FS + "typeannos" + FS + "ComplexBoth.html", 7.88 + "class <span class=\"strong\">ComplexBoth<K extends <a href=\"" + 7.89 + "../typeannos/ClassParamA.html\" title=\"annotation in typeannos\"" + 7.90 + ">@ClassParamA</a> java.lang.String & <a href=\"../typeannos/" + 7.91 + "ClassParamA.html\" title=\"annotation in typeannos\">@ClassParamA" + 7.92 + "</a> java.lang.Runnable></span>" 7.93 + }, 7.94 + 7.95 + // Test for type annotations on method return types (MethodReturnType.java). 7.96 + {BUG_ID + FS + "typeannos" + FS + "MtdDefaultScope.html", 7.97 + "<pre>public <T> <a href=\"../typeannos/MRtnA.html\" " + 7.98 + "title=\"annotation in typeannos\">@MRtnA</a> java.lang.String" + 7.99 + " method()</pre>" 7.100 + }, 7.101 + 7.102 + // Test for type annotations on method type parameters (MethodTypeParameters.java). 7.103 + {BUG_ID + FS + "typeannos" + FS + "UnscopedUnmodified.html", 7.104 + "<pre><K extends <a href=\"../typeannos/MTyParamA.html\" title=\"" + 7.105 + "annotation in typeannos\">@MTyParamA</a> java.lang.String>" + 7.106 + " void methodExtends()</pre>" 7.107 + }, 7.108 + {BUG_ID + FS + "typeannos" + FS + "PublicModifiedMethods.html", 7.109 + "<pre>public final <K extends <a href=\"../typeannos/" + 7.110 + "MTyParamA.html\" title=\"annotation in typeannos\">@MTyParamA</a> " + 7.111 + "java.lang.String> void methodExtends()</pre>" 7.112 + }, 7.113 + 7.114 + // Test for type annotations on throws (Throws.java). 7.115 + {BUG_ID + FS + "typeannos" + FS + "ThrDefaultUnmodified.html", 7.116 + "<pre>void oneException()" + NL + 7.117 + " throws <a href=\"../typeannos/ThrA.html\" title=\"" + 7.118 + "annotation in typeannos\">@ThrA</a> java.lang.Exception</pre>" 7.119 + }, 7.120 + {BUG_ID + FS + "typeannos" + FS + "ThrDefaultUnmodified.html", 7.121 + "<pre>void twoExceptions()" + NL + 7.122 + " throws <a href=\"../typeannos/ThrA.html\" title=\"" + 7.123 + "annotation in typeannos\">@ThrA</a> java.lang.RuntimeException," + NL + 7.124 + " <a href=\"../typeannos/ThrA.html\" title=\"" + 7.125 + "annotation in typeannos\">@ThrA</a> java.lang.Exception</pre>" 7.126 + }, 7.127 + {BUG_ID + FS + "typeannos" + FS + "ThrPublicModified.html", 7.128 + "<pre>public final void oneException(java.lang.String a)" + NL + 7.129 + " throws <a href=\"../typeannos/ThrA.html\" " + 7.130 + "title=\"annotation in typeannos\">@ThrA</a> java.lang.Exception</pre>" 7.131 + }, 7.132 + {BUG_ID + FS + "typeannos" + FS + "ThrPublicModified.html", 7.133 + "<pre>public final void twoExceptions(java.lang.String a)" + NL + 7.134 + " throws <a href=\"../typeannos/ThrA.html\" " + 7.135 + "title=\"annotation in typeannos\">@ThrA</a> java.lang.RuntimeException," + NL + 7.136 + " <a href=\"../typeannos/ThrA.html\" " + 7.137 + "title=\"annotation in typeannos\">@ThrA</a> java.lang.Exception</pre>" 7.138 + }, 7.139 + {BUG_ID + FS + "typeannos" + FS + "ThrWithValue.html", 7.140 + "<pre>void oneException()" + NL + 7.141 + " throws <a href=\"../typeannos/ThrB.html\" title=\"" + 7.142 + "annotation in typeannos\">@ThrB</a>(<a href=\"../typeannos/" + 7.143 + "ThrB.html#value()\">value</a>=\"m\") java.lang.Exception</pre>" 7.144 + }, 7.145 + {BUG_ID + FS + "typeannos" + FS + "ThrWithValue.html", 7.146 + "<pre>void twoExceptions()" + NL + 7.147 + " throws <a href=\"../typeannos/ThrB.html\" title=\"" + 7.148 + "annotation in typeannos\">@ThrB</a>(<a href=\"../typeannos/" + 7.149 + "ThrB.html#value()\">value</a>=\"m\") java.lang.RuntimeException," + NL + 7.150 + " <a href=\"../typeannos/ThrA.html\" title=\"" + 7.151 + "annotation in typeannos\">@ThrA</a> java.lang.Exception</pre>" 7.152 + }, 7.153 + 7.154 + // Test for type annotations on wildcard type (Wildcards.java). 7.155 + {BUG_ID + FS + "typeannos" + FS + "BoundTest.html", 7.156 + "<pre>void wcExtends(<a href=\"../typeannos/MyList.html\" " + 7.157 + "title=\"class in typeannos\">MyList</a><? extends <a href=\"" + 7.158 + "../typeannos/WldA.html\" title=\"annotation in typeannos\">@WldA" + 7.159 + "</a> java.lang.String> l)</pre>" 7.160 + }, 7.161 + {BUG_ID + FS + "typeannos" + FS + "BoundTest.html", 7.162 + "<pre><a href=\"../typeannos/MyList.html\" title=\"class in " + 7.163 + "typeannos\">MyList</a><? super <a href=\"../typeannos/WldA.html\" " + 7.164 + "title=\"annotation in typeannos\">@WldA</a> java.lang.String>" + 7.165 + " returnWcSuper()</pre>" 7.166 + }, 7.167 + {BUG_ID + FS + "typeannos" + FS + "BoundWithValue.html", 7.168 + "<pre>void wcSuper(<a href=\"../typeannos/MyList.html\" title=\"" + 7.169 + "class in typeannos\">MyList</a><? super <a href=\"../typeannos/" + 7.170 + "WldB.html\" title=\"annotation in typeannos\">@WldB</a>(<a href=\"" + 7.171 + "../typeannos/WldB.html#value()\">value</a>=\"m\") java.lang." + 7.172 + "String> l)</pre>" 7.173 + }, 7.174 + {BUG_ID + FS + "typeannos" + FS + "BoundWithValue.html", 7.175 + "<pre><a href=\"../typeannos/MyList.html\" title=\"class in " + 7.176 + "typeannos\">MyList</a><? extends <a href=\"../typeannos/WldB." + 7.177 + "html\" title=\"annotation in typeannos\">@WldB</a>(<a href=\"../" + 7.178 + "typeannos/WldB.html#value()\">value</a>=\"m\") java.lang.String" + 7.179 + "> returnWcExtends()</pre>" 7.180 + }, 7.181 + 7.182 + // Test for receiver annotations (Receivers.java). 7.183 + {BUG_ID + FS + "typeannos" + FS + "DefaultUnmodified.html", 7.184 + "<pre>void withException(<a href=\"../typeannos/RcvrA.html\" " + 7.185 + "title=\"annotation in typeannos\">@RcvrA</a> " + 7.186 + "DefaultUnmodified this)" + NL + " throws java." + 7.187 + "lang.Exception</pre>" 7.188 + }, 7.189 + {BUG_ID + FS + "typeannos" + FS + "DefaultUnmodified.html", 7.190 + "<pre>java.lang.String nonVoid(<a href=\"../typeannos/RcvrA." + 7.191 + "html\" title=\"annotation in typeannos\">@RcvrA</a> <a href=\"../" + 7.192 + "typeannos/RcvrB.html\" title=\"annotation in typeannos\">@RcvrB" + 7.193 + "</a>(<a href=\"../typeannos/RcvrB.html#value()\">value</a>=\"m\")" + 7.194 + " DefaultUnmodified this)</pre>" 7.195 + }, 7.196 + {BUG_ID + FS + "typeannos" + FS + "DefaultUnmodified.html", 7.197 + "<pre><T extends java.lang.Runnable> void accept(" + 7.198 + "<a href=\"../typeannos/RcvrA.html\" title=\"annotation in " + 7.199 + "typeannos\">@RcvrA</a> DefaultUnmodified this," + NL + 7.200 + " T r)" + NL + 7.201 + " throws java.lang.Exception</pre>" 7.202 + }, 7.203 + {BUG_ID + FS + "typeannos" + FS + "PublicModified.html", 7.204 + "<pre>public final java.lang.String nonVoid(<a href=\"" + 7.205 + "../typeannos/RcvrA.html\" title=\"annotation in typeannos\">" + 7.206 + "@RcvrA</a> PublicModified this)</pre>" 7.207 + }, 7.208 + {BUG_ID + FS + "typeannos" + FS + "PublicModified.html", 7.209 + "<pre>public final <T extends java.lang.Runnable> " + 7.210 + "void accept(<a href=\"../typeannos/RcvrA.html\" title=\"" + 7.211 + "annotation in typeannos\">@RcvrA</a> PublicModified this," + NL + 7.212 + " T r)" + NL + 7.213 + " throws java.lang.Exception</pre>" 7.214 + }, 7.215 + {BUG_ID + FS + "typeannos" + FS + "WithValue.html", 7.216 + "<pre><T extends java.lang.Runnable> void accept(" + 7.217 + "<a href=\"../typeannos/RcvrB.html\" title=\"annotation in " + 7.218 + "typeannos\">@RcvrB</a>(<a href=\"../typeannos/RcvrB.html#value()\">" + 7.219 + "value</a>=\"m\") WithValue this," + NL + 7.220 + " T r)" + NL + 7.221 + " throws java.lang.Exception</pre>" 7.222 + }, 7.223 + {BUG_ID + FS + "typeannos" + FS + "WithFinal.html", 7.224 + "<pre>java.lang.String nonVoid(<a href=\"../typeannos/RcvrB." + 7.225 + "html\" title=\"annotation in typeannos\">@RcvrB</a>(<a href=\"../" + 7.226 + "typeannos/RcvrB.html#value()\">value</a>=\"m\") WithFinal" + 7.227 + " this)</pre>" 7.228 + }, 7.229 + {BUG_ID + FS + "typeannos" + FS + "WithBody.html", 7.230 + "<pre>void field(<a href=\"../typeannos/RcvrA.html\" title=\"" + 7.231 + "annotation in typeannos\">@RcvrA</a> WithBody this)</pre>" 7.232 + }, 7.233 + {BUG_ID + FS + "typeannos" + FS + "Generic2.html", 7.234 + "<pre>void test2(<a href=\"../typeannos/RcvrA.html\" title=\"" + 7.235 + "annotation in typeannos\">@RcvrA</a> Generic2<X> this)</pre>" 7.236 + } 7.237 + }; 7.238 + 7.239 + /** 7.240 + * The entry point of the test. 7.241 + * @param args the array of command line arguments. 7.242 + */ 7.243 + public static void main(String[] args) { 7.244 + TestTypeAnnotations tester = new TestTypeAnnotations(); 7.245 + run(tester, ARGS, TEST, NEGATED_TEST); 7.246 + tester.printSummary(); 7.247 + } 7.248 + 7.249 + /** 7.250 + * {@inheritDoc} 7.251 + */ 7.252 + public String getBugId() { 7.253 + return BUG_ID; 7.254 + } 7.255 + 7.256 + /** 7.257 + * {@inheritDoc} 7.258 + */ 7.259 + public String getBugName() { 7.260 + return getClass().getName(); 7.261 + } 7.262 +}
8.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 8.2 +++ b/test/com/sun/javadoc/testTypeAnnotations/typeannos/ClassExtends.java Tue Apr 09 14:18:22 2013 -0700 8.3 @@ -0,0 +1,45 @@ 8.4 +/* 8.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. 8.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 8.7 + * 8.8 + * This code is free software; you can redistribute it and/or modify it 8.9 + * under the terms of the GNU General Public License version 2 only, as 8.10 + * published by the Free Software Foundation. 8.11 + * 8.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 8.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 8.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 8.15 + * version 2 for more details (a copy is included in the LICENSE file that 8.16 + * accompanied this code). 8.17 + * 8.18 + * You should have received a copy of the GNU General Public License version 8.19 + * 2 along with this work; if not, write to the Free Software Foundation, 8.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 8.21 + * 8.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 8.23 + * or visit www.oracle.com if you need additional information or have any 8.24 + * questions. 8.25 + */ 8.26 + 8.27 +package typeannos; 8.28 + 8.29 +import java.lang.annotation.*; 8.30 + 8.31 +/* 8.32 + * This class is replicated from test/tools/javac/annotations/typeAnnotations/newlocations. 8.33 + */ 8.34 +abstract class MyClass extends @ClassExtA ParameterizedClass<@ClassExtB String> 8.35 + implements @ClassExtB CharSequence, @ClassExtA ParameterizedInterface<@ClassExtB String> { } 8.36 + 8.37 +interface MyInterface extends @ClassExtA ParameterizedInterface<@ClassExtA String>, 8.38 + @ClassExtB CharSequence { } 8.39 + 8.40 +class ParameterizedClass<K> {} 8.41 +interface ParameterizedInterface<K> {} 8.42 + 8.43 +@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER}) 8.44 +@Documented 8.45 +@interface ClassExtA {} 8.46 +@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER}) 8.47 +@Documented 8.48 +@interface ClassExtB {}
9.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 9.2 +++ b/test/com/sun/javadoc/testTypeAnnotations/typeannos/ClassParameters.java Tue Apr 09 14:18:22 2013 -0700 9.3 @@ -0,0 +1,60 @@ 9.4 +/* 9.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. 9.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 9.7 + * 9.8 + * This code is free software; you can redistribute it and/or modify it 9.9 + * under the terms of the GNU General Public License version 2 only, as 9.10 + * published by the Free Software Foundation. 9.11 + * 9.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 9.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 9.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 9.15 + * version 2 for more details (a copy is included in the LICENSE file that 9.16 + * accompanied this code). 9.17 + * 9.18 + * You should have received a copy of the GNU General Public License version 9.19 + * 2 along with this work; if not, write to the Free Software Foundation, 9.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 9.21 + * 9.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 9.23 + * or visit www.oracle.com if you need additional information or have any 9.24 + * questions. 9.25 + */ 9.26 + 9.27 +package typeannos; 9.28 + 9.29 +import java.lang.annotation.*; 9.30 + 9.31 +/* 9.32 + * This class is replicated from test/tools/javac/annotations/typeAnnotations/newlocations. 9.33 + */ 9.34 +class Unannotated<K> { } 9.35 + 9.36 +class ExtendsBound<K extends @ClassParamA String> { } 9.37 +class ExtendsGeneric<K extends @ClassParamA Unannotated<@ClassParamB String>> { } 9.38 +class TwoBounds<K extends @ClassParamA String, V extends @ClassParamB String> { } 9.39 + 9.40 +class Complex1<K extends @ClassParamA String&Runnable> { } 9.41 +class Complex2<K extends String & @ClassParamB Runnable> { } 9.42 +class ComplexBoth<K extends @ClassParamA String & @ClassParamA Runnable> { } 9.43 + 9.44 +class ClassParamOuter { 9.45 + void inner() { 9.46 + class LUnannotated<K> { } 9.47 + 9.48 + class LExtendsBound<K extends @ClassParamA String> { } 9.49 + class LExtendsGeneric<K extends @ClassParamA LUnannotated<@ClassParamB String>> { } 9.50 + class LTwoBounds<K extends @ClassParamA String, V extends @ClassParamB String> { } 9.51 + 9.52 + class LComplex1<K extends @ClassParamA String&Runnable> { } 9.53 + class LComplex2<K extends String & @ClassParamB Runnable> { } 9.54 + class LComplexBoth<K extends @ClassParamA String & @ClassParamA Runnable> { } 9.55 + } 9.56 +} 9.57 + 9.58 +@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER}) 9.59 +@Documented 9.60 +@interface ClassParamA { } 9.61 +@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER}) 9.62 +@Documented 9.63 +@interface ClassParamB { }
10.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 10.2 +++ b/test/com/sun/javadoc/testTypeAnnotations/typeannos/Fields.java Tue Apr 09 14:18:22 2013 -0700 10.3 @@ -0,0 +1,76 @@ 10.4 +/* 10.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. 10.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 10.7 + * 10.8 + * This code is free software; you can redistribute it and/or modify it 10.9 + * under the terms of the GNU General Public License version 2 only, as 10.10 + * published by the Free Software Foundation. 10.11 + * 10.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 10.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 10.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 10.15 + * version 2 for more details (a copy is included in the LICENSE file that 10.16 + * accompanied this code). 10.17 + * 10.18 + * You should have received a copy of the GNU General Public License version 10.19 + * 2 along with this work; if not, write to the Free Software Foundation, 10.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 10.21 + * 10.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 10.23 + * or visit www.oracle.com if you need additional information or have any 10.24 + * questions. 10.25 + */ 10.26 + 10.27 +package typeannos; 10.28 + 10.29 +import java.lang.annotation.*; 10.30 + 10.31 +/* 10.32 + * This class is replicated from test/tools/javac/annotations/typeAnnotations/newlocations. 10.33 + */ 10.34 +class DefaultScope { 10.35 + Parameterized<String, String> unannotated; 10.36 + Parameterized<@FldA String, String> firstTypeArg; 10.37 + Parameterized<String, @FldA String> secondTypeArg; 10.38 + Parameterized<@FldA String, @FldB String> bothTypeArgs; 10.39 + 10.40 + Parameterized<@FldA Parameterized<@FldA String, @FldB String>, @FldB String> 10.41 + nestedParameterized; 10.42 + 10.43 + @FldA String [] array1; 10.44 + @FldA String @FldB [] array1Deep; 10.45 + @FldA String [] [] array2; 10.46 + @FldA String @FldA [] @FldB [] array2Deep; 10.47 + String @FldA [] [] array2First; 10.48 + String [] @FldB [] array2Second; 10.49 + 10.50 + // Old-style array syntax 10.51 + String array2FirstOld @FldA []; 10.52 + String array2SecondOld [] @FldB []; 10.53 +} 10.54 + 10.55 +class ModifiedScoped { 10.56 + public final Parameterized<String, String> unannotated = null; 10.57 + public final Parameterized<@FldA String, String> firstTypeArg = null; 10.58 + public final Parameterized<String, @FldA String> secondTypeArg = null; 10.59 + public final Parameterized<@FldA String, @FldB String> bothTypeArgs = null; 10.60 + 10.61 + public final Parameterized<@FldA Parameterized<@FldA String, @FldB String>, @FldB String> 10.62 + nestedParameterized = null; 10.63 + 10.64 + public final @FldA String [] array1 = null; 10.65 + public final @FldA String @FldB [] array1Deep = null; 10.66 + public final @FldA String [] [] array2 = null; 10.67 + public final @FldA String @FldA [] @FldB [] array2Deep = null; 10.68 + public final String @FldA [] [] array2First = null; 10.69 + public final String [] @FldB [] array2Second = null; 10.70 +} 10.71 + 10.72 +class Parameterized<K, V> { } 10.73 + 10.74 +@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER}) 10.75 +@Documented 10.76 +@interface FldA { } 10.77 +@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER}) 10.78 +@Documented 10.79 +@interface FldB { }
11.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 11.2 +++ b/test/com/sun/javadoc/testTypeAnnotations/typeannos/MethodReturnType.java Tue Apr 09 14:18:22 2013 -0700 11.3 @@ -0,0 +1,78 @@ 11.4 +/* 11.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. 11.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 11.7 + * 11.8 + * This code is free software; you can redistribute it and/or modify it 11.9 + * under the terms of the GNU General Public License version 2 only, as 11.10 + * published by the Free Software Foundation. 11.11 + * 11.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 11.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 11.15 + * version 2 for more details (a copy is included in the LICENSE file that 11.16 + * accompanied this code). 11.17 + * 11.18 + * You should have received a copy of the GNU General Public License version 11.19 + * 2 along with this work; if not, write to the Free Software Foundation, 11.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 11.21 + * 11.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 11.23 + * or visit www.oracle.com if you need additional information or have any 11.24 + * questions. 11.25 + */ 11.26 + 11.27 +package typeannos; 11.28 + 11.29 +import java.lang.annotation.*; 11.30 + 11.31 +/* 11.32 + * This class is replicated from test/tools/javac/annotations/typeAnnotations/newlocations. 11.33 + */ 11.34 +class MtdDefaultScope { 11.35 + MtdParameterized<String, String> unannotated() { return null; } 11.36 + MtdParameterized<@MRtnA String, String> firstTypeArg() { return null; } 11.37 + MtdParameterized<String, @MRtnA String> secondTypeArg() { return null; } 11.38 + MtdParameterized<@MRtnA String, @MRtnB String> bothTypeArgs() { return null; } 11.39 + 11.40 + MtdParameterized<@MRtnA MtdParameterized<@MRtnA String, @MRtnB String>, @MRtnB String> 11.41 + nestedMtdParameterized() { return null; } 11.42 + 11.43 + public <T> @MRtnA String method() { return null; } 11.44 + 11.45 + @MRtnA String [] array1() { return null; } 11.46 + @MRtnA String @MRtnB [] array1Deep() { return null; } 11.47 + @MRtnA String [] [] array2() { return null; } 11.48 + @MRtnA String @MRtnA [] @MRtnB [] array2Deep() { return null; } 11.49 + String @MRtnA [] [] array2First() { return null; } 11.50 + String [] @MRtnB [] array2Second() { return null; } 11.51 + 11.52 + // Old-style array syntax 11.53 + String array2FirstOld() @MRtnA [] { return null; } 11.54 + String array2SecondOld() [] @MRtnB [] { return null; } 11.55 +} 11.56 + 11.57 +class MtdModifiedScoped { 11.58 + public final MtdParameterized<String, String> unannotated() { return null; } 11.59 + public final MtdParameterized<@MRtnA String, String> firstTypeArg() { return null; } 11.60 + public final MtdParameterized<String, @MRtnA String> secondTypeArg() { return null; } 11.61 + public final MtdParameterized<@MRtnA String, @MRtnB String> bothTypeArgs() { return null; } 11.62 + 11.63 + public final MtdParameterized<@MRtnA MtdParameterized<@MRtnA String, @MRtnB String>, @MRtnB String> 11.64 + nestedMtdParameterized() { return null; } 11.65 + 11.66 + public final @MRtnA String [] array1() { return null; } 11.67 + public final @MRtnA String @MRtnB [] array1Deep() { return null; } 11.68 + public final @MRtnA String [] [] array2() { return null; } 11.69 + public final @MRtnA String @MRtnA [] @MRtnB [] array2Deep() { return null; } 11.70 + public final String @MRtnA [] [] array2First() { return null; } 11.71 + public final String [] @MRtnB [] array2Second() { return null; } 11.72 +} 11.73 + 11.74 +class MtdParameterized<K, V> { } 11.75 + 11.76 +@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER}) 11.77 +@Documented 11.78 +@interface MRtnA { } 11.79 +@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER}) 11.80 +@Documented 11.81 +@interface MRtnB { }
12.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 12.2 +++ b/test/com/sun/javadoc/testTypeAnnotations/typeannos/MethodTypeParameters.java Tue Apr 09 14:18:22 2013 -0700 12.3 @@ -0,0 +1,52 @@ 12.4 +/* 12.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. 12.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 12.7 + * 12.8 + * This code is free software; you can redistribute it and/or modify it 12.9 + * under the terms of the GNU General Public License version 2 only, as 12.10 + * published by the Free Software Foundation. 12.11 + * 12.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 12.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 12.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12.15 + * version 2 for more details (a copy is included in the LICENSE file that 12.16 + * accompanied this code). 12.17 + * 12.18 + * You should have received a copy of the GNU General Public License version 12.19 + * 2 along with this work; if not, write to the Free Software Foundation, 12.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 12.21 + * 12.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 12.23 + * or visit www.oracle.com if you need additional information or have any 12.24 + * questions. 12.25 + */ 12.26 + 12.27 +package typeannos; 12.28 + 12.29 +import java.lang.annotation.*; 12.30 + 12.31 +/* 12.32 + * This class is replicated from test/tools/javac/annotations/typeAnnotations/newlocations. 12.33 + */ 12.34 +class UnscopedUnmodified { 12.35 + <K extends @MTyParamA String> void methodExtends() {} 12.36 + <K extends @MTyParamA MtdTyParameterized<@MTyParamB String>> void nestedExtends() {} 12.37 + <K extends @MTyParamA String, V extends @MTyParamA MtdTyParameterized<@MTyParamB String>> void dual() {} 12.38 + <K extends String, V extends MtdTyParameterized<@MTyParamB String>> void dualOneAnno() {} 12.39 +} 12.40 + 12.41 +class PublicModifiedMethods { 12.42 + public final <K extends @MTyParamA String> void methodExtends() {} 12.43 + public final <K extends @MTyParamA MtdTyParameterized<@MTyParamB String>> void nestedExtends() {} 12.44 + public final <K extends @MTyParamA String, V extends @MTyParamA MtdTyParameterized<@MTyParamB String>> void dual() {} 12.45 + public final <K extends String, V extends MtdTyParameterized<@MTyParamB String>> void dualOneAnno() {} 12.46 +} 12.47 + 12.48 +class MtdTyParameterized<K> { } 12.49 + 12.50 +@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER}) 12.51 +@Documented 12.52 +@interface MTyParamA { } 12.53 +@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER}) 12.54 +@Documented 12.55 +@interface MTyParamB { }
13.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 13.2 +++ b/test/com/sun/javadoc/testTypeAnnotations/typeannos/Parameters.java Tue Apr 09 14:18:22 2013 -0700 13.3 @@ -0,0 +1,54 @@ 13.4 +/* 13.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. 13.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 13.7 + * 13.8 + * This code is free software; you can redistribute it and/or modify it 13.9 + * under the terms of the GNU General Public License version 2 only, as 13.10 + * published by the Free Software Foundation. 13.11 + * 13.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 13.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 13.15 + * version 2 for more details (a copy is included in the LICENSE file that 13.16 + * accompanied this code). 13.17 + * 13.18 + * You should have received a copy of the GNU General Public License version 13.19 + * 2 along with this work; if not, write to the Free Software Foundation, 13.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 13.21 + * 13.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 13.23 + * or visit www.oracle.com if you need additional information or have any 13.24 + * questions. 13.25 + */ 13.26 + 13.27 +package typeannos; 13.28 + 13.29 +import java.lang.annotation.*; 13.30 + 13.31 +/* 13.32 + * This class is replicated from test/tools/javac/annotations/typeAnnotations/newlocations. 13.33 + */ 13.34 +class Parameters { 13.35 + void unannotated(ParaParameterized<String, String> a) {} 13.36 + void firstTypeArg(ParaParameterized<@ParamA String, String> a) {} 13.37 + void secondTypeArg(ParaParameterized<String, @ParamA String> a) {} 13.38 + void bothTypeArgs(ParaParameterized<@ParamA String, @ParamB String> both) {} 13.39 + 13.40 + void nestedParaParameterized(ParaParameterized<@ParamA ParaParameterized<@ParamA String, @ParamB String>, @ParamB String> a) {} 13.41 + 13.42 + void array1(@ParamA String [] a) {} 13.43 + void array1Deep(@ParamA String @ParamB [] a) {} 13.44 + void array2(@ParamA String [] [] a) {} 13.45 + void array2Deep(@ParamA String @ParamA [] @ParamB [] a) {} 13.46 + void array2First(String @ParamA [] [] a) {} 13.47 + void array2Second(String [] @ParamB [] a) {} 13.48 +} 13.49 + 13.50 +class ParaParameterized<K, V> { } 13.51 + 13.52 +@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER}) 13.53 +@Documented 13.54 +@interface ParamA { } 13.55 +@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER}) 13.56 +@Documented 13.57 +@interface ParamB { }
14.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 14.2 +++ b/test/com/sun/javadoc/testTypeAnnotations/typeannos/Receivers.java Tue Apr 09 14:18:22 2013 -0700 14.3 @@ -0,0 +1,131 @@ 14.4 +/* 14.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. 14.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 14.7 + * 14.8 + * This code is free software; you can redistribute it and/or modify it 14.9 + * under the terms of the GNU General Public License version 2 only, as 14.10 + * published by the Free Software Foundation. 14.11 + * 14.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 14.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 14.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14.15 + * version 2 for more details (a copy is included in the LICENSE file that 14.16 + * accompanied this code). 14.17 + * 14.18 + * You should have received a copy of the GNU General Public License version 14.19 + * 2 along with this work; if not, write to the Free Software Foundation, 14.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 14.21 + * 14.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 14.23 + * or visit www.oracle.com if you need additional information or have any 14.24 + * questions. 14.25 + */ 14.26 + 14.27 +package typeannos; 14.28 + 14.29 +import java.lang.annotation.*; 14.30 + 14.31 +/* 14.32 + * This class is replicated from test/tools/javac/annotations/typeAnnotations/newlocations. 14.33 + */ 14.34 +class DefaultUnmodified { 14.35 + void plain(@RcvrA DefaultUnmodified this) { } 14.36 + <T> void generic(@RcvrA DefaultUnmodified this) { } 14.37 + void withException(@RcvrA DefaultUnmodified this) throws Exception { } 14.38 + String nonVoid(@RcvrA @RcvrB("m") DefaultUnmodified this) { return null; } 14.39 + <T extends Runnable> void accept(@RcvrA DefaultUnmodified this, T r) throws Exception { } 14.40 +} 14.41 + 14.42 +class PublicModified { 14.43 + public final void plain(@RcvrA PublicModified this) { } 14.44 + public final <T> void generic(@RcvrA PublicModified this) { } 14.45 + public final void withException(@RcvrA PublicModified this) throws Exception { } 14.46 + public final String nonVoid(@RcvrA PublicModified this) { return null; } 14.47 + public final <T extends Runnable> void accept(@RcvrA PublicModified this, T r) throws Exception { } 14.48 +} 14.49 + 14.50 +class WithValue { 14.51 + void plain(@RcvrB("m") WithValue this) { } 14.52 + <T> void generic(@RcvrB("m") WithValue this) { } 14.53 + void withException(@RcvrB("m") WithValue this) throws Exception { } 14.54 + String nonVoid(@RcvrB("m") WithValue this) { return null; } 14.55 + <T extends Runnable> void accept(@RcvrB("m") WithValue this, T r) throws Exception { } 14.56 +} 14.57 + 14.58 +class WithFinal { 14.59 + void plain(final @RcvrB("m") WithFinal this) { } 14.60 + <T> void generic(final @RcvrB("m") WithFinal this) { } 14.61 + void withException(final @RcvrB("m") WithFinal this) throws Exception { } 14.62 + String nonVoid(final @RcvrB("m") WithFinal this) { return null; } 14.63 + <T extends Runnable> void accept(final @RcvrB("m") WithFinal this, T r) throws Exception { } 14.64 +} 14.65 + 14.66 +class WithBody { 14.67 + Object f; 14.68 + 14.69 + void field(@RcvrA WithBody this) { 14.70 + this.f = null; 14.71 + } 14.72 + void meth(@RcvrA WithBody this) { 14.73 + this.toString(); 14.74 + } 14.75 +} 14.76 + 14.77 +class Generic1<X> { 14.78 + void test1(Generic1<X> this) {} 14.79 + void test2(@RcvrA Generic1<X> this) {} 14.80 + void test3(Generic1<@RcvrA X> this) {} 14.81 + void test4(@RcvrA Generic1<@RcvrA X> this) {} 14.82 +} 14.83 + 14.84 +class Generic2<@RcvrA X> { 14.85 + void test1(Generic2<X> this) {} 14.86 + void test2(@RcvrA Generic2<X> this) {} 14.87 + void test3(Generic2<@RcvrA X> this) {} 14.88 + void test4(@RcvrA Generic2<@RcvrA X> this) {} 14.89 +} 14.90 + 14.91 +class Generic3<X extends @RcvrA Object> { 14.92 + void test1(Generic3<X> this) {} 14.93 + void test2(@RcvrA Generic3<X> this) {} 14.94 + void test3(Generic3<@RcvrA X> this) {} 14.95 + void test4(@RcvrA Generic3<@RcvrA X> this) {} 14.96 +} 14.97 + 14.98 +class Generic4<X extends @RcvrA Object> { 14.99 + <Y> void test1(Generic4<X> this) {} 14.100 + <Y> void test2(@RcvrA Generic4<X> this) {} 14.101 + <Y> void test3(Generic4<@RcvrA X> this) {} 14.102 + <Y> void test4(@RcvrA Generic4<@RcvrA X> this) {} 14.103 +} 14.104 + 14.105 +class Outer { 14.106 + class Inner { 14.107 + void none(Outer.Inner this) {} 14.108 + void outer(@RcvrA Outer.Inner this) {} 14.109 + void inner(Outer. @RcvrB("i") Inner this) {} 14.110 + void both(@RcvrA Outer.@RcvrB("i") Inner this) {} 14.111 + 14.112 + void innerOnlyNone(Inner this) {} 14.113 + void innerOnly(@RcvrA Inner this) {} 14.114 + } 14.115 +} 14.116 + 14.117 +class GenericOuter<S, T> { 14.118 + class GenericInner<U, V> { 14.119 + void none(GenericOuter<S, T>.GenericInner<U, V> this) {} 14.120 + void outer(@RcvrA GenericOuter<S, T>.GenericInner<U, V> this) {} 14.121 + void inner(GenericOuter<S, T>. @RcvrB("i") GenericInner<U, V> this) {} 14.122 + void both(@RcvrA GenericOuter<S, T>.@RcvrB("i") GenericInner<U, V> this) {} 14.123 + 14.124 + void innerOnlyNone(GenericInner<U, V> this) {} 14.125 + void innerOnly(@RcvrA GenericInner<U, V> this) {} 14.126 + } 14.127 +} 14.128 + 14.129 +@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER}) 14.130 +@Documented 14.131 +@interface RcvrA {} 14.132 +@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER}) 14.133 +@Documented 14.134 +@interface RcvrB { String value(); }
15.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 15.2 +++ b/test/com/sun/javadoc/testTypeAnnotations/typeannos/Throws.java Tue Apr 09 14:18:22 2013 -0700 15.3 @@ -0,0 +1,51 @@ 15.4 +/* 15.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. 15.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 15.7 + * 15.8 + * This code is free software; you can redistribute it and/or modify it 15.9 + * under the terms of the GNU General Public License version 2 only, as 15.10 + * published by the Free Software Foundation. 15.11 + * 15.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 15.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 15.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 15.15 + * version 2 for more details (a copy is included in the LICENSE file that 15.16 + * accompanied this code). 15.17 + * 15.18 + * You should have received a copy of the GNU General Public License version 15.19 + * 2 along with this work; if not, write to the Free Software Foundation, 15.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 15.21 + * 15.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 15.23 + * or visit www.oracle.com if you need additional information or have any 15.24 + * questions. 15.25 + */ 15.26 + 15.27 +package typeannos; 15.28 + 15.29 +import java.lang.annotation.*; 15.30 + 15.31 +/* 15.32 + * This class is replicated from test/tools/javac/annotations/typeAnnotations/newlocations. 15.33 + */ 15.34 +class ThrDefaultUnmodified { 15.35 + void oneException() throws @ThrA Exception {} 15.36 + void twoExceptions() throws @ThrA RuntimeException, @ThrA Exception {} 15.37 +} 15.38 + 15.39 +class ThrPublicModified { 15.40 + public final void oneException(String a) throws @ThrA Exception {} 15.41 + public final void twoExceptions(String a) throws @ThrA RuntimeException, @ThrA Exception {} 15.42 +} 15.43 + 15.44 +class ThrWithValue { 15.45 + void oneException() throws @ThrB("m") Exception {} 15.46 + void twoExceptions() throws @ThrB(value="m") RuntimeException, @ThrA Exception {} 15.47 +} 15.48 + 15.49 +@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER}) 15.50 +@Documented 15.51 +@interface ThrA {} 15.52 +@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER}) 15.53 +@Documented 15.54 +@interface ThrB { String value(); }
16.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 16.2 +++ b/test/com/sun/javadoc/testTypeAnnotations/typeannos/TypeParameters.java Tue Apr 09 14:18:22 2013 -0700 16.3 @@ -0,0 +1,60 @@ 16.4 +/* 16.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. 16.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 16.7 + * 16.8 + * This code is free software; you can redistribute it and/or modify it 16.9 + * under the terms of the GNU General Public License version 2 only, as 16.10 + * published by the Free Software Foundation. 16.11 + * 16.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 16.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 16.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 16.15 + * version 2 for more details (a copy is included in the LICENSE file that 16.16 + * accompanied this code). 16.17 + * 16.18 + * You should have received a copy of the GNU General Public License version 16.19 + * 2 along with this work; if not, write to the Free Software Foundation, 16.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 16.21 + * 16.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 16.23 + * or visit www.oracle.com if you need additional information or have any 16.24 + * questions. 16.25 + */ 16.26 + 16.27 +package typeannos; 16.28 + 16.29 +import java.lang.annotation.*; 16.30 + 16.31 +/* 16.32 + * This class is replicated from test/tools/javac/annotations/typeAnnotations/newlocations. 16.33 + */ 16.34 +class TypUnannotated<K> { } 16.35 +class OneAnnotated<@TyParaA K> { } 16.36 +class TwoAnnotated<@TyParaA K, @TyParaA V> { } 16.37 +class SecondAnnotated<K, @TyParaA V extends String> { } 16.38 + 16.39 +class TestMethods { 16.40 + <K> void unannotated() { } 16.41 + <@TyParaA K> void oneAnnotated() { } 16.42 + <@TyParaA K, @TyParaB("m") V> void twoAnnotated() { } 16.43 + <K, @TyParaA V extends @TyParaA String> void secondAnnotated() { } 16.44 +} 16.45 + 16.46 +class UnannotatedB<K> { } 16.47 +class OneAnnotatedB<@TyParaB("m") K> { } 16.48 +class TwoAnnotatedB<@TyParaB("m") K, @TyParaB("m") V> { } 16.49 +class SecondAnnotatedB<K, @TyParaB("m") V extends @TyParaB("m") String> { } 16.50 + 16.51 +class OneAnnotatedC<@TyParaC K> { } 16.52 +class TwoAnnotatedC<@TyParaC K, @TyParaC V> { } 16.53 +class SecondAnnotatedC<K, @TyParaC V extends String> { } 16.54 + 16.55 +@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER}) 16.56 +@Documented 16.57 +@interface TyParaA { } 16.58 +@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER}) 16.59 +@Documented 16.60 +@interface TyParaB { String value(); } 16.61 +@Target(ElementType.TYPE_USE) 16.62 +@Documented 16.63 +@interface TyParaC { }
17.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 17.2 +++ b/test/com/sun/javadoc/testTypeAnnotations/typeannos/Varargs.java Tue Apr 09 14:18:22 2013 -0700 17.3 @@ -0,0 +1,42 @@ 17.4 +/* 17.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. 17.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 17.7 + * 17.8 + * This code is free software; you can redistribute it and/or modify it 17.9 + * under the terms of the GNU General Public License version 2 only, as 17.10 + * published by the Free Software Foundation. 17.11 + * 17.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 17.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 17.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 17.15 + * version 2 for more details (a copy is included in the LICENSE file that 17.16 + * accompanied this code). 17.17 + * 17.18 + * You should have received a copy of the GNU General Public License version 17.19 + * 2 along with this work; if not, write to the Free Software Foundation, 17.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 17.21 + * 17.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 17.23 + * or visit www.oracle.com if you need additional information or have any 17.24 + * questions. 17.25 + */ 17.26 +package typeannos; 17.27 + 17.28 +import java.lang.annotation.*; 17.29 + 17.30 +@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER}) 17.31 +@Documented 17.32 +@interface VarArgA {} 17.33 + 17.34 +/* 17.35 + * This class is replicated from test/tools/javac/annotations/typeAnnotations/newlocations. 17.36 + */ 17.37 +class Varargs { 17.38 + 17.39 + // Handle annotations on a varargs element type 17.40 + void varargPlain(Object @VarArgA... objs) { 17.41 + } 17.42 + 17.43 + void varargGeneric(Class<?> @VarArgA ... clz) { 17.44 + } 17.45 +}
18.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 18.2 +++ b/test/com/sun/javadoc/testTypeAnnotations/typeannos/Wildcards.java Tue Apr 09 14:18:22 2013 -0700 18.3 @@ -0,0 +1,74 @@ 18.4 +/* 18.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. 18.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 18.7 + * 18.8 + * This code is free software; you can redistribute it and/or modify it 18.9 + * under the terms of the GNU General Public License version 2 only, as 18.10 + * published by the Free Software Foundation. 18.11 + * 18.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 18.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 18.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 18.15 + * version 2 for more details (a copy is included in the LICENSE file that 18.16 + * accompanied this code). 18.17 + * 18.18 + * You should have received a copy of the GNU General Public License version 18.19 + * 2 along with this work; if not, write to the Free Software Foundation, 18.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18.21 + * 18.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 18.23 + * or visit www.oracle.com if you need additional information or have any 18.24 + * questions. 18.25 + */ 18.26 + 18.27 +package typeannos; 18.28 + 18.29 +import java.lang.annotation.*; 18.30 + 18.31 +/* 18.32 + * This class is replicated from test/tools/javac/annotations/typeAnnotations/newlocations. 18.33 + */ 18.34 +class BoundTest { 18.35 + void wcExtends(MyList<? extends @WldA String> l) { } 18.36 + void wcSuper(MyList<? super @WldA String> l) { } 18.37 + 18.38 + MyList<? extends @WldA String> returnWcExtends() { return null; } 18.39 + MyList<? super @WldA String> returnWcSuper() { return null; } 18.40 + MyList<? extends @WldA MyList<? super @WldB("m") String>> complex() { return null; } 18.41 +} 18.42 + 18.43 +class BoundWithValue { 18.44 + void wcExtends(MyList<? extends @WldB("m") String> l) { } 18.45 + void wcSuper(MyList<? super @WldB(value="m") String> l) { } 18.46 + 18.47 + MyList<? extends @WldB("m") String> returnWcExtends() { return null; } 18.48 + MyList<? super @WldB(value="m") String> returnWcSuper() { return null; } 18.49 + MyList<? extends @WldB("m") MyList<? super @WldB("m") String>> complex() { return null; } 18.50 +} 18.51 + 18.52 +class SelfTest { 18.53 + void wcExtends(MyList<@WldA ?> l) { } 18.54 + void wcSuper(MyList<@WldA ?> l) { } 18.55 + 18.56 + MyList<@WldA ?> returnWcExtends() { return null; } 18.57 + MyList<@WldA ?> returnWcSuper() { return null; } 18.58 + MyList<@WldA ? extends @WldA MyList<@WldB("m") ?>> complex() { return null; } 18.59 +} 18.60 + 18.61 +class SelfWithValue { 18.62 + void wcExtends(MyList<@WldB("m") ?> l) { } 18.63 + void wcSuper(MyList<@WldB(value="m") ?> l) { } 18.64 + 18.65 + MyList<@WldB("m") ?> returnWcExtends() { return null; } 18.66 + MyList<@WldB(value="m") ?> returnWcSuper() { return null; } 18.67 + MyList<@WldB("m") ? extends MyList<@WldB("m") ? super String>> complex() { return null; } 18.68 +} 18.69 + 18.70 +class MyList<K> { } 18.71 + 18.72 +@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER}) 18.73 +@Documented 18.74 +@interface WldA { } 18.75 +@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER}) 18.76 +@Documented 18.77 +@interface WldB { String value(); }