Fri, 28 Dec 2012 18:39:09 -0800
Merge
test/tools/javac/processing/model/util/deprecation/TestDeprecation.java | file | annotate | diff | comparison | revisions |
1.1 --- a/make/build.properties Thu Dec 27 12:15:17 2012 -0800 1.2 +++ b/make/build.properties Fri Dec 28 18:39:09 2012 -0800 1.3 @@ -68,7 +68,7 @@ 1.4 # set the following to -version to verify the versions of javac being used 1.5 javac.version.opt = 1.6 # in time, there should be no exceptions to -Xlint:all 1.7 -javac.lint.opts = -Xlint:all,-deprecation -Werror 1.8 +javac.lint.opts = -Xlint:all -Werror 1.9 1.10 # options for the <javadoc> task for javac 1.11 #javadoc.jls3.url=http://java.sun.com/docs/books/jls/ 1.12 @@ -117,7 +117,8 @@ 1.13 javax/lang/model/ \ 1.14 javax/tools/ \ 1.15 com/sun/source/ \ 1.16 - com/sun/tools/javac/ 1.17 + com/sun/tools/javac/ \ 1.18 + com/sun/tools/doclint/ 1.19 1.20 javac.tests = \ 1.21 tools/javac
2.1 --- a/src/share/classes/com/sun/javadoc/ClassDoc.java Thu Dec 27 12:15:17 2012 -0800 2.2 +++ b/src/share/classes/com/sun/javadoc/ClassDoc.java Fri Dec 28 18:39:09 2012 -0800 2.3 @@ -1,5 +1,5 @@ 2.4 /* 2.5 - * Copyright (c) 1998, 2006, Oracle and/or its affiliates. All rights reserved. 2.6 + * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved. 2.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 2.8 * 2.9 * This code is free software; you can redistribute it and/or modify it 2.10 @@ -66,6 +66,12 @@ 2.11 boolean isExternalizable(); 2.12 2.13 /** 2.14 + * Return true if this class can be used as a target type of a lambda expression 2.15 + * or method reference. 2.16 + */ 2.17 + boolean isFunctionalInterface(); 2.18 + 2.19 + /** 2.20 * Return the serialization methods for this class or 2.21 * interface. 2.22 *
3.1 --- a/src/share/classes/com/sun/javadoc/MethodDoc.java Thu Dec 27 12:15:17 2012 -0800 3.2 +++ b/src/share/classes/com/sun/javadoc/MethodDoc.java Fri Dec 28 18:39:09 2012 -0800 3.3 @@ -1,5 +1,5 @@ 3.4 /* 3.5 - * Copyright (c) 1998, 2006, Oracle and/or its affiliates. All rights reserved. 3.6 + * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved. 3.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3.8 * 3.9 * This code is free software; you can redistribute it and/or modify it 3.10 @@ -39,6 +39,11 @@ 3.11 boolean isAbstract(); 3.12 3.13 /** 3.14 + * Return true if this method is default 3.15 + */ 3.16 + boolean isDefault(); 3.17 + 3.18 + /** 3.19 * Get return type. 3.20 * 3.21 * @return the return type of this method, null if it
4.1 --- a/src/share/classes/com/sun/source/util/DocTrees.java Thu Dec 27 12:15:17 2012 -0800 4.2 +++ b/src/share/classes/com/sun/source/util/DocTrees.java Fri Dec 28 18:39:09 2012 -0800 4.3 @@ -45,9 +45,7 @@ 4.4 * @throws IllegalArgumentException if the task does not support the Trees API. 4.5 */ 4.6 public static DocTrees instance(CompilationTask task) { 4.7 - if (!task.getClass().getName().equals("com.sun.tools.javac.api.JavacTaskImpl")) 4.8 - throw new IllegalArgumentException(); 4.9 - return (DocTrees) getJavacTrees(CompilationTask.class, task); 4.10 + return (DocTrees) Trees.instance(task); 4.11 } 4.12 4.13 /**
5.1 --- a/src/share/classes/com/sun/source/util/JavacTask.java Thu Dec 27 12:15:17 2012 -0800 5.2 +++ b/src/share/classes/com/sun/source/util/JavacTask.java Fri Dec 28 18:39:09 2012 -0800 5.3 @@ -139,6 +139,7 @@ 5.4 * @see com.sun.source.util.Trees#getTypeMirror 5.5 */ 5.6 public abstract TypeMirror getTypeMirror(Iterable<? extends Tree> path); 5.7 + 5.8 /** 5.9 * Get a utility object for dealing with program elements. 5.10 */
6.1 --- a/src/share/classes/com/sun/source/util/Plugin.java Thu Dec 27 12:15:17 2012 -0800 6.2 +++ b/src/share/classes/com/sun/source/util/Plugin.java Fri Dec 28 18:39:09 2012 -0800 6.3 @@ -56,9 +56,9 @@ 6.4 String getName(); 6.5 6.6 /** 6.7 - * Invoke the plug-in for a given compilation task. 6.8 + * Initialize the plug-in for a given compilation task. 6.9 * @param task The compilation task that has just been started 6.10 * @param args Arguments, if any, for the plug-in 6.11 */ 6.12 - void call(JavacTask task, String... args); 6.13 + void init(JavacTask task, String... args); 6.14 }
7.1 --- a/src/share/classes/com/sun/source/util/TreePath.java Thu Dec 27 12:15:17 2012 -0800 7.2 +++ b/src/share/classes/com/sun/source/util/TreePath.java Fri Dec 28 18:39:09 2012 -0800 7.3 @@ -60,14 +60,20 @@ 7.4 this.path = path; 7.5 } 7.6 } 7.7 + 7.8 class PathFinder extends TreePathScanner<TreePath,Tree> { 7.9 public TreePath scan(Tree tree, Tree target) { 7.10 - if (tree == target) 7.11 + if (tree == target) { 7.12 throw new Result(new TreePath(getCurrentPath(), target)); 7.13 + } 7.14 return super.scan(tree, target); 7.15 } 7.16 } 7.17 7.18 + if (path.getLeaf() == target) { 7.19 + return path; 7.20 + } 7.21 + 7.22 try { 7.23 new PathFinder().scan(path, target); 7.24 } catch (Result result) {
8.1 --- a/src/share/classes/com/sun/tools/doclets/formats/html/AbstractMemberWriter.java Thu Dec 27 12:15:17 2012 -0800 8.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/AbstractMemberWriter.java Fri Dec 28 18:39:09 2012 -0800 8.3 @@ -239,7 +239,14 @@ 8.4 if ((member.isField() || member.isMethod()) && 8.5 writer instanceof ClassWriterImpl && 8.6 ((ClassWriterImpl) writer).getClassDoc().isInterface()) { 8.7 - mod = Util.replaceText(mod, "public", "").trim(); 8.8 + // This check for isDefault() and the default modifier needs to be 8.9 + // added for it to appear on the method details section. Once the 8.10 + // default modifier is added to the Modifier list on DocEnv and once 8.11 + // it is updated to use the javax.lang.model.element.Modifier, we 8.12 + // will need to remove this. 8.13 + mod = (member.isMethod() && ((MethodDoc)member).isDefault()) ? 8.14 + Util.replaceText(mod, "public", "default").trim() : 8.15 + Util.replaceText(mod, "public", "").trim(); 8.16 } 8.17 if(mod.length() > 0) { 8.18 htmltree.addContent(mod); 8.19 @@ -313,8 +320,18 @@ 8.20 code.addContent(configuration.getText("doclet.Package_private")); 8.21 code.addContent(" "); 8.22 } 8.23 - if (member.isMethod() && ((MethodDoc)member).isAbstract()) { 8.24 - code.addContent("abstract "); 8.25 + if (member.isMethod()) { 8.26 + if (((MethodDoc)member).isAbstract()) { 8.27 + code.addContent("abstract "); 8.28 + } 8.29 + // This check for isDefault() and the default modifier needs to be 8.30 + // added for it to appear on the "Modifier and Type" column in the 8.31 + // method summary section. Once the default modifier is added 8.32 + // to the Modifier list on DocEnv and once it is updated to use the 8.33 + // javax.lang.model.element.Modifier, we will need to remove this. 8.34 + else if (((MethodDoc)member).isDefault()) { 8.35 + code.addContent("default "); 8.36 + } 8.37 } 8.38 if (member.isStatic()) { 8.39 code.addContent("static "); 8.40 @@ -547,6 +564,9 @@ 8.41 methodType = (classdoc.isInterface() || ((MethodDoc)member).isAbstract()) ? 8.42 methodType | MethodTypes.ABSTRACT.value() : 8.43 methodType | MethodTypes.CONCRETE.value(); 8.44 + if (((MethodDoc)member).isDefault()) { 8.45 + methodType = methodType | MethodTypes.DEFAULT.value(); 8.46 + } 8.47 if (Util.isDeprecated(member) || Util.isDeprecated(classdoc)) { 8.48 methodType = methodType | MethodTypes.DEPRECATED.value(); 8.49 }
9.1 --- a/src/share/classes/com/sun/tools/doclets/formats/html/ClassWriterImpl.java Thu Dec 27 12:15:17 2012 -0800 9.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/ClassWriterImpl.java Fri Dec 28 18:39:09 2012 -0800 9.3 @@ -516,6 +516,20 @@ 9.4 /** 9.5 * {@inheritDoc} 9.6 */ 9.7 + public void addFunctionalInterfaceInfo (Content classInfoTree) { 9.8 + if (classDoc.isFunctionalInterface()) { 9.9 + Content dt = HtmlTree.DT(getResource("doclet.Functional_Interface")); 9.10 + Content dl = HtmlTree.DL(dt); 9.11 + Content dd = new HtmlTree(HtmlTag.DD); 9.12 + dd.addContent(getResource("doclet.Functional_Interface_Message")); 9.13 + dl.addContent(dd); 9.14 + classInfoTree.addContent(dl); 9.15 + } 9.16 + } 9.17 + 9.18 + /** 9.19 + * {@inheritDoc} 9.20 + */ 9.21 public void addClassDeprecationInfo(Content classInfoTree) { 9.22 Content hr = new HtmlTree(HtmlTag.HR); 9.23 classInfoTree.addContent(hr);
10.1 --- a/src/share/classes/com/sun/tools/doclets/formats/html/resources/standard.properties Thu Dec 27 12:15:17 2012 -0800 10.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/resources/standard.properties Fri Dec 28 18:39:09 2012 -0800 10.3 @@ -90,6 +90,8 @@ 10.4 doclet.Subclasses=Direct Known Subclasses: 10.5 doclet.Subinterfaces=All Known Subinterfaces: 10.6 doclet.Implementing_Classes=All Known Implementing Classes: 10.7 +doclet.Functional_Interface=Functional Interface: 10.8 +doclet.Functional_Interface_Message=This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference. 10.9 doclet.also=also 10.10 doclet.Frames=Frames 10.11 doclet.No_Frames=No Frames
11.1 --- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/ClassWriter.java Thu Dec 27 12:15:17 2012 -0800 11.2 +++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/ClassWriter.java Fri Dec 28 18:39:09 2012 -0800 11.3 @@ -117,6 +117,13 @@ 11.4 public void addInterfaceUsageInfo(Content classInfoTree); 11.5 11.6 /** 11.7 + * If this is an functional interface, display appropriate message. 11.8 + * 11.9 + * @param classInfoTree content tree to which the documentation will be added 11.10 + */ 11.11 + public void addFunctionalInterfaceInfo(Content classInfoTree); 11.12 + 11.13 + /** 11.14 * If this is an inner class or interface, add the enclosing class or 11.15 * interface. 11.16 *
12.1 --- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/ClassBuilder.java Thu Dec 27 12:15:17 2012 -0800 12.2 +++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/ClassBuilder.java Fri Dec 28 18:39:09 2012 -0800 12.3 @@ -236,6 +236,16 @@ 12.4 } 12.5 12.6 /** 12.7 + * If this is an functional interface, display appropriate message. 12.8 + * 12.9 + * @param node the XML element that specifies which components to document 12.10 + * @param classInfoTree the content tree to which the documentation will be added 12.11 + */ 12.12 + public void buildFunctionalInterfaceInfo(XMLNode node, Content classInfoTree) { 12.13 + writer.addFunctionalInterfaceInfo(classInfoTree); 12.14 + } 12.15 + 12.16 + /** 12.17 * If this class is deprecated, build the appropriate information. 12.18 * 12.19 * @param node the XML element that specifies which components to document
13.1 --- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/resources/doclet.xml Thu Dec 27 12:15:17 2012 -0800 13.2 +++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/resources/doclet.xml Fri Dec 28 18:39:09 2012 -0800 13.3 @@ -85,6 +85,7 @@ 13.4 <SubInterfacesInfo/> 13.5 <InterfaceUsageInfo/> 13.6 <NestedClassInfo/> 13.7 + <FunctionalInterfaceInfo/> 13.8 <DeprecationInfo/> 13.9 <ClassSignature/> 13.10 <ClassDescription/>
14.1 --- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/MethodTypes.java Thu Dec 27 12:15:17 2012 -0800 14.2 +++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/MethodTypes.java Fri Dec 28 18:39:09 2012 -0800 14.3 @@ -36,7 +36,8 @@ 14.4 INSTANCE(0x2, "Instance Methods", "t2", false), 14.5 ABSTRACT(0x4, "Abstract Methods", "t3", false), 14.6 CONCRETE(0x8, "Concrete Methods", "t4", false), 14.7 - DEPRECATED(0x10, "Deprecated Methods", "t5", false); 14.8 + DEFAULT(0x10, "Default Methods", "t5", false), 14.9 + DEPRECATED(0x20, "Deprecated Methods", "t6", false); 14.10 14.11 private final int value; 14.12 private final String text;
15.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 15.2 +++ b/src/share/classes/com/sun/tools/doclint/Checker.java Fri Dec 28 18:39:09 2012 -0800 15.3 @@ -0,0 +1,754 @@ 15.4 +/* 15.5 + * Copyright (c) 2012, 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. Oracle designates this 15.11 + * particular file as subject to the "Classpath" exception as provided 15.12 + * by Oracle in the LICENSE file that accompanied this code. 15.13 + * 15.14 + * This code is distributed in the hope that it will be useful, but WITHOUT 15.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 15.16 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 15.17 + * version 2 for more details (a copy is included in the LICENSE file that 15.18 + * accompanied this code). 15.19 + * 15.20 + * You should have received a copy of the GNU General Public License version 15.21 + * 2 along with this work; if not, write to the Free Software Foundation, 15.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 15.23 + * 15.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 15.25 + * or visit www.oracle.com if you need additional information or have any 15.26 + * questions. 15.27 + */ 15.28 + 15.29 +package com.sun.tools.doclint; 15.30 + 15.31 +import java.util.regex.Matcher; 15.32 +import com.sun.source.doctree.LinkTree; 15.33 +import java.net.URI; 15.34 +import java.util.regex.Pattern; 15.35 +import java.io.IOException; 15.36 +import com.sun.tools.javac.tree.DocPretty; 15.37 +import java.io.StringWriter; 15.38 +import java.util.Deque; 15.39 +import java.util.EnumSet; 15.40 +import java.util.HashSet; 15.41 +import java.util.LinkedList; 15.42 +import java.util.List; 15.43 +import java.util.Set; 15.44 + 15.45 +import javax.lang.model.element.Element; 15.46 +import javax.lang.model.element.ElementKind; 15.47 +import javax.lang.model.element.ExecutableElement; 15.48 +import javax.lang.model.element.Name; 15.49 +import javax.lang.model.element.TypeElement; 15.50 +import javax.lang.model.type.TypeKind; 15.51 +import javax.lang.model.type.TypeMirror; 15.52 +import javax.tools.Diagnostic.Kind; 15.53 + 15.54 +import com.sun.source.doctree.AttributeTree; 15.55 +import com.sun.source.doctree.AuthorTree; 15.56 +import com.sun.source.doctree.DocCommentTree; 15.57 +import com.sun.source.doctree.DocTree; 15.58 +import com.sun.source.doctree.EndElementTree; 15.59 +import com.sun.source.doctree.EntityTree; 15.60 +import com.sun.source.doctree.ErroneousTree; 15.61 +import com.sun.source.doctree.IdentifierTree; 15.62 +import com.sun.source.doctree.InheritDocTree; 15.63 +import com.sun.source.doctree.ParamTree; 15.64 +import com.sun.source.doctree.ReferenceTree; 15.65 +import com.sun.source.doctree.ReturnTree; 15.66 +import com.sun.source.doctree.SerialDataTree; 15.67 +import com.sun.source.doctree.SerialFieldTree; 15.68 +import com.sun.source.doctree.SinceTree; 15.69 +import com.sun.source.doctree.StartElementTree; 15.70 +import com.sun.source.doctree.TextTree; 15.71 +import com.sun.source.doctree.ThrowsTree; 15.72 +import com.sun.source.doctree.VersionTree; 15.73 +import com.sun.source.util.DocTreeScanner; 15.74 +import com.sun.source.util.TreePath; 15.75 +import com.sun.tools.doclint.HtmlTag.AttrKind; 15.76 +import java.net.URISyntaxException; 15.77 +import static com.sun.tools.doclint.Messages.Group.*; 15.78 + 15.79 + 15.80 +/** 15.81 + * Validate a doc comment. 15.82 + * 15.83 + * <p><b>This is NOT part of any supported API. 15.84 + * If you write code that depends on this, you do so at your own 15.85 + * risk. This code and its internal interfaces are subject to change 15.86 + * or deletion without notice.</b></p> 15.87 + */ 15.88 +public class Checker extends DocTreeScanner<Void, Void> { 15.89 + final Env env; 15.90 + 15.91 + Set<Element> foundParams = new HashSet<Element>(); 15.92 + Set<TypeMirror> foundThrows = new HashSet<TypeMirror>(); 15.93 + Set<String> foundAnchors = new HashSet<String>(); 15.94 + boolean foundInheritDoc = false; 15.95 + boolean foundReturn = false; 15.96 + 15.97 + enum Flag { 15.98 + TABLE_HAS_CAPTION, 15.99 + HAS_ELEMENT, 15.100 + HAS_TEXT 15.101 + } 15.102 + 15.103 + static class TagStackItem { 15.104 + final DocTree tree; // typically, but not always, StartElementTree 15.105 + final HtmlTag tag; 15.106 + final Set<HtmlTag.Attr> attrs; 15.107 + final Set<Flag> flags; 15.108 + TagStackItem(DocTree tree, HtmlTag tag) { 15.109 + this.tree = tree; 15.110 + this.tag = tag; 15.111 + attrs = EnumSet.noneOf(HtmlTag.Attr.class); 15.112 + flags = EnumSet.noneOf(Flag.class); 15.113 + } 15.114 + @Override 15.115 + public String toString() { 15.116 + return String.valueOf(tag); 15.117 + } 15.118 + } 15.119 + 15.120 + private Deque<TagStackItem> tagStack; // TODO: maybe want to record starting tree as well 15.121 + private HtmlTag currHeaderTag; 15.122 + 15.123 + // <editor-fold defaultstate="collapsed" desc="Top level"> 15.124 + 15.125 + Checker(Env env) { 15.126 + env.getClass(); 15.127 + this.env = env; 15.128 + tagStack = new LinkedList<TagStackItem>(); 15.129 + } 15.130 + 15.131 + public Void scan(DocCommentTree tree, TreePath p) { 15.132 + env.setCurrent(p, tree); 15.133 + 15.134 + boolean isOverridingMethod = !env.currOverriddenMethods.isEmpty(); 15.135 + 15.136 + if (tree == null) { 15.137 + if (!isSynthetic() && !isOverridingMethod) 15.138 + reportMissing("dc.missing.comment"); 15.139 + return null; 15.140 + } 15.141 + 15.142 + tagStack.clear(); 15.143 + currHeaderTag = null; 15.144 + 15.145 + foundParams.clear(); 15.146 + foundThrows.clear(); 15.147 + foundInheritDoc = false; 15.148 + foundReturn = false; 15.149 + 15.150 + scan(tree, (Void) null); 15.151 + 15.152 + if (!isOverridingMethod) { 15.153 + switch (env.currElement.getKind()) { 15.154 + case METHOD: 15.155 + case CONSTRUCTOR: { 15.156 + ExecutableElement ee = (ExecutableElement) env.currElement; 15.157 + checkParamsDocumented(ee.getTypeParameters()); 15.158 + checkParamsDocumented(ee.getParameters()); 15.159 + switch (ee.getReturnType().getKind()) { 15.160 + case VOID: 15.161 + case NONE: 15.162 + break; 15.163 + default: 15.164 + if (!foundReturn 15.165 + && !foundInheritDoc 15.166 + && !env.types.isSameType(ee.getReturnType(), env.java_lang_Void)) { 15.167 + reportMissing("dc.missing.return"); 15.168 + } 15.169 + } 15.170 + checkThrowsDocumented(ee.getThrownTypes()); 15.171 + } 15.172 + } 15.173 + } 15.174 + 15.175 + return null; 15.176 + } 15.177 + 15.178 + private void reportMissing(String code, Object... args) { 15.179 + env.messages.report(MISSING, Kind.WARNING, env.currPath.getLeaf(), code, args); 15.180 + } 15.181 + 15.182 + @Override 15.183 + public Void visitDocComment(DocCommentTree tree, Void ignore) { 15.184 + super.visitDocComment(tree, ignore); 15.185 + for (TagStackItem tsi: tagStack) { 15.186 + if (tsi.tree.getKind() == DocTree.Kind.START_ELEMENT 15.187 + && tsi.tag.endKind == HtmlTag.EndKind.REQUIRED) { 15.188 + StartElementTree t = (StartElementTree) tsi.tree; 15.189 + env.messages.error(HTML, t, "dc.tag.not.closed", t.getName()); 15.190 + } 15.191 + } 15.192 + return null; 15.193 + } 15.194 + // </editor-fold> 15.195 + 15.196 + // <editor-fold defaultstate="collapsed" desc="Text and entities."> 15.197 + 15.198 + @Override 15.199 + public Void visitText(TextTree tree, Void ignore) { 15.200 + if (!tree.getBody().trim().isEmpty()) { 15.201 + markEnclosingTag(Flag.HAS_TEXT); 15.202 + } 15.203 + return null; 15.204 + } 15.205 + 15.206 + @Override 15.207 + public Void visitEntity(EntityTree tree, Void ignore) { 15.208 + markEnclosingTag(Flag.HAS_TEXT); 15.209 + String name = tree.getName().toString(); 15.210 + if (name.startsWith("#")) { 15.211 + int v = name.toLowerCase().startsWith("#x") 15.212 + ? Integer.parseInt(name.substring(2), 16) 15.213 + : Integer.parseInt(name.substring(1), 10); 15.214 + if (!Entity.isValid(v)) { 15.215 + env.messages.error(HTML, tree, "dc.entity.invalid", name); 15.216 + } 15.217 + } else if (!Entity.isValid(name)) { 15.218 + env.messages.error(HTML, tree, "dc.entity.invalid", name); 15.219 + } 15.220 + return null; 15.221 + } 15.222 + 15.223 + // </editor-fold> 15.224 + 15.225 + // <editor-fold defaultstate="collapsed" desc="HTML elements"> 15.226 + 15.227 + @Override 15.228 + public Void visitStartElement(StartElementTree tree, Void ignore) { 15.229 + markEnclosingTag(Flag.HAS_ELEMENT); 15.230 + final Name treeName = tree.getName(); 15.231 + final HtmlTag t = HtmlTag.get(treeName); 15.232 + if (t == null) { 15.233 + env.messages.error(HTML, tree, "dc.tag.unknown", treeName); 15.234 + } else { 15.235 + // tag specific checks 15.236 + switch (t) { 15.237 + // check for out of sequence headers, such as <h1>...</h1> <h3>...</h3> 15.238 + case H1: case H2: case H3: case H4: case H5: case H6: 15.239 + checkHeader(tree, t); 15.240 + break; 15.241 + // <p> inside <pre> 15.242 + case P: 15.243 + TagStackItem top = tagStack.peek(); 15.244 + if (top != null && top.tag == HtmlTag.PRE) 15.245 + env.messages.warning(HTML, tree, "dc.tag.p.in.pre"); 15.246 + break; 15.247 + } 15.248 + 15.249 + // check that only block tags and inline tags are used, 15.250 + // and that blocks tags are not used within inline tags 15.251 + switch (t.blockType) { 15.252 + case INLINE: 15.253 + break; 15.254 + case BLOCK: 15.255 + TagStackItem top = tagStack.peek(); 15.256 + if (top != null && top.tag != null && top.tag.blockType == HtmlTag.BlockType.INLINE) { 15.257 + switch (top.tree.getKind()) { 15.258 + case START_ELEMENT: { 15.259 + Name name = ((StartElementTree) top.tree).getName(); 15.260 + env.messages.error(HTML, tree, "dc.tag.not.allowed.inline.element", 15.261 + treeName, name); 15.262 + break; 15.263 + } 15.264 + case LINK: 15.265 + case LINK_PLAIN: { 15.266 + String name = top.tree.getKind().tagName; 15.267 + env.messages.error(HTML, tree, "dc.tag.not.allowed.inline.tag", 15.268 + treeName, name); 15.269 + break; 15.270 + } 15.271 + default: 15.272 + env.messages.error(HTML, tree, "dc.tag.not.allowed.inline.other", 15.273 + treeName); 15.274 + } 15.275 + } 15.276 + break; 15.277 + case OTHER: 15.278 + env.messages.error(HTML, tree, "dc.tag.not.allowed", treeName); 15.279 + break; 15.280 + default: 15.281 + throw new AssertionError(); 15.282 + } 15.283 + 15.284 + if (t.flags.contains(HtmlTag.Flag.NO_NEST)) { 15.285 + for (TagStackItem i: tagStack) { 15.286 + if (t == i.tag) { 15.287 + env.messages.warning(HTML, tree, "dc.tag.nested.not.allowed", treeName); 15.288 + break; 15.289 + } 15.290 + } 15.291 + } 15.292 + } 15.293 + 15.294 + // check for self closing tags, such as <a id="name"/> 15.295 + if (tree.isSelfClosing()) { 15.296 + env.messages.error(HTML, tree, "dc.tag.self.closing", treeName); 15.297 + } 15.298 + 15.299 + try { 15.300 + TagStackItem parent = tagStack.peek(); 15.301 + TagStackItem top = new TagStackItem(tree, t); 15.302 + tagStack.push(top); 15.303 + 15.304 + super.visitStartElement(tree, ignore); 15.305 + 15.306 + // handle attributes that may or may not have been found in start element 15.307 + if (t != null) { 15.308 + switch (t) { 15.309 + case CAPTION: 15.310 + if (parent != null && parent.tag == HtmlTag.TABLE) 15.311 + parent.flags.add(Flag.TABLE_HAS_CAPTION); 15.312 + break; 15.313 + 15.314 + case IMG: 15.315 + if (!top.attrs.contains(HtmlTag.Attr.ALT)) 15.316 + env.messages.error(ACCESSIBILITY, tree, "dc.no.alt.attr.for.image"); 15.317 + break; 15.318 + } 15.319 + } 15.320 + 15.321 + return null; 15.322 + } finally { 15.323 + 15.324 + if (t == null || t.endKind == HtmlTag.EndKind.NONE) 15.325 + tagStack.pop(); 15.326 + } 15.327 + } 15.328 + 15.329 + private void checkHeader(StartElementTree tree, HtmlTag tag) { 15.330 + // verify the new tag 15.331 + if (getHeaderLevel(tag) > getHeaderLevel(currHeaderTag) + 1) { 15.332 + if (currHeaderTag == null) { 15.333 + env.messages.error(ACCESSIBILITY, tree, "dc.tag.header.sequence.1", tag); 15.334 + } else { 15.335 + env.messages.error(ACCESSIBILITY, tree, "dc.tag.header.sequence.2", 15.336 + tag, currHeaderTag); 15.337 + } 15.338 + } 15.339 + 15.340 + currHeaderTag = tag; 15.341 + } 15.342 + 15.343 + private int getHeaderLevel(HtmlTag tag) { 15.344 + if (tag == null) 15.345 + return 0; 15.346 + switch (tag) { 15.347 + case H1: return 1; 15.348 + case H2: return 2; 15.349 + case H3: return 3; 15.350 + case H4: return 4; 15.351 + case H5: return 5; 15.352 + case H6: return 6; 15.353 + default: throw new IllegalArgumentException(); 15.354 + } 15.355 + } 15.356 + 15.357 + @Override 15.358 + public Void visitEndElement(EndElementTree tree, Void ignore) { 15.359 + final Name treeName = tree.getName(); 15.360 + final HtmlTag t = HtmlTag.get(treeName); 15.361 + if (t == null) { 15.362 + env.messages.error(HTML, tree, "dc.tag.unknown", treeName); 15.363 + } else if (t.endKind == HtmlTag.EndKind.NONE) { 15.364 + env.messages.error(HTML, tree, "dc.tag.end.not.permitted", treeName); 15.365 + } else if (tagStack.isEmpty()) { 15.366 + env.messages.error(HTML, tree, "dc.tag.end.unexpected", treeName); 15.367 + } else { 15.368 + while (!tagStack.isEmpty()) { 15.369 + TagStackItem top = tagStack.peek(); 15.370 + if (t == top.tag) { 15.371 + switch (t) { 15.372 + case TABLE: 15.373 + if (!top.attrs.contains(HtmlTag.Attr.SUMMARY) 15.374 + && !top.flags.contains(Flag.TABLE_HAS_CAPTION)) { 15.375 + env.messages.error(ACCESSIBILITY, tree, 15.376 + "dc.no.summary.or.caption.for.table"); 15.377 + } 15.378 + } 15.379 + if (t.flags.contains(HtmlTag.Flag.EXPECT_CONTENT) 15.380 + && !top.flags.contains(Flag.HAS_TEXT) 15.381 + && !top.flags.contains(Flag.HAS_ELEMENT)) { 15.382 + env.messages.warning(HTML, tree, "dc.tag.empty", treeName); 15.383 + } 15.384 + if (t.flags.contains(HtmlTag.Flag.NO_TEXT) 15.385 + && top.flags.contains(Flag.HAS_TEXT)) { 15.386 + env.messages.error(HTML, tree, "dc.text.not.allowed", treeName); 15.387 + } 15.388 + tagStack.pop(); 15.389 + break; 15.390 + } else if (top.tag == null || top.tag.endKind != HtmlTag.EndKind.REQUIRED) { 15.391 + tagStack.pop(); 15.392 + } else { 15.393 + boolean found = false; 15.394 + for (TagStackItem si: tagStack) { 15.395 + if (si.tag == t) { 15.396 + found = true; 15.397 + break; 15.398 + } 15.399 + } 15.400 + if (found && top.tree.getKind() == DocTree.Kind.START_ELEMENT) { 15.401 + env.messages.error(HTML, top.tree, "dc.tag.start.unmatched", 15.402 + ((StartElementTree) top.tree).getName()); 15.403 + tagStack.pop(); 15.404 + } else { 15.405 + env.messages.error(HTML, tree, "dc.tag.end.unexpected", treeName); 15.406 + break; 15.407 + } 15.408 + } 15.409 + } 15.410 + } 15.411 + 15.412 + return super.visitEndElement(tree, ignore); 15.413 + } 15.414 + // </editor-fold> 15.415 + 15.416 + // <editor-fold defaultstate="collapsed" desc="HTML attributes"> 15.417 + 15.418 + @Override @SuppressWarnings("fallthrough") 15.419 + public Void visitAttribute(AttributeTree tree, Void ignore) { 15.420 + HtmlTag currTag = tagStack.peek().tag; 15.421 + if (currTag != null) { 15.422 + Name name = tree.getName(); 15.423 + HtmlTag.Attr attr = currTag.getAttr(name); 15.424 + if (attr != null) { 15.425 + boolean first = tagStack.peek().attrs.add(attr); 15.426 + if (!first) 15.427 + env.messages.error(HTML, tree, "dc.attr.repeated", name); 15.428 + } 15.429 + AttrKind k = currTag.getAttrKind(name); 15.430 + switch (k) { 15.431 + case OK: 15.432 + break; 15.433 + 15.434 + case INVALID: 15.435 + env.messages.error(HTML, tree, "dc.attr.unknown", name); 15.436 + break; 15.437 + 15.438 + case OBSOLETE: 15.439 + env.messages.warning(ACCESSIBILITY, tree, "dc.attr.obsolete", name); 15.440 + break; 15.441 + 15.442 + case USE_CSS: 15.443 + env.messages.warning(ACCESSIBILITY, tree, "dc.attr.obsolete.use.css", name); 15.444 + break; 15.445 + } 15.446 + 15.447 + if (attr != null) { 15.448 + switch (attr) { 15.449 + case NAME: 15.450 + if (currTag != HtmlTag.A) { 15.451 + break; 15.452 + } 15.453 + // fallthrough 15.454 + case ID: 15.455 + String value = getAttrValue(tree); 15.456 + if (!validName.matcher(value).matches()) { 15.457 + env.messages.error(HTML, tree, "dc.invalid.anchor", value); 15.458 + } 15.459 + if (!foundAnchors.add(value)) { 15.460 + env.messages.error(HTML, tree, "dc.anchor.already.defined", value); 15.461 + } 15.462 + break; 15.463 + 15.464 + case HREF: 15.465 + if (currTag == HtmlTag.A) { 15.466 + String v = getAttrValue(tree); 15.467 + if (v == null || v.isEmpty()) { 15.468 + env.messages.error(HTML, tree, "dc.attr.lacks.value"); 15.469 + } else { 15.470 + Matcher m = docRoot.matcher(v); 15.471 + if (m.matches()) { 15.472 + String rest = m.group(2); 15.473 + if (!rest.isEmpty()) 15.474 + checkURI(tree, rest); 15.475 + } else { 15.476 + checkURI(tree, v); 15.477 + } 15.478 + } 15.479 + } 15.480 + break; 15.481 + } 15.482 + } 15.483 + } 15.484 + 15.485 + // TODO: basic check on value 15.486 + 15.487 + return super.visitAttribute(tree, ignore); 15.488 + } 15.489 + 15.490 + // http://www.w3.org/TR/html401/types.html#type-name 15.491 + private static final Pattern validName = Pattern.compile("[A-Za-z][A-Za-z0-9-_:.]*"); 15.492 + 15.493 + // pattern to remove leading {@docRoot}/? 15.494 + private static final Pattern docRoot = Pattern.compile("(?i)(\\{@docRoot *\\}/?)?(.*)"); 15.495 + 15.496 + private String getAttrValue(AttributeTree tree) { 15.497 + if (tree.getValue() == null) 15.498 + return null; 15.499 + 15.500 + StringWriter sw = new StringWriter(); 15.501 + try { 15.502 + new DocPretty(sw).print(tree.getValue()); 15.503 + } catch (IOException e) { 15.504 + // cannot happen 15.505 + } 15.506 + // ignore potential use of entities for now 15.507 + return sw.toString(); 15.508 + } 15.509 + 15.510 + private void checkURI(AttributeTree tree, String uri) { 15.511 + try { 15.512 + URI u = new URI(uri); 15.513 + } catch (URISyntaxException e) { 15.514 + env.messages.error(HTML, tree, "dc.invalid.uri", uri); 15.515 + } 15.516 + } 15.517 + // </editor-fold> 15.518 + 15.519 + // <editor-fold defaultstate="collapsed" desc="javadoc tags"> 15.520 + 15.521 + @Override 15.522 + public Void visitAuthor(AuthorTree tree, Void ignore) { 15.523 + warnIfEmpty(tree, tree.getName()); 15.524 + return super.visitAuthor(tree, ignore); 15.525 + } 15.526 + 15.527 + @Override 15.528 + public Void visitInheritDoc(InheritDocTree tree, Void ignore) { 15.529 + // TODO: verify on overridden method 15.530 + foundInheritDoc = true; 15.531 + return super.visitInheritDoc(tree, ignore); 15.532 + } 15.533 + 15.534 + @Override 15.535 + public Void visitLink(LinkTree tree, Void ignore) { 15.536 + // simulate inline context on tag stack 15.537 + HtmlTag t = (tree.getKind() == DocTree.Kind.LINK) 15.538 + ? HtmlTag.CODE : HtmlTag.SPAN; 15.539 + tagStack.push(new TagStackItem(tree, t)); 15.540 + try { 15.541 + return super.visitLink(tree, ignore); 15.542 + } finally { 15.543 + tagStack.pop(); 15.544 + } 15.545 + } 15.546 + 15.547 + @Override 15.548 + public Void visitParam(ParamTree tree, Void ignore) { 15.549 + boolean typaram = tree.isTypeParameter(); 15.550 + IdentifierTree nameTree = tree.getName(); 15.551 + Element e = env.currElement; 15.552 + switch (e.getKind()) { 15.553 + case METHOD: case CONSTRUCTOR: { 15.554 + ExecutableElement ee = (ExecutableElement) e; 15.555 + checkParamDeclared(nameTree, typaram ? ee.getTypeParameters() : ee.getParameters()); 15.556 + break; 15.557 + } 15.558 + 15.559 + case CLASS: case INTERFACE: { 15.560 + TypeElement te = (TypeElement) e; 15.561 + if (typaram) { 15.562 + checkParamDeclared(nameTree, te.getTypeParameters()); 15.563 + } else { 15.564 + env.messages.error(REFERENCE, tree, "dc.invalid.param"); 15.565 + } 15.566 + break; 15.567 + } 15.568 + 15.569 + default: 15.570 + env.messages.error(REFERENCE, tree, "dc.invalid.param"); 15.571 + break; 15.572 + } 15.573 + warnIfEmpty(tree, tree.getDescription()); 15.574 + return super.visitParam(tree, ignore); 15.575 + } 15.576 + // where 15.577 + private void checkParamDeclared(IdentifierTree nameTree, List<? extends Element> list) { 15.578 + Name name = nameTree.getName(); 15.579 + boolean found = false; 15.580 + for (Element e: list) { 15.581 + if (name.equals(e.getSimpleName())) { 15.582 + foundParams.add(e); 15.583 + found = true; 15.584 + } 15.585 + } 15.586 + if (!found) 15.587 + env.messages.error(REFERENCE, nameTree, "dc.param.name.not.found"); 15.588 + } 15.589 + 15.590 + private void checkParamsDocumented(List<? extends Element> list) { 15.591 + if (foundInheritDoc) 15.592 + return; 15.593 + 15.594 + for (Element e: list) { 15.595 + if (!foundParams.contains(e)) { 15.596 + CharSequence paramName = (e.getKind() == ElementKind.TYPE_PARAMETER) 15.597 + ? "<" + e.getSimpleName() + ">" 15.598 + : e.getSimpleName(); 15.599 + reportMissing("dc.missing.param", paramName); 15.600 + } 15.601 + } 15.602 + } 15.603 + 15.604 + @Override 15.605 + public Void visitReference(ReferenceTree tree, Void ignore) { 15.606 + Element e = env.trees.getElement(env.currPath, tree); 15.607 + if (e == null) 15.608 + env.messages.error(REFERENCE, tree, "dc.ref.not.found"); 15.609 + return super.visitReference(tree, ignore); 15.610 + } 15.611 + 15.612 + @Override 15.613 + public Void visitReturn(ReturnTree tree, Void ignore) { 15.614 + Element e = env.trees.getElement(env.currPath); 15.615 + if (e.getKind() != ElementKind.METHOD 15.616 + || ((ExecutableElement) e).getReturnType().getKind() == TypeKind.VOID) 15.617 + env.messages.error(REFERENCE, tree, "dc.invalid.return"); 15.618 + foundReturn = true; 15.619 + warnIfEmpty(tree, tree.getDescription()); 15.620 + return super.visitReturn(tree, ignore); 15.621 + } 15.622 + 15.623 + @Override 15.624 + public Void visitSerialData(SerialDataTree tree, Void ignore) { 15.625 + warnIfEmpty(tree, tree.getDescription()); 15.626 + return super.visitSerialData(tree, ignore); 15.627 + } 15.628 + 15.629 + @Override 15.630 + public Void visitSerialField(SerialFieldTree tree, Void ignore) { 15.631 + warnIfEmpty(tree, tree.getDescription()); 15.632 + return super.visitSerialField(tree, ignore); 15.633 + } 15.634 + 15.635 + @Override 15.636 + public Void visitSince(SinceTree tree, Void ignore) { 15.637 + warnIfEmpty(tree, tree.getBody()); 15.638 + return super.visitSince(tree, ignore); 15.639 + } 15.640 + 15.641 + @Override 15.642 + public Void visitThrows(ThrowsTree tree, Void ignore) { 15.643 + ReferenceTree exName = tree.getExceptionName(); 15.644 + Element ex = env.trees.getElement(env.currPath, exName); 15.645 + if (ex == null) { 15.646 + env.messages.error(REFERENCE, tree, "dc.ref.not.found"); 15.647 + } else if (ex.asType().getKind() == TypeKind.DECLARED 15.648 + && env.types.isAssignable(ex.asType(), env.java_lang_Throwable)) { 15.649 + switch (env.currElement.getKind()) { 15.650 + case CONSTRUCTOR: 15.651 + case METHOD: 15.652 + if (isCheckedException(ex.asType())) { 15.653 + ExecutableElement ee = (ExecutableElement) env.currElement; 15.654 + checkThrowsDeclared(exName, ex.asType(), ee.getThrownTypes()); 15.655 + } 15.656 + break; 15.657 + default: 15.658 + env.messages.error(REFERENCE, tree, "dc.invalid.throws"); 15.659 + } 15.660 + } else { 15.661 + env.messages.error(REFERENCE, tree, "dc.invalid.throws"); 15.662 + } 15.663 + warnIfEmpty(tree, tree.getDescription()); 15.664 + return scan(tree.getDescription(), ignore); 15.665 + } 15.666 + 15.667 + private void checkThrowsDeclared(ReferenceTree tree, TypeMirror t, List<? extends TypeMirror> list) { 15.668 + boolean found = false; 15.669 + for (TypeMirror tl : list) { 15.670 + if (env.types.isAssignable(t, tl)) { 15.671 + foundThrows.add(tl); 15.672 + found = true; 15.673 + } 15.674 + } 15.675 + if (!found) 15.676 + env.messages.error(REFERENCE, tree, "dc.exception.not.thrown", t); 15.677 + } 15.678 + 15.679 + private void checkThrowsDocumented(List<? extends TypeMirror> list) { 15.680 + if (foundInheritDoc) 15.681 + return; 15.682 + 15.683 + for (TypeMirror tl: list) { 15.684 + if (isCheckedException(tl) && !foundThrows.contains(tl)) 15.685 + reportMissing("dc.missing.throws", tl); 15.686 + } 15.687 + } 15.688 + 15.689 + @Override 15.690 + public Void visitVersion(VersionTree tree, Void ignore) { 15.691 + warnIfEmpty(tree, tree.getBody()); 15.692 + return super.visitVersion(tree, ignore); 15.693 + } 15.694 + 15.695 + @Override 15.696 + public Void visitErroneous(ErroneousTree tree, Void ignore) { 15.697 + env.messages.error(SYNTAX, tree, null, tree.getDiagnostic().getMessage(null)); 15.698 + return null; 15.699 + } 15.700 + // </editor-fold> 15.701 + 15.702 + // <editor-fold defaultstate="collapsed" desc="Utility methods"> 15.703 + 15.704 + private boolean isCheckedException(TypeMirror t) { 15.705 + return !(env.types.isAssignable(t, env.java_lang_Error) 15.706 + || env.types.isAssignable(t, env.java_lang_RuntimeException)); 15.707 + } 15.708 + 15.709 + private boolean isSynthetic() { 15.710 + switch (env.currElement.getKind()) { 15.711 + case CONSTRUCTOR: 15.712 + // A synthetic default constructor has the same pos as the 15.713 + // enclosing class 15.714 + TreePath p = env.currPath; 15.715 + return env.getPos(p) == env.getPos(p.getParentPath()); 15.716 + } 15.717 + return false; 15.718 + } 15.719 + 15.720 + void markEnclosingTag(Flag flag) { 15.721 + TagStackItem top = tagStack.peek(); 15.722 + if (top != null) 15.723 + top.flags.add(flag); 15.724 + } 15.725 + 15.726 + String toString(TreePath p) { 15.727 + StringBuilder sb = new StringBuilder("TreePath["); 15.728 + toString(p, sb); 15.729 + sb.append("]"); 15.730 + return sb.toString(); 15.731 + } 15.732 + 15.733 + void toString(TreePath p, StringBuilder sb) { 15.734 + TreePath parent = p.getParentPath(); 15.735 + if (parent != null) { 15.736 + toString(parent, sb); 15.737 + sb.append(","); 15.738 + } 15.739 + sb.append(p.getLeaf().getKind()).append(":").append(env.getPos(p)).append(":S").append(env.getStartPos(p)); 15.740 + } 15.741 + 15.742 + void warnIfEmpty(DocTree tree, List<? extends DocTree> list) { 15.743 + for (DocTree d: list) { 15.744 + switch (d.getKind()) { 15.745 + case TEXT: 15.746 + if (!((TextTree) d).getBody().trim().isEmpty()) 15.747 + return; 15.748 + break; 15.749 + default: 15.750 + return; 15.751 + } 15.752 + } 15.753 + env.messages.warning(SYNTAX, tree, "dc.empty", tree.getKind().tagName); 15.754 + } 15.755 + // </editor-fold> 15.756 + 15.757 +}
16.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 16.2 +++ b/src/share/classes/com/sun/tools/doclint/DocLint.java Fri Dec 28 18:39:09 2012 -0800 16.3 @@ -0,0 +1,376 @@ 16.4 +/* 16.5 + * Copyright (c) 2012, 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. Oracle designates this 16.11 + * particular file as subject to the "Classpath" exception as provided 16.12 + * by Oracle in the LICENSE file that accompanied this code. 16.13 + * 16.14 + * This code is distributed in the hope that it will be useful, but WITHOUT 16.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 16.16 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 16.17 + * version 2 for more details (a copy is included in the LICENSE file that 16.18 + * accompanied this code). 16.19 + * 16.20 + * You should have received a copy of the GNU General Public License version 16.21 + * 2 along with this work; if not, write to the Free Software Foundation, 16.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 16.23 + * 16.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 16.25 + * or visit www.oracle.com if you need additional information or have any 16.26 + * questions. 16.27 + */ 16.28 + 16.29 +package com.sun.tools.doclint; 16.30 + 16.31 +import java.io.File; 16.32 +import java.io.IOException; 16.33 +import java.io.PrintWriter; 16.34 +import java.util.ArrayList; 16.35 +import java.util.List; 16.36 + 16.37 +import javax.lang.model.element.Name; 16.38 +import javax.tools.StandardLocation; 16.39 + 16.40 +import com.sun.source.doctree.DocCommentTree; 16.41 +import com.sun.source.tree.ClassTree; 16.42 +import com.sun.source.tree.CompilationUnitTree; 16.43 +import com.sun.source.tree.MethodTree; 16.44 +import com.sun.source.tree.Tree; 16.45 +import com.sun.source.tree.VariableTree; 16.46 +import com.sun.source.util.JavacTask; 16.47 +import com.sun.source.util.Plugin; 16.48 +import com.sun.source.util.TaskEvent; 16.49 +import com.sun.source.util.TaskListener; 16.50 +import com.sun.source.util.TreePath; 16.51 +import com.sun.source.util.TreePathScanner; 16.52 +import com.sun.tools.javac.api.JavacTaskImpl; 16.53 +import com.sun.tools.javac.api.JavacTool; 16.54 +import com.sun.tools.javac.file.JavacFileManager; 16.55 +import com.sun.tools.javac.main.JavaCompiler; 16.56 +import com.sun.tools.javac.util.Context; 16.57 + 16.58 +/** 16.59 + * Multi-function entry point for the doc check utility. 16.60 + * 16.61 + * This class can be invoked in the following ways: 16.62 + * <ul> 16.63 + * <li>From the command line 16.64 + * <li>From javac, as a plugin 16.65 + * <li>Directly, via a simple API 16.66 + * </ul> 16.67 + * 16.68 + * <p><b>This is NOT part of any supported API. 16.69 + * If you write code that depends on this, you do so at your own 16.70 + * risk. This code and its internal interfaces are subject to change 16.71 + * or deletion without notice.</b></p> 16.72 + */ 16.73 +public class DocLint implements Plugin { 16.74 + 16.75 + public static final String XMSGS_OPTION = "-Xmsgs"; 16.76 + public static final String XMSGS_CUSTOM_PREFIX = "-Xmsgs:"; 16.77 + private static final String STATS = "-stats"; 16.78 + 16.79 + // <editor-fold defaultstate="collapsed" desc="Command-line entry point"> 16.80 + public static void main(String... args) { 16.81 + try { 16.82 + new DocLint().run(args); 16.83 + } catch (BadArgs e) { 16.84 + System.err.println(e.getMessage()); 16.85 + System.exit(1); 16.86 + } catch (IOException e) { 16.87 + System.err.println(e); 16.88 + System.exit(2); 16.89 + } 16.90 + } 16.91 + 16.92 + // </editor-fold> 16.93 + 16.94 + // <editor-fold defaultstate="collapsed" desc="Simple API"> 16.95 + 16.96 + public static class BadArgs extends Exception { 16.97 + private static final long serialVersionUID = 0; 16.98 + BadArgs(String code, Object... args) { 16.99 + this.code = code; 16.100 + this.args = args; 16.101 + } 16.102 + 16.103 + final String code; 16.104 + final Object[] args; 16.105 + } 16.106 + 16.107 + /** 16.108 + * Simple API entry point. 16.109 + */ 16.110 + public void run(String... args) throws BadArgs, IOException { 16.111 + PrintWriter out = new PrintWriter(System.out); 16.112 + try { 16.113 + run(out, args); 16.114 + } finally { 16.115 + out.flush(); 16.116 + } 16.117 + } 16.118 + 16.119 + public void run(PrintWriter out, String... args) throws BadArgs, IOException { 16.120 + env = new Env(); 16.121 + processArgs(args); 16.122 + 16.123 + if (needHelp) 16.124 + showHelp(out); 16.125 + 16.126 + if (javacFiles.isEmpty()) { 16.127 + if (!needHelp) 16.128 + System.out.println("no files given"); 16.129 + } 16.130 + 16.131 + JavacTool tool = JavacTool.create(); 16.132 + 16.133 + JavacFileManager fm = new JavacFileManager(new Context(), false, null); 16.134 + fm.setSymbolFileEnabled(false); 16.135 + fm.setLocation(StandardLocation.PLATFORM_CLASS_PATH, javacBootClassPath); 16.136 + fm.setLocation(StandardLocation.CLASS_PATH, javacClassPath); 16.137 + fm.setLocation(StandardLocation.SOURCE_PATH, javacSourcePath); 16.138 + 16.139 + JavacTask task = tool.getTask(out, fm, null, javacOpts, null, 16.140 + fm.getJavaFileObjectsFromFiles(javacFiles)); 16.141 + Iterable<? extends CompilationUnitTree> units = task.parse(); 16.142 + ((JavacTaskImpl) task).enter(); 16.143 + 16.144 + env.init(task); 16.145 + checker = new Checker(env); 16.146 + 16.147 + DeclScanner ds = new DeclScanner() { 16.148 + @Override 16.149 + void visitDecl(Tree tree, Name name) { 16.150 + TreePath p = getCurrentPath(); 16.151 + DocCommentTree dc = env.trees.getDocCommentTree(p); 16.152 + 16.153 + checker.scan(dc, p); 16.154 + } 16.155 + }; 16.156 + 16.157 + ds.scan(units, null); 16.158 + 16.159 + reportStats(out); 16.160 + 16.161 + Context ctx = ((JavacTaskImpl) task).getContext(); 16.162 + JavaCompiler c = JavaCompiler.instance(ctx); 16.163 + c.printCount("error", c.errorCount()); 16.164 + c.printCount("warn", c.warningCount()); 16.165 + } 16.166 + 16.167 + void processArgs(String... args) throws BadArgs { 16.168 + javacOpts = new ArrayList<String>(); 16.169 + javacFiles = new ArrayList<File>(); 16.170 + 16.171 + if (args.length == 0) 16.172 + needHelp = true; 16.173 + 16.174 + for (int i = 0; i < args.length; i++) { 16.175 + String arg = args[i]; 16.176 + if (arg.matches("-Xmax(errs|warns)") && i + 1 < args.length) { 16.177 + if (args[++i].matches("[0-9]+")) { 16.178 + javacOpts.add(arg); 16.179 + javacOpts.add(args[i]); 16.180 + } else { 16.181 + throw new BadArgs("dc.bad.value.for.option", arg, args[i]); 16.182 + } 16.183 + } else if (arg.equals(STATS)) { 16.184 + env.messages.setStatsEnabled(true); 16.185 + } else if (arg.matches("-bootclasspath") && i + 1 < args.length) { 16.186 + javacBootClassPath = splitPath(args[++i]); 16.187 + } else if (arg.matches("-classpath") && i + 1 < args.length) { 16.188 + javacClassPath = splitPath(args[++i]); 16.189 + } else if (arg.matches("-sourcepath") && i + 1 < args.length) { 16.190 + javacSourcePath = splitPath(args[++i]); 16.191 + } else if (arg.equals(XMSGS_OPTION)) { 16.192 + env.messages.setOptions(null); 16.193 + } else if (arg.startsWith(XMSGS_CUSTOM_PREFIX)) { 16.194 + env.messages.setOptions(arg.substring(arg.indexOf(":") + 1)); 16.195 + } else if (arg.equals("-h") || arg.equals("-help") || arg.equals("--help") 16.196 + || arg.equals("-?") || arg.equals("-usage")) { 16.197 + needHelp = true; 16.198 + } else if (arg.startsWith("-")) { 16.199 + throw new BadArgs("dc.bad.option", arg); 16.200 + } else { 16.201 + while (i < args.length) 16.202 + javacFiles.add(new File(args[i++])); 16.203 + } 16.204 + } 16.205 + } 16.206 + 16.207 + void showHelp(PrintWriter out) { 16.208 + out.println("Usage:"); 16.209 + out.println(" doclint [options] source-files..."); 16.210 + out.println(""); 16.211 + out.println("Options:"); 16.212 + out.println(" -Xmsgs "); 16.213 + out.println(" Same as -Xmsgs:all"); 16.214 + out.println(" -Xmsgs:values"); 16.215 + out.println(" Specify categories of issues to be checked, where 'values'"); 16.216 + out.println(" is a comma-separated list of any of the following:"); 16.217 + out.println(" reference show places where comments contain incorrect"); 16.218 + out.println(" references to Java source code elements"); 16.219 + out.println(" syntax show basic syntax errors within comments"); 16.220 + out.println(" html show issues with HTML tags and attributes"); 16.221 + out.println(" accessibility show issues for accessibility"); 16.222 + out.println(" missing show issues with missing documentation"); 16.223 + out.println(" all all of the above"); 16.224 + out.println(" Precede a value with '-' to negate it"); 16.225 + out.println(" Categories may be qualified by one of:"); 16.226 + out.println(" /public /protected /package /private"); 16.227 + out.println(" For positive categories (not beginning with '-')"); 16.228 + out.println(" the qualifier applies to that access level and above."); 16.229 + out.println(" For negative categories (beginning with '-')"); 16.230 + out.println(" the qualifier applies to that access level and below."); 16.231 + out.println(" If a qualifier is missing, the category applies to"); 16.232 + out.println(" all access levels."); 16.233 + out.println(" For example, -Xmsgs:all,-syntax/private"); 16.234 + out.println(" This will enable all messages, except syntax errors"); 16.235 + out.println(" in the doc comments of private methods."); 16.236 + out.println(" If no -Xmsgs options are provided, the default is"); 16.237 + out.println(" equivalent to -Xmsgs:all/protected, meaning that"); 16.238 + out.println(" all messages are reported for protected and public"); 16.239 + out.println(" declarations only. "); 16.240 + out.println(" -h -help --help -usage -?"); 16.241 + out.println(" Show this message."); 16.242 + out.println(""); 16.243 + out.println("The following javac options are also supported"); 16.244 + out.println(" -bootclasspath, -classpath, -sourcepath, -Xmaxerrs, -Xmaxwarns"); 16.245 + out.println(""); 16.246 + out.println("To run doclint on part of a project, put the compiled classes for your"); 16.247 + out.println("project on the classpath (or bootclasspath), then specify the source files"); 16.248 + out.println("to be checked on the command line."); 16.249 + } 16.250 + 16.251 + List<File> splitPath(String path) { 16.252 + List<File> files = new ArrayList<File>(); 16.253 + for (String f: path.split(File.separator)) { 16.254 + if (f.length() > 0) 16.255 + files.add(new File(f)); 16.256 + } 16.257 + return files; 16.258 + } 16.259 + 16.260 + List<File> javacBootClassPath; 16.261 + List<File> javacClassPath; 16.262 + List<File> javacSourcePath; 16.263 + List<String> javacOpts; 16.264 + List<File> javacFiles; 16.265 + boolean needHelp = false; 16.266 + 16.267 + // </editor-fold> 16.268 + 16.269 + // <editor-fold defaultstate="collapsed" desc="javac Plugin"> 16.270 + 16.271 + @Override 16.272 + public String getName() { 16.273 + return "doclint"; 16.274 + } 16.275 + 16.276 + @Override 16.277 + public void init(JavacTask task, String... args) { 16.278 + init(task, args, true); 16.279 + } 16.280 + 16.281 + // </editor-fold> 16.282 + 16.283 + // <editor-fold defaultstate="collapsed" desc="Embedding API"> 16.284 + 16.285 + public void init(JavacTask task, String[] args, boolean addTaskListener) { 16.286 + env = new Env(); 16.287 + for (int i = 0; i < args.length; i++) { 16.288 + String arg = args[i]; 16.289 + if (arg.equals(XMSGS_OPTION)) { 16.290 + env.messages.setOptions(null); 16.291 + } else if (arg.startsWith(XMSGS_CUSTOM_PREFIX)) { 16.292 + env.messages.setOptions(arg.substring(arg.indexOf(":") + 1)); 16.293 + } else 16.294 + throw new IllegalArgumentException(arg); 16.295 + } 16.296 + env.init(task); 16.297 + 16.298 + checker = new Checker(env); 16.299 + 16.300 + if (addTaskListener) { 16.301 + final DeclScanner ds = new DeclScanner() { 16.302 + @Override 16.303 + void visitDecl(Tree tree, Name name) { 16.304 + TreePath p = getCurrentPath(); 16.305 + DocCommentTree dc = env.trees.getDocCommentTree(p); 16.306 + 16.307 + checker.scan(dc, p); 16.308 + } 16.309 + }; 16.310 + 16.311 + TaskListener tl = new TaskListener() { 16.312 + @Override 16.313 + public void started(TaskEvent e) { 16.314 + return; 16.315 + } 16.316 + 16.317 + @Override 16.318 + public void finished(TaskEvent e) { 16.319 + switch (e.getKind()) { 16.320 + case ENTER: 16.321 + ds.scan(e.getCompilationUnit(), null); 16.322 + } 16.323 + } 16.324 + }; 16.325 + 16.326 + task.addTaskListener(tl); 16.327 + } 16.328 + } 16.329 + 16.330 + public void scan(TreePath p) { 16.331 + DocCommentTree dc = env.trees.getDocCommentTree(p); 16.332 + checker.scan(dc, p); 16.333 + } 16.334 + 16.335 + public void reportStats(PrintWriter out) { 16.336 + env.messages.reportStats(out); 16.337 + } 16.338 + 16.339 + // </editor-fold> 16.340 + 16.341 + Env env; 16.342 + Checker checker; 16.343 + 16.344 + public static boolean isValidOption(String opt) { 16.345 + if (opt.equals(XMSGS_OPTION)) 16.346 + return true; 16.347 + if (opt.startsWith(XMSGS_CUSTOM_PREFIX)) 16.348 + return Messages.Options.isValidOptions(opt.substring(XMSGS_CUSTOM_PREFIX.length())); 16.349 + return false; 16.350 + } 16.351 + 16.352 + // <editor-fold defaultstate="collapsed" desc="DeclScanner"> 16.353 + 16.354 + static abstract class DeclScanner extends TreePathScanner<Void, Void> { 16.355 + abstract void visitDecl(Tree tree, Name name); 16.356 + 16.357 + @Override 16.358 + public Void visitClass(ClassTree tree, Void ignore) { 16.359 + visitDecl(tree, tree.getSimpleName()); 16.360 + return super.visitClass(tree, ignore); 16.361 + } 16.362 + 16.363 + @Override 16.364 + public Void visitMethod(MethodTree tree, Void ignore) { 16.365 + visitDecl(tree, tree.getName()); 16.366 + //return super.visitMethod(tree, ignore); 16.367 + return null; 16.368 + } 16.369 + 16.370 + @Override 16.371 + public Void visitVariable(VariableTree tree, Void ignore) { 16.372 + visitDecl(tree, tree.getName()); 16.373 + return super.visitVariable(tree, ignore); 16.374 + } 16.375 + } 16.376 + 16.377 + // </editor-fold> 16.378 + 16.379 +}
17.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 17.2 +++ b/src/share/classes/com/sun/tools/doclint/Entity.java Fri Dec 28 18:39:09 2012 -0800 17.3 @@ -0,0 +1,326 @@ 17.4 +/* 17.5 + * Copyright (c) 2012, 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. Oracle designates this 17.11 + * particular file as subject to the "Classpath" exception as provided 17.12 + * by Oracle in the LICENSE file that accompanied this code. 17.13 + * 17.14 + * This code is distributed in the hope that it will be useful, but WITHOUT 17.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 17.16 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 17.17 + * version 2 for more details (a copy is included in the LICENSE file that 17.18 + * accompanied this code). 17.19 + * 17.20 + * You should have received a copy of the GNU General Public License version 17.21 + * 2 along with this work; if not, write to the Free Software Foundation, 17.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 17.23 + * 17.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 17.25 + * or visit www.oracle.com if you need additional information or have any 17.26 + * questions. 17.27 + */ 17.28 + 17.29 +package com.sun.tools.doclint; 17.30 + 17.31 +import java.util.HashMap; 17.32 +import java.util.Map; 17.33 + 17.34 +/** 17.35 + * Table of entities defined in HTML 4.01. 17.36 + * 17.37 + * <p> Derived from 17.38 + * <a href="http://www.w3.org/TR/html4/sgml/entities.html">Character entity references in HTML 4</a>. 17.39 + * 17.40 + * The name of the member follows the name of the entity, 17.41 + * except when it clashes with a keyword, in which case 17.42 + * it is prefixed by '_'. 17.43 + * 17.44 + * <p><b>This is NOT part of any supported API. 17.45 + * If you write code that depends on this, you do so at your own 17.46 + * risk. This code and its internal interfaces are subject to change 17.47 + * or deletion without notice.</b></p> 17.48 + */ 17.49 +enum Entity { 17.50 + nbsp(160), 17.51 + iexcl(161), 17.52 + cent(162), 17.53 + pound(163), 17.54 + curren(164), 17.55 + yen(165), 17.56 + brvbar(166), 17.57 + sect(167), 17.58 + uml(168), 17.59 + copy(169), 17.60 + ordf(170), 17.61 + laquo(171), 17.62 + not(172), 17.63 + shy(173), 17.64 + reg(174), 17.65 + macr(175), 17.66 + deg(176), 17.67 + plusmn(177), 17.68 + sup2(178), 17.69 + sup3(179), 17.70 + acute(180), 17.71 + micro(181), 17.72 + para(182), 17.73 + middot(183), 17.74 + cedil(184), 17.75 + sup1(185), 17.76 + ordm(186), 17.77 + raquo(187), 17.78 + frac14(188), 17.79 + frac12(189), 17.80 + frac34(190), 17.81 + iquest(191), 17.82 + Agrave(192), 17.83 + Aacute(193), 17.84 + Acirc(194), 17.85 + Atilde(195), 17.86 + Auml(196), 17.87 + Aring(197), 17.88 + AElig(198), 17.89 + Ccedil(199), 17.90 + Egrave(200), 17.91 + Eacute(201), 17.92 + Ecirc(202), 17.93 + Euml(203), 17.94 + Igrave(204), 17.95 + Iacute(205), 17.96 + Icirc(206), 17.97 + Iuml(207), 17.98 + ETH(208), 17.99 + Ntilde(209), 17.100 + Ograve(210), 17.101 + Oacute(211), 17.102 + Ocirc(212), 17.103 + Otilde(213), 17.104 + Ouml(214), 17.105 + times(215), 17.106 + Oslash(216), 17.107 + Ugrave(217), 17.108 + Uacute(218), 17.109 + Ucirc(219), 17.110 + Uuml(220), 17.111 + Yacute(221), 17.112 + THORN(222), 17.113 + szlig(223), 17.114 + agrave(224), 17.115 + aacute(225), 17.116 + acirc(226), 17.117 + atilde(227), 17.118 + auml(228), 17.119 + aring(229), 17.120 + aelig(230), 17.121 + ccedil(231), 17.122 + egrave(232), 17.123 + eacute(233), 17.124 + ecirc(234), 17.125 + euml(235), 17.126 + igrave(236), 17.127 + iacute(237), 17.128 + icirc(238), 17.129 + iuml(239), 17.130 + eth(240), 17.131 + ntilde(241), 17.132 + ograve(242), 17.133 + oacute(243), 17.134 + ocirc(244), 17.135 + otilde(245), 17.136 + ouml(246), 17.137 + divide(247), 17.138 + oslash(248), 17.139 + ugrave(249), 17.140 + uacute(250), 17.141 + ucirc(251), 17.142 + uuml(252), 17.143 + yacute(253), 17.144 + thorn(254), 17.145 + yuml(255), 17.146 + fnof(402), 17.147 + Alpha(913), 17.148 + Beta(914), 17.149 + Gamma(915), 17.150 + Delta(916), 17.151 + Epsilon(917), 17.152 + Zeta(918), 17.153 + Eta(919), 17.154 + Theta(920), 17.155 + Iota(921), 17.156 + Kappa(922), 17.157 + Lambda(923), 17.158 + Mu(924), 17.159 + Nu(925), 17.160 + Xi(926), 17.161 + Omicron(927), 17.162 + Pi(928), 17.163 + Rho(929), 17.164 + Sigma(931), 17.165 + Tau(932), 17.166 + Upsilon(933), 17.167 + Phi(934), 17.168 + Chi(935), 17.169 + Psi(936), 17.170 + Omega(937), 17.171 + alpha(945), 17.172 + beta(946), 17.173 + gamma(947), 17.174 + delta(948), 17.175 + epsilon(949), 17.176 + zeta(950), 17.177 + eta(951), 17.178 + theta(952), 17.179 + iota(953), 17.180 + kappa(954), 17.181 + lambda(955), 17.182 + mu(956), 17.183 + nu(957), 17.184 + xi(958), 17.185 + omicron(959), 17.186 + pi(960), 17.187 + rho(961), 17.188 + sigmaf(962), 17.189 + sigma(963), 17.190 + tau(964), 17.191 + upsilon(965), 17.192 + phi(966), 17.193 + chi(967), 17.194 + psi(968), 17.195 + omega(969), 17.196 + thetasym(977), 17.197 + upsih(978), 17.198 + piv(982), 17.199 + bull(8226), 17.200 + hellip(8230), 17.201 + prime(8242), 17.202 + Prime(8243), 17.203 + oline(8254), 17.204 + frasl(8260), 17.205 + weierp(8472), 17.206 + image(8465), 17.207 + real(8476), 17.208 + trade(8482), 17.209 + alefsym(8501), 17.210 + larr(8592), 17.211 + uarr(8593), 17.212 + rarr(8594), 17.213 + darr(8595), 17.214 + harr(8596), 17.215 + crarr(8629), 17.216 + lArr(8656), 17.217 + uArr(8657), 17.218 + rArr(8658), 17.219 + dArr(8659), 17.220 + hArr(8660), 17.221 + forall(8704), 17.222 + part(8706), 17.223 + exist(8707), 17.224 + empty(8709), 17.225 + nabla(8711), 17.226 + isin(8712), 17.227 + notin(8713), 17.228 + ni(8715), 17.229 + prod(8719), 17.230 + sum(8721), 17.231 + minus(8722), 17.232 + lowast(8727), 17.233 + radic(8730), 17.234 + prop(8733), 17.235 + infin(8734), 17.236 + ang(8736), 17.237 + and(8743), 17.238 + or(8744), 17.239 + cap(8745), 17.240 + cup(8746), 17.241 + _int(8747), 17.242 + there4(8756), 17.243 + sim(8764), 17.244 + cong(8773), 17.245 + asymp(8776), 17.246 + ne(8800), 17.247 + equiv(8801), 17.248 + le(8804), 17.249 + ge(8805), 17.250 + sub(8834), 17.251 + sup(8835), 17.252 + nsub(8836), 17.253 + sube(8838), 17.254 + supe(8839), 17.255 + oplus(8853), 17.256 + otimes(8855), 17.257 + perp(8869), 17.258 + sdot(8901), 17.259 + lceil(8968), 17.260 + rceil(8969), 17.261 + lfloor(8970), 17.262 + rfloor(8971), 17.263 + lang(9001), 17.264 + rang(9002), 17.265 + loz(9674), 17.266 + spades(9824), 17.267 + clubs(9827), 17.268 + hearts(9829), 17.269 + diams(9830), 17.270 + quot(34), 17.271 + amp(38), 17.272 + lt(60), 17.273 + gt(62), 17.274 + OElig(338), 17.275 + oelig(339), 17.276 + Scaron(352), 17.277 + scaron(353), 17.278 + Yuml(376), 17.279 + circ(710), 17.280 + tilde(732), 17.281 + ensp(8194), 17.282 + emsp(8195), 17.283 + thinsp(8201), 17.284 + zwnj(8204), 17.285 + zwj(8205), 17.286 + lrm(8206), 17.287 + rlm(8207), 17.288 + ndash(8211), 17.289 + mdash(8212), 17.290 + lsquo(8216), 17.291 + rsquo(8217), 17.292 + sbquo(8218), 17.293 + ldquo(8220), 17.294 + rdquo(8221), 17.295 + bdquo(8222), 17.296 + dagger(8224), 17.297 + Dagger(8225), 17.298 + permil(8240), 17.299 + lsaquo(8249), 17.300 + rsaquo(8250), 17.301 + euro(8364); 17.302 + 17.303 + int code; 17.304 + 17.305 + private Entity(int code) { 17.306 + this.code = code; 17.307 + } 17.308 + 17.309 + static boolean isValid(String name) { 17.310 + return names.containsKey(name); 17.311 + } 17.312 + 17.313 + static boolean isValid(int code) { 17.314 + // allow numeric codes for standard ANSI characters 17.315 + return codes.containsKey(code) || ( 32 <= code && code < 2127); 17.316 + } 17.317 + 17.318 + private static final Map<String,Entity> names = new HashMap<String,Entity>(); 17.319 + private static final Map<Integer,Entity> codes = new HashMap<Integer,Entity>(); 17.320 + static { 17.321 + for (Entity e: values()) { 17.322 + String name = e.name(); 17.323 + int code = e.code; 17.324 + if (name.startsWith("_")) name = name.substring(1); 17.325 + names.put(name, e); 17.326 + codes.put(code, e); 17.327 + } 17.328 + } 17.329 +}
18.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 18.2 +++ b/src/share/classes/com/sun/tools/doclint/Env.java Fri Dec 28 18:39:09 2012 -0800 18.3 @@ -0,0 +1,166 @@ 18.4 +/* 18.5 + * Copyright (c) 2012, 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. Oracle designates this 18.11 + * particular file as subject to the "Classpath" exception as provided 18.12 + * by Oracle in the LICENSE file that accompanied this code. 18.13 + * 18.14 + * This code is distributed in the hope that it will be useful, but WITHOUT 18.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 18.16 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 18.17 + * version 2 for more details (a copy is included in the LICENSE file that 18.18 + * accompanied this code). 18.19 + * 18.20 + * You should have received a copy of the GNU General Public License version 18.21 + * 2 along with this work; if not, write to the Free Software Foundation, 18.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18.23 + * 18.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 18.25 + * or visit www.oracle.com if you need additional information or have any 18.26 + * questions. 18.27 + */ 18.28 + 18.29 +package com.sun.tools.doclint; 18.30 + 18.31 + 18.32 +import java.util.Set; 18.33 + 18.34 +import javax.lang.model.element.Element; 18.35 +import javax.lang.model.element.ExecutableElement; 18.36 +import javax.lang.model.element.Modifier; 18.37 +import javax.lang.model.type.TypeMirror; 18.38 +import javax.lang.model.util.Elements; 18.39 +import javax.lang.model.util.Types; 18.40 + 18.41 +import com.sun.source.doctree.DocCommentTree; 18.42 +import com.sun.source.util.DocTrees; 18.43 +import com.sun.source.util.JavacTask; 18.44 +import com.sun.source.util.SourcePositions; 18.45 +import com.sun.source.util.TreePath; 18.46 +import com.sun.tools.javac.model.JavacTypes; 18.47 +import com.sun.tools.javac.tree.JCTree; 18.48 + 18.49 +/** 18.50 + * Utility container for current execution environment, 18.51 + * providing the current declaration and its doc comment. 18.52 + * 18.53 + * <p><b>This is NOT part of any supported API. 18.54 + * If you write code that depends on this, you do so at your own 18.55 + * risk. This code and its internal interfaces are subject to change 18.56 + * or deletion without notice.</b></p> 18.57 + */ 18.58 +public class Env { 18.59 + /** 18.60 + * Access kinds for declarations. 18.61 + */ 18.62 + public enum AccessKind { 18.63 + PRIVATE, 18.64 + PACKAGE, 18.65 + PROTECTED, 18.66 + PUBLIC; 18.67 + 18.68 + static boolean accepts(String opt) { 18.69 + for (AccessKind g: values()) 18.70 + if (opt.equals(g.name().toLowerCase())) return true; 18.71 + return false; 18.72 + } 18.73 + 18.74 + static AccessKind of(Set<Modifier> mods) { 18.75 + if (mods.contains(Modifier.PUBLIC)) 18.76 + return AccessKind.PUBLIC; 18.77 + else if (mods.contains(Modifier.PROTECTED)) 18.78 + return AccessKind.PROTECTED; 18.79 + else if (mods.contains(Modifier.PRIVATE)) 18.80 + return AccessKind.PRIVATE; 18.81 + else 18.82 + return AccessKind.PACKAGE; 18.83 + } 18.84 + }; 18.85 + 18.86 + /** Message handler. */ 18.87 + final Messages messages; 18.88 + 18.89 + // Utility classes 18.90 + DocTrees trees; 18.91 + Elements elements; 18.92 + Types types; 18.93 + 18.94 + // Types used when analysing doc comments. 18.95 + TypeMirror java_lang_Error; 18.96 + TypeMirror java_lang_RuntimeException; 18.97 + TypeMirror java_lang_Throwable; 18.98 + TypeMirror java_lang_Void; 18.99 + 18.100 + /** The path for the declaration containing the comment currently being analyzed. */ 18.101 + TreePath currPath; 18.102 + /** The element for the declaration containing the comment currently being analyzed. */ 18.103 + Element currElement; 18.104 + /** The comment current being analyzed. */ 18.105 + DocCommentTree currDocComment; 18.106 + /** 18.107 + * The access kind of the declaration containing the comment currently being analyzed. 18.108 + * This is the minimum (most restrictive) access kind of the declaration iteself 18.109 + * and that of its containers. For example, a public method in a private class is 18.110 + * noted as private. 18.111 + */ 18.112 + AccessKind currAccess; 18.113 + /** The set of methods, if any, that the current declaration overrides. */ 18.114 + Set<? extends ExecutableElement> currOverriddenMethods; 18.115 + 18.116 + Env() { 18.117 + messages = new Messages(this); 18.118 + } 18.119 + 18.120 + void init(JavacTask task) { 18.121 + init(DocTrees.instance(task), task.getElements(), task.getTypes()); 18.122 + } 18.123 + 18.124 + void init(DocTrees trees, Elements elements, Types types) { 18.125 + this.trees = trees; 18.126 + this.elements = elements; 18.127 + this.types = types; 18.128 + java_lang_Error = elements.getTypeElement("java.lang.Error").asType(); 18.129 + java_lang_RuntimeException = elements.getTypeElement("java.lang.RuntimeException").asType(); 18.130 + java_lang_Throwable = elements.getTypeElement("java.lang.Throwable").asType(); 18.131 + java_lang_Void = elements.getTypeElement("java.lang.Void").asType(); 18.132 + } 18.133 + 18.134 + /** Set the current declaration and its doc comment. */ 18.135 + void setCurrent(TreePath path, DocCommentTree comment) { 18.136 + currPath = path; 18.137 + currDocComment = comment; 18.138 + currElement = trees.getElement(currPath); 18.139 + currOverriddenMethods = ((JavacTypes) types).getOverriddenMethods(currElement); 18.140 + 18.141 + AccessKind ak = null; 18.142 + for (TreePath p = path; p != null; p = p.getParentPath()) { 18.143 + Element e = trees.getElement(p); 18.144 + if (e != null) { 18.145 + ak = min(ak, AccessKind.of(e.getModifiers())); 18.146 + } 18.147 + } 18.148 + currAccess = ak; 18.149 + } 18.150 + 18.151 + AccessKind getAccessKind() { 18.152 + return currAccess; 18.153 + } 18.154 + 18.155 + long getPos(TreePath p) { 18.156 + return ((JCTree) p.getLeaf()).pos; 18.157 + } 18.158 + 18.159 + long getStartPos(TreePath p) { 18.160 + SourcePositions sp = trees.getSourcePositions(); 18.161 + return sp.getStartPosition(p.getCompilationUnit(), p.getLeaf()); 18.162 + } 18.163 + 18.164 + private <T extends Comparable<T>> T min(T item1, T item2) { 18.165 + return (item1 == null) ? item2 18.166 + : (item2 == null) ? item1 18.167 + : item1.compareTo(item2) <= 0 ? item1 : item2; 18.168 + } 18.169 +}
19.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 19.2 +++ b/src/share/classes/com/sun/tools/doclint/HtmlTag.java Fri Dec 28 18:39:09 2012 -0800 19.3 @@ -0,0 +1,356 @@ 19.4 +/* 19.5 + * Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved. 19.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 19.7 + * 19.8 + * This code is free software; you can redistribute it and/or modify it 19.9 + * under the terms of the GNU General Public License version 2 only, as 19.10 + * published by the Free Software Foundation. Oracle designates this 19.11 + * particular file as subject to the "Classpath" exception as provided 19.12 + * by Oracle in the LICENSE file that accompanied this code. 19.13 + * 19.14 + * This code is distributed in the hope that it will be useful, but WITHOUT 19.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 19.16 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 19.17 + * version 2 for more details (a copy is included in the LICENSE file that 19.18 + * accompanied this code). 19.19 + * 19.20 + * You should have received a copy of the GNU General Public License version 19.21 + * 2 along with this work; if not, write to the Free Software Foundation, 19.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 19.23 + * 19.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 19.25 + * or visit www.oracle.com if you need additional information or have any 19.26 + * questions. 19.27 + */ 19.28 + 19.29 +package com.sun.tools.doclint; 19.30 + 19.31 +import java.util.Set; 19.32 +import java.util.Collections; 19.33 +import java.util.EnumMap; 19.34 +import java.util.EnumSet; 19.35 +import java.util.HashMap; 19.36 +import java.util.Map; 19.37 + 19.38 +import javax.lang.model.element.Name; 19.39 + 19.40 +import static com.sun.tools.doclint.HtmlTag.Attr.*; 19.41 + 19.42 +/** 19.43 + * Enum representing HTML tags. 19.44 + * 19.45 + * The intent of this class is to embody the semantics of W3C HTML 4.01 19.46 + * to the extent supported/used by javadoc. 19.47 + * 19.48 + * This is derivative of com.sun.tools.doclets.formats.html.markup.HtmlTag. 19.49 + * Eventually, these two should be merged back together, and possibly made 19.50 + * public. 19.51 + * 19.52 + * @see <a href="http://www.w3.org/TR/REC-html40/">HTML 4.01 Specification</a> 19.53 + * @author Bhavesh Patel 19.54 + * @author Jonathan Gibbons (revised) 19.55 + */ 19.56 +public enum HtmlTag { 19.57 + A(BlockType.INLINE, EndKind.REQUIRED, 19.58 + attrs(AttrKind.OK, HREF, TARGET, NAME)), 19.59 + 19.60 + B(BlockType.INLINE, EndKind.REQUIRED, 19.61 + EnumSet.of(Flag.EXPECT_CONTENT, Flag.NO_NEST)), 19.62 + 19.63 + BLOCKQUOTE, 19.64 + 19.65 + BODY(BlockType.OTHER, EndKind.REQUIRED), 19.66 + 19.67 + BR(BlockType.INLINE, EndKind.NONE, 19.68 + attrs(AttrKind.USE_CSS, CLEAR)), 19.69 + 19.70 + CAPTION(EnumSet.of(Flag.EXPECT_CONTENT)), 19.71 + 19.72 + CENTER, 19.73 + 19.74 + CITE(BlockType.INLINE, EndKind.REQUIRED, 19.75 + EnumSet.of(Flag.EXPECT_CONTENT, Flag.NO_NEST)), 19.76 + 19.77 + CODE(BlockType.INLINE, EndKind.REQUIRED, 19.78 + EnumSet.of(Flag.EXPECT_CONTENT, Flag.NO_NEST)), 19.79 + 19.80 + DD(BlockType.BLOCK, EndKind.OPTIONAL, 19.81 + EnumSet.of(Flag.EXPECT_CONTENT)), 19.82 + 19.83 + DIV, 19.84 + 19.85 + DL(BlockType.BLOCK, EndKind.REQUIRED, 19.86 + EnumSet.of(Flag.EXPECT_CONTENT, Flag.NO_TEXT), 19.87 + attrs(AttrKind.USE_CSS, COMPACT)), 19.88 + 19.89 + DT(BlockType.BLOCK, EndKind.OPTIONAL, 19.90 + EnumSet.of(Flag.EXPECT_CONTENT)), 19.91 + 19.92 + EM(BlockType.INLINE, EndKind.REQUIRED, 19.93 + EnumSet.of(Flag.NO_NEST)), 19.94 + 19.95 + FONT(BlockType.INLINE, EndKind.REQUIRED, // tag itself is deprecated 19.96 + EnumSet.of(Flag.EXPECT_CONTENT), 19.97 + attrs(AttrKind.USE_CSS, SIZE, COLOR, FACE)), 19.98 + 19.99 + FRAME(BlockType.OTHER, EndKind.NONE), 19.100 + 19.101 + FRAMESET(BlockType.OTHER, EndKind.REQUIRED), 19.102 + 19.103 + H1, 19.104 + H2, 19.105 + H3, 19.106 + H4, 19.107 + H5, 19.108 + H6, 19.109 + 19.110 + HEAD(BlockType.OTHER, EndKind.REQUIRED), 19.111 + 19.112 + HR(BlockType.BLOCK, EndKind.NONE), 19.113 + 19.114 + HTML(BlockType.OTHER, EndKind.REQUIRED), 19.115 + 19.116 + I(BlockType.INLINE, EndKind.REQUIRED, 19.117 + EnumSet.of(Flag.EXPECT_CONTENT, Flag.NO_NEST)), 19.118 + 19.119 + IMG(BlockType.INLINE, EndKind.NONE, 19.120 + attrs(AttrKind.OK, SRC, ALT, HEIGHT, WIDTH), 19.121 + attrs(AttrKind.OBSOLETE, NAME), 19.122 + attrs(AttrKind.USE_CSS, ALIGN, HSPACE, VSPACE, BORDER)), 19.123 + 19.124 + LI(BlockType.BLOCK, EndKind.OPTIONAL), 19.125 + 19.126 + LINK(BlockType.OTHER, EndKind.NONE), 19.127 + 19.128 + MENU, 19.129 + 19.130 + META(BlockType.OTHER, EndKind.NONE), 19.131 + 19.132 + NOFRAMES(BlockType.OTHER, EndKind.REQUIRED), 19.133 + 19.134 + NOSCRIPT(BlockType.OTHER, EndKind.REQUIRED), 19.135 + 19.136 + OL(BlockType.BLOCK, EndKind.REQUIRED, 19.137 + EnumSet.of(Flag.EXPECT_CONTENT, Flag.NO_TEXT), 19.138 + attrs(AttrKind.USE_CSS, START, TYPE)), 19.139 + 19.140 + P(BlockType.BLOCK, EndKind.OPTIONAL, 19.141 + EnumSet.of(Flag.EXPECT_CONTENT), 19.142 + attrs(AttrKind.USE_CSS, ALIGN)), 19.143 + 19.144 + PRE(EnumSet.of(Flag.EXPECT_CONTENT)), 19.145 + 19.146 + SCRIPT(BlockType.OTHER, EndKind.REQUIRED), 19.147 + 19.148 + SMALL(BlockType.INLINE, EndKind.REQUIRED), 19.149 + 19.150 + SPAN(BlockType.INLINE, EndKind.REQUIRED, 19.151 + EnumSet.of(Flag.EXPECT_CONTENT)), 19.152 + 19.153 + STRONG(BlockType.INLINE, EndKind.REQUIRED, 19.154 + EnumSet.of(Flag.EXPECT_CONTENT)), 19.155 + 19.156 + SUB(BlockType.INLINE, EndKind.REQUIRED, 19.157 + EnumSet.of(Flag.EXPECT_CONTENT, Flag.NO_NEST)), 19.158 + 19.159 + SUP(BlockType.INLINE, EndKind.REQUIRED, 19.160 + EnumSet.of(Flag.EXPECT_CONTENT, Flag.NO_NEST)), 19.161 + 19.162 + TABLE(BlockType.BLOCK, EndKind.REQUIRED, 19.163 + EnumSet.of(Flag.EXPECT_CONTENT, Flag.NO_TEXT), 19.164 + attrs(AttrKind.OK, SUMMARY, Attr.FRAME, RULES, BORDER, 19.165 + CELLPADDING, CELLSPACING), 19.166 + attrs(AttrKind.USE_CSS, ALIGN, WIDTH, BGCOLOR)), 19.167 + 19.168 + TBODY(BlockType.BLOCK, EndKind.REQUIRED, 19.169 + EnumSet.of(Flag.EXPECT_CONTENT, Flag.NO_TEXT), 19.170 + attrs(AttrKind.OK, ALIGN, CHAR, CHAROFF, VALIGN)), 19.171 + 19.172 + TD(BlockType.BLOCK, EndKind.OPTIONAL, 19.173 + attrs(AttrKind.OK, COLSPAN, ROWSPAN, HEADERS, SCOPE, ABBR, AXIS, 19.174 + ALIGN, CHAR, CHAROFF, VALIGN), 19.175 + attrs(AttrKind.USE_CSS, WIDTH, BGCOLOR, HEIGHT, NOWRAP)), 19.176 + 19.177 + TFOOT(BlockType.BLOCK, EndKind.REQUIRED, 19.178 + attrs(AttrKind.OK, ALIGN, CHAR, CHAROFF, VALIGN)), 19.179 + 19.180 + TH(BlockType.BLOCK, EndKind.OPTIONAL, 19.181 + attrs(AttrKind.OK, COLSPAN, ROWSPAN, HEADERS, SCOPE, ABBR, AXIS, 19.182 + ALIGN, CHAR, CHAROFF, VALIGN), 19.183 + attrs(AttrKind.USE_CSS, WIDTH, BGCOLOR, HEIGHT, NOWRAP)), 19.184 + 19.185 + THEAD(BlockType.BLOCK, EndKind.REQUIRED, 19.186 + attrs(AttrKind.OK, ALIGN, CHAR, CHAROFF, VALIGN)), 19.187 + 19.188 + TITLE(BlockType.OTHER, EndKind.REQUIRED), 19.189 + 19.190 + TR(BlockType.BLOCK, EndKind.OPTIONAL, 19.191 + EnumSet.of(Flag.NO_TEXT), 19.192 + attrs(AttrKind.OK, ALIGN, CHAR, CHAROFF, VALIGN), 19.193 + attrs(AttrKind.USE_CSS, BGCOLOR)), 19.194 + 19.195 + TT(BlockType.INLINE, EndKind.REQUIRED, 19.196 + EnumSet.of(Flag.EXPECT_CONTENT, Flag.NO_NEST)), 19.197 + 19.198 + U(BlockType.INLINE, EndKind.REQUIRED, 19.199 + EnumSet.of(Flag.EXPECT_CONTENT, Flag.NO_NEST)), 19.200 + 19.201 + UL(BlockType.BLOCK, EndKind.REQUIRED, 19.202 + EnumSet.of(Flag.EXPECT_CONTENT, Flag.NO_TEXT), 19.203 + attrs(AttrKind.USE_CSS, COMPACT, TYPE)), 19.204 + 19.205 + VAR(BlockType.INLINE, EndKind.REQUIRED); 19.206 + 19.207 + /** 19.208 + * Enum representing the type of HTML element. 19.209 + */ 19.210 + public static enum BlockType { 19.211 + BLOCK, 19.212 + INLINE, 19.213 + OTHER; 19.214 + } 19.215 + 19.216 + /** 19.217 + * Enum representing HTML end tag requirement. 19.218 + */ 19.219 + public static enum EndKind { 19.220 + NONE, 19.221 + OPTIONAL, 19.222 + REQUIRED; 19.223 + } 19.224 + 19.225 + public static enum Flag { 19.226 + EXPECT_CONTENT, 19.227 + NO_NEST, 19.228 + NO_TEXT 19.229 + } 19.230 + 19.231 + public static enum Attr { 19.232 + ABBR, 19.233 + ALIGN, 19.234 + ALT, 19.235 + AXIS, 19.236 + BGCOLOR, 19.237 + BORDER, 19.238 + CELLSPACING, 19.239 + CELLPADDING, 19.240 + CHAR, 19.241 + CHAROFF, 19.242 + CLEAR, 19.243 + CLASS, 19.244 + COLOR, 19.245 + COLSPAN, 19.246 + COMPACT, 19.247 + FACE, 19.248 + FRAME, 19.249 + HEADERS, 19.250 + HEIGHT, 19.251 + HREF, 19.252 + HSPACE, 19.253 + ID, 19.254 + NAME, 19.255 + NOWRAP, 19.256 + REVERSED, 19.257 + ROWSPAN, 19.258 + RULES, 19.259 + SCOPE, 19.260 + SIZE, 19.261 + SPACE, 19.262 + SRC, 19.263 + START, 19.264 + STYLE, 19.265 + SUMMARY, 19.266 + TARGET, 19.267 + TYPE, 19.268 + VALIGN, 19.269 + VSPACE, 19.270 + WIDTH; 19.271 + 19.272 + public String getText() { 19.273 + return name().toLowerCase(); 19.274 + } 19.275 + 19.276 + static final Map<String,Attr> index = new HashMap<String,Attr>(); 19.277 + static { 19.278 + for (Attr t: values()) { 19.279 + index.put(t.name().toLowerCase(), t); 19.280 + } 19.281 + } 19.282 + } 19.283 + 19.284 + public static enum AttrKind { 19.285 + INVALID, 19.286 + OBSOLETE, 19.287 + USE_CSS, 19.288 + OK 19.289 + } 19.290 + 19.291 + // This class exists to avoid warnings from using parameterized vararg type 19.292 + // Map<Attr,AttrKind> in signature of HtmlTag constructor. 19.293 + private static class AttrMap extends EnumMap<Attr,AttrKind> { 19.294 + private static final long serialVersionUID = 0; 19.295 + AttrMap() { 19.296 + super(Attr.class); 19.297 + } 19.298 + } 19.299 + 19.300 + 19.301 + public final BlockType blockType; 19.302 + public final EndKind endKind; 19.303 + public final Set<Flag> flags; 19.304 + private final Map<Attr,AttrKind> attrs; 19.305 + 19.306 + 19.307 + HtmlTag() { 19.308 + this(BlockType.BLOCK, EndKind.REQUIRED); 19.309 + } 19.310 + 19.311 + HtmlTag(Set<Flag> flags) { 19.312 + this(BlockType.BLOCK, EndKind.REQUIRED, flags); 19.313 + } 19.314 + 19.315 + HtmlTag(BlockType blockType, EndKind endKind, AttrMap... attrMaps) { 19.316 + this(blockType, endKind, Collections.<Flag>emptySet(), attrMaps); 19.317 + } 19.318 + 19.319 + HtmlTag(BlockType blockType, EndKind endKind, Set<Flag> flags, AttrMap... attrMaps) { 19.320 + this.blockType = blockType; 19.321 + this.endKind = endKind;this.flags = flags; 19.322 + this.attrs = new EnumMap<Attr,AttrKind>(Attr.class); 19.323 + for (Map<Attr,AttrKind> m: attrMaps) 19.324 + this.attrs.putAll(m); 19.325 + attrs.put(Attr.CLASS, AttrKind.OK); 19.326 + attrs.put(Attr.ID, AttrKind.OK); 19.327 + attrs.put(Attr.STYLE, AttrKind.OK); 19.328 + } 19.329 + 19.330 + public String getText() { 19.331 + return name().toLowerCase(); 19.332 + } 19.333 + 19.334 + public Attr getAttr(Name attrName) { 19.335 + return Attr.index.get(attrName.toString().toLowerCase()); 19.336 + } 19.337 + 19.338 + public AttrKind getAttrKind(Name attrName) { 19.339 + AttrKind k = attrs.get(getAttr(attrName)); // null-safe 19.340 + return (k == null) ? AttrKind.INVALID : k; 19.341 + } 19.342 + 19.343 + private static AttrMap attrs(AttrKind k, Attr... attrs) { 19.344 + AttrMap map = new AttrMap(); 19.345 + for (Attr a: attrs) map.put(a, k); 19.346 + return map; 19.347 + } 19.348 + 19.349 + private static final Map<String,HtmlTag> index = new HashMap<String,HtmlTag>(); 19.350 + static { 19.351 + for (HtmlTag t: values()) { 19.352 + index.put(t.name().toLowerCase(), t); 19.353 + } 19.354 + } 19.355 + 19.356 + static HtmlTag get(Name tagName) { 19.357 + return index.get(tagName.toString().toLowerCase()); 19.358 + } 19.359 +}
20.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 20.2 +++ b/src/share/classes/com/sun/tools/doclint/Messages.java Fri Dec 28 18:39:09 2012 -0800 20.3 @@ -0,0 +1,348 @@ 20.4 +/* 20.5 + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. 20.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 20.7 + * 20.8 + * This code is free software; you can redistribute it and/or modify it 20.9 + * under the terms of the GNU General Public License version 2 only, as 20.10 + * published by the Free Software Foundation. Oracle designates this 20.11 + * particular file as subject to the "Classpath" exception as provided 20.12 + * by Oracle in the LICENSE file that accompanied this code. 20.13 + * 20.14 + * This code is distributed in the hope that it will be useful, but WITHOUT 20.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 20.16 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 20.17 + * version 2 for more details (a copy is included in the LICENSE file that 20.18 + * accompanied this code). 20.19 + * 20.20 + * You should have received a copy of the GNU General Public License version 20.21 + * 2 along with this work; if not, write to the Free Software Foundation, 20.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20.23 + * 20.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20.25 + * or visit www.oracle.com if you need additional information or have any 20.26 + * questions. 20.27 + */ 20.28 + 20.29 +package com.sun.tools.doclint; 20.30 + 20.31 +import java.io.PrintWriter; 20.32 +import java.text.MessageFormat; 20.33 +import java.util.Comparator; 20.34 +import java.util.HashMap; 20.35 +import java.util.Locale; 20.36 +import java.util.Map; 20.37 +import java.util.MissingResourceException; 20.38 +import java.util.ResourceBundle; 20.39 +import java.util.Set; 20.40 +import java.util.TreeMap; 20.41 +import java.util.TreeSet; 20.42 + 20.43 +import javax.tools.Diagnostic; 20.44 + 20.45 +import com.sun.source.doctree.DocTree; 20.46 +import com.sun.source.tree.Tree; 20.47 +import com.sun.tools.doclint.Env.AccessKind; 20.48 + 20.49 +/** 20.50 + * Message reporting for DocLint. 20.51 + * 20.52 + * Options are used to filter out messages based on group and access level. 20.53 + * Support can be enabled for accumulating statistics of different kinds of 20.54 + * messages. 20.55 + * 20.56 + * <p><b>This is NOT part of any supported API. 20.57 + * If you write code that depends on this, you do so at your own 20.58 + * risk. This code and its internal interfaces are subject to change 20.59 + * or deletion without notice.</b></p> 20.60 + */ 20.61 +public class Messages { 20.62 + /** 20.63 + * Groups used to categorize messages, so that messages in each group 20.64 + * can be enabled or disabled via options. 20.65 + */ 20.66 + public enum Group { 20.67 + ACCESSIBILITY, 20.68 + HTML, 20.69 + MISSING, 20.70 + SYNTAX, 20.71 + REFERENCE; 20.72 + 20.73 + String optName() { return name().toLowerCase(); } 20.74 + String notOptName() { return "-" + optName(); } 20.75 + 20.76 + static boolean accepts(String opt) { 20.77 + for (Group g: values()) 20.78 + if (opt.equals(g.optName())) return true; 20.79 + return false; 20.80 + } 20.81 + }; 20.82 + 20.83 + private final Options options; 20.84 + private final Stats stats; 20.85 + 20.86 + ResourceBundle bundle; 20.87 + Env env; 20.88 + 20.89 + Messages(Env env) { 20.90 + this.env = env; 20.91 + String name = getClass().getPackage().getName() + ".resources.doclint"; 20.92 + bundle = ResourceBundle.getBundle(name, Locale.ENGLISH); 20.93 + 20.94 + stats = new Stats(bundle); 20.95 + options = new Options(stats); 20.96 + } 20.97 + 20.98 + void error(Group group, DocTree tree, String code, Object... args) { 20.99 + report(group, Diagnostic.Kind.ERROR, tree, code, args); 20.100 + } 20.101 + 20.102 + void warning(Group group, DocTree tree, String code, Object... args) { 20.103 + report(group, Diagnostic.Kind.WARNING, tree, code, args); 20.104 + } 20.105 + 20.106 + void setOptions(String opts) { 20.107 + options.setOptions(opts); 20.108 + } 20.109 + 20.110 + void setStatsEnabled(boolean b) { 20.111 + stats.setEnabled(b); 20.112 + } 20.113 + 20.114 + void reportStats(PrintWriter out) { 20.115 + stats.report(out); 20.116 + } 20.117 + 20.118 + protected void report(Group group, Diagnostic.Kind dkind, DocTree tree, String code, Object... args) { 20.119 + if (options.isEnabled(group, env.currAccess)) { 20.120 + String msg = (code == null) ? (String) args[0] : localize(code, args); 20.121 + env.trees.printMessage(dkind, msg, tree, 20.122 + env.currDocComment, env.currPath.getCompilationUnit()); 20.123 + 20.124 + stats.record(group, dkind, code); 20.125 + } 20.126 + } 20.127 + 20.128 + protected void report(Group group, Diagnostic.Kind dkind, Tree tree, String code, Object... args) { 20.129 + if (options.isEnabled(group, env.currAccess)) { 20.130 + String msg = localize(code, args); 20.131 + env.trees.printMessage(dkind, msg, tree, env.currPath.getCompilationUnit()); 20.132 + 20.133 + stats.record(group, dkind, code); 20.134 + } 20.135 + } 20.136 + 20.137 + String localize(String code, Object... args) { 20.138 + String msg = bundle.getString(code); 20.139 + if (msg == null) { 20.140 + StringBuilder sb = new StringBuilder(); 20.141 + sb.append("message file broken: code=").append(code); 20.142 + if (args.length > 0) { 20.143 + sb.append(" arguments={0}"); 20.144 + for (int i = 1; i < args.length; i++) { 20.145 + sb.append(", {").append(i).append("}"); 20.146 + } 20.147 + } 20.148 + msg = sb.toString(); 20.149 + } 20.150 + return MessageFormat.format(msg, args); 20.151 + } 20.152 + 20.153 + // <editor-fold defaultstate="collapsed" desc="Options"> 20.154 + 20.155 + /** 20.156 + * Handler for (sub)options specific to message handling. 20.157 + */ 20.158 + static class Options { 20.159 + Map<String, Env.AccessKind> map = new HashMap<String, Env.AccessKind>(); 20.160 + private final Stats stats; 20.161 + 20.162 + static boolean isValidOptions(String opts) { 20.163 + for (String opt: opts.split(",")) { 20.164 + if (!isValidOption(opt.trim().toLowerCase())) 20.165 + return false; 20.166 + } 20.167 + return true; 20.168 + } 20.169 + 20.170 + private static boolean isValidOption(String opt) { 20.171 + if (opt.equals("none") || opt.equals(Stats.OPT)) 20.172 + return true; 20.173 + 20.174 + int begin = opt.startsWith("-") ? 1 : 0; 20.175 + int sep = opt.indexOf("/"); 20.176 + String grp = opt.substring(begin, (sep != -1) ? sep : opt.length()); 20.177 + return ((begin == 0 && grp.equals("all")) || Group.accepts(grp)) 20.178 + && ((sep == -1) || AccessKind.accepts(opt.substring(sep + 1))); 20.179 + } 20.180 + 20.181 + Options(Stats stats) { 20.182 + this.stats = stats; 20.183 + } 20.184 + 20.185 + /** Determine if a message group is enabled for a particular access level. */ 20.186 + boolean isEnabled(Group g, Env.AccessKind access) { 20.187 + if (map.isEmpty()) 20.188 + map.put("all", Env.AccessKind.PROTECTED); 20.189 + 20.190 + Env.AccessKind ak = map.get(g.optName()); 20.191 + if (ak != null && access.compareTo(ak) >= 0) 20.192 + return true; 20.193 + 20.194 + ak = map.get(ALL); 20.195 + if (ak != null && access.compareTo(ak) >= 0) { 20.196 + ak = map.get(g.notOptName()); 20.197 + if (ak == null || access.compareTo(ak) > 0) // note >, not >= 20.198 + return true; 20.199 + } 20.200 + 20.201 + return false; 20.202 + } 20.203 + 20.204 + void setOptions(String opts) { 20.205 + if (opts == null) 20.206 + setOption(ALL, Env.AccessKind.PRIVATE); 20.207 + else { 20.208 + for (String opt: opts.split(",")) 20.209 + setOption(opt.trim().toLowerCase()); 20.210 + } 20.211 + } 20.212 + 20.213 + private void setOption(String arg) throws IllegalArgumentException { 20.214 + if (arg.equals(Stats.OPT)) { 20.215 + stats.setEnabled(true); 20.216 + return; 20.217 + } 20.218 + 20.219 + int sep = arg.indexOf("/"); 20.220 + if (sep > 0) { 20.221 + Env.AccessKind ak = Env.AccessKind.valueOf(arg.substring(sep + 1).toUpperCase()); 20.222 + setOption(arg.substring(0, sep), ak); 20.223 + } else { 20.224 + setOption(arg, null); 20.225 + } 20.226 + } 20.227 + 20.228 + private void setOption(String opt, Env.AccessKind ak) { 20.229 + map.put(opt, (ak != null) ? ak 20.230 + : opt.startsWith("-") ? Env.AccessKind.PUBLIC : Env.AccessKind.PRIVATE); 20.231 + } 20.232 + 20.233 + private static final String ALL = "all"; 20.234 + } 20.235 + 20.236 + // </editor-fold> 20.237 + 20.238 + // <editor-fold defaultstate="collapsed" desc="Statistics"> 20.239 + 20.240 + /** 20.241 + * Optionally record statistics of different kinds of message. 20.242 + */ 20.243 + static class Stats { 20.244 + public static final String OPT = "stats"; 20.245 + public static final String NO_CODE = ""; 20.246 + final ResourceBundle bundle; 20.247 + 20.248 + // tables only initialized if enabled 20.249 + int[] groupCounts; 20.250 + int[] dkindCounts; 20.251 + Map<String, Integer> codeCounts; 20.252 + 20.253 + Stats(ResourceBundle bundle) { 20.254 + this.bundle = bundle; 20.255 + } 20.256 + 20.257 + void setEnabled(boolean b) { 20.258 + if (b) { 20.259 + groupCounts = new int[Messages.Group.values().length]; 20.260 + dkindCounts = new int[Diagnostic.Kind.values().length]; 20.261 + codeCounts = new HashMap<String, Integer>(); 20.262 + } else { 20.263 + groupCounts = null; 20.264 + dkindCounts = null; 20.265 + codeCounts = null; 20.266 + } 20.267 + } 20.268 + 20.269 + void record(Messages.Group g, Diagnostic.Kind dkind, String code) { 20.270 + if (codeCounts == null) { 20.271 + return; 20.272 + } 20.273 + groupCounts[g.ordinal()]++; 20.274 + dkindCounts[dkind.ordinal()]++; 20.275 + if (code == null) { 20.276 + code = NO_CODE; 20.277 + } 20.278 + Integer i = codeCounts.get(code); 20.279 + codeCounts.put(code, (i == null) ? 1 : i + 1); 20.280 + } 20.281 + 20.282 + void report(PrintWriter out) { 20.283 + if (codeCounts == null) { 20.284 + return; 20.285 + } 20.286 + out.println("By group..."); 20.287 + Table groupTable = new Table(); 20.288 + for (Messages.Group g : Messages.Group.values()) { 20.289 + groupTable.put(g.optName(), groupCounts[g.ordinal()]); 20.290 + } 20.291 + groupTable.print(out); 20.292 + out.println(); 20.293 + out.println("By diagnostic kind..."); 20.294 + Table dkindTable = new Table(); 20.295 + for (Diagnostic.Kind k : Diagnostic.Kind.values()) { 20.296 + dkindTable.put(k.toString().toLowerCase(), dkindCounts[k.ordinal()]); 20.297 + } 20.298 + dkindTable.print(out); 20.299 + out.println(); 20.300 + out.println("By message kind..."); 20.301 + Table codeTable = new Table(); 20.302 + for (Map.Entry<String, Integer> e : codeCounts.entrySet()) { 20.303 + String code = e.getKey(); 20.304 + String msg; 20.305 + try { 20.306 + msg = code.equals(NO_CODE) ? "OTHER" : bundle.getString(code); 20.307 + } catch (MissingResourceException ex) { 20.308 + msg = code; 20.309 + } 20.310 + codeTable.put(msg, e.getValue()); 20.311 + } 20.312 + codeTable.print(out); 20.313 + } 20.314 + 20.315 + /** 20.316 + * A table of (int, String) sorted by decreasing int. 20.317 + */ 20.318 + private static class Table { 20.319 + 20.320 + private static final Comparator<Integer> DECREASING = new Comparator<Integer>() { 20.321 + 20.322 + public int compare(Integer o1, Integer o2) { 20.323 + return o2.compareTo(o1); 20.324 + } 20.325 + }; 20.326 + private final TreeMap<Integer, Set<String>> map = new TreeMap<Integer, Set<String>>(DECREASING); 20.327 + 20.328 + void put(String label, int n) { 20.329 + if (n == 0) { 20.330 + return; 20.331 + } 20.332 + Set<String> labels = map.get(n); 20.333 + if (labels == null) { 20.334 + map.put(n, labels = new TreeSet<String>()); 20.335 + } 20.336 + labels.add(label); 20.337 + } 20.338 + 20.339 + void print(PrintWriter out) { 20.340 + for (Map.Entry<Integer, Set<String>> e : map.entrySet()) { 20.341 + int count = e.getKey(); 20.342 + Set<String> labels = e.getValue(); 20.343 + for (String label : labels) { 20.344 + out.println(String.format("%6d: %s", count, label)); 20.345 + } 20.346 + } 20.347 + } 20.348 + } 20.349 + } 20.350 + // </editor-fold> 20.351 +}
21.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 21.2 +++ b/src/share/classes/com/sun/tools/doclint/resources/doclint.properties Fri Dec 28 18:39:09 2012 -0800 21.3 @@ -0,0 +1,65 @@ 21.4 +# 21.5 +# Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. 21.6 +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 21.7 +# 21.8 +# This code is free software; you can redistribute it and/or modify it 21.9 +# under the terms of the GNU General Public License version 2 only, as 21.10 +# published by the Free Software Foundation. Oracle designates this 21.11 +# particular file as subject to the "Classpath" exception as provided 21.12 +# by Oracle in the LICENSE file that accompanied this code. 21.13 +# 21.14 +# This code is distributed in the hope that it will be useful, but WITHOUT 21.15 +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 21.16 +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 21.17 +# version 2 for more details (a copy is included in the LICENSE file that 21.18 +# accompanied this code). 21.19 +# 21.20 +# You should have received a copy of the GNU General Public License version 21.21 +# 2 along with this work; if not, write to the Free Software Foundation, 21.22 +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 21.23 +# 21.24 +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 21.25 +# or visit www.oracle.com if you need additional information or have any 21.26 +# questions. 21.27 +# 21.28 + 21.29 +dc.anchor.already.defined = anchor already defined: {0} 21.30 +dc.attr.lacks.value = attribute lacks value 21.31 +dc.attr.obsolete = attribute obsolete: {0} 21.32 +dc.attr.obsolete.use.css = attribute obsolete, use CSS instead: {0} 21.33 +dc.attr.repeated = repeated attribute: {0} 21.34 +dc.attr.unknown = unknown attribute: {0} 21.35 +dc.bad.option = bad option: {0} 21.36 +dc.bad.value.for.option = bad value for option: {0} {1} 21.37 +dc.empty = no description for @{0} 21.38 +dc.entity.invalid = invalid entity &{0}; 21.39 +dc.exception.not.thrown = exception not thrown: {0} 21.40 +dc.invalid.anchor = invalid name for anchor: "{0}" 21.41 +dc.invalid.param = invalid use of @param 21.42 +dc.invalid.return = invalid use of @return 21.43 +dc.invalid.throws = invalid use of @throws 21.44 +dc.invalid.uri = invalid uri: "{0}" 21.45 +dc.missing.comment = no comment 21.46 +dc.missing.param = no @param for {0} 21.47 +dc.missing.return = no @return 21.48 +dc.missing.throws = no @throws for {0} 21.49 +dc.no.alt.attr.for.image = no "alt" attribute for image 21.50 +dc.no.summary.or.caption.for.table=no summary or caption for table 21.51 +dc.param.name.not.found = @param name not found 21.52 +dc.ref.not.found = reference not found 21.53 +dc.tag.empty = empty <{0}> tag 21.54 +dc.tag.end.not.permitted = invalid end tag: </{0}> 21.55 +dc.tag.end.unexpected = unexpected end tag: </{0}> 21.56 +dc.tag.header.sequence.1 = header used out of sequence: <{0}> 21.57 +dc.tag.header.sequence.2 = header used out of sequence: <{0}> 21.58 +dc.tag.nested.not.allowed=nested tag not allowed: <{0}> 21.59 +dc.tag.not.allowed = element not allowed in documentation comments: <{0}> 21.60 +dc.tag.not.allowed.inline.element = block element not allowed within inline element <{1}>: {0} 21.61 +dc.tag.not.allowed.inline.tag = block element not allowed within @{1}: {0} 21.62 +dc.tag.not.allowed.inline.other = block element not allowed here: {0} 21.63 +dc.tag.not.closed= element not closed: {0} 21.64 +dc.tag.p.in.pre= unexpected use of <p> inside <pre> element 21.65 +dc.tag.self.closing = self-closing element not allowed 21.66 +dc.tag.start.unmatched = end tag missing: </{0}> 21.67 +dc.tag.unknown = unknown tag: {0} 21.68 +dc.text.not.allowed = text not allowed in <{0}> element
22.1 --- a/src/share/classes/com/sun/tools/javac/api/BasicJavacTask.java Thu Dec 27 12:15:17 2012 -0800 22.2 +++ b/src/share/classes/com/sun/tools/javac/api/BasicJavacTask.java Fri Dec 28 18:39:09 2012 -0800 22.3 @@ -57,6 +57,13 @@ 22.4 protected Context context; 22.5 private TaskListener taskListener; 22.6 22.7 + public static JavacTask instance(Context context) { 22.8 + JavacTask instance = context.get(JavacTask.class); 22.9 + if (instance == null) 22.10 + instance = new BasicJavacTask(context, true); 22.11 + return instance; 22.12 + } 22.13 + 22.14 public BasicJavacTask(Context c, boolean register) { 22.15 context = c; 22.16 if (register)
23.1 --- a/src/share/classes/com/sun/tools/javac/api/JavacTaskImpl.java Thu Dec 27 12:15:17 2012 -0800 23.2 +++ b/src/share/classes/com/sun/tools/javac/api/JavacTaskImpl.java Fri Dec 28 18:39:09 2012 -0800 23.3 @@ -65,7 +65,6 @@ 23.4 * @author Jonathan Gibbons 23.5 */ 23.6 public class JavacTaskImpl extends BasicJavacTask { 23.7 - private ClientCodeWrapper ccw; 23.8 private Main compilerMain; 23.9 private JavaCompiler compiler; 23.10 private Locale locale; 23.11 @@ -85,7 +84,6 @@ 23.12 Context context, 23.13 List<JavaFileObject> fileObjects) { 23.14 super(null, false); 23.15 - this.ccw = ClientCodeWrapper.instance(context); 23.16 this.compilerMain = compilerMain; 23.17 this.args = args; 23.18 this.classNames = classNames;
24.1 --- a/src/share/classes/com/sun/tools/javac/api/JavacTool.java Thu Dec 27 12:15:17 2012 -0800 24.2 +++ b/src/share/classes/com/sun/tools/javac/api/JavacTool.java Fri Dec 28 18:39:09 2012 -0800 24.3 @@ -159,7 +159,7 @@ 24.4 } 24.5 } 24.6 24.7 - private static void processOptions(Context context, 24.8 + public static void processOptions(Context context, 24.9 JavaFileManager fileManager, 24.10 Iterable<String> options) 24.11 {
25.1 --- a/src/share/classes/com/sun/tools/javac/api/JavacTrees.java Thu Dec 27 12:15:17 2012 -0800 25.2 +++ b/src/share/classes/com/sun/tools/javac/api/JavacTrees.java Fri Dec 28 18:39:09 2012 -0800 25.3 @@ -84,6 +84,7 @@ 25.4 import com.sun.tools.javac.tree.TreeCopier; 25.5 import com.sun.tools.javac.tree.TreeInfo; 25.6 import com.sun.tools.javac.tree.TreeMaker; 25.7 +import com.sun.tools.javac.util.Abort; 25.8 import com.sun.tools.javac.util.Assert; 25.9 import com.sun.tools.javac.util.Context; 25.10 import com.sun.tools.javac.util.JCDiagnostic; 25.11 @@ -236,19 +237,26 @@ 25.12 public Element getElement(TreePath path) { 25.13 JCTree tree = (JCTree) path.getLeaf(); 25.14 Symbol sym = TreeInfo.symbolFor(tree); 25.15 - if (sym == null && TreeInfo.isDeclaration(tree)) { 25.16 - for (TreePath p = path; p != null; p = p.getParentPath()) { 25.17 - JCTree t = (JCTree) p.getLeaf(); 25.18 - if (t.hasTag(JCTree.Tag.CLASSDEF)) { 25.19 - JCClassDecl ct = (JCClassDecl) t; 25.20 - if (ct.sym != null) { 25.21 - if ((ct.sym.flags_field & Flags.UNATTRIBUTED) != 0) { 25.22 - attr.attribClass(ct.pos(), ct.sym); 25.23 - sym = TreeInfo.symbolFor(tree); 25.24 + if (sym == null) { 25.25 + if (TreeInfo.isDeclaration(tree)) { 25.26 + for (TreePath p = path; p != null; p = p.getParentPath()) { 25.27 + JCTree t = (JCTree) p.getLeaf(); 25.28 + if (t.hasTag(JCTree.Tag.CLASSDEF)) { 25.29 + JCClassDecl ct = (JCClassDecl) t; 25.30 + if (ct.sym != null) { 25.31 + if ((ct.sym.flags_field & Flags.UNATTRIBUTED) != 0) { 25.32 + attr.attribClass(ct.pos(), ct.sym); 25.33 + sym = TreeInfo.symbolFor(tree); 25.34 + } 25.35 + break; 25.36 } 25.37 - break; 25.38 } 25.39 } 25.40 + } else if (tree.hasTag(Tag.TOPLEVEL)) { 25.41 + JCCompilationUnit cu = (JCCompilationUnit) tree; 25.42 + if (cu.sourcefile.isNameCompatible("package-info", JavaFileObject.Kind.SOURCE)) { 25.43 + sym = cu.packge; 25.44 + } 25.45 } 25.46 } 25.47 return sym; 25.48 @@ -332,6 +340,8 @@ 25.49 } else { 25.50 return msym; 25.51 } 25.52 + } catch (Abort e) { // may be thrown by Check.completionError in case of bad class file 25.53 + return null; 25.54 } finally { 25.55 log.popDiagnosticHandler(deferredDiagnosticHandler); 25.56 }
26.1 --- a/src/share/classes/com/sun/tools/javac/code/Attribute.java Thu Dec 27 12:15:17 2012 -0800 26.2 +++ b/src/share/classes/com/sun/tools/javac/code/Attribute.java Fri Dec 28 18:39:09 2012 -0800 26.3 @@ -60,6 +60,9 @@ 26.4 throw new UnsupportedOperationException(); 26.5 } 26.6 26.7 + public boolean isSynthesized() { 26.8 + return false; 26.9 + } 26.10 26.11 /** The value for an annotation element of primitive type or String. */ 26.12 public static class Constant extends Attribute { 26.13 @@ -136,6 +139,18 @@ 26.14 * access this attribute. 26.15 */ 26.16 public final List<Pair<MethodSymbol,Attribute>> values; 26.17 + 26.18 + private boolean synthesized = false; 26.19 + 26.20 + @Override 26.21 + public boolean isSynthesized() { 26.22 + return synthesized; 26.23 + } 26.24 + 26.25 + public void setSynthesized(boolean synthesized) { 26.26 + this.synthesized = synthesized; 26.27 + } 26.28 + 26.29 public Compound(Type type, 26.30 List<Pair<MethodSymbol,Attribute>> values) { 26.31 super(type);
27.1 --- a/src/share/classes/com/sun/tools/javac/code/Symbol.java Thu Dec 27 12:15:17 2012 -0800 27.2 +++ b/src/share/classes/com/sun/tools/javac/code/Symbol.java Fri Dec 28 18:39:09 2012 -0800 27.3 @@ -83,13 +83,13 @@ 27.4 * Attributes of class symbols should be accessed through the accessor 27.5 * method to make sure that the class symbol is loaded. 27.6 */ 27.7 - public List<Attribute.Compound> getAnnotationMirrors() { 27.8 - return Assert.checkNonNull(annotations.getAttributes()); 27.9 + public List<Attribute.Compound> getRawAttributes() { 27.10 + return annotations.getAttributes(); 27.11 } 27.12 27.13 /** Fetch a particular annotation from a symbol. */ 27.14 public Attribute.Compound attribute(Symbol anno) { 27.15 - for (Attribute.Compound a : getAnnotationMirrors()) { 27.16 + for (Attribute.Compound a : getRawAttributes()) { 27.17 if (a.type.tsym == anno) return a; 27.18 } 27.19 return null; 27.20 @@ -447,6 +447,14 @@ 27.21 } 27.22 27.23 /** 27.24 + * This is the implementation for {@code 27.25 + * javax.lang.model.element.Element.getAnnotationMirrors()}. 27.26 + */ 27.27 + public final List<Attribute.Compound> getAnnotationMirrors() { 27.28 + return getRawAttributes(); 27.29 + } 27.30 + 27.31 + /** 27.32 * @deprecated this method should never be used by javac internally. 27.33 */ 27.34 @Deprecated 27.35 @@ -662,15 +670,21 @@ 27.36 return flags_field; 27.37 } 27.38 27.39 - public List<Attribute.Compound> getAnnotationMirrors() { 27.40 + @Override 27.41 + public List<Attribute.Compound> getRawAttributes() { 27.42 if (completer != null) complete(); 27.43 if (package_info != null && package_info.completer != null) { 27.44 package_info.complete(); 27.45 - if (annotations.isEmpty()) { 27.46 - annotations.setAttributes(package_info.annotations); 27.47 + mergeAttributes(); 27.48 } 27.49 + return super.getRawAttributes(); 27.50 + } 27.51 + 27.52 + private void mergeAttributes() { 27.53 + if (annotations.isEmpty() && 27.54 + !package_info.annotations.isEmpty()) { 27.55 + annotations.setAttributes(package_info.annotations); 27.56 } 27.57 - return Assert.checkNonNull(annotations.getAttributes()); 27.58 } 27.59 27.60 /** A package "exists" if a type or package that exists has 27.61 @@ -770,9 +784,10 @@ 27.62 return members_field; 27.63 } 27.64 27.65 - public List<Attribute.Compound> getAnnotationMirrors() { 27.66 + @Override 27.67 + public List<Attribute.Compound> getRawAttributes() { 27.68 if (completer != null) complete(); 27.69 - return Assert.checkNonNull(annotations.getAttributes()); 27.70 + return super.getRawAttributes(); 27.71 } 27.72 27.73 public Type erasure(Types types) { 27.74 @@ -1353,7 +1368,7 @@ 27.75 return defaultValue; 27.76 } 27.77 27.78 - public List<VarSymbol> getParameters() { 27.79 + public List<VarSymbol> getParameters() { 27.80 return params(); 27.81 } 27.82 27.83 @@ -1361,6 +1376,10 @@ 27.84 return (flags() & VARARGS) != 0; 27.85 } 27.86 27.87 + public boolean isDefault() { 27.88 + return (flags() & DEFAULT) != 0; 27.89 + } 27.90 + 27.91 public <R, P> R accept(ElementVisitor<R, P> v, P p) { 27.92 return v.visitExecutable(this, p); 27.93 }
28.1 --- a/src/share/classes/com/sun/tools/javac/code/Type.java Thu Dec 27 12:15:17 2012 -0800 28.2 +++ b/src/share/classes/com/sun/tools/javac/code/Type.java Fri Dec 28 18:39:09 2012 -0800 28.3 @@ -302,10 +302,12 @@ 28.4 * never complete classes. Where isSameType would complete a 28.5 * class, equals assumes that the two types are different. 28.6 */ 28.7 + @Override 28.8 public boolean equals(Object t) { 28.9 return super.equals(t); 28.10 } 28.11 28.12 + @Override 28.13 public int hashCode() { 28.14 return super.hashCode(); 28.15 } 28.16 @@ -996,34 +998,6 @@ 28.17 return "(" + argtypes + ")" + restype; 28.18 } 28.19 28.20 - public boolean equals(Object obj) { 28.21 - if (this == obj) 28.22 - return true; 28.23 - if (!(obj instanceof MethodType)) 28.24 - return false; 28.25 - MethodType m = (MethodType)obj; 28.26 - List<Type> args1 = argtypes; 28.27 - List<Type> args2 = m.argtypes; 28.28 - while (!args1.isEmpty() && !args2.isEmpty()) { 28.29 - if (!args1.head.equals(args2.head)) 28.30 - return false; 28.31 - args1 = args1.tail; 28.32 - args2 = args2.tail; 28.33 - } 28.34 - if (!args1.isEmpty() || !args2.isEmpty()) 28.35 - return false; 28.36 - return restype.equals(m.restype); 28.37 - } 28.38 - 28.39 - public int hashCode() { 28.40 - int h = METHOD.ordinal(); 28.41 - for (List<Type> thisargs = this.argtypes; 28.42 - thisargs.tail != null; /*inlined: thisargs.nonEmpty()*/ 28.43 - thisargs = thisargs.tail) 28.44 - h = (h << 5) + thisargs.head.hashCode(); 28.45 - return (h << 5) + this.restype.hashCode(); 28.46 - } 28.47 - 28.48 public List<Type> getParameterTypes() { return argtypes; } 28.49 public Type getReturnType() { return restype; } 28.50 public List<Type> getThrownTypes() { return thrown; }
29.1 --- a/src/share/classes/com/sun/tools/javac/code/Types.java Thu Dec 27 12:15:17 2012 -0800 29.2 +++ b/src/share/classes/com/sun/tools/javac/code/Types.java Fri Dec 28 18:39:09 2012 -0800 29.3 @@ -1007,11 +1007,11 @@ 29.4 if (!visit(supertype(t), supertype(s))) 29.5 return false; 29.6 29.7 - HashSet<SingletonType> set = new HashSet<SingletonType>(); 29.8 + HashSet<UniqueType> set = new HashSet<UniqueType>(); 29.9 for (Type x : interfaces(t)) 29.10 - set.add(new SingletonType(x)); 29.11 + set.add(new UniqueType(x, Types.this)); 29.12 for (Type x : interfaces(s)) { 29.13 - if (!set.remove(new SingletonType(x))) 29.14 + if (!set.remove(new UniqueType(x, Types.this))) 29.15 return false; 29.16 } 29.17 return (set.isEmpty()); 29.18 @@ -3137,7 +3137,7 @@ 29.19 } 29.20 @Override 29.21 public int hashCode() { 29.22 - return 127 * Types.hashCode(t1) + Types.hashCode(t2); 29.23 + return 127 * Types.this.hashCode(t1) + Types.this.hashCode(t2); 29.24 } 29.25 @Override 29.26 public boolean equals(Object obj) { 29.27 @@ -3400,7 +3400,7 @@ 29.28 /** 29.29 * Compute a hash code on a type. 29.30 */ 29.31 - public static int hashCode(Type t) { 29.32 + public int hashCode(Type t) { 29.33 return hashCode.visit(t); 29.34 } 29.35 // where 29.36 @@ -3423,6 +3423,16 @@ 29.37 } 29.38 29.39 @Override 29.40 + public Integer visitMethodType(MethodType t, Void ignored) { 29.41 + int h = METHOD.ordinal(); 29.42 + for (List<Type> thisargs = t.argtypes; 29.43 + thisargs.tail != null; 29.44 + thisargs = thisargs.tail) 29.45 + h = (h << 5) + visit(thisargs.head); 29.46 + return (h << 5) + visit(t.restype); 29.47 + } 29.48 + 29.49 + @Override 29.50 public Integer visitWildcardType(WildcardType t, Void ignored) { 29.51 int result = t.kind.hashCode(); 29.52 if (t.type != null) { 29.53 @@ -4082,21 +4092,28 @@ 29.54 /** 29.55 * A wrapper for a type that allows use in sets. 29.56 */ 29.57 - class SingletonType { 29.58 - final Type t; 29.59 - SingletonType(Type t) { 29.60 - this.t = t; 29.61 + public static class UniqueType { 29.62 + public final Type type; 29.63 + final Types types; 29.64 + 29.65 + public UniqueType(Type type, Types types) { 29.66 + this.type = type; 29.67 + this.types = types; 29.68 } 29.69 + 29.70 public int hashCode() { 29.71 - return Types.hashCode(t); 29.72 + return types.hashCode(type); 29.73 } 29.74 + 29.75 public boolean equals(Object obj) { 29.76 - return (obj instanceof SingletonType) && 29.77 - isSameType(t, ((SingletonType)obj).t); 29.78 + return (obj instanceof UniqueType) && 29.79 + types.isSameType(type, ((UniqueType)obj).type); 29.80 } 29.81 + 29.82 public String toString() { 29.83 - return t.toString(); 29.84 + return type.toString(); 29.85 } 29.86 + 29.87 } 29.88 // </editor-fold> 29.89
30.1 --- a/src/share/classes/com/sun/tools/javac/comp/Annotate.java Thu Dec 27 12:15:17 2012 -0800 30.2 +++ b/src/share/classes/com/sun/tools/javac/comp/Annotate.java Fri Dec 28 18:39:09 2012 -0800 30.3 @@ -400,6 +400,7 @@ 30.4 Attribute.Compound c = enterAnnotation(annoTree, 30.5 targetContainerType, 30.6 ctx.env); 30.7 + c.setSynthesized(true); 30.8 return c; 30.9 } else { 30.10 return null; // errors should have been reported elsewhere
31.1 --- a/src/share/classes/com/sun/tools/javac/comp/Attr.java Thu Dec 27 12:15:17 2012 -0800 31.2 +++ b/src/share/classes/com/sun/tools/javac/comp/Attr.java Fri Dec 28 18:39:09 2012 -0800 31.3 @@ -1405,7 +1405,8 @@ 31.4 Type owntype = standaloneConditional ? condType(tree, truetype, falsetype) : pt(); 31.5 if (condtype.constValue() != null && 31.6 truetype.constValue() != null && 31.7 - falsetype.constValue() != null) { 31.8 + falsetype.constValue() != null && 31.9 + !owntype.hasTag(NONE)) { 31.10 //constant folding 31.11 owntype = cfolder.coerce(condtype.isTrue() ? truetype : falsetype, owntype); 31.12 }
32.1 --- a/src/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java Thu Dec 27 12:15:17 2012 -0800 32.2 +++ b/src/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java Fri Dec 28 18:39:09 2012 -0800 32.3 @@ -692,8 +692,9 @@ 32.4 //determine the static bsm args 32.5 Type mtype = makeFunctionalDescriptorType(targetType, true); 32.6 List<Object> staticArgs = List.<Object>of( 32.7 - new Pool.MethodHandle(ClassFile.REF_invokeInterface, types.findDescriptorSymbol(targetType.tsym)), 32.8 - new Pool.MethodHandle(refKind, refSym), 32.9 + new Pool.MethodHandle(ClassFile.REF_invokeInterface, 32.10 + types.findDescriptorSymbol(targetType.tsym), types), 32.11 + new Pool.MethodHandle(refKind, refSym, types), 32.12 new MethodType(mtype.getParameterTypes(), 32.13 mtype.getReturnType(), 32.14 mtype.getThrownTypes(),
33.1 --- a/src/share/classes/com/sun/tools/javac/comp/Resolve.java Thu Dec 27 12:15:17 2012 -0800 33.2 +++ b/src/share/classes/com/sun/tools/javac/comp/Resolve.java Fri Dec 28 18:39:09 2012 -0800 33.3 @@ -1798,6 +1798,9 @@ 33.4 33.5 if ((kind & TYP) != 0) { 33.6 sym = findType(env, name); 33.7 + if (sym.kind==TYP) { 33.8 + reportDependence(env.enclClass.sym, sym); 33.9 + } 33.10 if (sym.exists()) return sym; 33.11 else if (sym.kind < bestSoFar.kind) bestSoFar = sym; 33.12 } 33.13 @@ -1806,6 +1809,14 @@ 33.14 else return bestSoFar; 33.15 } 33.16 33.17 + /** Report dependencies. 33.18 + * @param from The enclosing class sym 33.19 + * @param to The found identifier that the class depends on. 33.20 + */ 33.21 + public void reportDependence(Symbol from, Symbol to) { 33.22 + // Override if you want to collect the reported dependencies. 33.23 + } 33.24 + 33.25 /** Find an identifier in a package which matches a specified kind set. 33.26 * @param env The current environment. 33.27 * @param name The identifier's name. 33.28 @@ -3064,16 +3075,20 @@ 33.29 if (hasLocation) { 33.30 return diags.create(dkind, log.currentSource(), pos, 33.31 errKey, kindname, idname, //symbol kindname, name 33.32 - typeargtypes, argtypes, //type parameters and arguments (if any) 33.33 + typeargtypes, args(argtypes), //type parameters and arguments (if any) 33.34 getLocationDiag(location, site)); //location kindname, type 33.35 } 33.36 else { 33.37 return diags.create(dkind, log.currentSource(), pos, 33.38 errKey, kindname, idname, //symbol kindname, name 33.39 - typeargtypes, argtypes); //type parameters and arguments (if any) 33.40 + typeargtypes, args(argtypes)); //type parameters and arguments (if any) 33.41 } 33.42 } 33.43 //where 33.44 + private Object args(List<Type> args) { 33.45 + return args.isEmpty() ? args : methodArguments(args); 33.46 + } 33.47 + 33.48 private String getErrorKey(KindName kindname, boolean hasTypeArgs, boolean hasLocation) { 33.49 String key = "cant.resolve"; 33.50 String suffix = hasLocation ? ".location" : "";
34.1 --- a/src/share/classes/com/sun/tools/javac/file/ZipFileIndex.java Thu Dec 27 12:15:17 2012 -0800 34.2 +++ b/src/share/classes/com/sun/tools/javac/file/ZipFileIndex.java Fri Dec 28 18:39:09 2012 -0800 34.3 @@ -548,17 +548,15 @@ 34.4 } 34.5 34.6 if (i >= 0) { 34.7 - zipDir = new byte[get4ByteLittleEndian(endbuf, i + 12) + 2]; 34.8 - zipDir[0] = endbuf[i + 10]; 34.9 - zipDir[1] = endbuf[i + 11]; 34.10 + zipDir = new byte[get4ByteLittleEndian(endbuf, i + 12)]; 34.11 int sz = get4ByteLittleEndian(endbuf, i + 16); 34.12 // a negative offset or the entries field indicates a 34.13 // potential zip64 archive 34.14 - if (sz < 0 || get2ByteLittleEndian(zipDir, 0) == 0xffff) { 34.15 + if (sz < 0 || get2ByteLittleEndian(endbuf, i + 10) == 0xffff) { 34.16 throw new ZipFormatException("detected a zip64 archive"); 34.17 } 34.18 zipRandomFile.seek(start + sz); 34.19 - zipRandomFile.readFully(zipDir, 2, zipDir.length - 2); 34.20 + zipRandomFile.readFully(zipDir, 0, zipDir.length); 34.21 return; 34.22 } else { 34.23 endbufend = endbufpos + 21; 34.24 @@ -568,14 +566,13 @@ 34.25 } 34.26 34.27 private void buildIndex() throws IOException { 34.28 - int entryCount = get2ByteLittleEndian(zipDir, 0); 34.29 + int len = zipDir.length; 34.30 34.31 // Add each of the files 34.32 - if (entryCount > 0) { 34.33 + if (len > 0) { 34.34 directories = new LinkedHashMap<RelativeDirectory, DirectoryEntry>(); 34.35 ArrayList<Entry> entryList = new ArrayList<Entry>(); 34.36 - int pos = 2; 34.37 - for (int i = 0; i < entryCount; i++) { 34.38 + for (int pos = 0; pos < len; ) { 34.39 pos = readEntry(pos, entryList, directories); 34.40 } 34.41
35.1 --- a/src/share/classes/com/sun/tools/javac/jvm/ClassFile.java Thu Dec 27 12:15:17 2012 -0800 35.2 +++ b/src/share/classes/com/sun/tools/javac/jvm/ClassFile.java Fri Dec 28 18:39:09 2012 -0800 35.3 @@ -26,6 +26,8 @@ 35.4 package com.sun.tools.javac.jvm; 35.5 35.6 import com.sun.tools.javac.code.Type; 35.7 +import com.sun.tools.javac.code.Types; 35.8 +import com.sun.tools.javac.code.Types.UniqueType; 35.9 import com.sun.tools.javac.util.Name; 35.10 35.11 35.12 @@ -166,22 +168,29 @@ 35.13 */ 35.14 public static class NameAndType { 35.15 Name name; 35.16 - Type type; 35.17 + UniqueType uniqueType; 35.18 + Types types; 35.19 35.20 - NameAndType(Name name, Type type) { 35.21 + NameAndType(Name name, Type type, Types types) { 35.22 this.name = name; 35.23 - this.type = type; 35.24 + this.uniqueType = new UniqueType(type, types); 35.25 + this.types = types; 35.26 } 35.27 35.28 - public boolean equals(Object other) { 35.29 - return 35.30 - other instanceof NameAndType && 35.31 - name == ((NameAndType) other).name && 35.32 - type.equals(((NameAndType) other).type); 35.33 + void setType(Type type) { 35.34 + this.uniqueType = new UniqueType(type, types); 35.35 } 35.36 35.37 + @Override 35.38 + public boolean equals(Object other) { 35.39 + return (other instanceof NameAndType && 35.40 + name == ((NameAndType) other).name && 35.41 + uniqueType.equals(((NameAndType) other).uniqueType)); 35.42 + } 35.43 + 35.44 + @Override 35.45 public int hashCode() { 35.46 - return name.hashCode() * type.hashCode(); 35.47 + return name.hashCode() * uniqueType.hashCode(); 35.48 } 35.49 } 35.50 }
36.1 --- a/src/share/classes/com/sun/tools/javac/jvm/ClassReader.java Thu Dec 27 12:15:17 2012 -0800 36.2 +++ b/src/share/classes/com/sun/tools/javac/jvm/ClassReader.java Fri Dec 28 18:39:09 2012 -0800 36.3 @@ -488,20 +488,20 @@ 36.4 case CONSTANT_Fieldref: { 36.5 ClassSymbol owner = readClassSymbol(getChar(index + 1)); 36.6 NameAndType nt = (NameAndType)readPool(getChar(index + 3)); 36.7 - poolObj[i] = new VarSymbol(0, nt.name, nt.type, owner); 36.8 + poolObj[i] = new VarSymbol(0, nt.name, nt.uniqueType.type, owner); 36.9 break; 36.10 } 36.11 case CONSTANT_Methodref: 36.12 case CONSTANT_InterfaceMethodref: { 36.13 ClassSymbol owner = readClassSymbol(getChar(index + 1)); 36.14 NameAndType nt = (NameAndType)readPool(getChar(index + 3)); 36.15 - poolObj[i] = new MethodSymbol(0, nt.name, nt.type, owner); 36.16 + poolObj[i] = new MethodSymbol(0, nt.name, nt.uniqueType.type, owner); 36.17 break; 36.18 } 36.19 case CONSTANT_NameandType: 36.20 poolObj[i] = new NameAndType( 36.21 readName(getChar(index + 1)), 36.22 - readType(getChar(index + 3))); 36.23 + readType(getChar(index + 3)), types); 36.24 break; 36.25 case CONSTANT_Integer: 36.26 poolObj[i] = getInt(index + 1); 36.27 @@ -1224,7 +1224,7 @@ 36.28 if (nt == null) 36.29 return null; 36.30 36.31 - MethodType type = nt.type.asMethodType(); 36.32 + MethodType type = nt.uniqueType.type.asMethodType(); 36.33 36.34 for (Scope.Entry e = scope.lookup(nt.name); e.scope != null; e = e.next()) 36.35 if (e.sym.kind == MTH && isSameBinaryType(e.sym.type.asMethodType(), type)) 36.36 @@ -1236,16 +1236,16 @@ 36.37 if ((flags & INTERFACE) != 0) 36.38 // no enclosing instance 36.39 return null; 36.40 - if (nt.type.getParameterTypes().isEmpty()) 36.41 + if (nt.uniqueType.type.getParameterTypes().isEmpty()) 36.42 // no parameters 36.43 return null; 36.44 36.45 // A constructor of an inner class. 36.46 // Remove the first argument (the enclosing instance) 36.47 - nt.type = new MethodType(nt.type.getParameterTypes().tail, 36.48 - nt.type.getReturnType(), 36.49 - nt.type.getThrownTypes(), 36.50 - syms.methodClass); 36.51 + nt.setType(new MethodType(nt.uniqueType.type.getParameterTypes().tail, 36.52 + nt.uniqueType.type.getReturnType(), 36.53 + nt.uniqueType.type.getThrownTypes(), 36.54 + syms.methodClass)); 36.55 // Try searching again 36.56 return findMethod(nt, scope, flags); 36.57 } 36.58 @@ -1959,7 +1959,7 @@ 36.59 36.60 if (readAllOfClassFile) { 36.61 for (int i = 1; i < poolObj.length; i++) readPool(i); 36.62 - c.pool = new Pool(poolObj.length, poolObj); 36.63 + c.pool = new Pool(poolObj.length, poolObj, types); 36.64 } 36.65 36.66 // reset and read rest of classinfo
37.1 --- a/src/share/classes/com/sun/tools/javac/jvm/ClassWriter.java Thu Dec 27 12:15:17 2012 -0800 37.2 +++ b/src/share/classes/com/sun/tools/javac/jvm/ClassWriter.java Fri Dec 28 18:39:09 2012 -0800 37.3 @@ -39,7 +39,12 @@ 37.4 import com.sun.tools.javac.code.Attribute.RetentionPolicy; 37.5 import com.sun.tools.javac.code.Symbol.*; 37.6 import com.sun.tools.javac.code.Type.*; 37.7 +import com.sun.tools.javac.code.Types.UniqueType; 37.8 import com.sun.tools.javac.file.BaseFileObject; 37.9 +import com.sun.tools.javac.jvm.Pool.DynamicMethod; 37.10 +import com.sun.tools.javac.jvm.Pool.Method; 37.11 +import com.sun.tools.javac.jvm.Pool.MethodHandle; 37.12 +import com.sun.tools.javac.jvm.Pool.Variable; 37.13 import com.sun.tools.javac.util.*; 37.14 37.15 import static com.sun.tools.javac.code.BoundKind.*; 37.16 @@ -142,7 +147,7 @@ 37.17 /** The bootstrap methods to be written in the corresponding class attribute 37.18 * (one for each invokedynamic) 37.19 */ 37.20 - Map<MethodSymbol, Pool.MethodHandle> bootstrapMethods; 37.21 + Map<DynamicMethod, MethodHandle> bootstrapMethods; 37.22 37.23 /** The log to use for verbose output. 37.24 */ 37.25 @@ -477,10 +482,10 @@ 37.26 while (i < pool.pp) { 37.27 Object value = pool.pool[i]; 37.28 Assert.checkNonNull(value); 37.29 - if (value instanceof Pool.Method) 37.30 - value = ((Pool.Method)value).m; 37.31 - else if (value instanceof Pool.Variable) 37.32 - value = ((Pool.Variable)value).v; 37.33 + if (value instanceof Method) 37.34 + value = ((Method)value).m; 37.35 + else if (value instanceof Variable) 37.36 + value = ((Variable)value).v; 37.37 37.38 if (value instanceof MethodSymbol) { 37.39 MethodSymbol m = (MethodSymbol)value; 37.40 @@ -493,8 +498,9 @@ 37.41 } else { 37.42 //invokedynamic 37.43 DynamicMethodSymbol dynSym = (DynamicMethodSymbol)m; 37.44 - Pool.MethodHandle handle = new Pool.MethodHandle(dynSym.bsmKind, dynSym.bsm); 37.45 - bootstrapMethods.put(dynSym, handle); 37.46 + MethodHandle handle = new MethodHandle(dynSym.bsmKind, dynSym.bsm, types); 37.47 + DynamicMethod dynMeth = new DynamicMethod(dynSym, types); 37.48 + bootstrapMethods.put(dynMeth, handle); 37.49 //init cp entries 37.50 pool.put(names.BootstrapMethods); 37.51 pool.put(handle); 37.52 @@ -531,7 +537,7 @@ 37.53 NameAndType nt = (NameAndType)value; 37.54 poolbuf.appendByte(CONSTANT_NameandType); 37.55 poolbuf.appendChar(pool.put(nt.name)); 37.56 - poolbuf.appendChar(pool.put(typeSig(nt.type))); 37.57 + poolbuf.appendChar(pool.put(typeSig(nt.uniqueType.type))); 37.58 } else if (value instanceof Integer) { 37.59 poolbuf.appendByte(CONSTANT_Integer); 37.60 poolbuf.appendInt(((Integer)value).intValue()); 37.61 @@ -549,17 +555,18 @@ 37.62 } else if (value instanceof String) { 37.63 poolbuf.appendByte(CONSTANT_String); 37.64 poolbuf.appendChar(pool.put(names.fromString((String)value))); 37.65 - } else if (value instanceof MethodType) { 37.66 - MethodType mtype = (MethodType)value; 37.67 - poolbuf.appendByte(CONSTANT_MethodType); 37.68 - poolbuf.appendChar(pool.put(typeSig(mtype))); 37.69 - } else if (value instanceof Type) { 37.70 - Type type = (Type)value; 37.71 - if (type.hasTag(CLASS)) enterInner((ClassSymbol)type.tsym); 37.72 - poolbuf.appendByte(CONSTANT_Class); 37.73 - poolbuf.appendChar(pool.put(xClassName(type))); 37.74 - } else if (value instanceof Pool.MethodHandle) { 37.75 - Pool.MethodHandle ref = (Pool.MethodHandle)value; 37.76 + } else if (value instanceof UniqueType) { 37.77 + Type type = ((UniqueType)value).type; 37.78 + if (type instanceof MethodType) { 37.79 + poolbuf.appendByte(CONSTANT_MethodType); 37.80 + poolbuf.appendChar(pool.put(typeSig((MethodType)type))); 37.81 + } else { 37.82 + if (type.hasTag(CLASS)) enterInner((ClassSymbol)type.tsym); 37.83 + poolbuf.appendByte(CONSTANT_Class); 37.84 + poolbuf.appendChar(pool.put(xClassName(type))); 37.85 + } 37.86 + } else if (value instanceof MethodHandle) { 37.87 + MethodHandle ref = (MethodHandle)value; 37.88 poolbuf.appendByte(CONSTANT_MethodHandle); 37.89 poolbuf.appendByte(ref.refKind); 37.90 poolbuf.appendChar(pool.put(ref.refSym)); 37.91 @@ -589,7 +596,7 @@ 37.92 return new NameAndType(fieldName(sym), 37.93 retrofit 37.94 ? sym.erasure(types) 37.95 - : sym.externalType(types)); 37.96 + : sym.externalType(types), types); 37.97 // if we retrofit, then the NameAndType has been read in as is 37.98 // and no change is necessary. If we compile normally, the 37.99 // NameAndType is generated from a symbol reference, and the 37.100 @@ -714,7 +721,7 @@ 37.101 endAttr(alenIdx); 37.102 acount++; 37.103 } 37.104 - acount += writeJavaAnnotations(sym.getAnnotationMirrors()); 37.105 + acount += writeJavaAnnotations(sym.getRawAttributes()); 37.106 return acount; 37.107 } 37.108 37.109 @@ -725,7 +732,7 @@ 37.110 boolean hasVisible = false; 37.111 boolean hasInvisible = false; 37.112 if (m.params != null) for (VarSymbol s : m.params) { 37.113 - for (Attribute.Compound a : s.getAnnotationMirrors()) { 37.114 + for (Attribute.Compound a : s.getRawAttributes()) { 37.115 switch (types.getRetention(a)) { 37.116 case SOURCE: break; 37.117 case CLASS: hasInvisible = true; break; 37.118 @@ -741,7 +748,7 @@ 37.119 databuf.appendByte(m.params.length()); 37.120 for (VarSymbol s : m.params) { 37.121 ListBuffer<Attribute.Compound> buf = new ListBuffer<Attribute.Compound>(); 37.122 - for (Attribute.Compound a : s.getAnnotationMirrors()) 37.123 + for (Attribute.Compound a : s.getRawAttributes()) 37.124 if (types.getRetention(a) == RetentionPolicy.RUNTIME) 37.125 buf.append(a); 37.126 databuf.appendChar(buf.length()); 37.127 @@ -756,7 +763,7 @@ 37.128 databuf.appendByte(m.params.length()); 37.129 for (VarSymbol s : m.params) { 37.130 ListBuffer<Attribute.Compound> buf = new ListBuffer<Attribute.Compound>(); 37.131 - for (Attribute.Compound a : s.getAnnotationMirrors()) 37.132 + for (Attribute.Compound a : s.getRawAttributes()) 37.133 if (types.getRetention(a) == RetentionPolicy.CLASS) 37.134 buf.append(a); 37.135 databuf.appendChar(buf.length()); 37.136 @@ -951,14 +958,16 @@ 37.137 void writeBootstrapMethods() { 37.138 int alenIdx = writeAttr(names.BootstrapMethods); 37.139 databuf.appendChar(bootstrapMethods.size()); 37.140 - for (Map.Entry<MethodSymbol, Pool.MethodHandle> entry : bootstrapMethods.entrySet()) { 37.141 - DynamicMethodSymbol dsym = (DynamicMethodSymbol)entry.getKey(); 37.142 + for (Map.Entry<DynamicMethod, MethodHandle> entry : bootstrapMethods.entrySet()) { 37.143 + DynamicMethod dmeth = entry.getKey(); 37.144 + DynamicMethodSymbol dsym = (DynamicMethodSymbol)dmeth.baseSymbol(); 37.145 //write BSM handle 37.146 databuf.appendChar(pool.get(entry.getValue())); 37.147 //write static args length 37.148 databuf.appendChar(dsym.staticArgs.length); 37.149 //write static args array 37.150 - for (Object o : dsym.staticArgs) { 37.151 + Object[] uniqueArgs = dmeth.uniqueStaticArgs; 37.152 + for (Object o : uniqueArgs) { 37.153 databuf.appendChar(pool.get(o)); 37.154 } 37.155 } 37.156 @@ -1534,7 +1543,7 @@ 37.157 pool = c.pool; 37.158 innerClasses = null; 37.159 innerClassesQueue = null; 37.160 - bootstrapMethods = new LinkedHashMap<MethodSymbol, Pool.MethodHandle>(); 37.161 + bootstrapMethods = new LinkedHashMap<DynamicMethod, MethodHandle>(); 37.162 37.163 Type supertype = types.supertype(c.type); 37.164 List<Type> interfaces = types.interfaces(c.type); 37.165 @@ -1627,7 +1636,7 @@ 37.166 } 37.167 37.168 acount += writeFlagAttrs(c.flags()); 37.169 - acount += writeJavaAnnotations(c.getAnnotationMirrors()); 37.170 + acount += writeJavaAnnotations(c.getRawAttributes()); 37.171 acount += writeEnclosingMethodAttribute(c); 37.172 acount += writeExtraClassAttributes(c); 37.173
38.1 --- a/src/share/classes/com/sun/tools/javac/jvm/Code.java Thu Dec 27 12:15:17 2012 -0800 38.2 +++ b/src/share/classes/com/sun/tools/javac/jvm/Code.java Fri Dec 28 18:39:09 2012 -0800 38.3 @@ -27,6 +27,7 @@ 38.4 38.5 import com.sun.tools.javac.code.*; 38.6 import com.sun.tools.javac.code.Symbol.*; 38.7 +import com.sun.tools.javac.code.Types.UniqueType; 38.8 import com.sun.tools.javac.util.*; 38.9 import com.sun.tools.javac.util.JCDiagnostic.DiagnosticPosition; 38.10 38.11 @@ -901,6 +902,7 @@ 38.12 if (o instanceof ClassSymbol) return syms.classType; 38.13 if (o instanceof Type.ArrayType) return syms.classType; 38.14 if (o instanceof Type.MethodType) return syms.methodTypeType; 38.15 + if (o instanceof UniqueType) return typeForPool(((UniqueType)o).type); 38.16 if (o instanceof Pool.MethodHandle) return syms.methodHandleType; 38.17 throw new AssertionError(o); 38.18 } 38.19 @@ -1030,7 +1032,7 @@ 38.20 Object o = pool.pool[od]; 38.21 Type t = (o instanceof Symbol) 38.22 ? ((Symbol)o).erasure(types) 38.23 - : types.erasure(((Type)o)); 38.24 + : types.erasure((((UniqueType)o).type)); 38.25 state.push(t); 38.26 break; } 38.27 case ldc2w:
39.1 --- a/src/share/classes/com/sun/tools/javac/jvm/Gen.java Thu Dec 27 12:15:17 2012 -0800 39.2 +++ b/src/share/classes/com/sun/tools/javac/jvm/Gen.java Fri Dec 28 18:39:09 2012 -0800 39.3 @@ -94,6 +94,10 @@ 39.4 return instance; 39.5 } 39.6 39.7 + /* Constant pool, reset by genClass. 39.8 + */ 39.9 + private Pool pool; 39.10 + 39.11 protected Gen(Context context) { 39.12 context.put(genKey, this); 39.13 39.14 @@ -126,6 +130,7 @@ 39.15 genCrt = options.isSet(XJCOV); 39.16 debugCode = options.isSet("debugcode"); 39.17 allowInvokedynamic = target.hasInvokedynamic() || options.isSet("invokedynamic"); 39.18 + pool = new Pool(types); 39.19 39.20 generateIproxies = 39.21 target.requiresIproxy() || 39.22 @@ -174,10 +179,6 @@ 39.23 */ 39.24 private boolean useJsrLocally; 39.25 39.26 - /* Constant pool, reset by genClass. 39.27 - */ 39.28 - private Pool pool = new Pool(); 39.29 - 39.30 /** Code buffer, set by genMethod. 39.31 */ 39.32 private Code code; 39.33 @@ -705,7 +706,7 @@ 39.34 } 39.35 int startpc = code.curPc(); 39.36 genStat(tree, env); 39.37 - if (tree.hasTag(BLOCK)) crtFlags |= CRT_BLOCK; 39.38 + if (tree.hasTag(Tag.BLOCK)) crtFlags |= CRT_BLOCK; 39.39 code.crt.put(tree, crtFlags, startpc, code.curPc()); 39.40 } 39.41
40.1 --- a/src/share/classes/com/sun/tools/javac/jvm/Pool.java Thu Dec 27 12:15:17 2012 -0800 40.2 +++ b/src/share/classes/com/sun/tools/javac/jvm/Pool.java Fri Dec 28 18:39:09 2012 -0800 40.3 @@ -28,6 +28,9 @@ 40.4 import com.sun.tools.javac.code.Kinds; 40.5 import com.sun.tools.javac.code.Symbol; 40.6 import com.sun.tools.javac.code.Symbol.*; 40.7 +import com.sun.tools.javac.code.Type; 40.8 +import com.sun.tools.javac.code.Types; 40.9 +import com.sun.tools.javac.code.Types.UniqueType; 40.10 40.11 import com.sun.tools.javac.util.ArrayUtils; 40.12 import com.sun.tools.javac.util.Assert; 40.13 @@ -60,11 +63,14 @@ 40.14 */ 40.15 Map<Object,Integer> indices; 40.16 40.17 + Types types; 40.18 + 40.19 /** Construct a pool with given number of elements and element array. 40.20 */ 40.21 - public Pool(int pp, Object[] pool) { 40.22 + public Pool(int pp, Object[] pool, Types types) { 40.23 this.pp = pp; 40.24 this.pool = pool; 40.25 + this.types = types; 40.26 this.indices = new HashMap<Object,Integer>(pool.length); 40.27 for (int i = 1; i < pp; i++) { 40.28 if (pool[i] != null) indices.put(pool[i], i); 40.29 @@ -73,8 +79,8 @@ 40.30 40.31 /** Construct an empty pool. 40.32 */ 40.33 - public Pool() { 40.34 - this(1, new Object[64]); 40.35 + public Pool(Types types) { 40.36 + this(1, new Object[64], types); 40.37 } 40.38 40.39 /** Return the number of entries in the constant pool. 40.40 @@ -114,11 +120,13 @@ 40.41 40.42 Object makePoolValue(Object o) { 40.43 if (o instanceof DynamicMethodSymbol) { 40.44 - return new DynamicMethod((DynamicMethodSymbol)o); 40.45 + return new DynamicMethod((DynamicMethodSymbol)o, types); 40.46 } else if (o instanceof MethodSymbol) { 40.47 - return new Method((MethodSymbol)o); 40.48 + return new Method((MethodSymbol)o, types); 40.49 } else if (o instanceof VarSymbol) { 40.50 - return new Variable((VarSymbol)o); 40.51 + return new Variable((VarSymbol)o, types); 40.52 + } else if (o instanceof Type) { 40.53 + return new UniqueType((Type)o, types); 40.54 } else { 40.55 return o; 40.56 } 40.57 @@ -134,9 +142,11 @@ 40.58 40.59 static class Method extends DelegatedSymbol { 40.60 MethodSymbol m; 40.61 - Method(MethodSymbol m) { 40.62 + UniqueType uniqueType; 40.63 + Method(MethodSymbol m, Types types) { 40.64 super(m); 40.65 this.m = m; 40.66 + this.uniqueType = new UniqueType(m.type, types); 40.67 } 40.68 public boolean equals(Object other) { 40.69 if (!(other instanceof Method)) return false; 40.70 @@ -144,20 +154,22 @@ 40.71 return 40.72 o.name == m.name && 40.73 o.owner == m.owner && 40.74 - o.type.equals(m.type); 40.75 + ((Method)other).uniqueType.equals(uniqueType); 40.76 } 40.77 public int hashCode() { 40.78 return 40.79 m.name.hashCode() * 33 + 40.80 m.owner.hashCode() * 9 + 40.81 - m.type.hashCode(); 40.82 + uniqueType.hashCode(); 40.83 } 40.84 } 40.85 40.86 static class DynamicMethod extends Method { 40.87 + public Object[] uniqueStaticArgs; 40.88 40.89 - DynamicMethod(DynamicMethodSymbol m) { 40.90 - super(m); 40.91 + DynamicMethod(DynamicMethodSymbol m, Types types) { 40.92 + super(m, types); 40.93 + uniqueStaticArgs = getUniqueTypeArray(m.staticArgs, types); 40.94 } 40.95 40.96 @Override 40.97 @@ -168,7 +180,8 @@ 40.98 DynamicMethodSymbol dm2 = (DynamicMethodSymbol)((DynamicMethod)other).m; 40.99 return dm1.bsm == dm2.bsm && 40.100 dm1.bsmKind == dm2.bsmKind && 40.101 - Arrays.equals(dm1.staticArgs, dm2.staticArgs); 40.102 + Arrays.equals(uniqueStaticArgs, 40.103 + ((DynamicMethod)other).uniqueStaticArgs); 40.104 } 40.105 40.106 @Override 40.107 @@ -178,17 +191,31 @@ 40.108 hash += dm.bsmKind * 7 + 40.109 dm.bsm.hashCode() * 11; 40.110 for (int i = 0; i < dm.staticArgs.length; i++) { 40.111 - hash += (dm.staticArgs[i].hashCode() * 23); 40.112 + hash += (uniqueStaticArgs[i].hashCode() * 23); 40.113 } 40.114 return hash; 40.115 } 40.116 + 40.117 + private Object[] getUniqueTypeArray(Object[] objects, Types types) { 40.118 + Object[] result = new Object[objects.length]; 40.119 + for (int i = 0; i < objects.length; i++) { 40.120 + if (objects[i] instanceof Type) { 40.121 + result[i] = new UniqueType((Type)objects[i], types); 40.122 + } else { 40.123 + result[i] = objects[i]; 40.124 + } 40.125 + } 40.126 + return result; 40.127 + } 40.128 } 40.129 40.130 static class Variable extends DelegatedSymbol { 40.131 VarSymbol v; 40.132 - Variable(VarSymbol v) { 40.133 + UniqueType uniqueType; 40.134 + Variable(VarSymbol v, Types types) { 40.135 super(v); 40.136 this.v = v; 40.137 + this.uniqueType = new UniqueType(v.type, types); 40.138 } 40.139 public boolean equals(Object other) { 40.140 if (!(other instanceof Variable)) return false; 40.141 @@ -196,13 +223,13 @@ 40.142 return 40.143 o.name == v.name && 40.144 o.owner == v.owner && 40.145 - o.type.equals(v.type); 40.146 + ((Variable)other).uniqueType.equals(uniqueType); 40.147 } 40.148 public int hashCode() { 40.149 return 40.150 v.name.hashCode() * 33 + 40.151 v.owner.hashCode() * 9 + 40.152 - v.type.hashCode(); 40.153 + uniqueType.hashCode(); 40.154 } 40.155 } 40.156 40.157 @@ -214,9 +241,12 @@ 40.158 /** Reference symbol */ 40.159 Symbol refSym; 40.160 40.161 - public MethodHandle(int refKind, Symbol refSym) { 40.162 + UniqueType uniqueType; 40.163 + 40.164 + public MethodHandle(int refKind, Symbol refSym, Types types) { 40.165 this.refKind = refKind; 40.166 this.refSym = refSym; 40.167 + this.uniqueType = new UniqueType(this.refSym.type, types); 40.168 checkConsistent(); 40.169 } 40.170 public boolean equals(Object other) { 40.171 @@ -227,14 +257,14 @@ 40.172 return 40.173 o.name == refSym.name && 40.174 o.owner == refSym.owner && 40.175 - o.type.equals(refSym.type); 40.176 + ((MethodHandle)other).uniqueType.equals(uniqueType); 40.177 } 40.178 public int hashCode() { 40.179 return 40.180 refKind * 65 + 40.181 refSym.name.hashCode() * 33 + 40.182 refSym.owner.hashCode() * 9 + 40.183 - refSym.type.hashCode(); 40.184 + uniqueType.hashCode(); 40.185 } 40.186 40.187 /**
41.1 --- a/src/share/classes/com/sun/tools/javac/main/JavaCompiler.java Thu Dec 27 12:15:17 2012 -0800 41.2 +++ b/src/share/classes/com/sun/tools/javac/main/JavaCompiler.java Fri Dec 28 18:39:09 2012 -0800 41.3 @@ -928,6 +928,16 @@ 41.4 } 41.5 } 41.6 41.7 + /** 41.8 + * Set needRootClasses to true, in JavaCompiler subclass constructor 41.9 + * that want to collect public apis of classes supplied on the command line. 41.10 + */ 41.11 + protected boolean needRootClasses = false; 41.12 + 41.13 + /** 41.14 + * The list of classes explicitly supplied on the command line for compilation. 41.15 + * Not always populated. 41.16 + */ 41.17 private List<JCClassDecl> rootClasses; 41.18 41.19 /** 41.20 @@ -984,9 +994,10 @@ 41.21 } 41.22 } 41.23 41.24 - //If generating source, remember the classes declared in 41.25 - //the original compilation units listed on the command line. 41.26 - if (sourceOutput || stubOutput) { 41.27 + // If generating source, or if tracking public apis, 41.28 + // then remember the classes declared in 41.29 + // the original compilation units listed on the command line. 41.30 + if (needRootClasses || sourceOutput || stubOutput) { 41.31 ListBuffer<JCClassDecl> cdefs = lb(); 41.32 for (JCCompilationUnit unit : roots) { 41.33 for (List<JCTree> defs = unit.defs; 41.34 @@ -1247,6 +1258,12 @@ 41.35 attr.postAttr(env.tree); 41.36 } 41.37 compileStates.put(env, CompileState.ATTR); 41.38 + if (rootClasses != null && rootClasses.contains(env.enclClass)) { 41.39 + // This was a class that was explicitly supplied for compilation. 41.40 + // If we want to capture the public api of this class, 41.41 + // then now is a good time to do it. 41.42 + reportPublicApi(env.enclClass.sym); 41.43 + } 41.44 } 41.45 finally { 41.46 log.useSource(prev); 41.47 @@ -1255,6 +1272,14 @@ 41.48 return env; 41.49 } 41.50 41.51 + /** Report the public api of a class that was supplied explicitly for compilation, 41.52 + * for example on the command line to javac. 41.53 + * @param sym The symbol of the class. 41.54 + */ 41.55 + public void reportPublicApi(ClassSymbol sym) { 41.56 + // Override to collect the reported public api. 41.57 + } 41.58 + 41.59 /** 41.60 * Perform dataflow checks on attributed parse trees. 41.61 * These include checks for definite assignment and unreachable statements. 41.62 @@ -1675,7 +1700,7 @@ 41.63 41.64 /** Print numbers of errors and warnings. 41.65 */ 41.66 - protected void printCount(String kind, int count) { 41.67 + public void printCount(String kind, int count) { 41.68 if (count != 0) { 41.69 String key; 41.70 if (count == 1)
42.1 --- a/src/share/classes/com/sun/tools/javac/main/Main.java Thu Dec 27 12:15:17 2012 -0800 42.2 +++ b/src/share/classes/com/sun/tools/javac/main/Main.java Fri Dec 28 18:39:09 2012 -0800 42.3 @@ -44,6 +44,8 @@ 42.4 42.5 import com.sun.source.util.JavacTask; 42.6 import com.sun.source.util.Plugin; 42.7 +import com.sun.tools.doclint.DocLint; 42.8 +import com.sun.tools.javac.api.BasicJavacTask; 42.9 import com.sun.tools.javac.code.Source; 42.10 import com.sun.tools.javac.file.CacheFSInfo; 42.11 import com.sun.tools.javac.file.JavacFileManager; 42.12 @@ -428,6 +430,7 @@ 42.13 if (batchMode) 42.14 CacheFSInfo.preRegister(context); 42.15 42.16 + // FIXME: this code will not be invoked if using JavacTask.parse/analyze/generate 42.17 // invoke any available plugins 42.18 String plugins = options.get(PLUGIN); 42.19 if (plugins != null) { 42.20 @@ -448,7 +451,7 @@ 42.21 try { 42.22 if (task == null) 42.23 task = JavacTask.instance(pEnv); 42.24 - plugin.call(task, p.tail.toArray(new String[p.tail.size()])); 42.25 + plugin.init(task, p.tail.toArray(new String[p.tail.size()])); 42.26 } catch (Throwable ex) { 42.27 if (apiMode) 42.28 throw new RuntimeException(ex); 42.29 @@ -464,11 +467,32 @@ 42.30 } 42.31 } 42.32 42.33 + comp = JavaCompiler.instance(context); 42.34 + 42.35 + // FIXME: this code will not be invoked if using JavacTask.parse/analyze/generate 42.36 + String xdoclint = options.get(XDOCLINT); 42.37 + String xdoclintCustom = options.get(XDOCLINT_CUSTOM); 42.38 + if (xdoclint != null || xdoclintCustom != null) { 42.39 + Set<String> doclintOpts = new LinkedHashSet<String>(); 42.40 + if (xdoclint != null) 42.41 + doclintOpts.add(DocLint.XMSGS_OPTION); 42.42 + if (xdoclintCustom != null) { 42.43 + for (String s: xdoclintCustom.split("\\s+")) { 42.44 + if (s.isEmpty()) 42.45 + continue; 42.46 + doclintOpts.add(s.replace(XDOCLINT_CUSTOM.text, DocLint.XMSGS_CUSTOM_PREFIX)); 42.47 + } 42.48 + } 42.49 + if (!(doclintOpts.size() == 1 42.50 + && doclintOpts.iterator().next().equals(DocLint.XMSGS_CUSTOM_PREFIX + "none"))) { 42.51 + JavacTask t = BasicJavacTask.instance(context); 42.52 + new DocLint().init(t, doclintOpts.toArray(new String[doclintOpts.size()])); 42.53 + comp.keepComments = true; 42.54 + } 42.55 + } 42.56 + 42.57 fileManager = context.get(JavaFileManager.class); 42.58 42.59 - comp = JavaCompiler.instance(context); 42.60 - if (comp == null) return Result.SYSERR; 42.61 - 42.62 if (!files.isEmpty()) { 42.63 // add filenames to fileObjects 42.64 comp = JavaCompiler.instance(context);
43.1 --- a/src/share/classes/com/sun/tools/javac/main/Option.java Thu Dec 27 12:15:17 2012 -0800 43.2 +++ b/src/share/classes/com/sun/tools/javac/main/Option.java Fri Dec 28 18:39:09 2012 -0800 43.3 @@ -25,28 +25,30 @@ 43.4 43.5 package com.sun.tools.javac.main; 43.6 43.7 +import java.io.File; 43.8 +import java.io.FileWriter; 43.9 +import java.io.PrintWriter; 43.10 import java.util.Collections; 43.11 -import com.sun.tools.javac.util.Log.PrefixKind; 43.12 -import com.sun.tools.javac.util.Log.WriterKind; 43.13 -import com.sun.tools.javac.util.Log; 43.14 +import java.util.EnumSet; 43.15 +import java.util.LinkedHashMap; 43.16 +import java.util.Map; 43.17 +import java.util.Set; 43.18 + 43.19 +import javax.lang.model.SourceVersion; 43.20 + 43.21 +import com.sun.tools.doclint.DocLint; 43.22 import com.sun.tools.javac.code.Lint; 43.23 import com.sun.tools.javac.code.Source; 43.24 import com.sun.tools.javac.code.Type; 43.25 import com.sun.tools.javac.jvm.Target; 43.26 +import com.sun.tools.javac.processing.JavacProcessingEnvironment; 43.27 +import com.sun.tools.javac.util.Log; 43.28 +import com.sun.tools.javac.util.Log.PrefixKind; 43.29 +import com.sun.tools.javac.util.Log.WriterKind; 43.30 import com.sun.tools.javac.util.Options; 43.31 -import com.sun.tools.javac.processing.JavacProcessingEnvironment; 43.32 -import java.io.File; 43.33 -import java.io.FileWriter; 43.34 -import java.io.PrintWriter; 43.35 -import java.util.EnumSet; 43.36 -import java.util.LinkedHashMap; 43.37 -import java.util.Map; 43.38 -import java.util.Set; 43.39 -import javax.lang.model.SourceVersion; 43.40 - 43.41 import static com.sun.tools.javac.main.Option.ChoiceKind.*; 43.42 +import static com.sun.tools.javac.main.Option.OptionGroup.*; 43.43 import static com.sun.tools.javac.main.Option.OptionKind.*; 43.44 -import static com.sun.tools.javac.main.Option.OptionGroup.*; 43.45 43.46 /** 43.47 * Options for javac. The specific Option to handle a command-line option 43.48 @@ -79,6 +81,24 @@ 43.49 XLINT_CUSTOM("-Xlint:", "opt.Xlint.suboptlist", 43.50 EXTENDED, BASIC, ANYOF, getXLintChoices()), 43.51 43.52 + XDOCLINT("-Xdoclint", "opt.Xdoclint", EXTENDED, BASIC), 43.53 + 43.54 + XDOCLINT_CUSTOM("-Xdoclint:", "opt.Xdoclint.subopts", "opt.Xdoclint.custom", EXTENDED, BASIC) { 43.55 + @Override 43.56 + public boolean matches(String option) { 43.57 + return DocLint.isValidOption( 43.58 + option.replace(XDOCLINT_CUSTOM.text, DocLint.XMSGS_CUSTOM_PREFIX)); 43.59 + } 43.60 + 43.61 + @Override 43.62 + public boolean process(OptionHelper helper, String option) { 43.63 + String prev = helper.get(XDOCLINT_CUSTOM); 43.64 + String next = (prev == null) ? option : (prev + " " + option); 43.65 + helper.put(XDOCLINT_CUSTOM.text, next); 43.66 + return false; 43.67 + } 43.68 + }, 43.69 + 43.70 // -nowarn is retained for command-line backward compatibility 43.71 NOWARN("-nowarn", "opt.nowarn", STANDARD, BASIC) { 43.72 @Override
44.1 --- a/src/share/classes/com/sun/tools/javac/model/JavacTypes.java Thu Dec 27 12:15:17 2012 -0800 44.2 +++ b/src/share/classes/com/sun/tools/javac/model/JavacTypes.java Fri Dec 28 18:39:09 2012 -0800 44.3 @@ -1,5 +1,5 @@ 44.4 /* 44.5 - * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved. 44.6 + * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved. 44.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 44.8 * 44.9 * This code is free software; you can redistribute it and/or modify it 44.10 @@ -25,11 +25,16 @@ 44.11 44.12 package com.sun.tools.javac.model; 44.13 44.14 +import java.util.Collections; 44.15 +import java.util.EnumSet; 44.16 +import java.util.HashSet; 44.17 +import java.util.LinkedHashSet; 44.18 import java.util.List; 44.19 import java.util.Set; 44.20 -import java.util.EnumSet; 44.21 + 44.22 import javax.lang.model.element.*; 44.23 import javax.lang.model.type.*; 44.24 + 44.25 import com.sun.tools.javac.code.*; 44.26 import com.sun.tools.javac.code.Symbol.*; 44.27 import com.sun.tools.javac.util.*; 44.28 @@ -301,4 +306,31 @@ 44.29 throw new IllegalArgumentException(o.toString()); 44.30 return clazz.cast(o); 44.31 } 44.32 + 44.33 + public Set<MethodSymbol> getOverriddenMethods(Element elem) { 44.34 + if (elem.getKind() != ElementKind.METHOD 44.35 + || elem.getModifiers().contains(Modifier.STATIC) 44.36 + || elem.getModifiers().contains(Modifier.PRIVATE)) 44.37 + return Collections.emptySet(); 44.38 + 44.39 + if (!(elem instanceof MethodSymbol)) 44.40 + throw new IllegalArgumentException(); 44.41 + 44.42 + MethodSymbol m = (MethodSymbol) elem; 44.43 + ClassSymbol origin = (ClassSymbol) m.owner; 44.44 + 44.45 + Set<MethodSymbol> results = new LinkedHashSet<MethodSymbol>(); 44.46 + for (Type t : types.closure(origin.type)) { 44.47 + if (t != origin.type) { 44.48 + ClassSymbol c = (ClassSymbol) t.tsym; 44.49 + for (Scope.Entry e = c.members().lookup(m.name); e.scope != null; e = e.next()) { 44.50 + if (e.sym.kind == Kinds.MTH && m.overrides(e.sym, origin, types, true)) { 44.51 + results.add((MethodSymbol) e.sym); 44.52 + } 44.53 + } 44.54 + } 44.55 + } 44.56 + 44.57 + return results; 44.58 + } 44.59 }
45.1 --- a/src/share/classes/com/sun/tools/javac/parser/DocCommentParser.java Thu Dec 27 12:15:17 2012 -0800 45.2 +++ b/src/share/classes/com/sun/tools/javac/parser/DocCommentParser.java Fri Dec 28 18:39:09 2012 -0800 45.3 @@ -25,15 +25,12 @@ 45.4 45.5 package com.sun.tools.javac.parser; 45.6 45.7 -import com.sun.tools.javac.util.Filter; 45.8 import java.text.BreakIterator; 45.9 import java.util.Arrays; 45.10 import java.util.HashMap; 45.11 import java.util.HashSet; 45.12 -import java.util.LinkedList; 45.13 import java.util.Locale; 45.14 import java.util.Map; 45.15 -import java.util.Queue; 45.16 import java.util.Set; 45.17 45.18 import com.sun.source.doctree.AttributeTree.ValueKind; 45.19 @@ -52,7 +49,6 @@ 45.20 import com.sun.tools.javac.tree.DocTreeMaker; 45.21 import com.sun.tools.javac.tree.JCTree; 45.22 import com.sun.tools.javac.util.DiagnosticSource; 45.23 -import com.sun.tools.javac.util.JCDiagnostic; 45.24 import com.sun.tools.javac.util.List; 45.25 import com.sun.tools.javac.util.ListBuffer; 45.26 import com.sun.tools.javac.util.Log; 45.27 @@ -736,7 +732,9 @@ 45.28 nextChar(); 45.29 return m.at(p).Entity(names.fromChars(buf, namep, bp - namep - 1)); 45.30 } else { 45.31 - String code = checkSemi ? "dc.missing.semicolon" : "dc.bad.entity"; 45.32 + String code = checkSemi 45.33 + ? "dc.missing.semicolon" 45.34 + : "dc.bad.entity"; 45.35 return erroneous(code, p); 45.36 } 45.37 } 45.38 @@ -888,8 +886,10 @@ 45.39 } 45.40 45.41 protected void addPendingText(ListBuffer<DCTree> list, int textEnd) { 45.42 - if (textStart != -1 && textStart <= textEnd) { 45.43 - list.add(m.at(textStart).Text(newString(textStart, textEnd + 1))); 45.44 + if (textStart != -1) { 45.45 + if (textStart <= textEnd) { 45.46 + list.add(m.at(textStart).Text(newString(textStart, textEnd + 1))); 45.47 + } 45.48 textStart = -1; 45.49 } 45.50 } 45.51 @@ -1196,6 +1196,16 @@ 45.52 return m.at(pos).See(html); 45.53 break; 45.54 45.55 + case '@': 45.56 + if (newline) 45.57 + throw new ParseException("dc.no.content"); 45.58 + break; 45.59 + 45.60 + case EOI: 45.61 + if (bp == buf.length - 1) 45.62 + throw new ParseException("dc.no.content"); 45.63 + break; 45.64 + 45.65 default: 45.66 if (isJavaIdentifierStart(ch) || ch == '#') { 45.67 DCReference ref = reference(true);
46.1 --- a/src/share/classes/com/sun/tools/javac/resources/compiler.properties Thu Dec 27 12:15:17 2012 -0800 46.2 +++ b/src/share/classes/com/sun/tools/javac/resources/compiler.properties Fri Dec 28 18:39:09 2012 -0800 46.3 @@ -2364,6 +2364,9 @@ 46.4 compiler.err.dc.missing.semicolon=\ 46.5 semicolon missing 46.6 46.7 +compiler.err.dc.no.content=\ 46.8 + no content 46.9 + 46.10 compiler.err.dc.no.tag.name=\ 46.11 no tag name after '@' 46.12
47.1 --- a/src/share/classes/com/sun/tools/javac/resources/javac.properties Thu Dec 27 12:15:17 2012 -0800 47.2 +++ b/src/share/classes/com/sun/tools/javac/resources/javac.properties Fri Dec 28 18:39:09 2012 -0800 47.3 @@ -138,6 +138,14 @@ 47.4 Enable recommended warnings 47.5 javac.opt.Xlint.suboptlist=\ 47.6 Enable or disable specific warnings 47.7 +javac.opt.Xdoclint=\ 47.8 + Enable recommended checks for problems in javadoc comments 47.9 +javac.opt.Xdoclint.subopts = \ 47.10 + (all|[-]<group>)[/<access>] 47.11 +javac.opt.Xdoclint.custom=\n\ 47.12 +\ Enable or disable specific checks for problems in javadoc comments,\n\ 47.13 +\ where <group> is one of accessibility, html, reference, or syntax,\n\ 47.14 +\ and <access> is one of public, protected, package, or private. 47.15 javac.opt.Xstdout=\ 47.16 Redirect standard output 47.17 javac.opt.X=\
48.1 --- a/src/share/classes/com/sun/tools/javac/sym/CreateSymbols.java Thu Dec 27 12:15:17 2012 -0800 48.2 +++ b/src/share/classes/com/sun/tools/javac/sym/CreateSymbols.java Fri Dec 28 18:39:09 2012 -0800 48.3 @@ -33,6 +33,7 @@ 48.4 import com.sun.tools.javac.code.Attribute; 48.5 import com.sun.tools.javac.code.Symtab; 48.6 import com.sun.tools.javac.code.Type; 48.7 +import com.sun.tools.javac.code.Types; 48.8 import com.sun.tools.javac.jvm.ClassReader; 48.9 import com.sun.tools.javac.jvm.ClassWriter; 48.10 import com.sun.tools.javac.jvm.Pool; 48.11 @@ -173,7 +174,8 @@ 48.12 List.<Pair<Symbol.MethodSymbol,Attribute>>nil()); 48.13 48.14 Type.moreInfo = true; 48.15 - Pool pool = new Pool(); 48.16 + Types types = Types.instance(task.getContext()); 48.17 + Pool pool = new Pool(types); 48.18 for (JavaFileObject file : fm.list(jarLocation, "", EnumSet.of(CLASS), true)) { 48.19 String className = fm.inferBinaryName(jarLocation, file); 48.20 int index = className.lastIndexOf('.');
49.1 --- a/src/share/classes/com/sun/tools/javac/tree/DCTree.java Thu Dec 27 12:15:17 2012 -0800 49.2 +++ b/src/share/classes/com/sun/tools/javac/tree/DCTree.java Fri Dec 28 18:39:09 2012 -0800 49.3 @@ -36,6 +36,8 @@ 49.4 import com.sun.tools.javac.util.JCDiagnostic.SimpleDiagnosticPosition; 49.5 import com.sun.tools.javac.util.List; 49.6 import com.sun.tools.javac.util.Name; 49.7 +import java.io.IOException; 49.8 +import java.io.StringWriter; 49.9 import javax.tools.JavaFileObject; 49.10 49.11 /** 49.12 @@ -65,6 +67,21 @@ 49.13 return new SimpleDiagnosticPosition(dc.comment.getSourcePos(pos)); 49.14 } 49.15 49.16 + /** Convert a tree to a pretty-printed string. */ 49.17 + @Override 49.18 + public String toString() { 49.19 + StringWriter s = new StringWriter(); 49.20 + try { 49.21 + new DocPretty(s).print(this); 49.22 + } 49.23 + catch (IOException e) { 49.24 + // should never happen, because StringWriter is defined 49.25 + // never to throw any IOExceptions 49.26 + throw new AssertionError(e); 49.27 + } 49.28 + return s.toString(); 49.29 + } 49.30 + 49.31 public static class DCDocComment extends DCTree implements DocCommentTree { 49.32 final Comment comment; // required for the implicit source pos table 49.33
50.1 --- a/src/share/classes/com/sun/tools/javac/tree/DocPretty.java Thu Dec 27 12:15:17 2012 -0800 50.2 +++ b/src/share/classes/com/sun/tools/javac/tree/DocPretty.java Fri Dec 28 18:39:09 2012 -0800 50.3 @@ -81,7 +81,7 @@ 50.4 /** 50.5 * Print list. 50.6 */ 50.7 - protected void print(List<? extends DocTree> list) throws IOException { 50.8 + public void print(List<? extends DocTree> list) throws IOException { 50.9 for (DocTree t: list) { 50.10 print(t); 50.11 }
51.1 --- a/src/share/classes/com/sun/tools/javac/tree/TreeInfo.java Thu Dec 27 12:15:17 2012 -0800 51.2 +++ b/src/share/classes/com/sun/tools/javac/tree/TreeInfo.java Fri Dec 28 18:39:09 2012 -0800 51.3 @@ -26,6 +26,7 @@ 51.4 package com.sun.tools.javac.tree; 51.5 51.6 51.7 + 51.8 import com.sun.source.tree.Tree; 51.9 import com.sun.tools.javac.code.*; 51.10 import com.sun.tools.javac.comp.AttrContext; 51.11 @@ -330,6 +331,13 @@ 51.12 return (docComments == null) ? null : docComments.getCommentText(tree); 51.13 } 51.14 51.15 + public static DCTree.DCDocComment getCommentTree(Env<?> env, JCTree tree) { 51.16 + DocCommentTable docComments = (tree.hasTag(JCTree.Tag.TOPLEVEL)) 51.17 + ? ((JCCompilationUnit) tree).docComments 51.18 + : env.toplevel.docComments; 51.19 + return (docComments == null) ? null : docComments.getCommentTree(tree); 51.20 + } 51.21 + 51.22 /** The position of the first statement in a block, or the position of 51.23 * the block itself if it is empty. 51.24 */
52.1 --- a/src/share/classes/com/sun/tools/javac/tree/TreeMaker.java Thu Dec 27 12:15:17 2012 -0800 52.2 +++ b/src/share/classes/com/sun/tools/javac/tree/TreeMaker.java Fri Dec 28 18:39:09 2012 -0800 52.3 @@ -684,7 +684,7 @@ 52.4 public JCVariableDecl VarDef(VarSymbol v, JCExpression init) { 52.5 return (JCVariableDecl) 52.6 new JCVariableDecl( 52.7 - Modifiers(v.flags(), Annotations(v.getAnnotationMirrors())), 52.8 + Modifiers(v.flags(), Annotations(v.getRawAttributes())), 52.9 v.name, 52.10 Type(v.type), 52.11 init, 52.12 @@ -800,7 +800,7 @@ 52.13 public JCMethodDecl MethodDef(MethodSymbol m, Type mtype, JCBlock body) { 52.14 return (JCMethodDecl) 52.15 new JCMethodDecl( 52.16 - Modifiers(m.flags(), Annotations(m.getAnnotationMirrors())), 52.17 + Modifiers(m.flags(), Annotations(m.getRawAttributes())), 52.18 m.name, 52.19 Type(mtype.getReturnType()), 52.20 TypeParams(mtype.getTypeArguments()),
53.1 --- a/src/share/classes/com/sun/tools/javadoc/ClassDocImpl.java Thu Dec 27 12:15:17 2012 -0800 53.2 +++ b/src/share/classes/com/sun/tools/javadoc/ClassDocImpl.java Fri Dec 28 18:39:09 2012 -0800 53.3 @@ -276,6 +276,10 @@ 53.4 return false; 53.5 } 53.6 53.7 + public boolean isFunctionalInterface() { 53.8 + return env.types.isFunctionalInterface(tsym); 53.9 + } 53.10 + 53.11 /** 53.12 * Return the package that this class is contained in. 53.13 */
54.1 --- a/src/share/classes/com/sun/tools/javadoc/MethodDocImpl.java Thu Dec 27 12:15:17 2012 -0800 54.2 +++ b/src/share/classes/com/sun/tools/javadoc/MethodDocImpl.java Fri Dec 28 18:39:09 2012 -0800 54.3 @@ -76,6 +76,13 @@ 54.4 } 54.5 54.6 /** 54.7 + * Return true if this method is default 54.8 + */ 54.9 + public boolean isDefault() { 54.10 + return (sym.flags() & Flags.DEFAULT) != 0; 54.11 + } 54.12 + 54.13 + /** 54.14 * Return true if this method is abstract 54.15 */ 54.16 public boolean isAbstract() {
55.1 --- a/src/share/classes/com/sun/tools/javadoc/PackageDocImpl.java Thu Dec 27 12:15:17 2012 -0800 55.2 +++ b/src/share/classes/com/sun/tools/javadoc/PackageDocImpl.java Fri Dec 28 18:39:09 2012 -0800 55.3 @@ -288,9 +288,9 @@ 55.4 * Return an empty array if there are none. 55.5 */ 55.6 public AnnotationDesc[] annotations() { 55.7 - AnnotationDesc res[] = new AnnotationDesc[sym.getAnnotationMirrors().length()]; 55.8 + AnnotationDesc res[] = new AnnotationDesc[sym.getRawAttributes().length()]; 55.9 int i = 0; 55.10 - for (Attribute.Compound a : sym.getAnnotationMirrors()) { 55.11 + for (Attribute.Compound a : sym.getRawAttributes()) { 55.12 res[i++] = new AnnotationDescImpl(env, a); 55.13 } 55.14 return res;
56.1 --- a/src/share/classes/com/sun/tools/javadoc/ParameterImpl.java Thu Dec 27 12:15:17 2012 -0800 56.2 +++ b/src/share/classes/com/sun/tools/javadoc/ParameterImpl.java Fri Dec 28 18:39:09 2012 -0800 56.3 @@ -99,9 +99,9 @@ 56.4 * Return an empty array if there are none. 56.5 */ 56.6 public AnnotationDesc[] annotations() { 56.7 - AnnotationDesc res[] = new AnnotationDesc[sym.getAnnotationMirrors().length()]; 56.8 + AnnotationDesc res[] = new AnnotationDesc[sym.getRawAttributes().length()]; 56.9 int i = 0; 56.10 - for (Attribute.Compound a : sym.getAnnotationMirrors()) { 56.11 + for (Attribute.Compound a : sym.getRawAttributes()) { 56.12 res[i++] = new AnnotationDescImpl(env, a); 56.13 } 56.14 return res;
57.1 --- a/src/share/classes/com/sun/tools/javadoc/ProgramElementDocImpl.java Thu Dec 27 12:15:17 2012 -0800 57.2 +++ b/src/share/classes/com/sun/tools/javadoc/ProgramElementDocImpl.java Fri Dec 28 18:39:09 2012 -0800 57.3 @@ -164,9 +164,9 @@ 57.4 * Return an empty array if there are none. 57.5 */ 57.6 public AnnotationDesc[] annotations() { 57.7 - AnnotationDesc res[] = new AnnotationDesc[sym.getAnnotationMirrors().length()]; 57.8 + AnnotationDesc res[] = new AnnotationDesc[sym.getRawAttributes().length()]; 57.9 int i = 0; 57.10 - for (Attribute.Compound a : sym.getAnnotationMirrors()) { 57.11 + for (Attribute.Compound a : sym.getRawAttributes()) { 57.12 res[i++] = new AnnotationDescImpl(env, a); 57.13 } 57.14 return res;
58.1 --- a/src/share/classes/javax/lang/model/element/ExecutableElement.java Thu Dec 27 12:15:17 2012 -0800 58.2 +++ b/src/share/classes/javax/lang/model/element/ExecutableElement.java Fri Dec 28 18:39:09 2012 -0800 58.3 @@ -78,6 +78,16 @@ 58.4 boolean isVarArgs(); 58.5 58.6 /** 58.7 + * Returns {@code true} if this method is a default method and 58.8 + * returns {@code false} otherwise. 58.9 + * 58.10 + * @return {@code true} if this method is a default method and 58.11 + * {@code false} otherwise 58.12 + * @since 1.8 58.13 + */ 58.14 + boolean isDefault(); 58.15 + 58.16 + /** 58.17 * Returns the exceptions and other throwables listed in this 58.18 * method or constructor's {@code throws} clause in declaration 58.19 * order.
59.1 --- a/test/com/sun/javadoc/testHtmlTableTags/TestHtmlTableTags.java Thu Dec 27 12:15:17 2012 -0800 59.2 +++ b/test/com/sun/javadoc/testHtmlTableTags/TestHtmlTableTags.java Fri Dec 28 18:39:09 2012 -0800 59.3 @@ -1,5 +1,5 @@ 59.4 /* 59.5 - * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved. 59.6 + * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. 59.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 59.8 * 59.9 * This code is free software; you can redistribute it and/or modify it 59.10 @@ -207,7 +207,7 @@ 59.11 "Instance Methods</a></span><span class=\"tabEnd\"> </span></span>" + 59.12 "<span id=\"t4\" class=\"tableTab\"><span><a href=\"javascript:show(8);\">" + 59.13 "Concrete Methods</a></span><span class=\"tabEnd\"> </span></span>" + 59.14 - "<span id=\"t5\" class=\"tableTab\"><span><a href=\"javascript:show(16);\">" + 59.15 + "<span id=\"t6\" class=\"tableTab\"><span><a href=\"javascript:show(32);\">" + 59.16 "Deprecated Methods</a></span><span class=\"tabEnd\"> </span></span>" + 59.17 "</caption>" 59.18 },
60.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 60.2 +++ b/test/com/sun/javadoc/testLambdaFeature/TestLambdaFeature.java Fri Dec 28 18:39:09 2012 -0800 60.3 @@ -0,0 +1,102 @@ 60.4 +/* 60.5 + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. 60.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 60.7 + * 60.8 + * This code is free software; you can redistribute it and/or modify it 60.9 + * under the terms of the GNU General Public License version 2 only, as 60.10 + * published by the Free Software Foundation. 60.11 + * 60.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 60.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 60.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 60.15 + * version 2 for more details (a copy is included in the LICENSE file that 60.16 + * accompanied this code). 60.17 + * 60.18 + * You should have received a copy of the GNU General Public License version 60.19 + * 2 along with this work; if not, write to the Free Software Foundation, 60.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 60.21 + * 60.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 60.23 + * or visit www.oracle.com if you need additional information or have any 60.24 + * questions. 60.25 + */ 60.26 + 60.27 +/* 60.28 + * @test 60.29 + * @bug 8004893 60.30 + * @summary Make sure that the lambda feature changes work fine in 60.31 + * javadoc. 60.32 + * @author bpatel 60.33 + * @library ../lib/ 60.34 + * @build JavadocTester TestLambdaFeature 60.35 + * @run main TestLambdaFeature 60.36 + */ 60.37 + 60.38 +public class TestLambdaFeature extends JavadocTester { 60.39 + 60.40 + //Test information. 60.41 + private static final String BUG_ID = "8004893"; 60.42 + 60.43 + //Javadoc arguments. 60.44 + private static final String[] ARGS = new String[] { 60.45 + "-d", BUG_ID, "-sourcepath", SRC_DIR, "pkg" 60.46 + }; 60.47 + 60.48 + //Input for string search tests. 60.49 + private static final String[][] TEST = { 60.50 + {BUG_ID + FS + "pkg" + FS + "A.html", 60.51 + "<td class=\"colFirst\"><code>default void</code></td>"}, 60.52 + {BUG_ID + FS + "pkg" + FS + "A.html", 60.53 + "<pre>default void defaultMethod()</pre>"}, 60.54 + {BUG_ID + FS + "pkg" + FS + "A.html", 60.55 + "<caption><span id=\"t0\" class=\"activeTableTab\"><span>" + 60.56 + "All Methods</span><span class=\"tabEnd\"> </span></span>" + 60.57 + "<span id=\"t2\" class=\"tableTab\"><span>" + 60.58 + "<a href=\"javascript:show(2);\">Instance Methods</a></span>" + 60.59 + "<span class=\"tabEnd\"> </span></span><span id=\"t3\" " + 60.60 + "class=\"tableTab\"><span><a href=\"javascript:show(4);\">" + 60.61 + "Abstract Methods</a></span><span class=\"tabEnd\"> </span>" + 60.62 + "</span><span id=\"t5\" class=\"tableTab\"><span>" + 60.63 + "<a href=\"javascript:show(16);\">Default Methods</a></span>" + 60.64 + "<span class=\"tabEnd\"> </span></span></caption>"}, 60.65 + {BUG_ID + FS + "pkg" + FS + "A.html", 60.66 + "<dl>" + NL + "<dt>Functional Interface:</dt>" + NL + 60.67 + "<dd>This is a functional interface and can therefore be used as " + 60.68 + "the assignment target for a lambda expression or method " + 60.69 + "reference. </dd>" + NL + "</dl>"} 60.70 + }; 60.71 + private static final String[][] NEGATED_TEST = { 60.72 + {BUG_ID + FS + "pkg" + FS + "A.html", 60.73 + "<td class=\"colFirst\"><code>default default void</code></td>"}, 60.74 + {BUG_ID + FS + "pkg" + FS + "A.html", 60.75 + "<pre>default default void defaultMethod()</pre>"}, 60.76 + {BUG_ID + FS + "pkg" + FS + "B.html", 60.77 + "<td class=\"colFirst\"><code>default void</code></td>"}, 60.78 + {BUG_ID + FS + "pkg" + FS + "B.html", 60.79 + "<dl>" + NL + "<dt>Functional Interface:</dt>"} 60.80 + }; 60.81 + 60.82 + /** 60.83 + * The entry point of the test. 60.84 + * @param args the array of command line arguments. 60.85 + */ 60.86 + public static void main(String[] args) { 60.87 + TestLambdaFeature tester = new TestLambdaFeature(); 60.88 + run(tester, ARGS, TEST, NEGATED_TEST); 60.89 + tester.printSummary(); 60.90 + } 60.91 + 60.92 + /** 60.93 + * {@inheritDoc} 60.94 + */ 60.95 + public String getBugId() { 60.96 + return BUG_ID; 60.97 + } 60.98 + 60.99 + /** 60.100 + * {@inheritDoc} 60.101 + */ 60.102 + public String getBugName() { 60.103 + return getClass().getName(); 60.104 + } 60.105 +}
61.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 61.2 +++ b/test/com/sun/javadoc/testLambdaFeature/pkg/A.java Fri Dec 28 18:39:09 2012 -0800 61.3 @@ -0,0 +1,31 @@ 61.4 +/* 61.5 + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. 61.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 61.7 + * 61.8 + * This code is free software; you can redistribute it and/or modify it 61.9 + * under the terms of the GNU General Public License version 2 only, as 61.10 + * published by the Free Software Foundation. 61.11 + * 61.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 61.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 61.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 61.15 + * version 2 for more details (a copy is included in the LICENSE file that 61.16 + * accompanied this code). 61.17 + * 61.18 + * You should have received a copy of the GNU General Public License version 61.19 + * 2 along with this work; if not, write to the Free Software Foundation, 61.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 61.21 + * 61.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 61.23 + * or visit www.oracle.com if you need additional information or have any 61.24 + * questions. 61.25 + */ 61.26 + 61.27 +package pkg; 61.28 + 61.29 +public interface A { 61.30 + 61.31 + public void method1(); 61.32 + 61.33 + public default void defaultMethod() { } 61.34 +}
62.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 62.2 +++ b/test/com/sun/javadoc/testLambdaFeature/pkg/B.java Fri Dec 28 18:39:09 2012 -0800 62.3 @@ -0,0 +1,31 @@ 62.4 +/* 62.5 + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. 62.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 62.7 + * 62.8 + * This code is free software; you can redistribute it and/or modify it 62.9 + * under the terms of the GNU General Public License version 2 only, as 62.10 + * published by the Free Software Foundation. 62.11 + * 62.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 62.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 62.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 62.15 + * version 2 for more details (a copy is included in the LICENSE file that 62.16 + * accompanied this code). 62.17 + * 62.18 + * You should have received a copy of the GNU General Public License version 62.19 + * 2 along with this work; if not, write to the Free Software Foundation, 62.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 62.21 + * 62.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 62.23 + * or visit www.oracle.com if you need additional information or have any 62.24 + * questions. 62.25 + */ 62.26 + 62.27 +package pkg; 62.28 + 62.29 +public abstract class B { 62.30 + 62.31 + public abstract void method1(); 62.32 + 62.33 + public void method2() { } 62.34 +}
63.1 --- a/test/com/sun/javadoc/testMethodTypes/TestMethodTypes.java Thu Dec 27 12:15:17 2012 -0800 63.2 +++ b/test/com/sun/javadoc/testMethodTypes/TestMethodTypes.java Fri Dec 28 18:39:09 2012 -0800 63.3 @@ -55,7 +55,7 @@ 63.4 "Instance Methods</a></span><span class=\"tabEnd\"> </span></span>" + 63.5 "<span id=\"t4\" class=\"tableTab\"><span><a href=\"javascript:show(8);\">" + 63.6 "Concrete Methods</a></span><span class=\"tabEnd\"> </span></span>" + 63.7 - "<span id=\"t5\" class=\"tableTab\"><span><a href=\"javascript:show(16);\">" + 63.8 + "<span id=\"t6\" class=\"tableTab\"><span><a href=\"javascript:show(32);\">" + 63.9 "Deprecated Methods</a></span><span class=\"tabEnd\"> </span></span>" + 63.10 "</caption>" 63.11 }, 63.12 @@ -87,7 +87,7 @@ 63.13 "Abstract Methods</a></span><span class=\"tabEnd\"> </span></span>" + 63.14 "<span id=\"t4\" class=\"tableTab\"><span><a href=\"javascript:show(8);\">" + 63.15 "Concrete Methods</a></span><span class=\"tabEnd\"> </span></span>" + 63.16 - "<span id=\"t5\" class=\"tableTab\"><span><a href=\"javascript:show(16);\">" + 63.17 + "<span id=\"t6\" class=\"tableTab\"><span><a href=\"javascript:show(32);\">" + 63.18 "Deprecated Methods</a></span><span class=\"tabEnd\"> </span></span>" + 63.19 "</caption>" 63.20 },
64.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 64.2 +++ b/test/tools/doclint/AccessTest.java Fri Dec 28 18:39:09 2012 -0800 64.3 @@ -0,0 +1,65 @@ 64.4 +/* 64.5 + * @test /nodynamiccopyright/ 64.6 + * @bug 8004832 64.7 + * @summary Add new doclint package 64.8 + * @build DocLintTester 64.9 + * @run main DocLintTester -ref AccessTest.protected.out AccessTest.java 64.10 + * @run main DocLintTester -Xmsgs -ref AccessTest.private.out AccessTest.java 64.11 + * @run main DocLintTester -Xmsgs:syntax -ref AccessTest.private.out AccessTest.java 64.12 + * @run main DocLintTester -Xmsgs:syntax/public -ref AccessTest.public.out AccessTest.java 64.13 + * @run main DocLintTester -Xmsgs:syntax/protected -ref AccessTest.protected.out AccessTest.java 64.14 + * @run main DocLintTester -Xmsgs:syntax/package -ref AccessTest.package.out AccessTest.java 64.15 + * @run main DocLintTester -Xmsgs:syntax/private -ref AccessTest.private.out AccessTest.java 64.16 + * @run main DocLintTester -Xmsgs:all,-syntax AccessTest.java 64.17 + * @run main DocLintTester -Xmsgs:all,-syntax/public AccessTest.java 64.18 + * @run main DocLintTester -Xmsgs:all,-syntax/protected -ref AccessTest.public.out AccessTest.java 64.19 + * @run main DocLintTester -Xmsgs:all,-syntax/package -ref AccessTest.protected.out AccessTest.java 64.20 + * @run main DocLintTester -Xmsgs:all,-syntax/private -ref AccessTest.package.out AccessTest.java 64.21 + */ 64.22 + 64.23 +/** */ 64.24 +public class AccessTest { 64.25 + /** 64.26 + * public a < b 64.27 + */ 64.28 + public void public_syntax_error() { } 64.29 + 64.30 + /** 64.31 + * protected a < b 64.32 + */ 64.33 + protected void protected_syntax_error() { } 64.34 + 64.35 + /** 64.36 + * package-private a < b 64.37 + */ 64.38 + void syntax_error() { } 64.39 + 64.40 + /** 64.41 + * private a < b 64.42 + */ 64.43 + private void private_syntax_error() { } 64.44 +} 64.45 + 64.46 +/** */ 64.47 +class AccessTest2 { 64.48 + /** 64.49 + * public a < b 64.50 + */ 64.51 + public void public_syntax_error() { } 64.52 + 64.53 + /** 64.54 + * protected a < b 64.55 + */ 64.56 + protected void protected_syntax_error() { } 64.57 + 64.58 + /** 64.59 + * package-private a < b 64.60 + */ 64.61 + void syntax_error() { } 64.62 + 64.63 + /** 64.64 + * private a < b 64.65 + */ 64.66 + private void private_syntax_error() { } 64.67 +} 64.68 +
65.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 65.2 +++ b/test/tools/doclint/AccessTest.package.out Fri Dec 28 18:39:09 2012 -0800 65.3 @@ -0,0 +1,20 @@ 65.4 +AccessTest.java:23: error: malformed HTML 65.5 + * public a < b 65.6 + ^ 65.7 +AccessTest.java:28: error: malformed HTML 65.8 + * protected a < b 65.9 + ^ 65.10 +AccessTest.java:33: error: malformed HTML 65.11 + * package-private a < b 65.12 + ^ 65.13 +AccessTest.java:46: error: malformed HTML 65.14 + * public a < b 65.15 + ^ 65.16 +AccessTest.java:51: error: malformed HTML 65.17 + * protected a < b 65.18 + ^ 65.19 +AccessTest.java:56: error: malformed HTML 65.20 + * package-private a < b 65.21 + ^ 65.22 +6 errors 65.23 +
66.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 66.2 +++ b/test/tools/doclint/AccessTest.private.out Fri Dec 28 18:39:09 2012 -0800 66.3 @@ -0,0 +1,27 @@ 66.4 +AccessTest.java:23: error: malformed HTML 66.5 + * public a < b 66.6 + ^ 66.7 +AccessTest.java:28: error: malformed HTML 66.8 + * protected a < b 66.9 + ^ 66.10 +AccessTest.java:33: error: malformed HTML 66.11 + * package-private a < b 66.12 + ^ 66.13 +AccessTest.java:38: error: malformed HTML 66.14 + * private a < b 66.15 + ^ 66.16 +AccessTest.java:46: error: malformed HTML 66.17 + * public a < b 66.18 + ^ 66.19 +AccessTest.java:51: error: malformed HTML 66.20 + * protected a < b 66.21 + ^ 66.22 +AccessTest.java:56: error: malformed HTML 66.23 + * package-private a < b 66.24 + ^ 66.25 +AccessTest.java:61: error: malformed HTML 66.26 + * private a < b 66.27 + ^ 66.28 +8 errors 66.29 + 66.30 +
67.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 67.2 +++ b/test/tools/doclint/AccessTest.protected.out Fri Dec 28 18:39:09 2012 -0800 67.3 @@ -0,0 +1,8 @@ 67.4 +AccessTest.java:23: error: malformed HTML 67.5 + * public a < b 67.6 + ^ 67.7 +AccessTest.java:28: error: malformed HTML 67.8 + * protected a < b 67.9 + ^ 67.10 +2 errors 67.11 +
68.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 68.2 +++ b/test/tools/doclint/AccessTest.public.out Fri Dec 28 18:39:09 2012 -0800 68.3 @@ -0,0 +1,5 @@ 68.4 +AccessTest.java:23: error: malformed HTML 68.5 + * public a < b 68.6 + ^ 68.7 +1 error 68.8 +
69.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 69.2 +++ b/test/tools/doclint/AccessibilityTest.java Fri Dec 28 18:39:09 2012 -0800 69.3 @@ -0,0 +1,44 @@ 69.4 +/* 69.5 + * @test /nodynamiccopyright/ 69.6 + * @bug 8004832 69.7 + * @summary Add new doclint package 69.8 + * @build DocLintTester 69.9 + * @run main DocLintTester -Xmsgs:-accessibility AccessibilityTest.java 69.10 + * @run main DocLintTester -ref AccessibilityTest.out AccessibilityTest.java 69.11 + */ 69.12 + 69.13 +/** */ 69.14 +public class AccessibilityTest { 69.15 + 69.16 + /** 69.17 + * <h2> ... </h2> 69.18 + */ 69.19 + public void missing_h1() { } 69.20 + 69.21 + /** 69.22 + * <h1> ... </h1> 69.23 + * <h3> ... </h3> 69.24 + */ 69.25 + public void missing_h2() { } 69.26 + 69.27 + /** 69.28 + * <img src="x.jpg"> 69.29 + */ 69.30 + public void missing_alt() { } 69.31 + 69.32 + /** 69.33 + * <table summary="ok"><tr><th>head<tr><td>data</table> 69.34 + */ 69.35 + public void table_with_summary() { } 69.36 + 69.37 + /** 69.38 + * <table><caption>ok</caption><tr><th>head<tr><td>data</table> 69.39 + */ 69.40 + public void table_with_caption() { } 69.41 + 69.42 + /** 69.43 + * <table><tr><th>head<tr><td>data</table> 69.44 + */ 69.45 + public void table_without_summary_and_caption() { } 69.46 +} 69.47 +
70.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 70.2 +++ b/test/tools/doclint/AccessibilityTest.out Fri Dec 28 18:39:09 2012 -0800 70.3 @@ -0,0 +1,13 @@ 70.4 +AccessibilityTest.java:14: error: header used out of sequence: <H2> 70.5 + * <h2> ... </h2> 70.6 + ^ 70.7 +AccessibilityTest.java:20: error: header used out of sequence: <H3> 70.8 + * <h3> ... </h3> 70.9 + ^ 70.10 +AccessibilityTest.java:25: error: no "alt" attribute for image 70.11 + * <img src="x.jpg"> 70.12 + ^ 70.13 +AccessibilityTest.java:40: error: no summary or caption for table 70.14 + * <table><tr><th>head<tr><td>data</table> 70.15 + ^ 70.16 +4 errors
71.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 71.2 +++ b/test/tools/doclint/DocLintTester.java Fri Dec 28 18:39:09 2012 -0800 71.3 @@ -0,0 +1,135 @@ 71.4 +/* 71.5 + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. 71.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 71.7 + * 71.8 + * This code is free software; you can redistribute it and/or modify it 71.9 + * under the terms of the GNU General Public License version 2 only, as 71.10 + * published by the Free Software Foundation. 71.11 + * 71.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 71.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 71.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 71.15 + * version 2 for more details (a copy is included in the LICENSE file that 71.16 + * accompanied this code). 71.17 + * 71.18 + * You should have received a copy of the GNU General Public License version 71.19 + * 2 along with this work; if not, write to the Free Software Foundation, 71.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 71.21 + * 71.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 71.23 + * or visit www.oracle.com if you need additional information or have any 71.24 + * questions. 71.25 + */ 71.26 + 71.27 +import java.io.File; 71.28 +import java.util.ArrayList; 71.29 +import java.util.List; 71.30 + 71.31 +import com.sun.tools.doclint.DocLint; 71.32 +import java.io.BufferedReader; 71.33 +import java.io.FileReader; 71.34 +import java.io.IOException; 71.35 +import java.io.PrintWriter; 71.36 +import java.io.Reader; 71.37 +import java.io.StringWriter; 71.38 +import java.util.regex.Matcher; 71.39 +import java.util.regex.Pattern; 71.40 + 71.41 + 71.42 +public class DocLintTester { 71.43 + 71.44 + public static void main(String... args) throws Exception { 71.45 + new DocLintTester().run(args); 71.46 + } 71.47 + 71.48 + public void run(String... args) throws Exception { 71.49 + String testSrc = System.getProperty("test.src"); 71.50 + 71.51 + File refFile = null; 71.52 + List<String> opts = new ArrayList<String>(); 71.53 + List<File> files = new ArrayList<File>(); 71.54 + for (int i = 0; i < args.length; i++) { 71.55 + String arg = args[i]; 71.56 + if (arg.equals("-ref")) { 71.57 + refFile = new File(testSrc, args[++i]); 71.58 + } else if (arg.startsWith("-Xmsgs")) { 71.59 + opts.add(arg); 71.60 + } else 71.61 + files.add(new File(testSrc, arg)); 71.62 + } 71.63 + 71.64 + check(opts, files, refFile); 71.65 + 71.66 + if (errors > 0) 71.67 + throw new Exception(errors + " errors occurred"); 71.68 + } 71.69 + 71.70 + void check(List<String> opts, List<File> files, File refFile) throws Exception { 71.71 + List<String> args = new ArrayList<String>(); 71.72 + args.addAll(opts); 71.73 + for (File file: files) 71.74 + args.add(file.getPath()); 71.75 + 71.76 + StringWriter sw = new StringWriter(); 71.77 + PrintWriter pw = new PrintWriter(sw); 71.78 + new DocLint().run(pw, args.toArray(new String[args.size()])); 71.79 + pw.flush(); 71.80 + String out = normalizeNewlines(removeFileNames(sw.toString())).trim(); 71.81 + if (out != null) 71.82 + System.err.println("Output:\n" + out); 71.83 + 71.84 + if (refFile == null) { 71.85 + if (!out.isEmpty()) 71.86 + error("unexpected output"); 71.87 + } else { 71.88 + String expect = readFile(refFile); 71.89 + if (!expect.equals(out)) { 71.90 + error("expected output not found"); 71.91 + System.err.println("EXPECT>>" + expect + "<<"); 71.92 + System.err.println(" FOUND>>" + out + "<<"); 71.93 + } 71.94 + } 71.95 + } 71.96 + 71.97 + String readFile(File file) throws IOException { 71.98 + StringBuilder sb = new StringBuilder(); 71.99 + Reader in = new BufferedReader(new FileReader(file)); 71.100 + try { 71.101 + char[] buf = new char[1024]; 71.102 + int n; 71.103 + while ((n = in.read(buf)) != -1) 71.104 + sb.append(buf, 0, n); 71.105 + } finally { 71.106 + in.close(); 71.107 + } 71.108 + return sb.toString().trim(); 71.109 + } 71.110 + 71.111 + private static final Pattern dirFileLine = Pattern.compile( 71.112 + "(?m)" // multi-line mode 71.113 + + "^([^: ]+?)" // directory part of file name 71.114 + + "([A-Za-z0-9.]+:[0-9]+:)"); // file name and line number 71.115 + 71.116 + String removeFileNames(String s) { 71.117 + Matcher m = dirFileLine.matcher(s); 71.118 + StringBuffer sb = new StringBuffer(); 71.119 + while (m.find()) { 71.120 + m.appendReplacement(sb, "$2"); 71.121 + } 71.122 + m.appendTail(sb); 71.123 + return sb.toString(); 71.124 + } 71.125 + 71.126 + private static final String nl = System.getProperty("line.separator"); 71.127 + String normalizeNewlines(String s) { 71.128 + return (nl.equals("\n") ? s : s.replace(nl, "\n")); 71.129 + } 71.130 + 71.131 + 71.132 + void error(String msg) { 71.133 + System.err.println("Error: " + msg); 71.134 + errors++; 71.135 + } 71.136 + 71.137 + int errors; 71.138 +}
72.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 72.2 +++ b/test/tools/doclint/EmptyAuthorTest.java Fri Dec 28 18:39:09 2012 -0800 72.3 @@ -0,0 +1,12 @@ 72.4 +/* 72.5 + * @test /nodynamiccopyright/ 72.6 + * @bug 8004832 72.7 + * @summary Add new doclint package 72.8 + * @build DocLintTester 72.9 + * @run main DocLintTester -Xmsgs:-syntax EmptyAuthorTest.java 72.10 + * @run main DocLintTester -Xmsgs:syntax -ref EmptyAuthorTest.out EmptyAuthorTest.java 72.11 + */ 72.12 + 72.13 +/** @author */ 72.14 +public class EmptyAuthorTest { 72.15 +}
73.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 73.2 +++ b/test/tools/doclint/EmptyAuthorTest.out Fri Dec 28 18:39:09 2012 -0800 73.3 @@ -0,0 +1,5 @@ 73.4 +EmptyAuthorTest.java:10: warning: no description for @author 73.5 +/** @author */ 73.6 + ^ 73.7 +1 warning 73.8 +
74.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 74.2 +++ b/test/tools/doclint/EmptyExceptionTest.java Fri Dec 28 18:39:09 2012 -0800 74.3 @@ -0,0 +1,14 @@ 74.4 +/* 74.5 + * @test /nodynamiccopyright/ 74.6 + * @bug 8004832 74.7 + * @summary Add new doclint package 74.8 + * @build DocLintTester 74.9 + * @run main DocLintTester -Xmsgs:-syntax EmptyExceptionTest.java 74.10 + * @run main DocLintTester -Xmsgs:syntax -ref EmptyExceptionTest.out EmptyExceptionTest.java 74.11 + */ 74.12 + 74.13 +/** . */ 74.14 +public class EmptyExceptionTest { 74.15 + /** @exception NullPointerException */ 74.16 + int emptyException() throws NullPointerException { } 74.17 +}
75.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 75.2 +++ b/test/tools/doclint/EmptyExceptionTest.out Fri Dec 28 18:39:09 2012 -0800 75.3 @@ -0,0 +1,4 @@ 75.4 +EmptyExceptionTest.java:12: warning: no description for @exception 75.5 + /** @exception NullPointerException */ 75.6 + ^ 75.7 +1 warning
76.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 76.2 +++ b/test/tools/doclint/EmptyParamTest.java Fri Dec 28 18:39:09 2012 -0800 76.3 @@ -0,0 +1,14 @@ 76.4 +/* 76.5 + * @test /nodynamiccopyright/ 76.6 + * @bug 8004832 76.7 + * @summary Add new doclint package 76.8 + * @build DocLintTester 76.9 + * @run main DocLintTester -Xmsgs:-syntax EmptyParamTest.java 76.10 + * @run main DocLintTester -Xmsgs:syntax -ref EmptyParamTest.out EmptyParamTest.java 76.11 + */ 76.12 + 76.13 +/** . */ 76.14 +public class EmptyParamTest { 76.15 + /** @param i */ 76.16 + int emptyParam(int i) { } 76.17 +}
77.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 77.2 +++ b/test/tools/doclint/EmptyParamTest.out Fri Dec 28 18:39:09 2012 -0800 77.3 @@ -0,0 +1,5 @@ 77.4 +EmptyParamTest.java:12: warning: no description for @param 77.5 + /** @param i */ 77.6 + ^ 77.7 +1 warning 77.8 +
78.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 78.2 +++ b/test/tools/doclint/EmptyReturnTest.java Fri Dec 28 18:39:09 2012 -0800 78.3 @@ -0,0 +1,14 @@ 78.4 +/* 78.5 + * @test /nodynamiccopyright/ 78.6 + * @bug 8004832 78.7 + * @summary Add new doclint package 78.8 + * @build DocLintTester 78.9 + * @run main DocLintTester -Xmsgs:-syntax EmptyReturnTest.java 78.10 + * @run main DocLintTester -Xmsgs:syntax -ref EmptyReturnTest.out EmptyReturnTest.java 78.11 + */ 78.12 + 78.13 +/** . */ 78.14 +public class EmptyReturnTest { 78.15 + /** @return */ 78.16 + int emptyReturn() { } 78.17 +}
79.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 79.2 +++ b/test/tools/doclint/EmptyReturnTest.out Fri Dec 28 18:39:09 2012 -0800 79.3 @@ -0,0 +1,5 @@ 79.4 +EmptyReturnTest.java:12: warning: no description for @return 79.5 + /** @return */ 79.6 + ^ 79.7 +1 warning 79.8 +
80.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 80.2 +++ b/test/tools/doclint/EmptySerialDataTest.java Fri Dec 28 18:39:09 2012 -0800 80.3 @@ -0,0 +1,17 @@ 80.4 +/* 80.5 + * @test /nodynamiccopyright/ 80.6 + * @bug 8004832 80.7 + * @summary Add new doclint package 80.8 + * @build DocLintTester 80.9 + * @run main DocLintTester -Xmsgs:-syntax EmptySerialDataTest.java 80.10 + * @run main DocLintTester -Xmsgs:syntax -ref EmptySerialDataTest.out EmptySerialDataTest.java 80.11 + */ 80.12 + 80.13 +import java.io.ObjectOutputStream; 80.14 +import java.io.Serializable; 80.15 + 80.16 +/** . */ 80.17 +public class EmptySerialDataTest implements Serializable { 80.18 + /** @serialData */ 80.19 + private void writeObject(ObjectOutputStream s) { } 80.20 +}
81.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 81.2 +++ b/test/tools/doclint/EmptySerialDataTest.out Fri Dec 28 18:39:09 2012 -0800 81.3 @@ -0,0 +1,5 @@ 81.4 +EmptySerialDataTest.java:15: warning: no description for @serialData 81.5 + /** @serialData */ 81.6 + ^ 81.7 +1 warning 81.8 +
82.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 82.2 +++ b/test/tools/doclint/EmptySerialFieldTest.java Fri Dec 28 18:39:09 2012 -0800 82.3 @@ -0,0 +1,22 @@ 82.4 +/* 82.5 + * @test /nodynamiccopyright/ 82.6 + * @bug 8004832 82.7 + * @summary Add new doclint package 82.8 + * @build DocLintTester 82.9 + * @run main DocLintTester -Xmsgs:-syntax EmptySerialFieldTest.java 82.10 + * @run main DocLintTester -Xmsgs:syntax -ref EmptySerialFieldTest.out EmptySerialFieldTest.java 82.11 + */ 82.12 + 82.13 +import java.io.ObjectStreamField; 82.14 +import java.io.Serializable; 82.15 + 82.16 +/** . */ 82.17 +public class EmptySerialFieldTest implements Serializable { 82.18 + 82.19 + /** 82.20 + * @serialField empty String 82.21 + */ 82.22 + private static final ObjectStreamField[] serialPersistentFields = { 82.23 + new ObjectStreamField("empty", String.class), 82.24 + }; 82.25 +}
83.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 83.2 +++ b/test/tools/doclint/EmptySerialFieldTest.out Fri Dec 28 18:39:09 2012 -0800 83.3 @@ -0,0 +1,5 @@ 83.4 +EmptySerialFieldTest.java:17: warning: no description for @serialField 83.5 + * @serialField empty String 83.6 + ^ 83.7 +1 warning 83.8 +
84.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 84.2 +++ b/test/tools/doclint/EmptySinceTest.java Fri Dec 28 18:39:09 2012 -0800 84.3 @@ -0,0 +1,14 @@ 84.4 +/* 84.5 + * @test /nodynamiccopyright/ 84.6 + * @bug 8004832 84.7 + * @summary Add new doclint package 84.8 + * @build DocLintTester 84.9 + * @run main DocLintTester -Xmsgs:-syntax EmptySinceTest.java 84.10 + * @run main DocLintTester -Xmsgs:syntax -ref EmptySinceTest.out EmptySinceTest.java 84.11 + */ 84.12 + 84.13 +/** . */ 84.14 +public class EmptySinceTest { 84.15 + /** @since */ 84.16 + int emptySince() { } 84.17 +}
85.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 85.2 +++ b/test/tools/doclint/EmptySinceTest.out Fri Dec 28 18:39:09 2012 -0800 85.3 @@ -0,0 +1,5 @@ 85.4 +EmptySinceTest.java:12: warning: no description for @since 85.5 + /** @since */ 85.6 + ^ 85.7 +1 warning 85.8 +
86.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 86.2 +++ b/test/tools/doclint/EmptyVersionTest.java Fri Dec 28 18:39:09 2012 -0800 86.3 @@ -0,0 +1,14 @@ 86.4 +/* 86.5 + * @test /nodynamiccopyright/ 86.6 + * @bug 8004832 86.7 + * @summary Add new doclint package 86.8 + * @build DocLintTester 86.9 + * @run main DocLintTester -Xmsgs:-syntax EmptyVersionTest.java 86.10 + * @run main DocLintTester -Xmsgs:syntax -ref EmptyVersionTest.out EmptyVersionTest.java 86.11 + */ 86.12 + 86.13 +/** . */ 86.14 +public class EmptyVersionTest { 86.15 + /** @version */ 86.16 + int missingVersion() { } 86.17 +}
87.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 87.2 +++ b/test/tools/doclint/EmptyVersionTest.out Fri Dec 28 18:39:09 2012 -0800 87.3 @@ -0,0 +1,4 @@ 87.4 +EmptyVersionTest.java:12: warning: no description for @version 87.5 + /** @version */ 87.6 + ^ 87.7 +1 warning
88.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 88.2 +++ b/test/tools/doclint/HtmlAttrsTest.java Fri Dec 28 18:39:09 2012 -0800 88.3 @@ -0,0 +1,27 @@ 88.4 +/* 88.5 + * @test /nodynamiccopyright/ 88.6 + * @bug 8004832 88.7 + * @summary Add new doclint package 88.8 + * @build DocLintTester 88.9 + * @run main DocLintTester -Xmsgs:-html HtmlAttrsTest.java 88.10 + * @run main DocLintTester -ref HtmlAttrsTest.out HtmlAttrsTest.java 88.11 + */ 88.12 + 88.13 +/** */ 88.14 +public class HtmlAttrsTest { 88.15 + /** 88.16 + * <p xyz> 88.17 + */ 88.18 + public void unknown() { } 88.19 + 88.20 + /** 88.21 + * <img name="x" alt="alt"> 88.22 + */ 88.23 + public void obsolete() { } 88.24 + 88.25 + /** 88.26 + * <font size="3"> text </font> 88.27 + */ 88.28 + public void obsolete_use_css() { } 88.29 +} 88.30 +
89.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 89.2 +++ b/test/tools/doclint/HtmlAttrsTest.out Fri Dec 28 18:39:09 2012 -0800 89.3 @@ -0,0 +1,12 @@ 89.4 +HtmlAttrsTest.java:13: error: unknown attribute: xyz 89.5 + * <p xyz> 89.6 + ^ 89.7 +HtmlAttrsTest.java:18: warning: attribute obsolete: name 89.8 + * <img name="x" alt="alt"> 89.9 + ^ 89.10 +HtmlAttrsTest.java:23: warning: attribute obsolete, use CSS instead: size 89.11 + * <font size="3"> text </font> 89.12 + ^ 89.13 +1 error 89.14 +2 warnings 89.15 +
90.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 90.2 +++ b/test/tools/doclint/HtmlTagsTest.java Fri Dec 28 18:39:09 2012 -0800 90.3 @@ -0,0 +1,58 @@ 90.4 +/* 90.5 + * @test /nodynamiccopyright/ 90.6 + * @bug 8004832 90.7 + * @summary Add new doclint package 90.8 + * @build DocLintTester 90.9 + * @run main DocLintTester -Xmsgs:-html HtmlTagsTest.java 90.10 + * @run main DocLintTester -ref HtmlTagsTest.out HtmlTagsTest.java 90.11 + */ 90.12 + 90.13 +/** */ 90.14 +public class HtmlTagsTest { 90.15 + /** 90.16 + * <xyz> ... </xyz> 90.17 + */ 90.18 + public void unknownTag1() { } 90.19 + 90.20 + /** 90.21 + * <div> <xyz> </div> 90.22 + */ 90.23 + public void unknownTag2() { } 90.24 + 90.25 + /** 90.26 + * <br/> 90.27 + */ 90.28 + public void selfClosingTag() { } 90.29 + 90.30 + /** 90.31 + * <html> 90.32 + */ 90.33 + public void not_allowed() { } 90.34 + 90.35 + /** 90.36 + * <span> <p> </span> 90.37 + */ 90.38 + public void not_allowed_inline() { } 90.39 + 90.40 + /** 90.41 + * {@link java.lang.String <p> } 90.42 + * {@link java.lang.String <p> } 90.43 + */ 90.44 + public void not_allowed_inline_2() { } 90.45 + 90.46 + /** 90.47 + * <img src="any.jpg" alt="alt"> </img> 90.48 + */ 90.49 + public void end_not_allowed() { } 90.50 + 90.51 + /** 90.52 + * <i> <b> </i> 90.53 + */ 90.54 + public void start_not_matched() { } 90.55 + 90.56 + /** 90.57 + * <i> </b> </i> 90.58 + */ 90.59 + public void end_unexpected() { } 90.60 +} 90.61 +
91.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 91.2 +++ b/test/tools/doclint/HtmlTagsTest.out Fri Dec 28 18:39:09 2012 -0800 91.3 @@ -0,0 +1,38 @@ 91.4 +HtmlTagsTest.java:13: error: unknown tag: xyz 91.5 + * <xyz> ... </xyz> 91.6 + ^ 91.7 +HtmlTagsTest.java:13: error: unknown tag: xyz 91.8 + * <xyz> ... </xyz> 91.9 + ^ 91.10 +HtmlTagsTest.java:18: error: unknown tag: xyz 91.11 + * <div> <xyz> </div> 91.12 + ^ 91.13 +HtmlTagsTest.java:23: error: self-closing element not allowed 91.14 + * <br/> 91.15 + ^ 91.16 +HtmlTagsTest.java:28: error: element not allowed in documentation comments: <html> 91.17 + * <html> 91.18 + ^ 91.19 +HtmlTagsTest.java:33: error: block element not allowed within inline element <span>: p 91.20 + * <span> <p> </span> 91.21 + ^ 91.22 +HtmlTagsTest.java:38: error: block element not allowed within @link: p 91.23 + * {@link java.lang.String <p> } 91.24 + ^ 91.25 +HtmlTagsTest.java:39: error: block element not allowed within @link: p 91.26 + * {@link java.lang.String <p> } 91.27 + ^ 91.28 +HtmlTagsTest.java:44: error: invalid end tag: </img> 91.29 + * <img src="any.jpg" alt="alt"> </img> 91.30 + ^ 91.31 +HtmlTagsTest.java:49: error: end tag missing: </b> 91.32 + * <i> <b> </i> 91.33 + ^ 91.34 +HtmlTagsTest.java:54: error: unexpected end tag: </b> 91.35 + * <i> </b> </i> 91.36 + ^ 91.37 +HtmlTagsTest.java:54: warning: empty <i> tag 91.38 + * <i> </b> </i> 91.39 + ^ 91.40 +11 errors 91.41 +1 warning
92.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 92.2 +++ b/test/tools/doclint/MissingCommentTest.java Fri Dec 28 18:39:09 2012 -0800 92.3 @@ -0,0 +1,14 @@ 92.4 +/* 92.5 + * @test /nodynamiccopyright/ 92.6 + * @build DocLintTester 92.7 + * @run main DocLintTester -Xmsgs:-missing MissingCommentTest.java 92.8 + * @run main DocLintTester -Xmsgs:missing -ref MissingCommentTest.out MissingCommentTest.java 92.9 + */ 92.10 + 92.11 +public class MissingCommentTest { 92.12 + MissingCommentTest() { } 92.13 + 92.14 + int missingComment; 92.15 + 92.16 + void missingComment() { } 92.17 +}
93.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 93.2 +++ b/test/tools/doclint/MissingCommentTest.out Fri Dec 28 18:39:09 2012 -0800 93.3 @@ -0,0 +1,14 @@ 93.4 +MissingCommentTest.java:8: warning: no comment 93.5 +public class MissingCommentTest { 93.6 + ^ 93.7 +MissingCommentTest.java:9: warning: no comment 93.8 + MissingCommentTest() { } 93.9 + ^ 93.10 +MissingCommentTest.java:11: warning: no comment 93.11 + int missingComment; 93.12 + ^ 93.13 +MissingCommentTest.java:13: warning: no comment 93.14 + void missingComment() { } 93.15 + ^ 93.16 +4 warnings 93.17 +
94.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 94.2 +++ b/test/tools/doclint/MissingParamsTest.java Fri Dec 28 18:39:09 2012 -0800 94.3 @@ -0,0 +1,23 @@ 94.4 +/* 94.5 + * @test /nodynamiccopyright/ 94.6 + * @bug 8004832 94.7 + * @summary Add new doclint package 94.8 + * @build DocLintTester 94.9 + * @run main DocLintTester -Xmsgs:-missing MissingParamsTest.java 94.10 + * @run main DocLintTester -Xmsgs:missing -ref MissingParamsTest.out MissingParamsTest.java 94.11 + */ 94.12 + 94.13 +/** . */ 94.14 +public class MissingParamsTest { 94.15 + /** */ 94.16 + MissingParamsTest(int param) { } 94.17 + 94.18 + /** */ 94.19 + <T> MissingParamsTest() { } 94.20 + 94.21 + /** */ 94.22 + void missingParam(int param) { } 94.23 + 94.24 + /** */ 94.25 + <T> void missingTyparam() { } 94.26 +}
95.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 95.2 +++ b/test/tools/doclint/MissingParamsTest.out Fri Dec 28 18:39:09 2012 -0800 95.3 @@ -0,0 +1,14 @@ 95.4 +MissingParamsTest.java:13: warning: no @param for param 95.5 + MissingParamsTest(int param) { } 95.6 + ^ 95.7 +MissingParamsTest.java:16: warning: no @param for <T> 95.8 + <T> MissingParamsTest() { } 95.9 + ^ 95.10 +MissingParamsTest.java:19: warning: no @param for param 95.11 + void missingParam(int param) { } 95.12 + ^ 95.13 +MissingParamsTest.java:22: warning: no @param for <T> 95.14 + <T> void missingTyparam() { } 95.15 + ^ 95.16 +4 warnings 95.17 +
96.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 96.2 +++ b/test/tools/doclint/MissingReturnTest.java Fri Dec 28 18:39:09 2012 -0800 96.3 @@ -0,0 +1,23 @@ 96.4 +/* 96.5 + * @test /nodynamiccopyright/ 96.6 + * @bug 8004832 96.7 + * @summary Add new doclint package 96.8 + * @build DocLintTester 96.9 + * @run main DocLintTester -Xmsgs:-missing MissingReturnTest.java 96.10 + * @run main DocLintTester -Xmsgs:missing -ref MissingReturnTest.out MissingReturnTest.java 96.11 + */ 96.12 + 96.13 +/** . */ 96.14 +public class MissingReturnTest { 96.15 + /** no return allowed */ 96.16 + MissingReturnTest() { } 96.17 + 96.18 + /** no return allowed */ 96.19 + void return_void() { } 96.20 + 96.21 + /** no return required */ 96.22 + Void return_Void() { } 96.23 + 96.24 + /** */ 96.25 + int missingReturn() { } 96.26 +}
97.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 97.2 +++ b/test/tools/doclint/MissingReturnTest.out Fri Dec 28 18:39:09 2012 -0800 97.3 @@ -0,0 +1,5 @@ 97.4 +MissingReturnTest.java:22: warning: no @return 97.5 + int missingReturn() { } 97.6 + ^ 97.7 +1 warning 97.8 +
98.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 98.2 +++ b/test/tools/doclint/MissingThrowsTest.java Fri Dec 28 18:39:09 2012 -0800 98.3 @@ -0,0 +1,14 @@ 98.4 +/* 98.5 + * @test /nodynamiccopyright/ 98.6 + * @bug 8004832 98.7 + * @summary Add new doclint package 98.8 + * @build DocLintTester 98.9 + * @run main DocLintTester -Xmsgs:-missing MissingThrowsTest.java 98.10 + * @run main DocLintTester -Xmsgs:missing -ref MissingThrowsTest.out MissingThrowsTest.java 98.11 + */ 98.12 + 98.13 +/** */ 98.14 +public class MissingThrowsTest { 98.15 + /** */ 98.16 + void missingThrows() throws Exception { } 98.17 +}
99.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 99.2 +++ b/test/tools/doclint/MissingThrowsTest.out Fri Dec 28 18:39:09 2012 -0800 99.3 @@ -0,0 +1,4 @@ 99.4 +MissingThrowsTest.java:13: warning: no @throws for java.lang.Exception 99.5 + void missingThrows() throws Exception { } 99.6 + ^ 99.7 +1 warning
100.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 100.2 +++ b/test/tools/doclint/OptionTest.java Fri Dec 28 18:39:09 2012 -0800 100.3 @@ -0,0 +1,96 @@ 100.4 +/* 100.5 + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. 100.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 100.7 + * 100.8 + * This code is free software; you can redistribute it and/or modify it 100.9 + * under the terms of the GNU General Public License version 2 only, as 100.10 + * published by the Free Software Foundation. 100.11 + * 100.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 100.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 100.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 100.15 + * version 2 for more details (a copy is included in the LICENSE file that 100.16 + * accompanied this code). 100.17 + * 100.18 + * You should have received a copy of the GNU General Public License version 100.19 + * 2 along with this work; if not, write to the Free Software Foundation, 100.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 100.21 + * 100.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 100.23 + * or visit www.oracle.com if you need additional information or have any 100.24 + * questions. 100.25 + */ 100.26 + 100.27 +/* 100.28 + * @test 100.29 + * @bug 8004832 100.30 + * @summary Add new doclint package 100.31 + */ 100.32 + 100.33 +import com.sun.tools.doclint.DocLint; 100.34 + 100.35 +public class OptionTest { 100.36 + public static void main(String... args) throws Exception { 100.37 + new OptionTest().run(); 100.38 + } 100.39 + 100.40 + String[] positiveTests = { 100.41 + "-Xmsgs", 100.42 + "-Xmsgs:all", 100.43 + "-Xmsgs:none", 100.44 + "-Xmsgs:accessibility", 100.45 + "-Xmsgs:html", 100.46 + "-Xmsgs:missing", 100.47 + "-Xmsgs:reference", 100.48 + "-Xmsgs:syntax", 100.49 + "-Xmsgs:html/public", 100.50 + "-Xmsgs:html/protected", 100.51 + "-Xmsgs:html/package", 100.52 + "-Xmsgs:html/private", 100.53 + "-Xmsgs:-html/public", 100.54 + "-Xmsgs:-html/protected", 100.55 + "-Xmsgs:-html/package", 100.56 + "-Xmsgs:-html/private", 100.57 + "-Xmsgs:html,syntax", 100.58 + "-Xmsgs:html,-syntax", 100.59 + "-Xmsgs:-html,syntax", 100.60 + "-Xmsgs:-html,-syntax", 100.61 + "-Xmsgs:html/public,syntax", 100.62 + "-Xmsgs:html,syntax/public", 100.63 + "-Xmsgs:-html/public,syntax/public" 100.64 + }; 100.65 + 100.66 + String[] negativeTests = { 100.67 + "-typo", 100.68 + "-Xmsgs:-all", 100.69 + "-Xmsgs:-none", 100.70 + "-Xmsgs:typo", 100.71 + "-Xmsgs:html/typo", 100.72 + "-Xmsgs:html/public,typo", 100.73 + "-Xmsgs:html/public,syntax/typo", 100.74 + }; 100.75 + 100.76 + void run() throws Exception { 100.77 + test(positiveTests, true); 100.78 + test(negativeTests, false); 100.79 + 100.80 + if (errors > 0) 100.81 + throw new Exception(errors + " errors occurred"); 100.82 + } 100.83 + 100.84 + void test(String[] tests, boolean expect) { 100.85 + for (String test: tests) { 100.86 + System.err.println("test: " + test); 100.87 + boolean found = DocLint.isValidOption(test); 100.88 + if (found != expect) 100.89 + error("Unexpected result: " + found + ",expected: " + expect); 100.90 + } 100.91 + } 100.92 + 100.93 + void error(String msg) { 100.94 + System.err.println("Error: " + msg); 100.95 + errors++; 100.96 + } 100.97 + 100.98 + int errors; 100.99 +}
101.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 101.2 +++ b/test/tools/doclint/OverridesTest.java Fri Dec 28 18:39:09 2012 -0800 101.3 @@ -0,0 +1,93 @@ 101.4 +/* 101.5 + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. 101.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 101.7 + * 101.8 + * This code is free software; you can redistribute it and/or modify it 101.9 + * under the terms of the GNU General Public License version 2 only, as 101.10 + * published by the Free Software Foundation. 101.11 + * 101.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 101.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 101.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 101.15 + * version 2 for more details (a copy is included in the LICENSE file that 101.16 + * accompanied this code). 101.17 + * 101.18 + * You should have received a copy of the GNU General Public License version 101.19 + * 2 along with this work; if not, write to the Free Software Foundation, 101.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 101.21 + * 101.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 101.23 + * or visit www.oracle.com if you need additional information or have any 101.24 + * questions. 101.25 + */ 101.26 + 101.27 +/* 101.28 + * @test 101.29 + * @bug 8004832 101.30 + * @summary Add new doclint package 101.31 + * @build DocLintTester 101.32 + * @run main DocLintTester -Xmsgs:all OverridesTest.java 101.33 + */ 101.34 + 101.35 +/* 101.36 + * This is a test that missing comments on methods may be inherited 101.37 + * from overridden methods. As such, there should be no errors due 101.38 + * to missing comments (or any other types of error) in this test. 101.39 + */ 101.40 + 101.41 +/** An interface. */ 101.42 +interface I1 { 101.43 + /** 101.44 + * A method 101.45 + * @param p a param 101.46 + * @throws Exception an exception 101.47 + * @return an int 101.48 + */ 101.49 + int m(int p) throws Exception; 101.50 +} 101.51 + 101.52 +/** An extending interface. */ 101.53 +interface I2 extends I1 { } 101.54 + 101.55 +/** An abstract class. */ 101.56 +abstract class C1 { 101.57 + /** 101.58 + * A method 101.59 + * @param p a param 101.60 + * @throws Exception an exception 101.61 + * @return an int 101.62 + */ 101.63 + int m(int p) throws Exception; 101.64 +} 101.65 + 101.66 +/** An implementing class. */ 101.67 +class C2 implements I1 { 101.68 + int m(int p) throws Exception { return p; } 101.69 +} 101.70 + 101.71 +/** An extending class. */ 101.72 +class C3 extends C1 { 101.73 + int m(int p) throws Exception { return p; } 101.74 +} 101.75 + 101.76 +/** An extending and implementing class. */ 101.77 +class C4 extends C1 implements I1 { 101.78 + int m(int p) throws Exception { return p; } 101.79 +} 101.80 + 101.81 +/** An implementing class using inheritdoc. */ 101.82 +class C5 implements I1 { 101.83 + /** {@inheritDoc} */ 101.84 + int m(int p) throws Exception { return p; } 101.85 +} 101.86 + 101.87 +/** An implementing class with incomplete documentation. */ 101.88 +class C6 implements I1 { 101.89 + /** Overriding method */ 101.90 + int m(int p) throws Exception { return p; } 101.91 +} 101.92 + 101.93 +/** A class implementing an inherited interface. */ 101.94 +class C7 implements I2 { 101.95 + int m(int p) throws Exception { return p; } 101.96 +}
102.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 102.2 +++ b/test/tools/doclint/ReferenceTest.java Fri Dec 28 18:39:09 2012 -0800 102.3 @@ -0,0 +1,52 @@ 102.4 +/* 102.5 + * @test /nodynamiccopyright/ 102.6 + * @bug 8004832 102.7 + * @summary Add new doclint package 102.8 + * @build DocLintTester 102.9 + * @run main DocLintTester -Xmsgs:-reference ReferenceTest.java 102.10 + * @run main DocLintTester -ref ReferenceTest.out ReferenceTest.java 102.11 + */ 102.12 + 102.13 +/** */ 102.14 +public class ReferenceTest { 102.15 + /** 102.16 + * @param x description 102.17 + */ 102.18 + public int invalid_param; 102.19 + 102.20 + /** 102.21 + * @param x description 102.22 + */ 102.23 + public class InvalidParam { } 102.24 + 102.25 + /** 102.26 + * @param x description 102.27 + */ 102.28 + public void param_name_not_found(int a) { } 102.29 + 102.30 + /** 102.31 + * @param <X> description 102.32 + */ 102.33 + public class typaram_name_not_found { } 102.34 + 102.35 + /** 102.36 + * @see Object#tooStrong() 102.37 + */ 102.38 + public void ref_not_found() { } 102.39 + 102.40 + /** 102.41 + * @return x description 102.42 + */ 102.43 + public int invalid_return; 102.44 + 102.45 + /** 102.46 + * @return x description 102.47 + */ 102.48 + public void invalid_return(); 102.49 + 102.50 + /** 102.51 + * @throws Exception description 102.52 + */ 102.53 + public void exception_not_thrown() { } 102.54 +} 102.55 +
103.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 103.2 +++ b/test/tools/doclint/ReferenceTest.out Fri Dec 28 18:39:09 2012 -0800 103.3 @@ -0,0 +1,30 @@ 103.4 +ReferenceTest.java:13: error: invalid use of @param 103.5 + * @param x description 103.6 + ^ 103.7 +ReferenceTest.java:18: error: invalid use of @param 103.8 + * @param x description 103.9 + ^ 103.10 +ReferenceTest.java:23: error: @param name not found 103.11 + * @param x description 103.12 + ^ 103.13 +ReferenceTest.java:25: warning: no @param for a 103.14 + public void param_name_not_found(int a) { } 103.15 + ^ 103.16 +ReferenceTest.java:28: error: @param name not found 103.17 + * @param <X> description 103.18 + ^ 103.19 +ReferenceTest.java:33: error: reference not found 103.20 + * @see Object#tooStrong() 103.21 + ^ 103.22 +ReferenceTest.java:38: error: invalid use of @return 103.23 + * @return x description 103.24 + ^ 103.25 +ReferenceTest.java:43: error: invalid use of @return 103.26 + * @return x description 103.27 + ^ 103.28 +ReferenceTest.java:48: error: exception not thrown: java.lang.Exception 103.29 + * @throws Exception description 103.30 + ^ 103.31 +8 errors 103.32 +1 warning 103.33 +
104.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 104.2 +++ b/test/tools/doclint/RunTest.java Fri Dec 28 18:39:09 2012 -0800 104.3 @@ -0,0 +1,105 @@ 104.4 +/* 104.5 + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. 104.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 104.7 + * 104.8 + * This code is free software; you can redistribute it and/or modify it 104.9 + * under the terms of the GNU General Public License version 2 only, as 104.10 + * published by the Free Software Foundation. 104.11 + * 104.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 104.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 104.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 104.15 + * version 2 for more details (a copy is included in the LICENSE file that 104.16 + * accompanied this code). 104.17 + * 104.18 + * You should have received a copy of the GNU General Public License version 104.19 + * 2 along with this work; if not, write to the Free Software Foundation, 104.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 104.21 + * 104.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 104.23 + * or visit www.oracle.com if you need additional information or have any 104.24 + * questions. 104.25 + */ 104.26 + 104.27 +/* @test 104.28 + * @bug 8004832 104.29 + * @summary Add new doclint package 104.30 + * @bug 8000103 104.31 + * @summary Create doclint utility 104.32 + */ 104.33 + 104.34 +import com.sun.tools.doclint.DocLint; 104.35 +import com.sun.tools.doclint.DocLint.BadArgs; 104.36 +import java.io.ByteArrayOutputStream; 104.37 +import java.io.File; 104.38 +import java.io.FilterOutputStream; 104.39 +import java.io.IOException; 104.40 +import java.io.OutputStream; 104.41 +import java.io.PrintStream; 104.42 +import java.io.PrintWriter; 104.43 +import java.io.StringWriter; 104.44 +import java.lang.annotation.Annotation; 104.45 +import java.lang.annotation.Retention; 104.46 +import java.lang.annotation.RetentionPolicy; 104.47 +import java.lang.reflect.InvocationTargetException; 104.48 +import java.lang.reflect.Method; 104.49 + 104.50 +/** javadoc error on toplevel: a & b. */ 104.51 +public class RunTest { 104.52 + /** javadoc error on member: a < b */ 104.53 + public static void main(String... args) throws Exception { 104.54 + new RunTest().run(); 104.55 + } 104.56 + 104.57 + 104.58 + File testSrc = new File(System.getProperty("test.src")); 104.59 + File thisFile = new File(testSrc, RunTest.class.getSimpleName() + ".java"); 104.60 + 104.61 + void run() throws Exception { 104.62 + for (Method m: getClass().getDeclaredMethods()) { 104.63 + Annotation a = m.getAnnotation(Test.class); 104.64 + if (a != null) { 104.65 + System.err.println("test: " + m.getName()); 104.66 + try { 104.67 + StringWriter sw = new StringWriter(); 104.68 + PrintWriter pw = new PrintWriter(sw);; 104.69 + m.invoke(this, new Object[] { pw }); 104.70 + String out = sw.toString(); 104.71 + System.err.println(">>> " + out.replace("\n", "\n>>> ")); 104.72 + if (!out.contains("a < b")) 104.73 + error("\"a < b\" not found"); 104.74 + if (!out.contains("a & b")) 104.75 + error("\"a & b\" not found"); 104.76 + } catch (InvocationTargetException e) { 104.77 + Throwable cause = e.getCause(); 104.78 + throw (cause instanceof Exception) ? ((Exception) cause) : e; 104.79 + } 104.80 + System.err.println(); 104.81 + } 104.82 + } 104.83 + 104.84 + if (errors > 0) 104.85 + throw new Exception(errors + " errors occurred"); 104.86 + } 104.87 + 104.88 + 104.89 + void error(String msg) { 104.90 + System.err.println("Error: " + msg); 104.91 + errors++; 104.92 + } 104.93 + 104.94 + int errors; 104.95 + 104.96 + /** Marker annotation for test cases. */ 104.97 + @Retention(RetentionPolicy.RUNTIME) 104.98 + @interface Test { } 104.99 + 104.100 + @Test 104.101 + void testMain(PrintWriter pw) throws BadArgs, IOException { 104.102 + String[] args = { "-Xmsgs", thisFile.getPath() }; 104.103 + DocLint d = new DocLint(); 104.104 + d.run(pw, args); 104.105 + } 104.106 +} 104.107 + 104.108 +
105.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 105.2 +++ b/test/tools/doclint/SyntaxTest.java Fri Dec 28 18:39:09 2012 -0800 105.3 @@ -0,0 +1,17 @@ 105.4 +/* 105.5 + * @test /nodynamiccopyright/ 105.6 + * @bug 8004832 105.7 + * @summary Add new doclint package 105.8 + * @build DocLintTester 105.9 + * @run main DocLintTester -Xmsgs:-syntax SyntaxTest.java 105.10 + * @run main DocLintTester -ref SyntaxTest.out SyntaxTest.java 105.11 + */ 105.12 + 105.13 +/** */ 105.14 +public class SyntaxTest { 105.15 + /** 105.16 + * a < b 105.17 + */ 105.18 + public void syntax_error() { } 105.19 +} 105.20 +
106.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 106.2 +++ b/test/tools/doclint/SyntaxTest.out Fri Dec 28 18:39:09 2012 -0800 106.3 @@ -0,0 +1,5 @@ 106.4 +SyntaxTest.java:13: error: malformed HTML 106.5 + * a < b 106.6 + ^ 106.7 +1 error 106.8 +
107.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 107.2 +++ b/test/tools/doclint/SyntheticTest.java Fri Dec 28 18:39:09 2012 -0800 107.3 @@ -0,0 +1,50 @@ 107.4 +/* 107.5 + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. 107.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 107.7 + * 107.8 + * This code is free software; you can redistribute it and/or modify it 107.9 + * under the terms of the GNU General Public License version 2 only, as 107.10 + * published by the Free Software Foundation. 107.11 + * 107.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 107.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 107.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 107.15 + * version 2 for more details (a copy is included in the LICENSE file that 107.16 + * accompanied this code). 107.17 + * 107.18 + * You should have received a copy of the GNU General Public License version 107.19 + * 2 along with this work; if not, write to the Free Software Foundation, 107.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 107.21 + * 107.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 107.23 + * or visit www.oracle.com if you need additional information or have any 107.24 + * questions. 107.25 + */ 107.26 + 107.27 +/* 107.28 + * @test 107.29 + * @bug 8004832 107.30 + * @summary Add new doclint package 107.31 + * @build DocLintTester 107.32 + * @run main DocLintTester -Xmsgs:all SyntheticTest.java 107.33 + */ 107.34 + 107.35 +/** 107.36 + * This is a test that messages are not generated for synthesized elements 107.37 + * such as default constructors and enum methods. 107.38 + */ 107.39 +public class SyntheticTest { 107.40 + // No explicit constructor implies a default constructor 107.41 + 107.42 + /** enum E */ 107.43 + enum E { 107.44 + /** enum member E1 */ 107.45 + E1, 107.46 + /** enum member E2 */ 107.47 + E2, 107.48 + /** enum member E3 */ 107.49 + E3 107.50 + } 107.51 +} 107.52 + 107.53 +
108.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 108.2 +++ b/test/tools/doclint/ValidTest.java Fri Dec 28 18:39:09 2012 -0800 108.3 @@ -0,0 +1,112 @@ 108.4 +/* 108.5 + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. 108.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 108.7 + * 108.8 + * This code is free software; you can redistribute it and/or modify it 108.9 + * under the terms of the GNU General Public License version 2 only, as 108.10 + * published by the Free Software Foundation. 108.11 + * 108.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 108.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 108.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 108.15 + * version 2 for more details (a copy is included in the LICENSE file that 108.16 + * accompanied this code). 108.17 + * 108.18 + * You should have received a copy of the GNU General Public License version 108.19 + * 2 along with this work; if not, write to the Free Software Foundation, 108.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 108.21 + * 108.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 108.23 + * or visit www.oracle.com if you need additional information or have any 108.24 + * questions. 108.25 + */ 108.26 + 108.27 +/* 108.28 + * @test 108.29 + * @bug 8004832 108.30 + * @summary Add new doclint package 108.31 + * @build DocLintTester 108.32 + * @run main DocLintTester ValidTest.java 108.33 + */ 108.34 + 108.35 +class ValidTest { 108.36 + /** 108.37 + * < > & ( 108.38 + */ 108.39 + void entities() { } 108.40 + 108.41 + /** 108.42 + * <h1> ... </h1> 108.43 + * <h2> ... </h2> 108.44 + * <h3> ... </h3> 108.45 + * <h4> ... </h4> 108.46 + * <h5> ... </h5> 108.47 + * <h6> ... </h6> 108.48 + */ 108.49 + void all_headers() { } 108.50 + 108.51 + /** 108.52 + * <h1> ... </h1> 108.53 + * <h2> ... </h2> 108.54 + * <h3> ... </h3> 108.55 + * <h1> ... </h1> 108.56 + * <h2> ... </h2> 108.57 + * <h3> ... </h3> 108.58 + * <h2> ... </h2> 108.59 + */ 108.60 + void header_series() { } 108.61 + 108.62 + /** 108.63 + * <div> <p> </div> 108.64 + */ 108.65 + void autoclose_tags() { } 108.66 + 108.67 + /** 108.68 + * @param x 108.69 + */ 108.70 + void method_param(int x) { } 108.71 + 108.72 + /** 108.73 + * @param <T> 108.74 + */ 108.75 + <T> T method_typaram(T t) { return t; } 108.76 + 108.77 + /** 108.78 + * @param <T> 108.79 + */ 108.80 + class ClassTyparam<T> { } 108.81 + 108.82 + /** 108.83 + * @param <T> 108.84 + */ 108.85 + interface InterfaceTyparam<T> { } 108.86 + 108.87 + /** 108.88 + * @return x 108.89 + */ 108.90 + int return_int() { return 0; } 108.91 + 108.92 + /** 108.93 + * @exception Exception 108.94 + */ 108.95 + void throws_Exception1() throws Exception { } 108.96 + 108.97 + /** 108.98 + * @throws Exception 108.99 + */ 108.100 + void throws_Exception2() throws Exception { } 108.101 + 108.102 + class X { 108.103 + /** 108.104 + * @param x 108.105 + */ 108.106 + X(int x) { } // constructor parameter 108.107 + 108.108 + /** 108.109 + * @param <T> 108.110 + */ 108.111 + <T> X(T t) { } // constructor type parameter 108.112 + } 108.113 + 108.114 +} 108.115 +
109.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 109.2 +++ b/test/tools/doclint/tidy/AnchorAlreadyDefined.java Fri Dec 28 18:39:09 2012 -0800 109.3 @@ -0,0 +1,17 @@ 109.4 +/* 109.5 + * @test /nodynamiccopyright/ 109.6 + * @bug 8004832 109.7 + * @summary Add new doclint package 109.8 + * @library .. 109.9 + * @build DocLintTester 109.10 + * @run main DocLintTester -ref AnchorAlreadyDefined.out AnchorAlreadyDefined.java 109.11 + */ 109.12 + 109.13 +// tidy: Warning: <.*> anchor ".*" already defined 109.14 + 109.15 +/** 109.16 + * <a name="here">valid</a> 109.17 + * <a name="here">duplicate</a> 109.18 + * <h1 id="here">duplicate</h1> 109.19 + */ 109.20 +public class AnchorAlreadyDefined { }
110.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 110.2 +++ b/test/tools/doclint/tidy/AnchorAlreadyDefined.out Fri Dec 28 18:39:09 2012 -0800 110.3 @@ -0,0 +1,7 @@ 110.4 +AnchorAlreadyDefined.java:14: error: anchor already defined: here 110.5 + * <a name="here">duplicate</a> 110.6 + ^ 110.7 +AnchorAlreadyDefined.java:15: error: anchor already defined: here 110.8 + * <h1 id="here">duplicate</h1> 110.9 + ^ 110.10 +2 errors
111.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 111.2 +++ b/test/tools/doclint/tidy/BadEnd.java Fri Dec 28 18:39:09 2012 -0800 111.3 @@ -0,0 +1,16 @@ 111.4 +/* 111.5 + * @test /nodynamiccopyright/ 111.6 + * @bug 8004832 111.7 + * @summary Add new doclint package 111.8 + * @library .. 111.9 + * @build DocLintTester 111.10 + * @run main DocLintTester -ref BadEnd.out BadEnd.java 111.11 + */ 111.12 + 111.13 +// tidy: Warning: <.*> is probably intended as </.*> 111.14 + 111.15 +/** 111.16 + * <a name="here"> text <a> 111.17 + * <code> text <code> 111.18 + */ 111.19 +public class BadEnd { }
112.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 112.2 +++ b/test/tools/doclint/tidy/BadEnd.out Fri Dec 28 18:39:09 2012 -0800 112.3 @@ -0,0 +1,17 @@ 112.4 +BadEnd.java:14: warning: nested tag not allowed: <code> 112.5 + * <code> text <code> 112.6 + ^ 112.7 +BadEnd.java:14: error: element not closed: code 112.8 + * <code> text <code> 112.9 + ^ 112.10 +BadEnd.java:14: error: element not closed: code 112.11 + * <code> text <code> 112.12 + ^ 112.13 +BadEnd.java:13: error: element not closed: a 112.14 + * <a name="here"> text <a> 112.15 + ^ 112.16 +BadEnd.java:13: error: element not closed: a 112.17 + * <a name="here"> text <a> 112.18 + ^ 112.19 +4 errors 112.20 +1 warning
113.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 113.2 +++ b/test/tools/doclint/tidy/InsertImplicit.java Fri Dec 28 18:39:09 2012 -0800 113.3 @@ -0,0 +1,16 @@ 113.4 +/* 113.5 + * @test /nodynamiccopyright/ 113.6 + * @bug 8004832 113.7 + * @summary Add new doclint package 113.8 + * @library .. 113.9 + * @build DocLintTester 113.10 + * @run main DocLintTester -ref InsertImplicit.out InsertImplicit.java 113.11 + */ 113.12 + 113.13 +// tidy: Warning: inserting implicit <.*> 113.14 + 113.15 +/** 113.16 + * </p> 113.17 + * <i> <blockquote> abc </blockquote> </i> 113.18 + */ 113.19 +public class InsertImplicit { }
114.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 114.2 +++ b/test/tools/doclint/tidy/InsertImplicit.out Fri Dec 28 18:39:09 2012 -0800 114.3 @@ -0,0 +1,7 @@ 114.4 +InsertImplicit.java:13: error: unexpected end tag: </p> 114.5 + * </p> 114.6 + ^ 114.7 +InsertImplicit.java:14: error: block element not allowed within inline element <i>: blockquote 114.8 + * <i> <blockquote> abc </blockquote> </i> 114.9 + ^ 114.10 +2 errors
115.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 115.2 +++ b/test/tools/doclint/tidy/InvalidEntity.java Fri Dec 28 18:39:09 2012 -0800 115.3 @@ -0,0 +1,22 @@ 115.4 +/* 115.5 + * @test /nodynamiccopyright/ 115.6 + * @bug 8004832 115.7 + * @summary Add new doclint package 115.8 + * @library .. 115.9 + * @build DocLintTester 115.10 + * @run main DocLintTester -ref InvalidEntity.out InvalidEntity.java 115.11 + */ 115.12 + 115.13 +// tidy: Warning: replacing invalid numeric character reference .* 115.14 + 115.15 +// See 115.16 +// http://www.w3.org/TR/html4/sgml/entities.html 115.17 +// http://stackoverflow.com/questions/631406/what-is-the-difference-between-em-dash-151-and-8212 115.18 + 115.19 +/** 115.20 + *  115.21 + *  115.22 + * &splodge; 115.23 + * 115.24 + */ 115.25 +public class InvalidEntity { }
116.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 116.2 +++ b/test/tools/doclint/tidy/InvalidEntity.out Fri Dec 28 18:39:09 2012 -0800 116.3 @@ -0,0 +1,10 @@ 116.4 +InvalidEntity.java:17: error: invalid entity  116.5 + *  116.6 + ^ 116.7 +InvalidEntity.java:18: error: invalid entity  116.8 + *  116.9 + ^ 116.10 +InvalidEntity.java:19: error: invalid entity &splodge; 116.11 + * &splodge; 116.12 + ^ 116.13 +3 errors
117.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 117.2 +++ b/test/tools/doclint/tidy/InvalidName.java Fri Dec 28 18:39:09 2012 -0800 117.3 @@ -0,0 +1,18 @@ 117.4 +/* 117.5 + * @test /nodynamiccopyright/ 117.6 + * @bug 8004832 117.7 + * @summary Add new doclint package 117.8 + * @library .. 117.9 + * @build DocLintTester 117.10 + * @run main DocLintTester -ref InvalidName.out InvalidName.java 117.11 + */ 117.12 + 117.13 +// tidy: Warning: <a> cannot copy name attribute to id 117.14 + 117.15 +/** 117.16 + * <a name="abc">valid</a> 117.17 + * <a name="abc123">valid</a> 117.18 + * <a name="a.1:2-3_4">valid</a> 117.19 + * <a name="foo()">invalid</a> 117.20 + */ 117.21 +public class InvalidName { }
118.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 118.2 +++ b/test/tools/doclint/tidy/InvalidName.out Fri Dec 28 18:39:09 2012 -0800 118.3 @@ -0,0 +1,4 @@ 118.4 +InvalidName.java:16: error: invalid name for anchor: "foo()" 118.5 + * <a name="foo()">invalid</a> 118.6 + ^ 118.7 +1 error
119.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 119.2 +++ b/test/tools/doclint/tidy/InvalidTag.java Fri Dec 28 18:39:09 2012 -0800 119.3 @@ -0,0 +1,15 @@ 119.4 +/* 119.5 + * @test /nodynamiccopyright/ 119.6 + * @bug 8004832 119.7 + * @summary Add new doclint package 119.8 + * @library .. 119.9 + * @build DocLintTester 119.10 + * @run main DocLintTester -ref InvalidTag.out InvalidTag.java 119.11 + */ 119.12 + 119.13 +// tidy: Error: <.*> is not recognized! 119.14 + 119.15 +/** 119.16 + * List<String> list = new ArrayList<>(); 119.17 + */ 119.18 +public class InvalidTag { }
120.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 120.2 +++ b/test/tools/doclint/tidy/InvalidTag.out Fri Dec 28 18:39:09 2012 -0800 120.3 @@ -0,0 +1,10 @@ 120.4 +InvalidTag.java:13: error: unknown tag: String 120.5 + * List<String> list = new ArrayList<>(); 120.6 + ^ 120.7 +InvalidTag.java:13: error: malformed HTML 120.8 + * List<String> list = new ArrayList<>(); 120.9 + ^ 120.10 +InvalidTag.java:13: error: bad use of '>' 120.11 + * List<String> list = new ArrayList<>(); 120.12 + ^ 120.13 +3 errors
121.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 121.2 +++ b/test/tools/doclint/tidy/InvalidURI.java Fri Dec 28 18:39:09 2012 -0800 121.3 @@ -0,0 +1,21 @@ 121.4 +/* 121.5 + * @test /nodynamiccopyright/ 121.6 + * @bug 8004832 121.7 + * @summary Add new doclint package 121.8 + * @library .. 121.9 + * @build DocLintTester 121.10 + * @run main DocLintTester -ref InvalidURI.out InvalidURI.java 121.11 + */ 121.12 + 121.13 +// tidy: Warning: <a> escaping malformed URI reference 121.14 +// tidy: Warning: <.*> attribute ".*" lacks value 121.15 + 121.16 +/** 121.17 + * <a href="abc">valid</a> 121.18 + * <a href="abc%20def">valid</a> 121.19 + * <a href="abc def">invalid</a> 121.20 + * <a href>no value</a> 121.21 + * <a href= >no value</a> 121.22 + * <a href="" >no value</a> 121.23 + */ 121.24 +public class InvalidURI { }
122.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 122.2 +++ b/test/tools/doclint/tidy/InvalidURI.out Fri Dec 28 18:39:09 2012 -0800 122.3 @@ -0,0 +1,13 @@ 122.4 +InvalidURI.java:16: error: invalid uri: "abc def" 122.5 + * <a href="abc def">invalid</a> 122.6 + ^ 122.7 +InvalidURI.java:17: error: attribute lacks value 122.8 + * <a href>no value</a> 122.9 + ^ 122.10 +InvalidURI.java:18: error: attribute lacks value 122.11 + * <a href= >no value</a> 122.12 + ^ 122.13 +InvalidURI.java:19: error: attribute lacks value 122.14 + * <a href="" >no value</a> 122.15 + ^ 122.16 +4 errors
123.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 123.2 +++ b/test/tools/doclint/tidy/MissingGT.java Fri Dec 28 18:39:09 2012 -0800 123.3 @@ -0,0 +1,16 @@ 123.4 +/* 123.5 + * @test /nodynamiccopyright/ 123.6 + * @bug 8004832 123.7 + * @summary Add new doclint package 123.8 + * @library .. 123.9 + * @build DocLintTester 123.10 + * @run main DocLintTester -ref MissingGT.out MissingGT.java 123.11 + */ 123.12 + 123.13 +// tidy: Warning: <.*> missing '>' for end of tag 123.14 + 123.15 +/** 123.16 + * <img src="image.gif" 123.17 + * <i> text </i> 123.18 + */ 123.19 +public class MissingGT { }
124.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 124.2 +++ b/test/tools/doclint/tidy/MissingGT.out Fri Dec 28 18:39:09 2012 -0800 124.3 @@ -0,0 +1,4 @@ 124.4 +MissingGT.java:13: error: malformed HTML 124.5 + * <img src="image.gif" 124.6 + ^ 124.7 +1 error
125.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 125.2 +++ b/test/tools/doclint/tidy/MissingTag.java Fri Dec 28 18:39:09 2012 -0800 125.3 @@ -0,0 +1,17 @@ 125.4 +/* 125.5 + * @test /nodynamiccopyright/ 125.6 + * @bug 8004832 125.7 + * @summary Add new doclint package 125.8 + * @library .. 125.9 + * @build DocLintTester 125.10 + * @run main DocLintTester -ref MissingTag.out MissingTag.java 125.11 + */ 125.12 + 125.13 +// tidy: Warning: missing <.*> 125.14 +// tidy: Warning: missing </.*> before </.*> 125.15 + 125.16 +/** 125.17 + * </p> 125.18 + * <h1> <b> text </h1> 125.19 + */ 125.20 +public class MissingTag { }
126.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 126.2 +++ b/test/tools/doclint/tidy/MissingTag.out Fri Dec 28 18:39:09 2012 -0800 126.3 @@ -0,0 +1,7 @@ 126.4 +MissingTag.java:14: error: unexpected end tag: </p> 126.5 + * </p> 126.6 + ^ 126.7 +MissingTag.java:15: error: end tag missing: </b> 126.8 + * <h1> <b> text </h1> 126.9 + ^ 126.10 +2 errors
127.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 127.2 +++ b/test/tools/doclint/tidy/NestedTag.java Fri Dec 28 18:39:09 2012 -0800 127.3 @@ -0,0 +1,16 @@ 127.4 +/* 127.5 + * @test /nodynamiccopyright/ 127.6 + * @bug 8004832 127.7 + * @summary Add new doclint package 127.8 + * @library .. 127.9 + * @build DocLintTester 127.10 + * @run main DocLintTester -ref NestedTag.out NestedTag.java 127.11 + */ 127.12 + 127.13 +// tidy: Warning: nested emphasis <.*> 127.14 + 127.15 +/** 127.16 + * <b><b> text </b></b> 127.17 + * {@link java.lang.String <code>String</code>} 127.18 + */ 127.19 +public class NestedTag { }
128.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 128.2 +++ b/test/tools/doclint/tidy/NestedTag.out Fri Dec 28 18:39:09 2012 -0800 128.3 @@ -0,0 +1,7 @@ 128.4 +NestedTag.java:13: warning: nested tag not allowed: <b> 128.5 + * <b><b> text </b></b> 128.6 + ^ 128.7 +NestedTag.java:14: warning: nested tag not allowed: <code> 128.8 + * {@link java.lang.String <code>String</code>} 128.9 + ^ 128.10 +2 warnings
129.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 129.2 +++ b/test/tools/doclint/tidy/ParaInPre.java Fri Dec 28 18:39:09 2012 -0800 129.3 @@ -0,0 +1,20 @@ 129.4 +/* 129.5 + * @test /nodynamiccopyright/ 129.6 + * @bug 8004832 129.7 + * @summary Add new doclint package 129.8 + * @library .. 129.9 + * @build DocLintTester 129.10 + * @run main DocLintTester -ref ParaInPre.out ParaInPre.java 129.11 + */ 129.12 + 129.13 +// tidy: Warning: replacing <p> by <br> 129.14 +// tidy: Warning: using <br> in place of <p> 129.15 + 129.16 +/** 129.17 + * <pre> 129.18 + * text 129.19 + * <p> 129.20 + * more text 129.21 + * </pre> 129.22 + */ 129.23 +public class ParaInPre { }
130.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 130.2 +++ b/test/tools/doclint/tidy/ParaInPre.out Fri Dec 28 18:39:09 2012 -0800 130.3 @@ -0,0 +1,4 @@ 130.4 +ParaInPre.java:16: warning: unexpected use of <p> inside <pre> element 130.5 + * <p> 130.6 + ^ 130.7 +1 warning
131.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 131.2 +++ b/test/tools/doclint/tidy/README.txt Fri Dec 28 18:39:09 2012 -0800 131.3 @@ -0,0 +1,21 @@ 131.4 +The utilities in this directory can be used to determine 131.5 +common issues in javadoc comments by running the standard 131.6 +"tidy" program on the output of javadoc, and analysing 131.7 +the messages that are reported. 131.8 + 131.9 +tidy.sh is a script that will run the "tidy" program on 131.10 +the files in a directory, writing the results to a new 131.11 +directroy. 131.12 + 131.13 +tidystats.Main is a Java program that can analyze the 131.14 +files produced by the tidy.sh script to generate a 131.15 +summary report about the warnings that were found. 131.16 + 131.17 + 131.18 +The tests is this directory are focussed on verifying 131.19 +that doclint detects issues in javadoc comments that will 131.20 +give rise to issues detected by "tidy" in the output 131.21 +generated by javadoc. 131.22 + 131.23 +For more information on the "tidy" program, see the HTML Tidy 131.24 +Library Project page at http://tidy.sourceforge.net/.
132.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 132.2 +++ b/test/tools/doclint/tidy/RepeatedAttr.java Fri Dec 28 18:39:09 2012 -0800 132.3 @@ -0,0 +1,15 @@ 132.4 +/* 132.5 + * @test /nodynamiccopyright/ 132.6 + * @bug 8004832 132.7 + * @summary Add new doclint package 132.8 + * @library .. 132.9 + * @build DocLintTester 132.10 + * @run main DocLintTester -ref RepeatedAttr.out RepeatedAttr.java 132.11 + */ 132.12 + 132.13 +// tidy: Warning: <.*> dropping value ".*" for repeated attribute ".*" 132.14 + 132.15 +/** 132.16 + * <img src="image.gif" alt alt="summary"> 132.17 + */ 132.18 +public class RepeatedAttr { }
133.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 133.2 +++ b/test/tools/doclint/tidy/RepeatedAttr.out Fri Dec 28 18:39:09 2012 -0800 133.3 @@ -0,0 +1,4 @@ 133.4 +RepeatedAttr.java:13: error: repeated attribute: alt 133.5 + * <img src="image.gif" alt alt="summary"> 133.6 + ^ 133.7 +1 error
134.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 134.2 +++ b/test/tools/doclint/tidy/TextNotAllowed.java Fri Dec 28 18:39:09 2012 -0800 134.3 @@ -0,0 +1,26 @@ 134.4 +/* 134.5 + * @test /nodynamiccopyright/ 134.6 + * @bug 8004832 134.7 + * @summary Add new doclint package 134.8 + * @library .. 134.9 + * @build DocLintTester 134.10 + * @run main DocLintTester -ref TextNotAllowed.out TextNotAllowed.java 134.11 + */ 134.12 + 134.13 +// tidy: Warning: plain text isn't allowed in <.*> elements 134.14 + 134.15 +/** 134.16 + * <table summary=description> abc </table> 134.17 + * <table summary=description> <tbody> abc </tbody> </table> 134.18 + * <table summary=description> <tr> abc </tr> </table> 134.19 + * 134.20 + * <dl> abc </dl> 134.21 + * <ol> abc </ol> 134.22 + * <ul> abc </ul> 134.23 + * 134.24 + * <ul> 134.25 + * <li> item 134.26 + * <li> item 134.27 + * </ul> 134.28 + */ 134.29 +public class TextNotAllowed { }
135.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 135.2 +++ b/test/tools/doclint/tidy/TextNotAllowed.out Fri Dec 28 18:39:09 2012 -0800 135.3 @@ -0,0 +1,19 @@ 135.4 +TextNotAllowed.java:13: error: text not allowed in <table> element 135.5 + * <table summary=description> abc </table> 135.6 + ^ 135.7 +TextNotAllowed.java:14: error: text not allowed in <tbody> element 135.8 + * <table summary=description> <tbody> abc </tbody> </table> 135.9 + ^ 135.10 +TextNotAllowed.java:15: error: text not allowed in <tr> element 135.11 + * <table summary=description> <tr> abc </tr> </table> 135.12 + ^ 135.13 +TextNotAllowed.java:17: error: text not allowed in <dl> element 135.14 + * <dl> abc </dl> 135.15 + ^ 135.16 +TextNotAllowed.java:18: error: text not allowed in <ol> element 135.17 + * <ol> abc </ol> 135.18 + ^ 135.19 +TextNotAllowed.java:19: error: text not allowed in <ul> element 135.20 + * <ul> abc </ul> 135.21 + ^ 135.22 +6 errors
136.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 136.2 +++ b/test/tools/doclint/tidy/TrimmingEmptyTag.java Fri Dec 28 18:39:09 2012 -0800 136.3 @@ -0,0 +1,29 @@ 136.4 +/* 136.5 + * @test /nodynamiccopyright/ 136.6 + * @bug 8004832 136.7 + * @summary Add new doclint package 136.8 + * @library .. 136.9 + * @build DocLintTester 136.10 + * @run main DocLintTester -ref TrimmingEmptyTag.out TrimmingEmptyTag.java 136.11 + */ 136.12 + 136.13 +// tidy: Warning: trimming empty <.*> 136.14 + 136.15 +/** 136.16 + * <b></b> 136.17 + * <table summary=description></table> 136.18 + * <table><caption></caption></table> 136.19 + * <code></code> 136.20 + * <dl></dl> 136.21 + * <dl><dt></dt><dd></dd></dl> 136.22 + * <font></font> 136.23 + * <i></i> 136.24 + * <ol></ol> 136.25 + * <p></p> 136.26 + * <pre></pre> 136.27 + * <span></span> 136.28 + * <tt></tt> 136.29 + * <ul></ul> 136.30 + * <ul><li></li></ul> 136.31 + */ 136.32 +public class TrimmingEmptyTag { }
137.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 137.2 +++ b/test/tools/doclint/tidy/TrimmingEmptyTag.out Fri Dec 28 18:39:09 2012 -0800 137.3 @@ -0,0 +1,46 @@ 137.4 +TrimmingEmptyTag.java:13: warning: empty <b> tag 137.5 + * <b></b> 137.6 + ^ 137.7 +TrimmingEmptyTag.java:14: warning: empty <table> tag 137.8 + * <table summary=description></table> 137.9 + ^ 137.10 +TrimmingEmptyTag.java:15: warning: empty <caption> tag 137.11 + * <table><caption></caption></table> 137.12 + ^ 137.13 +TrimmingEmptyTag.java:16: warning: empty <code> tag 137.14 + * <code></code> 137.15 + ^ 137.16 +TrimmingEmptyTag.java:17: warning: empty <dl> tag 137.17 + * <dl></dl> 137.18 + ^ 137.19 +TrimmingEmptyTag.java:18: warning: empty <dt> tag 137.20 + * <dl><dt></dt><dd></dd></dl> 137.21 + ^ 137.22 +TrimmingEmptyTag.java:18: warning: empty <dd> tag 137.23 + * <dl><dt></dt><dd></dd></dl> 137.24 + ^ 137.25 +TrimmingEmptyTag.java:19: warning: empty <font> tag 137.26 + * <font></font> 137.27 + ^ 137.28 +TrimmingEmptyTag.java:20: warning: empty <i> tag 137.29 + * <i></i> 137.30 + ^ 137.31 +TrimmingEmptyTag.java:21: warning: empty <ol> tag 137.32 + * <ol></ol> 137.33 + ^ 137.34 +TrimmingEmptyTag.java:22: warning: empty <p> tag 137.35 + * <p></p> 137.36 + ^ 137.37 +TrimmingEmptyTag.java:23: warning: empty <pre> tag 137.38 + * <pre></pre> 137.39 + ^ 137.40 +TrimmingEmptyTag.java:24: warning: empty <span> tag 137.41 + * <span></span> 137.42 + ^ 137.43 +TrimmingEmptyTag.java:25: warning: empty <tt> tag 137.44 + * <tt></tt> 137.45 + ^ 137.46 +TrimmingEmptyTag.java:26: warning: empty <ul> tag 137.47 + * <ul></ul> 137.48 + ^ 137.49 +15 warnings
138.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 138.2 +++ b/test/tools/doclint/tidy/UnescapedOrUnknownEntity.java Fri Dec 28 18:39:09 2012 -0800 138.3 @@ -0,0 +1,19 @@ 138.4 +/* 138.5 + * @test /nodynamiccopyright/ 138.6 + * @bug 8004832 138.7 + * @summary Add new doclint package 138.8 + * @library .. 138.9 + * @build DocLintTester 138.10 + * @run main DocLintTester -ref UnescapedOrUnknownEntity.out UnescapedOrUnknownEntity.java 138.11 + */ 138.12 + 138.13 +// tidy: Warning: unescaped & or unknown entity ".*" 138.14 +// tidy: Warning: unescaped & which should be written as & 138.15 +// tidy: Warning: entity ".*" doesn't end in ';' 138.16 + 138.17 +/** 138.18 + * L&F 138.19 + * Drag&Drop 138.20 + * if (a & b); 138.21 + */ 138.22 +public class UnescapedOrUnknownEntity { }
139.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 139.2 +++ b/test/tools/doclint/tidy/UnescapedOrUnknownEntity.out Fri Dec 28 18:39:09 2012 -0800 139.3 @@ -0,0 +1,11 @@ 139.4 +UnescapedOrUnknownEntity.java:15: error: semicolon missing 139.5 + * L&F 139.6 + ^ 139.7 +UnescapedOrUnknownEntity.java:16: error: semicolon missing 139.8 + * Drag&Drop 139.9 + ^ 139.10 +UnescapedOrUnknownEntity.java:17: error: bad HTML entity 139.11 + * if (a & b); 139.12 + ^ 139.13 +3 errors 139.14 +
140.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 140.2 +++ b/test/tools/doclint/tidy/util/Main.java Fri Dec 28 18:39:09 2012 -0800 140.3 @@ -0,0 +1,182 @@ 140.4 +package tidystats; 140.5 + 140.6 +import java.io.IOException; 140.7 +import java.nio.charset.Charset; 140.8 +import java.nio.file.FileSystem; 140.9 +import java.nio.file.FileSystems; 140.10 +import java.nio.file.Files; 140.11 +import java.nio.file.Path; 140.12 +import java.util.ArrayList; 140.13 +import java.util.Comparator; 140.14 +import java.util.HashMap; 140.15 +import java.util.List; 140.16 +import java.util.Map; 140.17 +import java.util.Set; 140.18 +import java.util.TreeMap; 140.19 +import java.util.TreeSet; 140.20 +import java.util.regex.Matcher; 140.21 +import java.util.regex.Pattern; 140.22 + 140.23 +public class Main { 140.24 + public static void main(String... args) throws IOException { 140.25 + new Main().run(args); 140.26 + } 140.27 + 140.28 + void run(String... args) throws IOException { 140.29 + FileSystem fs = FileSystems.getDefault(); 140.30 + List<Path> paths = new ArrayList<>(); 140.31 + 140.32 + int i; 140.33 + for (i = 0; i < args.length; i++) { 140.34 + String arg = args[i]; 140.35 + if (arg.startsWith("-")) 140.36 + throw new IllegalArgumentException(arg); 140.37 + else 140.38 + break; 140.39 + } 140.40 + 140.41 + for ( ; i < args.length; i++) { 140.42 + Path p = fs.getPath(args[i]); 140.43 + paths.add(p); 140.44 + } 140.45 + 140.46 + for (Path p: paths) { 140.47 + scan(p); 140.48 + } 140.49 + 140.50 + print("%6d files read", files); 140.51 + print("%6d files had no errors or warnings", ok); 140.52 + print("%6d files reported \"Not all warnings/errors were shown.\"", overflow); 140.53 + print("%6d errors found", errs); 140.54 + print("%6d warnings found", warns); 140.55 + print("%6d recommendations to use CSS", css); 140.56 + print(""); 140.57 + 140.58 + Map<Integer, Set<String>> sortedCounts = new TreeMap<>( 140.59 + new Comparator<Integer>() { 140.60 + @Override 140.61 + public int compare(Integer o1, Integer o2) { 140.62 + return o2.compareTo(o1); 140.63 + } 140.64 + }); 140.65 + 140.66 + for (Map.Entry<Pattern, Integer> e: counts.entrySet()) { 140.67 + Pattern p = e.getKey(); 140.68 + Integer n = e.getValue(); 140.69 + Set<String> set = sortedCounts.get(n); 140.70 + if (set == null) 140.71 + sortedCounts.put(n, (set = new TreeSet<>())); 140.72 + set.add(p.toString()); 140.73 + } 140.74 + 140.75 + for (Map.Entry<Integer, Set<String>> e: sortedCounts.entrySet()) { 140.76 + for (String p: e.getValue()) { 140.77 + if (p.startsWith(".*")) p = p.substring(2); 140.78 + print("%6d: %s", e.getKey(), p); 140.79 + } 140.80 + } 140.81 + } 140.82 + 140.83 + void scan(Path p) throws IOException { 140.84 + if (Files.isDirectory(p)) { 140.85 + for (Path c: Files.newDirectoryStream(p)) { 140.86 + scan(c); 140.87 + } 140.88 + } else if (isTidyFile(p)) { 140.89 + scan(Files.readAllLines(p, Charset.defaultCharset())); 140.90 + } 140.91 + } 140.92 + 140.93 + boolean isTidyFile(Path p) { 140.94 + return Files.isRegularFile(p) && p.getFileName().toString().endsWith(".tidy"); 140.95 + } 140.96 + 140.97 + void scan(List<String> lines) { 140.98 + Matcher m; 140.99 + files++; 140.100 + for (String line: lines) { 140.101 + if (okPattern.matcher(line).matches()) { 140.102 + ok++; 140.103 + } else if ((m = countPattern.matcher(line)).matches()) { 140.104 + warns += Integer.valueOf(m.group(1)); 140.105 + errs += Integer.valueOf(m.group(2)); 140.106 + if (m.group(3) != null) 140.107 + overflow++; 140.108 + } else if ((m = guardPattern.matcher(line)).matches()) { 140.109 + boolean found = false; 140.110 + for (Pattern p: patterns) { 140.111 + if ((m = p.matcher(line)).matches()) { 140.112 + found = true; 140.113 + count(p); 140.114 + break; 140.115 + } 140.116 + } 140.117 + if (!found) 140.118 + System.err.println("Unrecognized line: " + line); 140.119 + } else if (cssPattern.matcher(line).matches()) { 140.120 + css++; 140.121 + } 140.122 + } 140.123 + } 140.124 + 140.125 + Map<Pattern, Integer> counts = new HashMap<>(); 140.126 + void count(Pattern p) { 140.127 + Integer i = counts.get(p); 140.128 + counts.put(p, (i == null) ? 1 : i + 1); 140.129 + } 140.130 + 140.131 + void print(String format, Object... args) { 140.132 + System.out.println(String.format(format, args)); 140.133 + } 140.134 + 140.135 + Pattern okPattern = Pattern.compile("No warnings or errors were found."); 140.136 + Pattern countPattern = Pattern.compile("([0-9]+) warnings, ([0-9]+) errors were found!.*?(Not all warnings/errors were shown.)?"); 140.137 + Pattern cssPattern = Pattern.compile("You are recommended to use CSS.*"); 140.138 + Pattern guardPattern = Pattern.compile("line [0-9]+ column [0-9]+ - (Error|Warning):.*"); 140.139 + 140.140 + Pattern[] patterns = { 140.141 + Pattern.compile(".*Error: <.*> is not recognized!"), 140.142 + Pattern.compile(".*Error: missing quote mark for attribute value"), 140.143 + Pattern.compile(".*Warning: <.*> anchor \".*\" already defined"), 140.144 + Pattern.compile(".*Warning: <.*> attribute \".*\" has invalid value \".*\""), 140.145 + Pattern.compile(".*Warning: <.*> attribute \".*\" lacks value"), 140.146 + Pattern.compile(".*Warning: <.*> attribute \".*\" lacks value"), 140.147 + Pattern.compile(".*Warning: <.*> attribute with missing trailing quote mark"), 140.148 + Pattern.compile(".*Warning: <.*> dropping value \".*\" for repeated attribute \".*\""), 140.149 + Pattern.compile(".*Warning: <.*> inserting \".*\" attribute"), 140.150 + Pattern.compile(".*Warning: <.*> is probably intended as </.*>"), 140.151 + Pattern.compile(".*Warning: <.*> isn't allowed in <.*> elements"), 140.152 + Pattern.compile(".*Warning: <.*> lacks \".*\" attribute"), 140.153 + Pattern.compile(".*Warning: <.*> missing '>' for end of tag"), 140.154 + Pattern.compile(".*Warning: <.*> proprietary attribute \".*\""), 140.155 + Pattern.compile(".*Warning: <.*> unexpected or duplicate quote mark"), 140.156 + Pattern.compile(".*Warning: <a> cannot copy name attribute to id"), 140.157 + Pattern.compile(".*Warning: <a> escaping malformed URI reference"), 140.158 + Pattern.compile(".*Warning: <blockquote> proprietary attribute \"pre\""), 140.159 + Pattern.compile(".*Warning: discarding unexpected <.*>"), 140.160 + Pattern.compile(".*Warning: discarding unexpected </.*>"), 140.161 + Pattern.compile(".*Warning: entity \".*\" doesn't end in ';'"), 140.162 + Pattern.compile(".*Warning: inserting implicit <.*>"), 140.163 + Pattern.compile(".*Warning: inserting missing 'title' element"), 140.164 + Pattern.compile(".*Warning: missing <!DOCTYPE> declaration"), 140.165 + Pattern.compile(".*Warning: missing <.*>"), 140.166 + Pattern.compile(".*Warning: missing </.*> before <.*>"), 140.167 + Pattern.compile(".*Warning: nested emphasis <.*>"), 140.168 + Pattern.compile(".*Warning: plain text isn't allowed in <.*> elements"), 140.169 + Pattern.compile(".*Warning: replacing <p> by <br>"), 140.170 + Pattern.compile(".*Warning: replacing invalid numeric character reference .*"), 140.171 + Pattern.compile(".*Warning: replacing unexpected .* by </.*>"), 140.172 + Pattern.compile(".*Warning: trimming empty <.*>"), 140.173 + Pattern.compile(".*Warning: unescaped & or unknown entity \".*\""), 140.174 + Pattern.compile(".*Warning: unescaped & which should be written as &"), 140.175 + Pattern.compile(".*Warning: using <br> in place of <p>") 140.176 + }; 140.177 + 140.178 + int files; 140.179 + int ok; 140.180 + int warns; 140.181 + int errs; 140.182 + int css; 140.183 + int overflow; 140.184 +} 140.185 +
141.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 141.2 +++ b/test/tools/doclint/tidy/util/tidy.sh Fri Dec 28 18:39:09 2012 -0800 141.3 @@ -0,0 +1,52 @@ 141.4 +#!/bin/sh 141.5 +# 141.6 +# Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. 141.7 +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 141.8 +# 141.9 +# This code is free software; you can redistribute it and/or modify it 141.10 +# under the terms of the GNU General Public License version 2 only, as 141.11 +# published by the Free Software Foundation. 141.12 +# 141.13 +# This code is distributed in the hope that it will be useful, but WITHOUT 141.14 +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 141.15 +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 141.16 +# version 2 for more details (a copy is included in the LICENSE file that 141.17 +# accompanied this code). 141.18 +# 141.19 +# You should have received a copy of the GNU General Public License version 141.20 +# 2 along with this work; if not, write to the Free Software Foundation, 141.21 +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 141.22 +# 141.23 +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 141.24 +# or visit www.oracle.com if you need additional information or have any 141.25 +# questions. 141.26 +# 141.27 + 141.28 +# Run the "tidy" program over the files in a directory. 141.29 +# 141.30 +# Usage: 141.31 +# sh tidy.sh <dir> 141.32 +# 141.33 +# The "tidy" program will be run on each HTML file in <dir>, 141.34 +# and the output placed in the corresponding location in a new 141.35 +# directory <dir>.tidy. The console output from running "tidy" will 141.36 +# be saved in a corresponding file with an additional .tidy extension. 141.37 +# 141.38 +# Non-HTML files will be copied without modification from <dir> to 141.39 +# <dir>.tidy, so that relative links within the directory tree are 141.40 +# unaffected. 141.41 + 141.42 +dir=$1 141.43 +odir=$dir.tidy 141.44 + 141.45 +( cd $dir ; find . -type f ) | \ 141.46 + while read file ; do 141.47 + mkdir -p $odir/$(dirname $file) 141.48 + case $file in 141.49 + *.html ) 141.50 + cat $dir/$file | tidy 1>$odir/$file 2>$odir/$file.tidy 141.51 + ;; 141.52 + * ) cp $dir/$file $odir/$file 141.53 + ;; 141.54 + esac 141.55 + done
142.1 --- a/test/tools/javac/7129225/TestImportStar.java Thu Dec 27 12:15:17 2012 -0800 142.2 +++ b/test/tools/javac/7129225/TestImportStar.java Fri Dec 28 18:39:09 2012 -0800 142.3 @@ -26,7 +26,7 @@ 142.4 /* @test 142.5 * @bug 7129225 142.6 * @summary import xxx.* isn't handled correctly by annotation processing 142.7 - * @library ../lib 142.8 + * @library /tools/javac/lib 142.9 * @build JavacTestingAbstractProcessor 142.10 * @compile/fail/ref=NegTest.ref -XDrawDiagnostics TestImportStar.java 142.11 * @compile Anno.java AnnoProcessor.java
143.1 --- a/test/tools/javac/7153958/CPoolRefClassContainingInlinedCts.java Thu Dec 27 12:15:17 2012 -0800 143.2 +++ b/test/tools/javac/7153958/CPoolRefClassContainingInlinedCts.java Fri Dec 28 18:39:09 2012 -0800 143.3 @@ -27,7 +27,7 @@ 143.4 * @test 143.5 * @bug 7153958 143.6 * @summary add constant pool reference to class containing inlined constants 143.7 - * @compile pkg/ClassToBeStaticallyImported.java 143.8 + * @compile pkg/ClassToBeStaticallyImported.java CPoolRefClassContainingInlinedCts.java 143.9 * @run main CPoolRefClassContainingInlinedCts 143.10 */ 143.11
144.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 144.2 +++ b/test/tools/javac/8000518/DuplicateConstantPoolEntry.java Fri Dec 28 18:39:09 2012 -0800 144.3 @@ -0,0 +1,119 @@ 144.4 +/* 144.5 + * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved. 144.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 144.7 + * 144.8 + * This code is free software; you can redistribute it and/or modify it 144.9 + * under the terms of the GNU General Public License version 2 only, as 144.10 + * published by the Free Software Foundation. 144.11 + * 144.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 144.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 144.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 144.15 + * version 2 for more details (a copy is included in the LICENSE file that 144.16 + * accompanied this code). 144.17 + * 144.18 + * You should have received a copy of the GNU General Public License version 144.19 + * 2 along with this work; if not, write to the Free Software Foundation, 144.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 144.21 + * 144.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 144.23 + * or visit www.oracle.com if you need additional information or have any 144.24 + * questions. 144.25 + */ 144.26 + 144.27 +/* 144.28 + * @test 144.29 + * @bug 8000518 144.30 + * @summary Javac generates duplicate name_and_type constant pool entry for 144.31 + * class BinaryOpValueExp.java 144.32 + * @run main DuplicateConstantPoolEntry 144.33 + */ 144.34 + 144.35 +import com.sun.source.util.JavacTask; 144.36 +import com.sun.tools.classfile.ClassFile; 144.37 +import com.sun.tools.classfile.ConstantPoolException; 144.38 +import java.io.File; 144.39 +import java.io.IOException; 144.40 +import java.net.URI; 144.41 +import java.util.Arrays; 144.42 +import java.util.List; 144.43 +import javax.tools.JavaCompiler; 144.44 +import javax.tools.JavaFileObject; 144.45 +import javax.tools.SimpleJavaFileObject; 144.46 +import javax.tools.ToolProvider; 144.47 + 144.48 +/* 144.49 + * This bug was reproduced having two classes B and C referenced from a class A 144.50 + * class C should be compiled and generated in advance. Later class A and B should 144.51 + * be compiled like this: javac A.java B.java 144.52 + */ 144.53 + 144.54 +public class DuplicateConstantPoolEntry { 144.55 + 144.56 + public static void main(String args[]) throws Exception { 144.57 + new DuplicateConstantPoolEntry().run(); 144.58 + } 144.59 + 144.60 + void run() throws Exception { 144.61 + generateFilesNeeded(); 144.62 + checkReference(); 144.63 + } 144.64 + 144.65 + void generateFilesNeeded() throws Exception { 144.66 + 144.67 + StringJavaFileObject[] CSource = new StringJavaFileObject[] { 144.68 + new StringJavaFileObject("C.java", 144.69 + "class C {C(String s) {}}"), 144.70 + }; 144.71 + 144.72 + List<StringJavaFileObject> AandBSource = Arrays.asList( 144.73 + new StringJavaFileObject("A.java", 144.74 + "class A {void test() {new B(null);new C(null);}}"), 144.75 + new StringJavaFileObject("B.java", 144.76 + "class B {B(String s) {}}") 144.77 + ); 144.78 + 144.79 + final JavaCompiler tool = ToolProvider.getSystemJavaCompiler(); 144.80 + JavacTask compileC = (JavacTask)tool.getTask(null, null, null, null, null, 144.81 + Arrays.asList(CSource)); 144.82 + if (!compileC.call()) { 144.83 + throw new AssertionError("Compilation error while compiling C.java sources"); 144.84 + } 144.85 + JavacTask compileAB = (JavacTask)tool.getTask(null, null, null, 144.86 + Arrays.asList("-cp", "."), null, AandBSource); 144.87 + if (!compileAB.call()) { 144.88 + throw new AssertionError("Compilation error while compiling A and B sources"); 144.89 + } 144.90 + } 144.91 + 144.92 + void checkReference() throws IOException, ConstantPoolException { 144.93 + File file = new File("A.class"); 144.94 + ClassFile classFile = ClassFile.read(file); 144.95 + for (int i = 1; 144.96 + i < classFile.constant_pool.size() - 1; 144.97 + i += classFile.constant_pool.get(i).size()) { 144.98 + for (int j = i + classFile.constant_pool.get(i).size(); 144.99 + j < classFile.constant_pool.size(); 144.100 + j += classFile.constant_pool.get(j).size()) { 144.101 + if (classFile.constant_pool.get(i).toString(). 144.102 + equals(classFile.constant_pool.get(j).toString())) { 144.103 + throw new AssertionError( 144.104 + "Duplicate entries in the constant pool at positions " + 144.105 + i + " and " + j); 144.106 + } 144.107 + } 144.108 + } 144.109 + } 144.110 + 144.111 + private static class StringJavaFileObject extends SimpleJavaFileObject { 144.112 + StringJavaFileObject(String name, String text) { 144.113 + super(URI.create(name), JavaFileObject.Kind.SOURCE); 144.114 + this.text = text; 144.115 + } 144.116 + @Override 144.117 + public CharSequence getCharContent(boolean b) { 144.118 + return text; 144.119 + } 144.120 + private String text; 144.121 + } 144.122 +}
145.1 --- a/test/tools/javac/cast/intersection/model/Model01.java Thu Dec 27 12:15:17 2012 -0800 145.2 +++ b/test/tools/javac/cast/intersection/model/Model01.java Fri Dec 28 18:39:09 2012 -0800 145.3 @@ -25,7 +25,7 @@ 145.4 * @test 145.5 * @bug 8002099 145.6 * @summary Add support for intersection types in cast expression 145.7 - * @library ../../../lib 145.8 + * @library /tools/javac/lib 145.9 * @build JavacTestingAbstractProcessor ModelChecker 145.10 * @compile -XDallowIntersectionTypes -processor ModelChecker Model01.java 145.11 */
146.1 --- a/test/tools/javac/classreader/T7031108.java Thu Dec 27 12:15:17 2012 -0800 146.2 +++ b/test/tools/javac/classreader/T7031108.java Fri Dec 28 18:39:09 2012 -0800 146.3 @@ -25,7 +25,7 @@ 146.4 * @test 146.5 * @bug 7031108 146.6 * @summary NPE in javac.jvm.ClassReader.findMethod in PackageElement.enclosedElements from AP in incr build 146.7 - * @library ../lib 146.8 + * @library /tools/javac/lib 146.9 * @build JavacTestingAbstractProcessor T7031108 146.10 * @run main T7031108 146.11 */
147.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 147.2 +++ b/test/tools/javac/diags/examples/NoContent.java Fri Dec 28 18:39:09 2012 -0800 147.3 @@ -0,0 +1,33 @@ 147.4 +/* 147.5 + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. 147.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 147.7 + * 147.8 + * This code is free software; you can redistribute it and/or modify it 147.9 + * under the terms of the GNU General Public License version 2 only, as 147.10 + * published by the Free Software Foundation. 147.11 + * 147.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 147.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 147.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 147.15 + * version 2 for more details (a copy is included in the LICENSE file that 147.16 + * accompanied this code). 147.17 + * 147.18 + * You should have received a copy of the GNU General Public License version 147.19 + * 2 along with this work; if not, write to the Free Software Foundation, 147.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 147.21 + * 147.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 147.23 + * or visit www.oracle.com if you need additional information or have any 147.24 + * questions. 147.25 + */ 147.26 + 147.27 +// key: compiler.err.dc.no.content 147.28 +// key: compiler.note.note 147.29 +// key: compiler.note.proc.messager 147.30 +// run: backdoor 147.31 +// options: -processor DocCommentProcessor -proc:only 147.32 + 147.33 +/** @see */ 147.34 +class NoContent { 147.35 +} 147.36 +
148.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 148.2 +++ b/test/tools/javac/doclint/DocLintTest.java Fri Dec 28 18:39:09 2012 -0800 148.3 @@ -0,0 +1,225 @@ 148.4 +/* 148.5 + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. 148.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 148.7 + * 148.8 + * This code is free software; you can redistribute it and/or modify it 148.9 + * under the terms of the GNU General Public License version 2 only, as 148.10 + * published by the Free Software Foundation. 148.11 + * 148.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 148.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 148.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 148.15 + * version 2 for more details (a copy is included in the LICENSE file that 148.16 + * accompanied this code). 148.17 + * 148.18 + * You should have received a copy of the GNU General Public License version 148.19 + * 2 along with this work; if not, write to the Free Software Foundation, 148.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 148.21 + * 148.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 148.23 + * or visit www.oracle.com if you need additional information or have any 148.24 + * questions. 148.25 + */ 148.26 + 148.27 +/* 148.28 + * @test 148.29 + * @bug 8004833 148.30 + * @summary Integrate doclint support into javac 148.31 + */ 148.32 + 148.33 +import java.io.File; 148.34 +import java.io.PrintWriter; 148.35 +import java.io.StringWriter; 148.36 +import java.net.URI; 148.37 +import java.util.Arrays; 148.38 +import java.util.Collections; 148.39 +import java.util.List; 148.40 + 148.41 +import javax.tools.Diagnostic; 148.42 +import javax.tools.JavaCompiler; 148.43 +import javax.tools.JavaFileObject; 148.44 +import javax.tools.SimpleJavaFileObject; 148.45 +import javax.tools.StandardJavaFileManager; 148.46 +import javax.tools.StandardLocation; 148.47 +import javax.tools.ToolProvider; 148.48 +import static javax.tools.Diagnostic.Kind.*; 148.49 + 148.50 +import com.sun.source.util.JavacTask; 148.51 +import com.sun.tools.javac.main.Main; 148.52 +import java.util.EnumSet; 148.53 +import java.util.Set; 148.54 +import java.util.regex.Matcher; 148.55 +import java.util.regex.Pattern; 148.56 + 148.57 +public class DocLintTest { 148.58 + public static void main(String... args) throws Exception { 148.59 + new DocLintTest().run(); 148.60 + } 148.61 + 148.62 + JavaCompiler javac; 148.63 + StandardJavaFileManager fm; 148.64 + JavaFileObject file; 148.65 + 148.66 + final String code = 148.67 + /* 01 */ "/** Class comment. */\n" + 148.68 + /* 02 */ "public class Test {\n" + 148.69 + /* 03 */ " /** Method comment. */\n" + 148.70 + /* 04 */ " public void method() { }\n" + 148.71 + /* 05 */ "\n" + 148.72 + /* 06 */ " /** Syntax < error. */\n" + 148.73 + /* 07 */ " private void syntaxError() { }\n" + 148.74 + /* 08 */ "\n" + 148.75 + /* 09 */ " /** @see DoesNotExist */\n" + 148.76 + /* 10 */ " protected void referenceError() { }\n" + 148.77 + /* 08 */ "\n" + 148.78 + /* 09 */ " /** @return */\n" + 148.79 + /* 10 */ " public int emptyReturn() { return 0; }\n" + 148.80 + /* 11 */ "}\n"; 148.81 + 148.82 + final String rawDiags = "-XDrawDiagnostics"; 148.83 + private enum Message { 148.84 + // doclint messages 148.85 + DL_ERR6(ERROR, "Test.java:6:16: compiler.err.proc.messager: malformed HTML"), 148.86 + DL_ERR9(ERROR, "Test.java:9:14: compiler.err.proc.messager: reference not found"), 148.87 + DL_WRN12(WARNING, "Test.java:12:9: compiler.warn.proc.messager: no description for @return"), 148.88 + 148.89 + OPT_BADARG(ERROR, "invalid flag: -Xdoclint:badarg"); 148.90 + 148.91 + final Diagnostic.Kind kind; 148.92 + final String text; 148.93 + 148.94 + static Message get(String text) { 148.95 + for (Message m: values()) { 148.96 + if (m.text.equals(text)) 148.97 + return m; 148.98 + } 148.99 + return null; 148.100 + } 148.101 + 148.102 + Message(Diagnostic.Kind kind, String text) { 148.103 + this.kind = kind; 148.104 + this.text = text; 148.105 + } 148.106 + 148.107 + @Override 148.108 + public String toString() { 148.109 + return "[" + kind + ",\"" + text + "\"]"; 148.110 + } 148.111 + } 148.112 + void run() throws Exception { 148.113 + javac = ToolProvider.getSystemJavaCompiler(); 148.114 + fm = javac.getStandardFileManager(null, null, null); 148.115 + fm.setLocation(StandardLocation.CLASS_OUTPUT, Arrays.asList(new File("."))); 148.116 + file = new SimpleJavaFileObject(URI.create("Test.java"), JavaFileObject.Kind.SOURCE) { 148.117 + @Override 148.118 + public CharSequence getCharContent(boolean ignoreEncoding) { 148.119 + return code; 148.120 + } 148.121 + }; 148.122 + 148.123 + test(Collections.<String>emptyList(), 148.124 + Main.Result.OK, 148.125 + EnumSet.noneOf(Message.class)); 148.126 + 148.127 + test(Arrays.asList("-Xdoclint:none"), 148.128 + Main.Result.OK, 148.129 + EnumSet.noneOf(Message.class)); 148.130 + 148.131 + test(Arrays.asList(rawDiags, "-Xdoclint"), 148.132 + Main.Result.ERROR, 148.133 + EnumSet.of(Message.DL_ERR6, Message.DL_ERR9, Message.DL_WRN12)); 148.134 + 148.135 + test(Arrays.asList(rawDiags, "-Xdoclint:all/public"), 148.136 + Main.Result.OK, 148.137 + EnumSet.of(Message.DL_WRN12)); 148.138 + 148.139 + test(Arrays.asList(rawDiags, "-Xdoclint:syntax"), 148.140 + Main.Result.ERROR, 148.141 + EnumSet.of(Message.DL_ERR6, Message.DL_WRN12)); 148.142 + 148.143 + test(Arrays.asList(rawDiags, "-Xdoclint:reference"), 148.144 + Main.Result.ERROR, 148.145 + EnumSet.of(Message.DL_ERR9)); 148.146 + 148.147 + test(Arrays.asList(rawDiags, "-Xdoclint:badarg"), 148.148 + Main.Result.CMDERR, 148.149 + EnumSet.of(Message.OPT_BADARG)); 148.150 + 148.151 + if (errors > 0) 148.152 + throw new Exception(errors + " errors occurred"); 148.153 + } 148.154 + 148.155 + void test(List<String> opts, Main.Result expectResult, Set<Message> expectMessages) { 148.156 + System.err.println("test: " + opts); 148.157 + StringWriter sw = new StringWriter(); 148.158 + PrintWriter pw = new PrintWriter(sw); 148.159 + List<JavaFileObject> files = Arrays.asList(file); 148.160 + try { 148.161 + JavacTask t = (JavacTask) javac.getTask(pw, fm, null, opts, null, files); 148.162 + boolean ok = t.call(); 148.163 + pw.close(); 148.164 + String out = sw.toString().replaceAll("[\r\n]+", "\n"); 148.165 + if (!out.isEmpty()) 148.166 + System.err.println(out); 148.167 + if (ok && expectResult != Main.Result.OK) { 148.168 + error("Compilation succeeded unexpectedly"); 148.169 + } else if (!ok && expectResult != Main.Result.ERROR) { 148.170 + error("Compilation failed unexpectedly"); 148.171 + } else 148.172 + check(out, expectMessages); 148.173 + } catch (IllegalArgumentException e) { 148.174 + System.err.println(e); 148.175 + String expectOut = expectMessages.iterator().next().text; 148.176 + if (expectResult != Main.Result.CMDERR) 148.177 + error("unexpected exception caught"); 148.178 + else if (!e.getMessage().equals(expectOut)) { 148.179 + error("unexpected exception message: " 148.180 + + e.getMessage() 148.181 + + " expected: " + expectOut); 148.182 + } 148.183 + } 148.184 + 148.185 +// if (errors > 0) 148.186 +// throw new Error("stop"); 148.187 + } 148.188 + 148.189 + private void check(String out, Set<Message> expect) { 148.190 + Pattern stats = Pattern.compile("^([1-9]+) (error|warning)(s?)"); 148.191 + Set<Message> found = EnumSet.noneOf(Message.class); 148.192 + int e = 0, w = 0; 148.193 + if (!out.isEmpty()) { 148.194 + for (String line: out.split("[\r\n]+")) { 148.195 + Matcher s = stats.matcher(line); 148.196 + if (s.matches()) { 148.197 + int i = Integer.valueOf(s.group(1)); 148.198 + if (s.group(2).equals("error")) 148.199 + e++; 148.200 + else 148.201 + w++; 148.202 + continue; 148.203 + } 148.204 + 148.205 + Message m = Message.get(line); 148.206 + if (m == null) 148.207 + error("Unexpected line: " + line); 148.208 + else 148.209 + found.add(m); 148.210 + } 148.211 + } 148.212 + for (Message m: expect) { 148.213 + if (!found.contains(m)) 148.214 + error("expected message not found: " + m.text); 148.215 + } 148.216 + for (Message m: found) { 148.217 + if (!expect.contains(m)) 148.218 + error("unexpected message found: " + m.text); 148.219 + } 148.220 + } 148.221 + 148.222 + void error(String msg) { 148.223 + System.err.println("Error: " + msg); 148.224 + errors++; 148.225 + } 148.226 + 148.227 + int errors; 148.228 +}
149.1 --- a/test/tools/javac/enum/6350057/T6350057.java Thu Dec 27 12:15:17 2012 -0800 149.2 +++ b/test/tools/javac/enum/6350057/T6350057.java Fri Dec 28 18:39:09 2012 -0800 149.3 @@ -26,7 +26,7 @@ 149.4 * @bug 6350057 7025809 149.5 * @summary Test that parameters on implicit enum methods have the right kind 149.6 * @author Joseph D. Darcy 149.7 - * @library ../../lib 149.8 + * @library /tools/javac/lib 149.9 * @build JavacTestingAbstractProcessor T6350057 149.10 * @compile -processor T6350057 -proc:only TestEnum.java 149.11 */
150.1 --- a/test/tools/javac/enum/6424358/T6424358.java Thu Dec 27 12:15:17 2012 -0800 150.2 +++ b/test/tools/javac/enum/6424358/T6424358.java Fri Dec 28 18:39:09 2012 -0800 150.3 @@ -26,7 +26,7 @@ 150.4 * @bug 6424358 7025809 150.5 * @summary Synthesized static enum method values() is final 150.6 * @author Peter von der Ah\u00e9 150.7 - * @library ../../lib 150.8 + * @library /tools/javac/lib 150.9 * @build JavacTestingAbstractProcessor T6424358 150.10 * @compile -processor T6424358 -proc:only T6424358.java 150.11 */
151.1 --- a/test/tools/javac/file/T7018098.java Thu Dec 27 12:15:17 2012 -0800 151.2 +++ b/test/tools/javac/file/T7018098.java Fri Dec 28 18:39:09 2012 -0800 151.3 @@ -25,7 +25,7 @@ 151.4 * @test 151.5 * @bug 7018098 151.6 * @summary CacheFSInfo persists too long 151.7 - * @library ../lib 151.8 + * @library /tools/javac/lib 151.9 * @build JavacTestingAbstractProcessor T7018098 151.10 * @run main T7018098 151.11 */
152.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 152.2 +++ b/test/tools/javac/file/zip/8003512/LoadClassFromJava6CreatedJarTest.java Fri Dec 28 18:39:09 2012 -0800 152.3 @@ -0,0 +1,183 @@ 152.4 + 152.5 +/* 152.6 + * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved. 152.7 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 152.8 + * 152.9 + * This code is free software; you can redistribute it and/or modify it 152.10 + * under the terms of the GNU General Public License version 2 only, as 152.11 + * published by the Free Software Foundation. 152.12 + * 152.13 + * This code is distributed in the hope that it will be useful, but WITHOUT 152.14 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 152.15 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 152.16 + * version 2 for more details (a copy is included in the LICENSE file that 152.17 + * accompanied this code). 152.18 + * 152.19 + * You should have received a copy of the GNU General Public License version 152.20 + * 2 along with this work; if not, write to the Free Software Foundation, 152.21 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 152.22 + * 152.23 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 152.24 + * or visit www.oracle.com if you need additional information or have any 152.25 + * questions. 152.26 + */ 152.27 + 152.28 +/* 152.29 + * @test 152.30 + * @bug 8003512 152.31 + * @summary javac doesn't work with jar files with >64k entries 152.32 + * @compile -target 6 -source 6 -XDignore.symbol.file LoadClassFromJava6CreatedJarTest.java ../Utils.java 152.33 + * @run main/timeout=360 LoadClassFromJava6CreatedJarTest 152.34 + */ 152.35 + 152.36 +/* 152.37 + * The test creates a jar file with more than 64K entries. The jar file is 152.38 + * created executing the LoadClassFromJava6CreatedJarTest$MakeJar 152.39 + * class with a JVM version 6. The test must include Java 6 features only. 152.40 + * 152.41 + * The aim is to verify classes included in jar files with more than 64K entries 152.42 + * created with Java 6 can be loaded by more recent versions of Java. 152.43 + * 152.44 + * A path to JDK or JRE version 6 is needed. This can be provided 152.45 + * by passing this option to jtreg: 152.46 + * -javaoption:-Djava6.home="/path/to/jdk_or_jre6" 152.47 + */ 152.48 + 152.49 +import java.io.BufferedInputStream; 152.50 +import java.io.BufferedReader; 152.51 +import java.io.File; 152.52 +import java.io.FileInputStream; 152.53 +import java.io.FileOutputStream; 152.54 +import java.io.IOException; 152.55 +import java.io.InputStreamReader; 152.56 +import java.util.Arrays; 152.57 +import java.util.List; 152.58 +import java.util.zip.CRC32; 152.59 +import java.util.zip.ZipEntry; 152.60 +import java.util.zip.ZipOutputStream; 152.61 + 152.62 +public class LoadClassFromJava6CreatedJarTest { 152.63 + 152.64 + static final String javaHome6 = System.getProperty("java6.home"); 152.65 + static final String testClasses = System.getProperty("test.classes"); 152.66 + 152.67 + public static void main(String... args) 152.68 + throws IOException, InterruptedException { 152.69 + if (javaHome6 != null) { 152.70 + new LoadClassFromJava6CreatedJarTest().run(); 152.71 + } else { 152.72 + System.out.println( 152.73 + "The test LoadClassFromJava6CreatedJarTest cannot be executed. " + 152.74 + "In order to run it you should pass an option with " + 152.75 + "this form -javaoption:-Djava6.home=\"/path/to/jdk_or_jre6\" " + 152.76 + "to jtreg."); 152.77 + } 152.78 + } 152.79 + 152.80 + void run() throws IOException, InterruptedException { 152.81 + File classA = new File("A.java"); 152.82 + Utils.createJavaFile(classA, null); 152.83 + if (!Utils.compile("-target", "6", "-source", "6", 152.84 + classA.getAbsolutePath())) { 152.85 + throw new AssertionError("Test failed while compiling class A"); 152.86 + } 152.87 + 152.88 + executeCommand(Arrays.asList(javaHome6 + "/bin/java", "-classpath", 152.89 + testClasses, "LoadClassFromJava6CreatedJarTest$MakeJar")); 152.90 + 152.91 + File classB = new File("B.java"); 152.92 + Utils.createJavaFile(classB, classA); 152.93 + if (!Utils.compile("-cp", "a.jar", classB.getAbsolutePath())) { 152.94 + throw new AssertionError("Test failed while compiling class Main"); 152.95 + } 152.96 + } 152.97 + 152.98 + void executeCommand(List<String> command) 152.99 + throws IOException, InterruptedException { 152.100 + ProcessBuilder pb = new ProcessBuilder(command). 152.101 + redirectErrorStream(true); 152.102 + Process p = pb.start(); 152.103 + BufferedReader r = 152.104 + new BufferedReader(new InputStreamReader(p.getInputStream())); 152.105 + String line; 152.106 + while ((line = r.readLine()) != null) { 152.107 + System.err.println(line); 152.108 + } 152.109 + int rc = p.waitFor(); 152.110 + if (rc != 0) { 152.111 + throw new AssertionError("Unexpected exit code: " + rc); 152.112 + } 152.113 + } 152.114 + 152.115 + static class MakeJar { 152.116 + public static void main(String[] args) throws Throwable { 152.117 + File classFile = new File("A.class"); 152.118 + ZipOutputStream zos = null; 152.119 + FileInputStream fis = null; 152.120 + final int MAX = Short.MAX_VALUE * 2 + 10; 152.121 + ZipEntry ze = null; 152.122 + try { 152.123 + zos = new ZipOutputStream(new FileOutputStream("a.jar")); 152.124 + zos.setLevel(ZipOutputStream.STORED); 152.125 + zos.setMethod(ZipOutputStream.STORED); 152.126 + for (int i = 0; i < MAX ; i++) { 152.127 + ze = new ZipEntry("X" + i + ".txt"); 152.128 + ze.setSize(0); 152.129 + ze.setCompressedSize(0); 152.130 + ze.setCrc(0); 152.131 + zos.putNextEntry(ze); 152.132 + } 152.133 + 152.134 + // add a class file 152.135 + ze = new ZipEntry("A.class"); 152.136 + ze.setCompressedSize(classFile.length()); 152.137 + ze.setSize(classFile.length()); 152.138 + ze.setCrc(computeCRC(classFile)); 152.139 + zos.putNextEntry(ze); 152.140 + fis = new FileInputStream(classFile); 152.141 + for (int c; (c = fis.read()) >= 0;) { 152.142 + zos.write(c); 152.143 + } 152.144 + } finally { 152.145 + zos.close(); 152.146 + fis.close(); 152.147 + } 152.148 + } 152.149 + 152.150 + private static final int BUFFER_LEN = Short.MAX_VALUE * 2; 152.151 + 152.152 + static long getCount(long minlength) { 152.153 + return (minlength / BUFFER_LEN) + 1; 152.154 + } 152.155 + 152.156 + static long computeCRC(long minlength) { 152.157 + CRC32 crc = new CRC32(); 152.158 + byte[] buffer = new byte[BUFFER_LEN]; 152.159 + long count = getCount(minlength); 152.160 + for (long i = 0; i < count; i++) { 152.161 + crc.update(buffer); 152.162 + } 152.163 + return crc.getValue(); 152.164 + } 152.165 + 152.166 + static long computeCRC(File inFile) throws IOException { 152.167 + byte[] buffer = new byte[8192]; 152.168 + CRC32 crc = new CRC32(); 152.169 + FileInputStream fis = null; 152.170 + BufferedInputStream bis = null; 152.171 + try { 152.172 + fis = new FileInputStream(inFile); 152.173 + bis = new BufferedInputStream(fis); 152.174 + int n = bis.read(buffer); 152.175 + while (n > 0) { 152.176 + crc.update(buffer, 0, n); 152.177 + n = bis.read(buffer); 152.178 + } 152.179 + } finally { 152.180 + bis.close(); 152.181 + fis.close(); 152.182 + } 152.183 + return crc.getValue(); 152.184 + } 152.185 + } 152.186 +}
153.1 --- a/test/tools/javac/file/zip/Utils.java Thu Dec 27 12:15:17 2012 -0800 153.2 +++ b/test/tools/javac/file/zip/Utils.java Fri Dec 28 18:39:09 2012 -0800 153.3 @@ -1,5 +1,5 @@ 153.4 /* 153.5 - * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. 153.6 + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. 153.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 153.8 * 153.9 * This code is free software; you can redistribute it and/or modify it 153.10 @@ -21,6 +21,12 @@ 153.11 * questions. 153.12 */ 153.13 153.14 +/* 153.15 + * This utils class is been used by test T8003512 which is compiled with Java 6 153.16 + * only features. So if this class is modified, it should be so using Java 6 153.17 + * features only. 153.18 + */ 153.19 + 153.20 import java.io.BufferedInputStream; 153.21 import java.io.BufferedOutputStream; 153.22 import java.io.Closeable;
154.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 154.2 +++ b/test/tools/javac/lambda/BadMethodCall2.java Fri Dec 28 18:39:09 2012 -0800 154.3 @@ -0,0 +1,13 @@ 154.4 +/** 154.5 + * @test /nodynamiccopyright/ 154.6 + * @bug 8004099 154.7 + * @summary Bad compiler diagnostic generated when poly expression is passed to non-existent method 154.8 + * @compile/fail/ref=BadMethodCall2.out -XDrawDiagnostics BadMethodCall2.java 154.9 + */ 154.10 +class BadMethodCall2 { 154.11 + void test(Object rec) { 154.12 + rec.nonExistent(System.out::println); 154.13 + rec.nonExistent(()->{}); 154.14 + rec.nonExistent(true ? "1" : "2"); 154.15 + } 154.16 +}
155.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 155.2 +++ b/test/tools/javac/lambda/BadMethodCall2.out Fri Dec 28 18:39:09 2012 -0800 155.3 @@ -0,0 +1,4 @@ 155.4 +BadMethodCall2.java:9:13: compiler.err.cant.resolve.location.args: kindname.method, nonExistent, , @309, (compiler.misc.location.1: kindname.variable, rec, java.lang.Object) 155.5 +BadMethodCall2.java:10:13: compiler.err.cant.resolve.location.args: kindname.method, nonExistent, , @356, (compiler.misc.location.1: kindname.variable, rec, java.lang.Object) 155.6 +BadMethodCall2.java:11:13: compiler.err.cant.resolve.location.args: kindname.method, nonExistent, , @390, (compiler.misc.location.1: kindname.variable, rec, java.lang.Object) 155.7 +3 errors
156.1 --- a/test/tools/javac/lambda/TestInvokeDynamic.java Thu Dec 27 12:15:17 2012 -0800 156.2 +++ b/test/tools/javac/lambda/TestInvokeDynamic.java Fri Dec 28 18:39:09 2012 -0800 156.3 @@ -50,6 +50,7 @@ 156.4 import com.sun.tools.javac.code.Symbol; 156.5 import com.sun.tools.javac.code.Symbol.MethodSymbol; 156.6 import com.sun.tools.javac.code.Symtab; 156.7 +import com.sun.tools.javac.code.Types; 156.8 import com.sun.tools.javac.jvm.Pool; 156.9 import com.sun.tools.javac.tree.JCTree.JCMethodInvocation; 156.10 import com.sun.tools.javac.tree.JCTree.JCMethodDecl; 156.11 @@ -151,7 +152,7 @@ 156.12 156.13 abstract boolean check(CPInfo cpInfo) throws Exception; 156.14 156.15 - Object getValue(Symtab syms, Names names) { 156.16 + Object getValue(Symtab syms, Names names, Types types) { 156.17 switch (this) { 156.18 case STRING: 156.19 case INTEGER: 156.20 @@ -162,7 +163,7 @@ 156.21 case CLASS: 156.22 return syms.stringType.tsym; 156.23 case METHOD_HANDLE: 156.24 - return new Pool.MethodHandle(REF_invokeVirtual, syms.arrayCloneMethod); 156.25 + return new Pool.MethodHandle(REF_invokeVirtual, syms.arrayCloneMethod, types); 156.26 case METHOD_TYPE: 156.27 return syms.arrayCloneMethod.type; 156.28 default: 156.29 @@ -231,7 +232,8 @@ 156.30 Context context = ct.getContext(); 156.31 Symtab syms = Symtab.instance(context); 156.32 Names names = Names.instance(context); 156.33 - ct.addTaskListener(new Indifier(syms, names)); 156.34 + Types types = Types.instance(context); 156.35 + ct.addTaskListener(new Indifier(syms, names, types)); 156.36 try { 156.37 ct.generate(); 156.38 } catch (Throwable t) { 156.39 @@ -378,10 +380,12 @@ 156.40 MethodSymbol bsm; 156.41 Symtab syms; 156.42 Names names; 156.43 + Types types; 156.44 156.45 - Indifier(Symtab syms, Names names) { 156.46 + Indifier(Symtab syms, Names names, Types types) { 156.47 this.syms = syms; 156.48 this.names = names; 156.49 + this.types = types; 156.50 } 156.51 156.52 @Override 156.53 @@ -405,7 +409,7 @@ 156.54 if (!oldSym.isConstructor()) { 156.55 Object[] staticArgs = new Object[arity.arity]; 156.56 for (int i = 0; i < arity.arity ; i++) { 156.57 - staticArgs[i] = saks[i].getValue(syms, names); 156.58 + staticArgs[i] = saks[i].getValue(syms, names, types); 156.59 } 156.60 ident.sym = new Symbol.DynamicMethodSymbol(oldSym.name, oldSym.owner, REF_invokeStatic, bsm, oldSym.type, staticArgs); 156.61 }
157.1 --- a/test/tools/javac/multicatch/model/ModelChecker.java Thu Dec 27 12:15:17 2012 -0800 157.2 +++ b/test/tools/javac/multicatch/model/ModelChecker.java Fri Dec 28 18:39:09 2012 -0800 157.3 @@ -25,7 +25,7 @@ 157.4 * @test 157.5 * @bug 6993963 7025809 157.6 * @summary Project Coin: Use precise exception analysis for effectively final catch parameters 157.7 - * @library ../../lib 157.8 + * @library /tools/javac/lib 157.9 * @build JavacTestingAbstractProcessor ModelChecker 157.10 * @compile -processor ModelChecker Model01.java 157.11 */
158.1 --- a/test/tools/javac/options/T7022337.java Thu Dec 27 12:15:17 2012 -0800 158.2 +++ b/test/tools/javac/options/T7022337.java Fri Dec 28 18:39:09 2012 -0800 158.3 @@ -26,7 +26,7 @@ 158.4 * @test 158.5 * @bug 7022337 158.6 * @summary repeated warnings about bootclasspath not set 158.7 - * @library ../lib 158.8 + * @library /tools/javac/lib 158.9 * @build JavacTestingAbstractProcessor T7022337 158.10 * @run main T7022337 158.11 */
159.1 --- a/test/tools/javac/plugin/showtype/ShowTypePlugin.java Thu Dec 27 12:15:17 2012 -0800 159.2 +++ b/test/tools/javac/plugin/showtype/ShowTypePlugin.java Fri Dec 28 18:39:09 2012 -0800 159.3 @@ -41,7 +41,7 @@ 159.4 return "showtype"; 159.5 } 159.6 159.7 - public void call(JavacTask task, String... args) { 159.8 + public void init(JavacTask task, String... args) { 159.9 Pattern pattern = null; 159.10 if (args.length == 1) 159.11 pattern = Pattern.compile(args[0]);
160.1 --- a/test/tools/javac/plugin/showtype/Test.java Thu Dec 27 12:15:17 2012 -0800 160.2 +++ b/test/tools/javac/plugin/showtype/Test.java Fri Dec 28 18:39:09 2012 -0800 160.3 @@ -1,22 +1,3 @@ 160.4 - 160.5 -import java.io.File; 160.6 -import java.io.FileWriter; 160.7 -import java.io.IOException; 160.8 -import java.io.PrintWriter; 160.9 -import java.io.StringWriter; 160.10 -import java.nio.charset.Charset; 160.11 -import java.nio.file.Files; 160.12 -import java.util.Arrays; 160.13 -import java.util.List; 160.14 -import java.util.Locale; 160.15 -import java.util.Objects; 160.16 -import javax.tools.JavaCompiler; 160.17 -import javax.tools.JavaFileManager; 160.18 -import javax.tools.JavaFileObject; 160.19 -import javax.tools.StandardJavaFileManager; 160.20 -import javax.tools.StandardLocation; 160.21 -import javax.tools.ToolProvider; 160.22 - 160.23 /* 160.24 * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. 160.25 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 160.26 @@ -42,10 +23,28 @@ 160.27 160.28 /** 160.29 * @test 160.30 - * @bug 8001098 160.31 + * @bug 8001098 8004961 160.32 * @summary Provide a simple light-weight "plug-in" mechanism for javac 160.33 */ 160.34 160.35 +import java.io.File; 160.36 +import java.io.FileWriter; 160.37 +import java.io.IOException; 160.38 +import java.io.PrintWriter; 160.39 +import java.io.StringWriter; 160.40 +import java.nio.charset.Charset; 160.41 +import java.nio.file.Files; 160.42 +import java.util.Arrays; 160.43 +import java.util.List; 160.44 +import java.util.Locale; 160.45 +import java.util.Objects; 160.46 +import javax.tools.JavaCompiler; 160.47 +import javax.tools.JavaFileManager; 160.48 +import javax.tools.JavaFileObject; 160.49 +import javax.tools.StandardJavaFileManager; 160.50 +import javax.tools.StandardLocation; 160.51 +import javax.tools.ToolProvider; 160.52 + 160.53 public class Test { 160.54 public static void main(String... args) throws Exception { 160.55 new Test().run();
161.1 --- a/test/tools/javac/processing/6348499/T6348499.java Thu Dec 27 12:15:17 2012 -0800 161.2 +++ b/test/tools/javac/processing/6348499/T6348499.java Fri Dec 28 18:39:09 2012 -0800 161.3 @@ -25,7 +25,7 @@ 161.4 * @test 161.5 * @bug 6441871 161.6 * @summary javac crashes at com.sun.tools.javac.jvm.ClassReader$BadClassFile 161.7 - * @library ../../lib 161.8 + * @library /tools/javac/lib 161.9 * @build JavacTestingAbstractProcessor A 161.10 * @run main T6348499 161.11 */
162.1 --- a/test/tools/javac/processing/6359313/T6359313.java Thu Dec 27 12:15:17 2012 -0800 162.2 +++ b/test/tools/javac/processing/6359313/T6359313.java Fri Dec 28 18:39:09 2012 -0800 162.3 @@ -26,7 +26,7 @@ 162.4 * @bug 6359313 162.5 * @summary error compiling annotated package 162.6 * @author Peter von der Ah\u00e9 162.7 - * @library ../../lib 162.8 + * @library /tools/javac/lib 162.9 * @build JavacTestingAbstractProcessor 162.10 * @compile T6359313.java 162.11 * @compile -processor T6359313 package-info.java Foo.java
163.1 --- a/test/tools/javac/processing/6365040/T6365040.java Thu Dec 27 12:15:17 2012 -0800 163.2 +++ b/test/tools/javac/processing/6365040/T6365040.java Fri Dec 28 18:39:09 2012 -0800 163.3 @@ -26,7 +26,7 @@ 163.4 * @bug 6365040 6358129 163.5 * @summary Test -processor foo,bar,baz 163.6 * @author Joseph D. Darcy 163.7 - * @library ../../lib 163.8 + * @library /tools/javac/lib 163.9 * @build JavacTestingAbstractProcessor 163.10 * @compile ProcFoo.java 163.11 * @compile ProcBar.java
164.1 --- a/test/tools/javac/processing/6413690/T6413690.java Thu Dec 27 12:15:17 2012 -0800 164.2 +++ b/test/tools/javac/processing/6413690/T6413690.java Fri Dec 28 18:39:09 2012 -0800 164.3 @@ -26,7 +26,7 @@ 164.4 * @bug 6413690 6380018 164.5 * @summary JavacProcessingEnvironment does not enter trees from preceding rounds 164.6 * @author Peter von der Ah\u00e9 164.7 - * @library ../../lib 164.8 + * @library /tools/javac/lib 164.9 * @build JavacTestingAbstractProcessor 164.10 * @compile T6413690.java 164.11 * @compile -XDfatalEnterError -verbose -processor T6413690 src/Super.java TestMe.java
165.1 --- a/test/tools/javac/processing/6414633/T6414633.java Thu Dec 27 12:15:17 2012 -0800 165.2 +++ b/test/tools/javac/processing/6414633/T6414633.java Fri Dec 28 18:39:09 2012 -0800 165.3 @@ -25,7 +25,7 @@ 165.4 * @test 165.5 * @bug 6414633 6440109 165.6 * @summary Only the first processor message at a source location is reported 165.7 - * @library ../../lib 165.8 + * @library /tools/javac/lib 165.9 * @build JavacTestingAbstractProcessor A T6414633 165.10 * @run main T6414633 165.11 */
166.1 --- a/test/tools/javac/processing/6430209/T6430209.java Thu Dec 27 12:15:17 2012 -0800 166.2 +++ b/test/tools/javac/processing/6430209/T6430209.java Fri Dec 28 18:39:09 2012 -0800 166.3 @@ -25,7 +25,7 @@ 166.4 * @test 166.5 * @bug 6441871 166.6 * @summary spurious compiler error elicited by packageElement.getEnclosedElements() 166.7 - * @library ../../lib 166.8 + * @library /tools/javac/lib 166.9 * @build JavacTestingAbstractProcessor b6341534 166.10 * @run main T6430209 166.11 */
167.1 --- a/test/tools/javac/processing/6499119/ClassProcessor.java Thu Dec 27 12:15:17 2012 -0800 167.2 +++ b/test/tools/javac/processing/6499119/ClassProcessor.java Fri Dec 28 18:39:09 2012 -0800 167.3 @@ -32,7 +32,7 @@ 167.4 * @test 167.5 * @bug 6499119 167.6 * @summary Created package-info class file modeled improperly 167.7 - * @library ../../lib 167.8 + * @library /tools/javac/lib 167.9 * @build JavacTestingAbstractProcessor 167.10 * @compile ClassProcessor.java package-info.java 167.11 * @compile/process -cp . -processor ClassProcessor -Akind=java java.lang.Object
168.1 --- a/test/tools/javac/processing/6511613/clss41701.java Thu Dec 27 12:15:17 2012 -0800 168.2 +++ b/test/tools/javac/processing/6511613/clss41701.java Fri Dec 28 18:39:09 2012 -0800 168.3 @@ -26,7 +26,7 @@ 168.4 * @bug 6511613 168.5 * @summary javac unexpectedly doesn't fail in some cases if an annotation processor specified 168.6 * 168.7 - * @library ../../lib 168.8 + * @library /tools/javac/lib 168.9 * @build JavacTestingAbstractProcessor DummyProcessor 168.10 * @compile/fail clss41701.java 168.11 * @compile/fail -processor DummyProcessor clss41701.java
169.1 --- a/test/tools/javac/processing/6512707/T6512707.java Thu Dec 27 12:15:17 2012 -0800 169.2 +++ b/test/tools/javac/processing/6512707/T6512707.java Fri Dec 28 18:39:09 2012 -0800 169.3 @@ -26,7 +26,7 @@ 169.4 * @bug 6512707 169.5 * @summary "incompatible types" after (unrelated) annotation processing 169.6 * @author Peter Runge 169.7 - * @library ../../lib 169.8 + * @library /tools/javac/lib 169.9 * @build JavacTestingAbstractProcessor 169.10 * @compile T6512707.java 169.11 * @compile -processor T6512707 TestAnnotation.java
170.1 --- a/test/tools/javac/processing/6634138/T6634138.java Thu Dec 27 12:15:17 2012 -0800 170.2 +++ b/test/tools/javac/processing/6634138/T6634138.java Fri Dec 28 18:39:09 2012 -0800 170.3 @@ -26,7 +26,7 @@ 170.4 * @bug 6634138 170.5 * @author Joseph D. Darcy 170.6 * @summary Verify source files output after processing is over are compiled 170.7 - * @library ../../lib 170.8 + * @library /tools/javac/lib 170.9 * @build JavacTestingAbstractProcessor 170.10 * @compile T6634138.java 170.11 * @compile -processor T6634138 Dummy.java
171.1 --- a/test/tools/javac/processing/6994946/SemanticErrorTest.java Thu Dec 27 12:15:17 2012 -0800 171.2 +++ b/test/tools/javac/processing/6994946/SemanticErrorTest.java Fri Dec 28 18:39:09 2012 -0800 171.3 @@ -2,7 +2,7 @@ 171.4 * @test /nodynamiccopyright/ 171.5 * @bug 6994946 171.6 * @summary option to specify only syntax errors as unrecoverable 171.7 - * @library ../../lib 171.8 + * @library /tools/javac/lib 171.9 * @build JavacTestingAbstractProcessor TestProcessor 171.10 * @compile/fail/ref=SemanticErrorTest.1.out -XDrawDiagnostics -processor TestProcessor SemanticErrorTest.java 171.11 * @compile/fail/ref=SemanticErrorTest.2.out -XDrawDiagnostics -XDonlySyntaxErrorsUnrecoverable -processor TestProcessor SemanticErrorTest.java
172.1 --- a/test/tools/javac/processing/6994946/SyntaxErrorTest.java Thu Dec 27 12:15:17 2012 -0800 172.2 +++ b/test/tools/javac/processing/6994946/SyntaxErrorTest.java Fri Dec 28 18:39:09 2012 -0800 172.3 @@ -2,7 +2,7 @@ 172.4 * @test /nodynamiccopyright/ 172.5 * @bug 6994946 172.6 * @summary option to specify only syntax errors as unrecoverable 172.7 - * @library ../../lib 172.8 + * @library /tools/javac/lib 172.9 * @build JavacTestingAbstractProcessor TestProcessor 172.10 * @compile/fail/ref=SyntaxErrorTest.out -XDrawDiagnostics -processor TestProcessor SyntaxErrorTest.java 172.11 * @compile/fail/ref=SyntaxErrorTest.out -XDrawDiagnostics -XDonlySyntaxErrorsUnrecoverable -processor TestProcessor SyntaxErrorTest.java
173.1 --- a/test/tools/javac/processing/T6920317.java Thu Dec 27 12:15:17 2012 -0800 173.2 +++ b/test/tools/javac/processing/T6920317.java Fri Dec 28 18:39:09 2012 -0800 173.3 @@ -25,7 +25,7 @@ 173.4 * @test 173.5 * @bug 6920317 173.6 * @summary package-info.java file has to be specified on the javac cmdline, else it will not be avail 173.7 - * @library ../lib 173.8 + * @library /tools/javac/lib 173.9 */ 173.10 173.11 import java.io.*;
174.1 --- a/test/tools/javac/processing/T7196462.java Thu Dec 27 12:15:17 2012 -0800 174.2 +++ b/test/tools/javac/processing/T7196462.java Fri Dec 28 18:39:09 2012 -0800 174.3 @@ -25,7 +25,7 @@ 174.4 * @test 174.5 * @bug 7196462 174.6 * @summary JavacProcessingEnvironment should tolerate BasicJavacTask 174.7 - * @library ../lib 174.8 + * @library /tools/javac/lib 174.9 * @build JavacTestingAbstractProcessor T7196462 174.10 * @compile/process -processor T7196462 T7196462.java 174.11 */
175.1 --- a/test/tools/javac/processing/TestWarnErrorCount.java Thu Dec 27 12:15:17 2012 -0800 175.2 +++ b/test/tools/javac/processing/TestWarnErrorCount.java Fri Dec 28 18:39:09 2012 -0800 175.3 @@ -26,7 +26,7 @@ 175.4 * @test 175.5 * @bug 7022337 175.6 * @summary repeated warnings about bootclasspath not set 175.7 - * @library ../lib 175.8 + * @library /tools/javac/lib 175.9 * @build JavacTestingAbstractProcessor TestWarnErrorCount 175.10 * @run main TestWarnErrorCount 175.11 */
176.1 --- a/test/tools/javac/processing/environment/TestSourceVersion.java Thu Dec 27 12:15:17 2012 -0800 176.2 +++ b/test/tools/javac/processing/environment/TestSourceVersion.java Fri Dec 28 18:39:09 2012 -0800 176.3 @@ -26,7 +26,7 @@ 176.4 * @bug 6402506 176.5 * @summary Test that getSourceVersion works properly 176.6 * @author Joseph D. Darcy 176.7 - * @library ../../lib 176.8 + * @library /tools/javac/lib 176.9 * @build JavacTestingAbstractProcessor 176.10 * @compile TestSourceVersion.java 176.11 * @compile -processor TestSourceVersion -proc:only -source 1.2 -AExpectedVersion=RELEASE_2 HelloWorld.java
177.1 --- a/test/tools/javac/processing/environment/round/TestContext.java Thu Dec 27 12:15:17 2012 -0800 177.2 +++ b/test/tools/javac/processing/environment/round/TestContext.java Fri Dec 28 18:39:09 2012 -0800 177.3 @@ -25,7 +25,7 @@ 177.4 * @test 177.5 * @bug 6988836 177.6 * @summary A new JavacElements is created for each round of annotation processing 177.7 - * @library ../../../lib 177.8 + * @library /tools/javac/lib 177.9 * @build JavacTestingAbstractProcessor TestContext 177.10 * @compile/process -processor TestContext -XprintRounds TestContext 177.11 */
178.1 --- a/test/tools/javac/processing/environment/round/TestElementsAnnotatedWith.java Thu Dec 27 12:15:17 2012 -0800 178.2 +++ b/test/tools/javac/processing/environment/round/TestElementsAnnotatedWith.java Fri Dec 28 18:39:09 2012 -0800 178.3 @@ -26,7 +26,7 @@ 178.4 * @bug 6397298 6400986 6425592 6449798 6453386 6508401 6498938 6911854 178.5 * @summary Tests that getElementsAnnotatedWith works properly. 178.6 * @author Joseph D. Darcy 178.7 - * @library ../../../lib 178.8 + * @library /tools/javac/lib 178.9 * @build JavacTestingAbstractProcessor 178.10 * @compile TestElementsAnnotatedWith.java 178.11 * @compile InheritedAnnotation.java
179.1 --- a/test/tools/javac/processing/errors/TestErrorCount.java Thu Dec 27 12:15:17 2012 -0800 179.2 +++ b/test/tools/javac/processing/errors/TestErrorCount.java Fri Dec 28 18:39:09 2012 -0800 179.3 @@ -25,7 +25,7 @@ 179.4 * @test 179.5 * @bug 6988079 179.6 * @summary Errors reported via Messager.printMessage(ERROR,"error message") are not tallied correctly 179.7 - * @library ../../lib 179.8 + * @library /tools/javac/lib 179.9 * @build JavacTestingAbstractProcessor TestErrorCount 179.10 * @compile/fail/ref=TestErrorCount.out -XDrawDiagnostics -processor TestErrorCount TestErrorCount.java 179.11 */
180.1 --- a/test/tools/javac/processing/errors/TestFatalityOfParseErrors.java Thu Dec 27 12:15:17 2012 -0800 180.2 +++ b/test/tools/javac/processing/errors/TestFatalityOfParseErrors.java Fri Dec 28 18:39:09 2012 -0800 180.3 @@ -26,7 +26,7 @@ 180.4 * @bug 6403459 180.5 * @summary Test that generating programs with syntax errors is a fatal condition 180.6 * @author Joseph D. Darcy 180.7 - * @library ../../lib 180.8 + * @library /tools/javac/lib 180.9 * @build JavacTestingAbstractProcessor 180.10 * @compile TestReturnCode.java 180.11 * @compile TestFatalityOfParseErrors.java
181.1 --- a/test/tools/javac/processing/errors/TestOptionSyntaxErrors.java Thu Dec 27 12:15:17 2012 -0800 181.2 +++ b/test/tools/javac/processing/errors/TestOptionSyntaxErrors.java Fri Dec 28 18:39:09 2012 -0800 181.3 @@ -26,7 +26,7 @@ 181.4 * @bug 6406212 181.5 * @summary Test that annotation processor options with illegal syntax are rejected 181.6 * @author Joseph D. Darcy 181.7 - * @library ../../lib 181.8 + * @library /tools/javac/lib 181.9 * @build JavacTestingAbstractProcessor CompileFail 181.10 * @compile TestOptionSyntaxErrors.java 181.11 * @run main CompileFail CMDERR -A TestOptionSyntaxErrors.java
182.1 --- a/test/tools/javac/processing/errors/TestParseErrors/TestParseErrors.java Thu Dec 27 12:15:17 2012 -0800 182.2 +++ b/test/tools/javac/processing/errors/TestParseErrors/TestParseErrors.java Fri Dec 28 18:39:09 2012 -0800 182.3 @@ -25,7 +25,7 @@ 182.4 * @test 182.5 * @bug 6988407 182.6 * @summary javac crashes running processor on errant code; it used to print error message 182.7 - * @library ../../../lib 182.8 + * @library /tools/javac/lib 182.9 * @build JavacTestingAbstractProcessor TestParseErrors 182.10 * @compile/fail/ref=TestParseErrors.out -XDrawDiagnostics -proc:only -processor TestParseErrors ParseErrors.java 182.11 */
183.1 --- a/test/tools/javac/processing/errors/TestReturnCode.java Thu Dec 27 12:15:17 2012 -0800 183.2 +++ b/test/tools/javac/processing/errors/TestReturnCode.java Fri Dec 28 18:39:09 2012 -0800 183.3 @@ -26,7 +26,7 @@ 183.4 * @bug 6403468 183.5 * @summary Test that an erroneous return code results from raising an error. 183.6 * @author Joseph D. Darcy 183.7 - * @library ../../lib 183.8 + * @library /tools/javac/lib 183.9 * @build JavacTestingAbstractProcessor CompileFail 183.10 * @compile TestReturnCode.java 183.11 *
184.1 --- a/test/tools/javac/processing/filer/TestFilerConstraints.java Thu Dec 27 12:15:17 2012 -0800 184.2 +++ b/test/tools/javac/processing/filer/TestFilerConstraints.java Fri Dec 28 18:39:09 2012 -0800 184.3 @@ -26,7 +26,7 @@ 184.4 * @bug 6380018 6453386 6457283 184.5 * @summary Test that the constraints guaranteed by the Filer and maintained 184.6 * @author Joseph D. Darcy 184.7 - * @library ../../lib 184.8 + * @library /tools/javac/lib 184.9 * @build TestFilerConstraints 184.10 * @compile -encoding iso-8859-1 -processor TestFilerConstraints -proc:only TestFilerConstraints.java 184.11 */
185.1 --- a/test/tools/javac/processing/filer/TestGetResource.java Thu Dec 27 12:15:17 2012 -0800 185.2 +++ b/test/tools/javac/processing/filer/TestGetResource.java Fri Dec 28 18:39:09 2012 -0800 185.3 @@ -26,7 +26,7 @@ 185.4 * @bug 6380018 6449798 185.5 * @summary Test Filer.getResource 185.6 * @author Joseph D. Darcy 185.7 - * @library ../../lib 185.8 + * @library /tools/javac/lib 185.9 * @build JavacTestingAbstractProcessor TestGetResource 185.10 * @compile -processor TestGetResource -proc:only -Aphase=write TestGetResource.java 185.11 * @compile -processor TestGetResource -proc:only -Aphase=read TestGetResource.java
186.1 --- a/test/tools/javac/processing/filer/TestGetResource2.java Thu Dec 27 12:15:17 2012 -0800 186.2 +++ b/test/tools/javac/processing/filer/TestGetResource2.java Fri Dec 28 18:39:09 2012 -0800 186.3 @@ -24,7 +24,7 @@ 186.4 /* @test 186.5 * @bug 6929404 186.6 * @summary Filer.getResource(SOURCE_PATH, ...) does not work when -sourcepath contains >1 entry 186.7 - * @library ../../lib 186.8 + * @library /tools/javac/lib 186.9 */ 186.10 186.11 import java.io.*;
187.1 --- a/test/tools/javac/processing/filer/TestInvalidRelativeNames.java Thu Dec 27 12:15:17 2012 -0800 187.2 +++ b/test/tools/javac/processing/filer/TestInvalidRelativeNames.java Fri Dec 28 18:39:09 2012 -0800 187.3 @@ -25,7 +25,7 @@ 187.4 * @test 187.5 * @bug 6502392 187.6 * @summary Invalid relative names for Filer.createResource and Filer.getResource 187.7 - * @library ../../lib 187.8 + * @library /tools/javac/lib 187.9 * @build JavacTestingAbstractProcessor 187.10 * @compile TestInvalidRelativeNames.java 187.11 * @compile/process -processor TestInvalidRelativeNames java.lang.Object
188.1 --- a/test/tools/javac/processing/filer/TestLastRound.java Thu Dec 27 12:15:17 2012 -0800 188.2 +++ b/test/tools/javac/processing/filer/TestLastRound.java Fri Dec 28 18:39:09 2012 -0800 188.3 @@ -24,7 +24,7 @@ 188.4 /* 188.5 * @test 6966604 188.6 * @summary JavacFiler not correctly notified of lastRound 188.7 - * @library ../../lib 188.8 + * @library /tools/javac/lib 188.9 * @build JavacTestingAbstractProcessor 188.10 * @compile TestLastRound.java 188.11 * @compile/fail/ref=TestLastRound.out -XDrawDiagnostics -Werror -proc:only -processor TestLastRound TestLastRound.java
189.1 --- a/test/tools/javac/processing/filer/TestPackageInfo.java Thu Dec 27 12:15:17 2012 -0800 189.2 +++ b/test/tools/javac/processing/filer/TestPackageInfo.java Fri Dec 28 18:39:09 2012 -0800 189.3 @@ -26,7 +26,7 @@ 189.4 * @bug 6380018 6392177 6993311 189.5 * @summary Test the ability to create and process package-info.java files 189.6 * @author Joseph D. Darcy 189.7 - * @library ../../lib 189.8 + * @library /tools/javac/lib 189.9 * @build JavacTestingAbstractProcessor 189.10 * @compile TestPackageInfo.java 189.11 * @compile -processor TestPackageInfo -proc:only foo/bar/package-info.java TestPackageInfo.java
190.1 --- a/test/tools/javac/processing/filer/TestValidRelativeNames.java Thu Dec 27 12:15:17 2012 -0800 190.2 +++ b/test/tools/javac/processing/filer/TestValidRelativeNames.java Fri Dec 28 18:39:09 2012 -0800 190.3 @@ -25,7 +25,7 @@ 190.4 * @test 190.5 * @bug 6999891 190.6 * @summary Test valid relative names for Filer.createResource and Filer.getResource 190.7 - * @library ../../lib 190.8 + * @library /tools/javac/lib 190.9 * @build JavacTestingAbstractProcessor 190.10 * @compile TestValidRelativeNames.java 190.11 * @compile/process -processor TestValidRelativeNames -Amode=create java.lang.Object
191.1 --- a/test/tools/javac/processing/messager/6362067/T6362067.java Thu Dec 27 12:15:17 2012 -0800 191.2 +++ b/test/tools/javac/processing/messager/6362067/T6362067.java Fri Dec 28 18:39:09 2012 -0800 191.3 @@ -2,7 +2,7 @@ 191.4 * @test /nodynamiccopyright/ 191.5 * @bug 6362067 191.6 * @summary Messager methods do not print out source position information 191.7 - * @library ../../../lib 191.8 + * @library /tools/javac/lib 191.9 * @build JavacTestingAbstractProcessor T6362067 191.10 * @compile -processor T6362067 -proc:only T6362067.java 191.11 * @compile/ref=T6362067.out -XDrawDiagnostics -processor T6362067 -proc:only T6362067.java
192.1 --- a/test/tools/javac/processing/messager/MessagerBasics.java Thu Dec 27 12:15:17 2012 -0800 192.2 +++ b/test/tools/javac/processing/messager/MessagerBasics.java Fri Dec 28 18:39:09 2012 -0800 192.3 @@ -26,7 +26,7 @@ 192.4 * @bug 6341173 6341072 192.5 * @summary Test presence of Messager methods 192.6 * @author Joseph D. Darcy 192.7 - * @library ../../lib 192.8 + * @library /tools/javac/lib 192.9 * @build JavacTestingAbstractProcessor 192.10 * @compile MessagerBasics.java 192.11 * @compile -processor MessagerBasics -proc:only MessagerBasics.java
193.1 --- a/test/tools/javac/processing/model/6194785/T6194785.java Thu Dec 27 12:15:17 2012 -0800 193.2 +++ b/test/tools/javac/processing/model/6194785/T6194785.java Fri Dec 28 18:39:09 2012 -0800 193.3 @@ -26,7 +26,7 @@ 193.4 * @bug 6194785 193.5 * @summary ParameterDeclaration.getSimpleName does not return actual name from class files 193.6 * @author Peter von der Ah\u00e9 193.7 - * @library ../../../lib 193.8 + * @library /tools/javac/lib 193.9 * @build JavacTestingAbstractProcessor 193.10 * @compile -g T6194785.java T6194785a.java 193.11 * @compile -processor T6194785 foo.T6194785a T6194785.java
194.1 --- a/test/tools/javac/processing/model/6341534/T6341534.java Thu Dec 27 12:15:17 2012 -0800 194.2 +++ b/test/tools/javac/processing/model/6341534/T6341534.java Fri Dec 28 18:39:09 2012 -0800 194.3 @@ -27,7 +27,7 @@ 194.4 * @summary PackageElement.getEnclosedElements results in NullPointerException from parse(JavaCompiler.java:429) 194.5 * @author Steve Sides 194.6 * @author Peter von der Ahe 194.7 - * @library ../../../lib 194.8 + * @library /tools/javac/lib 194.9 * @build JavacTestingAbstractProcessor 194.10 * @compile T6341534.java 194.11 * @compile -proc:only -processor T6341534 dir/package-info.java
195.1 --- a/test/tools/javac/processing/model/element/TestAnonClassNames.java Thu Dec 27 12:15:17 2012 -0800 195.2 +++ b/test/tools/javac/processing/model/element/TestAnonClassNames.java Fri Dec 28 18:39:09 2012 -0800 195.3 @@ -26,7 +26,7 @@ 195.4 * @bug 6449781 6930508 195.5 * @summary Test that reported names of anonymous classes are non-null. 195.6 * @author Joseph D. Darcy 195.7 - * @library ../../../lib 195.8 + * @library /tools/javac/lib 195.9 * @build JavacTestingAbstractProcessor TestAnonSourceNames 195.10 * @compile -processor TestAnonSourceNames TestAnonClassNames.java 195.11 * @run main TestAnonClassNames
196.1 --- a/test/tools/javac/processing/model/element/TestElement.java Thu Dec 27 12:15:17 2012 -0800 196.2 +++ b/test/tools/javac/processing/model/element/TestElement.java Fri Dec 28 18:39:09 2012 -0800 196.3 @@ -26,7 +26,7 @@ 196.4 * @bug 6453386 196.5 * @summary Test basic properties of javax.lang.element.Element 196.6 * @author Joseph D. Darcy 196.7 - * @library ../../../lib 196.8 + * @library /tools/javac/lib 196.9 * @build JavacTestingAbstractProcessor TestElement 196.10 * @compile -processor TestElement -proc:only TestElement.java 196.11 */
197.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 197.2 +++ b/test/tools/javac/processing/model/element/TestExecutableElement.java Fri Dec 28 18:39:09 2012 -0800 197.3 @@ -0,0 +1,113 @@ 197.4 +/* 197.5 + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. 197.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 197.7 + * 197.8 + * This code is free software; you can redistribute it and/or modify it 197.9 + * under the terms of the GNU General Public License version 2 only, as 197.10 + * published by the Free Software Foundation. 197.11 + * 197.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 197.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 197.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 197.15 + * version 2 for more details (a copy is included in the LICENSE file that 197.16 + * accompanied this code). 197.17 + * 197.18 + * You should have received a copy of the GNU General Public License version 197.19 + * 2 along with this work; if not, write to the Free Software Foundation, 197.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 197.21 + * 197.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 197.23 + * or visit www.oracle.com if you need additional information or have any 197.24 + * questions. 197.25 + */ 197.26 + 197.27 +/* 197.28 + * @test 197.29 + * @bug 8005046 197.30 + * @summary Test basic properties of javax.lang.element.Element 197.31 + * @author Joseph D. Darcy 197.32 + * @library /tools/javac/lib 197.33 + * @build JavacTestingAbstractProcessor TestExecutableElement 197.34 + * @compile -processor TestExecutableElement -proc:only TestExecutableElement.java 197.35 + */ 197.36 + 197.37 +import java.lang.annotation.*; 197.38 +import java.util.Formatter; 197.39 +import java.util.Set; 197.40 +import java.util.Objects; 197.41 +import javax.annotation.processing.*; 197.42 +import javax.lang.model.SourceVersion; 197.43 +import static javax.lang.model.SourceVersion.*; 197.44 +import javax.lang.model.element.*; 197.45 +import javax.lang.model.util.*; 197.46 +import static javax.lang.model.util.ElementFilter.*; 197.47 +import static javax.tools.Diagnostic.Kind.*; 197.48 +import static javax.tools.StandardLocation.*; 197.49 + 197.50 +/** 197.51 + * Test some basic workings of javax.lang.element.ExecutableElement 197.52 + */ 197.53 +public class TestExecutableElement extends JavacTestingAbstractProcessor implements ProviderOfDefault { 197.54 + @IsDefault(false) 197.55 + public boolean process(Set<? extends TypeElement> annotations, 197.56 + RoundEnvironment roundEnv) { 197.57 + int errors = 0; 197.58 + if (!roundEnv.processingOver()) { 197.59 + boolean hasRun = false; 197.60 + for (Element element : roundEnv.getRootElements()) { 197.61 + for (ExecutableElement method : methodsIn(element.getEnclosedElements())) { 197.62 + hasRun = true; 197.63 + errors += checkIsDefault(method); 197.64 + } 197.65 + } 197.66 + 197.67 + if (!hasRun) { 197.68 + messager.printMessage(ERROR, "No test cases run; test fails."); 197.69 + } 197.70 + } 197.71 + return true; 197.72 + } 197.73 + 197.74 + @IsDefault(false) 197.75 + int checkIsDefault(ExecutableElement method) { 197.76 + System.out.println("Testing " + method); 197.77 + IsDefault expectedIsDefault = method.getAnnotation(IsDefault.class); 197.78 + 197.79 + boolean expectedDefault = (expectedIsDefault != null) ? 197.80 + expectedIsDefault.value() : 197.81 + false; 197.82 + 197.83 + boolean methodIsDefault = method.isDefault(); 197.84 + 197.85 + if (methodIsDefault != expectedDefault) { 197.86 + messager.printMessage(ERROR, 197.87 + new Formatter().format("Unexpected Executable.isDefault result: got %s, expected %s", 197.88 + expectedDefault, 197.89 + methodIsDefault).toString(), 197.90 + method); 197.91 + return 1; 197.92 + } 197.93 + return 0; 197.94 + } 197.95 +} 197.96 + 197.97 +/** 197.98 + * Expected value of the ExecutableElement.isDefault method. 197.99 + */ 197.100 +@Retention(RetentionPolicy.RUNTIME) 197.101 +@Target(ElementType.METHOD) 197.102 +@interface IsDefault { 197.103 + boolean value(); 197.104 +} 197.105 + 197.106 +/** 197.107 + * Test interface to provide a default method. 197.108 + */ 197.109 +interface ProviderOfDefault { 197.110 + @IsDefault(false) 197.111 + boolean process(Set<? extends TypeElement> annotations, 197.112 + RoundEnvironment roundEnv); 197.113 + 197.114 + @IsDefault(true) 197.115 + default void quux() {}; 197.116 +}
198.1 --- a/test/tools/javac/processing/model/element/TestMissingElement/TestMissingElement.java Thu Dec 27 12:15:17 2012 -0800 198.2 +++ b/test/tools/javac/processing/model/element/TestMissingElement/TestMissingElement.java Fri Dec 28 18:39:09 2012 -0800 198.3 @@ -26,7 +26,7 @@ 198.4 * @test 198.5 * @bug 6639645 7026414 7025809 198.6 * @summary Modeling type implementing missing interfaces 198.7 - * @library ../../../../lib 198.8 + * @library /tools/javac/lib 198.9 * @build JavacTestingAbstractProcessor TestMissingElement 198.10 * @compile -proc:only -XprintRounds -processor TestMissingElement InvalidSource.java 198.11 */
199.1 --- a/test/tools/javac/processing/model/element/TestMissingElement2/TestMissingClass.java Thu Dec 27 12:15:17 2012 -0800 199.2 +++ b/test/tools/javac/processing/model/element/TestMissingElement2/TestMissingClass.java Fri Dec 28 18:39:09 2012 -0800 199.3 @@ -25,7 +25,7 @@ 199.4 * @test 199.5 * @bug 6639645 199.6 * @summary Modeling type implementing missing interfaces 199.7 - * @library ../../../../lib 199.8 + * @library /tools/javac/lib 199.9 * @build JavacTestingAbstractProcessor Generator 199.10 * @compile -XprintRounds -processor Generator TestMissingClass.java 199.11 * @run main TestMissingClass
200.1 --- a/test/tools/javac/processing/model/element/TestMissingElement2/TestMissingGenericClass1.java Thu Dec 27 12:15:17 2012 -0800 200.2 +++ b/test/tools/javac/processing/model/element/TestMissingElement2/TestMissingGenericClass1.java Fri Dec 28 18:39:09 2012 -0800 200.3 @@ -25,7 +25,7 @@ 200.4 * @test 200.5 * @bug 6639645 200.6 * @summary Modeling type implementing missing interfaces 200.7 - * @library ../../../../lib 200.8 + * @library /tools/javac/lib 200.9 * @clean MissingGenericClass1 200.10 * @build JavacTestingAbstractProcessor Generator 200.11 * @compile -XprintRounds -processor Generator TestMissingGenericClass1.java
201.1 --- a/test/tools/javac/processing/model/element/TestMissingElement2/TestMissingGenericClass2.java Thu Dec 27 12:15:17 2012 -0800 201.2 +++ b/test/tools/javac/processing/model/element/TestMissingElement2/TestMissingGenericClass2.java Fri Dec 28 18:39:09 2012 -0800 201.3 @@ -25,7 +25,7 @@ 201.4 * @test 201.5 * @bug 6639645 201.6 * @summary Modeling type implementing missing interfaces 201.7 - * @library ../../../../lib 201.8 + * @library /tools/javac/lib 201.9 * @clean MissingGenericClass2 201.10 * @build JavacTestingAbstractProcessor Generator 201.11 * @compile -XprintRounds -processor Generator TestMissingGenericClass2.java
202.1 --- a/test/tools/javac/processing/model/element/TestMissingElement2/TestMissingGenericInterface1.java Thu Dec 27 12:15:17 2012 -0800 202.2 +++ b/test/tools/javac/processing/model/element/TestMissingElement2/TestMissingGenericInterface1.java Fri Dec 28 18:39:09 2012 -0800 202.3 @@ -25,7 +25,7 @@ 202.4 * @test 202.5 * @bug 6639645 202.6 * @summary Modeling type implementing missing interfaces 202.7 - * @library ../../../../lib 202.8 + * @library /tools/javac/lib 202.9 * @clean MissingGenericInterface1 202.10 * @build JavacTestingAbstractProcessor Generator 202.11 * @compile -XprintRounds -processor Generator TestMissingGenericInterface1.java
203.1 --- a/test/tools/javac/processing/model/element/TestMissingElement2/TestMissingGenericInterface2.java Thu Dec 27 12:15:17 2012 -0800 203.2 +++ b/test/tools/javac/processing/model/element/TestMissingElement2/TestMissingGenericInterface2.java Fri Dec 28 18:39:09 2012 -0800 203.3 @@ -25,7 +25,7 @@ 203.4 * @test 203.5 * @bug 6639645 203.6 * @summary Modeling type implementing missing interfaces 203.7 - * @library ../../../../lib 203.8 + * @library /tools/javac/lib 203.9 * @clean MissingGenericInterface2 203.10 * @build JavacTestingAbstractProcessor Generator 203.11 * @compile -XprintRounds -processor Generator TestMissingGenericInterface2.java
204.1 --- a/test/tools/javac/processing/model/element/TestMissingElement2/TestMissingInterface.java Thu Dec 27 12:15:17 2012 -0800 204.2 +++ b/test/tools/javac/processing/model/element/TestMissingElement2/TestMissingInterface.java Fri Dec 28 18:39:09 2012 -0800 204.3 @@ -25,7 +25,7 @@ 204.4 * @test 204.5 * @bug 6639645 204.6 * @summary Modeling type implementing missing interfaces 204.7 - * @library ../../../../lib 204.8 + * @library /tools/javac/lib 204.9 * @build JavacTestingAbstractProcessor Generator 204.10 * @compile -XprintRounds -processor Generator TestMissingInterface.java 204.11 * @run main TestMissingInterface
205.1 --- a/test/tools/javac/processing/model/element/TestNames.java Thu Dec 27 12:15:17 2012 -0800 205.2 +++ b/test/tools/javac/processing/model/element/TestNames.java Fri Dec 28 18:39:09 2012 -0800 205.3 @@ -26,7 +26,7 @@ 205.4 * @bug 6380016 205.5 * @summary Test that the constraints guaranteed by the Filer and maintained 205.6 * @author Joseph D. Darcy 205.7 - * @library ../../../lib 205.8 + * @library /tools/javac/lib 205.9 * @build JavacTestingAbstractProcessor TestNames 205.10 * @compile -processor TestNames -proc:only TestNames.java 205.11 */
206.1 --- a/test/tools/javac/processing/model/element/TestPackageElement.java Thu Dec 27 12:15:17 2012 -0800 206.2 +++ b/test/tools/javac/processing/model/element/TestPackageElement.java Fri Dec 28 18:39:09 2012 -0800 206.3 @@ -26,7 +26,7 @@ 206.4 * @bug 6449798 6399404 206.5 * @summary Test basic workings of PackageElement 206.6 * @author Joseph D. Darcy 206.7 - * @library ../../../lib 206.8 + * @library /tools/javac/lib 206.9 * @build JavacTestingAbstractProcessor TestPackageElement 206.10 * @compile -processor TestPackageElement -proc:only TestPackageElement.java 206.11 */
207.1 --- a/test/tools/javac/processing/model/element/TestResourceElement.java Thu Dec 27 12:15:17 2012 -0800 207.2 +++ b/test/tools/javac/processing/model/element/TestResourceElement.java Fri Dec 28 18:39:09 2012 -0800 207.3 @@ -26,7 +26,7 @@ 207.4 * @bug 6967842 207.5 * @summary Element not returned from tree API for ARM resource variables. 207.6 * @author A. Sundararajan 207.7 - * @library ../../../lib 207.8 + * @library /tools/javac/lib 207.9 * @build JavacTestingAbstractProcessor TestResourceElement 207.10 * @compile -processor TestResourceElement -proc:only TestResourceElement.java 207.11 */
208.1 --- a/test/tools/javac/processing/model/element/TestResourceVariable.java Thu Dec 27 12:15:17 2012 -0800 208.2 +++ b/test/tools/javac/processing/model/element/TestResourceVariable.java Fri Dec 28 18:39:09 2012 -0800 208.3 @@ -26,7 +26,7 @@ 208.4 * @bug 6911256 6964740 6967842 6961571 7025809 208.5 * @summary Test that the resource variable kind is appropriately set 208.6 * @author Joseph D. Darcy 208.7 - * @library ../../../lib 208.8 + * @library /tools/javac/lib 208.9 * @build JavacTestingAbstractProcessor TestResourceVariable 208.10 * @compile -processor TestResourceVariable -proc:only TestResourceVariable.java 208.11 */
209.1 --- a/test/tools/javac/processing/model/element/TestTypeParameter.java Thu Dec 27 12:15:17 2012 -0800 209.2 +++ b/test/tools/javac/processing/model/element/TestTypeParameter.java Fri Dec 28 18:39:09 2012 -0800 209.3 @@ -25,7 +25,7 @@ 209.4 * @test 209.5 * @bug 6505047 209.6 * @summary javax.lang.model.element.Element.getEnclosingElement() doesn't return null for type parameter 209.7 - * @library ../../../lib 209.8 + * @library /tools/javac/lib 209.9 * @build JavacTestingAbstractProcessor TestTypeParameter 209.10 * @compile -processor TestTypeParameter -proc:only TestTypeParameter.java 209.11 */
210.1 --- a/test/tools/javac/processing/model/element/TypeParamBounds.java Thu Dec 27 12:15:17 2012 -0800 210.2 +++ b/test/tools/javac/processing/model/element/TypeParamBounds.java Fri Dec 28 18:39:09 2012 -0800 210.3 @@ -26,7 +26,7 @@ 210.4 * @bug 6423972 210.5 * @summary Tests TypeParameter.getBounds. 210.6 * @author Scott Seligman 210.7 - * @library ../../../lib 210.8 + * @library /tools/javac/lib 210.9 * @build JavacTestingAbstractProcessor TypeParamBounds 210.10 * @compile -processor TypeParamBounds -proc:only TypeParamBounds.java 210.11 */
211.1 --- a/test/tools/javac/processing/model/type/MirroredTypeEx/OverEager.java Thu Dec 27 12:15:17 2012 -0800 211.2 +++ b/test/tools/javac/processing/model/type/MirroredTypeEx/OverEager.java Fri Dec 28 18:39:09 2012 -0800 211.3 @@ -26,7 +26,7 @@ 211.4 * @bug 6362178 211.5 * @summary MirroredType[s]Exception shouldn't be created too eagerly 211.6 * @author Scott Seligman 211.7 - * @library ../../../../lib 211.8 + * @library /tools/javac/lib 211.9 * @build JavacTestingAbstractProcessor 211.10 * @compile -g OverEager.java 211.11 * @compile -processor OverEager -proc:only OverEager.java
212.1 --- a/test/tools/javac/processing/model/type/MirroredTypeEx/Plurality.java Thu Dec 27 12:15:17 2012 -0800 212.2 +++ b/test/tools/javac/processing/model/type/MirroredTypeEx/Plurality.java Fri Dec 28 18:39:09 2012 -0800 212.3 @@ -25,7 +25,7 @@ 212.4 * @test 212.5 * @bug 6519115 212.6 * @summary Verify MirroredTypeException vs MirroredTypesException is thrown 212.7 - * @library ../../../../lib 212.8 + * @library /tools/javac/lib 212.9 * @build JavacTestingAbstractProcessor 212.10 * @compile Plurality.java 212.11 * @compile -processor Plurality -proc:only Plurality.java
213.1 --- a/test/tools/javac/processing/model/type/NoTypes.java Thu Dec 27 12:15:17 2012 -0800 213.2 +++ b/test/tools/javac/processing/model/type/NoTypes.java Fri Dec 28 18:39:09 2012 -0800 213.3 @@ -26,7 +26,7 @@ 213.4 * @bug 6418666 6423973 6453386 7025809 213.5 * @summary Test the NoTypes: VOID, PACKAGE, NONE 213.6 * @author Scott Seligman 213.7 - * @library ../../../lib 213.8 + * @library /tools/javac/lib 213.9 * @build JavacTestingAbstractProcessor 213.10 * @compile -g NoTypes.java 213.11 * @compile -processor NoTypes -proc:only NoTypes.java
214.1 --- a/test/tools/javac/processing/model/type/TestUnionType.java Thu Dec 27 12:15:17 2012 -0800 214.2 +++ b/test/tools/javac/processing/model/type/TestUnionType.java Fri Dec 28 18:39:09 2012 -0800 214.3 @@ -25,7 +25,7 @@ 214.4 * @test 214.5 * @bug 7029150 7025809 214.6 * @summary Test support for union types 214.7 - * @library ../../../lib 214.8 + * @library /tools/javac/lib 214.9 */ 214.10 214.11 import java.net.URI;
215.1 --- a/test/tools/javac/processing/model/util/BinaryName.java Thu Dec 27 12:15:17 2012 -0800 215.2 +++ b/test/tools/javac/processing/model/util/BinaryName.java Fri Dec 28 18:39:09 2012 -0800 215.3 @@ -26,7 +26,7 @@ 215.4 * @bug 6346251 215.5 * @summary Test Elements.getBinaryName 215.6 * @author Scott Seligman 215.7 - * @library ../../../lib 215.8 + * @library /tools/javac/lib 215.9 * @build JavacTestingAbstractProcessor BinaryName 215.10 * @compile -processor BinaryName -proc:only BinaryName.java 215.11 */
216.1 --- a/test/tools/javac/processing/model/util/GetTypeElemBadArg.java Thu Dec 27 12:15:17 2012 -0800 216.2 +++ b/test/tools/javac/processing/model/util/GetTypeElemBadArg.java Fri Dec 28 18:39:09 2012 -0800 216.3 @@ -26,7 +26,7 @@ 216.4 * @bug 6346506 6408241 216.5 * @summary getTypeElement should tolerate a type that can't be found 216.6 * @author Scott Seligman 216.7 - * @library ../../../lib 216.8 + * @library /tools/javac/lib 216.9 * @build JavacTestingAbstractProcessor GetTypeElemBadArg 216.10 * @compile -processor GetTypeElemBadArg -proc:only GetTypeElemBadArg.java 216.11 */
217.1 --- a/test/tools/javac/processing/model/util/NoSupers.java Thu Dec 27 12:15:17 2012 -0800 217.2 +++ b/test/tools/javac/processing/model/util/NoSupers.java Fri Dec 28 18:39:09 2012 -0800 217.3 @@ -26,7 +26,7 @@ 217.4 * @bug 6346453 217.5 * @summary directSupertypes should return empty list if arg has no supertypes 217.6 * @author Scott Seligman 217.7 - * @library ../../../lib 217.8 + * @library /tools/javac/lib 217.9 * @build JavacTestingAbstractProcessor NoSupers 217.10 * @compile -processor NoSupers -proc:only NoSupers.java 217.11 */
218.1 --- a/test/tools/javac/processing/model/util/OverridesSpecEx.java Thu Dec 27 12:15:17 2012 -0800 218.2 +++ b/test/tools/javac/processing/model/util/OverridesSpecEx.java Fri Dec 28 18:39:09 2012 -0800 218.3 @@ -26,7 +26,7 @@ 218.4 * @bug 6453386 218.5 * @summary Verify that example code in Elements.overrides works as spec'ed. 218.6 * @author Scott Seligman 218.7 - * @library ../../../lib 218.8 + * @library /tools/javac/lib 218.9 * @build JavacTestingAbstractProcessor 218.10 * @compile -g OverridesSpecEx.java 218.11 * @compile -processor OverridesSpecEx -proc:only OverridesSpecEx.java
219.1 --- a/test/tools/javac/processing/model/util/TypesBadArg.java Thu Dec 27 12:15:17 2012 -0800 219.2 +++ b/test/tools/javac/processing/model/util/TypesBadArg.java Fri Dec 28 18:39:09 2012 -0800 219.3 @@ -26,7 +26,7 @@ 219.4 * @bug 6345812 219.5 * @summary Validate argument kinds in Types utilities 219.6 * @author Scott Seligman 219.7 - * @library ../../../lib 219.8 + * @library /tools/javac/lib 219.9 * @build JavacTestingAbstractProcessor TypesBadArg 219.10 * @compile -processor TypesBadArg -proc:only TypesBadArg.java 219.11 */
220.1 --- a/test/tools/javac/processing/model/util/deprecation/TestDeprecation.java Thu Dec 27 12:15:17 2012 -0800 220.2 +++ b/test/tools/javac/processing/model/util/deprecation/TestDeprecation.java Fri Dec 28 18:39:09 2012 -0800 220.3 @@ -26,7 +26,7 @@ 220.4 * @bug 6392818 220.5 * @summary Tests Elements.isDeprecated(Element) 220.6 * @author Joseph D. Darcy 220.7 - * @library ../../../../lib 220.8 + * @library /tools/javac/lib 220.9 * @build JavacTestingAbstractProcessor 220.10 * @compile TestDeprecation.java 220.11 * @compile -processor TestDeprecation -proc:only Dep1.java
221.1 --- a/test/tools/javac/processing/model/util/directSupersOfErr/DirectSupersOfErr.java Thu Dec 27 12:15:17 2012 -0800 221.2 +++ b/test/tools/javac/processing/model/util/directSupersOfErr/DirectSupersOfErr.java Fri Dec 28 18:39:09 2012 -0800 221.3 @@ -26,7 +26,7 @@ 221.4 * @bug 6346973 221.5 * @summary directSupertypes(t) should not return t 221.6 * @author Scott Seligman 221.7 - * @library ../../../../lib 221.8 + * @library /tools/javac/lib 221.9 * @build JavacTestingAbstractProcessor DirectSupersOfErr 221.10 * @compile -processor DirectSupersOfErr -proc:only C1.java 221.11 */
222.1 --- a/test/tools/javac/processing/model/util/elements/TestGetConstantExpression.java Thu Dec 27 12:15:17 2012 -0800 222.2 +++ b/test/tools/javac/processing/model/util/elements/TestGetConstantExpression.java Fri Dec 28 18:39:09 2012 -0800 222.3 @@ -26,7 +26,7 @@ 222.4 * @bug 6471577 6517779 222.5 * @summary Test Elements.getConstantExpression 222.6 * @author Joseph D. Darcy 222.7 - * @library ../../../../lib 222.8 + * @library /tools/javac/lib 222.9 * @build JavacTestingAbstractProcessor TestGetConstantExpression 222.10 * @compile -processor TestGetConstantExpression Foo.java 222.11 */
223.1 --- a/test/tools/javac/processing/model/util/elements/TestGetPackageOf.java Thu Dec 27 12:15:17 2012 -0800 223.2 +++ b/test/tools/javac/processing/model/util/elements/TestGetPackageOf.java Fri Dec 28 18:39:09 2012 -0800 223.3 @@ -26,7 +26,7 @@ 223.4 * @bug 6453386 223.5 * @summary Test Elements.getPackageOf 223.6 * @author Joseph D. Darcy 223.7 - * @library ../../../../lib 223.8 + * @library /tools/javac/lib 223.9 * @build JavacTestingAbstractProcessor TestGetPackageOf 223.10 * @compile -processor TestGetPackageOf -proc:only TestGetPackageOf.java 223.11 */
224.1 --- a/test/tools/javac/processing/model/util/filter/TestIterables.java Thu Dec 27 12:15:17 2012 -0800 224.2 +++ b/test/tools/javac/processing/model/util/filter/TestIterables.java Fri Dec 28 18:39:09 2012 -0800 224.3 @@ -26,7 +26,7 @@ 224.4 * @bug 6406164 224.5 * @summary Test that ElementFilter iterable methods behave properly. 224.6 * @author Joseph D. Darcy 224.7 - * @library ../../../../lib 224.8 + * @library /tools/javac/lib 224.9 * @build JavacTestingAbstractProcessor 224.10 * @compile TestIterables.java 224.11 * @compile -processor TestIterables -proc:only Foo1.java
225.1 --- a/test/tools/javac/processing/options/testCommandLineClasses/Test.java Thu Dec 27 12:15:17 2012 -0800 225.2 +++ b/test/tools/javac/processing/options/testCommandLineClasses/Test.java Fri Dec 28 18:39:09 2012 -0800 225.3 @@ -25,7 +25,7 @@ 225.4 * @test 225.5 * @bug 6930508 225.6 * @summary Passing nested class names on javac command line interfere with subsequent name -> class lookup 225.7 - * @library ../../../lib 225.8 + * @library /tools/javac/lib 225.9 * @build JavacTestingAbstractProcessor p.NestedExamples Test 225.10 * @run main Test 225.11 */
226.1 --- a/test/tools/javac/processing/options/testPrintProcessorInfo/Test.java Thu Dec 27 12:15:17 2012 -0800 226.2 +++ b/test/tools/javac/processing/options/testPrintProcessorInfo/Test.java Fri Dec 28 18:39:09 2012 -0800 226.3 @@ -25,7 +25,7 @@ 226.4 * @test 226.5 * @bug 6987384 226.6 * @summary -XprintProcessorRoundsInfo message printed with different timing than previous 226.7 - * @library ../../../lib 226.8 + * @library /tools/javac/lib 226.9 * @build JavacTestingAbstractProcessor Test 226.10 * @compile/fail/ref=Test.out -XDrawDiagnostics -XprintProcessorInfo -Werror -proc:only -processor Test Test.java 226.11 */
227.1 --- a/test/tools/javac/processing/options/testPrintProcessorInfo/TestWithXstdout.java Thu Dec 27 12:15:17 2012 -0800 227.2 +++ b/test/tools/javac/processing/options/testPrintProcessorInfo/TestWithXstdout.java Fri Dec 28 18:39:09 2012 -0800 227.3 @@ -25,7 +25,7 @@ 227.4 * @test 227.5 * @bug 6987384 227.6 * @summary -XprintProcessorRoundsInfo message printed with different timing than previous 227.7 - * @library ../../../lib 227.8 + * @library /tools/javac/lib 227.9 * @build JavacTestingAbstractProcessor Test TestWithXstdout 227.10 * @run main TestWithXstdout 227.11 */
228.1 --- a/test/tools/javac/processing/warnings/UseImplicit/TestProcUseImplicitWarning.java Thu Dec 27 12:15:17 2012 -0800 228.2 +++ b/test/tools/javac/processing/warnings/UseImplicit/TestProcUseImplicitWarning.java Fri Dec 28 18:39:09 2012 -0800 228.3 @@ -25,7 +25,7 @@ 228.4 * @test 228.5 * @bug 6986892 228.6 * @summary confusing warning given after errors in annotation processing 228.7 - * @library ../../../lib 228.8 + * @library /tools/javac/lib 228.9 * @build JavacTestingAbstractProcessor TestProcUseImplicitWarning 228.10 * @clean C1 p.C2 228.11 * @compile/fail/ref=err.out -XDrawDiagnostics -processor TestProcUseImplicitWarning -Aerror C1.java
229.1 --- a/test/tools/javac/processing/werror/WError1.java Thu Dec 27 12:15:17 2012 -0800 229.2 +++ b/test/tools/javac/processing/werror/WError1.java Fri Dec 28 18:39:09 2012 -0800 229.3 @@ -24,7 +24,7 @@ 229.4 /* 229.5 * @test 6403456 229.6 * @summary -Werror should work with annotation processing 229.7 - * @library ../../lib 229.8 + * @library /tools/javac/lib 229.9 * @build JavacTestingAbstractProcessor 229.10 * @compile WError1.java 229.11 * @compile -proc:only -processor WError1 WError1.java
230.1 --- a/test/tools/javac/processing/werror/WErrorGen.java Thu Dec 27 12:15:17 2012 -0800 230.2 +++ b/test/tools/javac/processing/werror/WErrorGen.java Fri Dec 28 18:39:09 2012 -0800 230.3 @@ -24,7 +24,7 @@ 230.4 /* 230.5 * @test 6403456 230.6 * @summary -Werror should work with annotation processing 230.7 - * @library ../../lib 230.8 + * @library /tools/javac/lib 230.9 * @build JavacTestingAbstractProcessor 230.10 * @compile WErrorGen.java 230.11 * @compile -proc:only -processor WErrorGen WErrorGen.java
231.1 --- a/test/tools/javac/processing/werror/WErrorLast.java Thu Dec 27 12:15:17 2012 -0800 231.2 +++ b/test/tools/javac/processing/werror/WErrorLast.java Fri Dec 28 18:39:09 2012 -0800 231.3 @@ -24,7 +24,7 @@ 231.4 /* 231.5 * @test 6403456 231.6 * @summary -Werror should work with annotation processing 231.7 - * @library ../../lib 231.8 + * @library /tools/javac/lib 231.9 * @build JavacTestingAbstractProcessor 231.10 * @compile WErrorLast.java 231.11 * @compile -proc:only -processor WErrorLast WErrorLast.java
232.1 --- a/test/tools/javac/resolve/ResolveHarness.java Thu Dec 27 12:15:17 2012 -0800 232.2 +++ b/test/tools/javac/resolve/ResolveHarness.java Fri Dec 28 18:39:09 2012 -0800 232.3 @@ -25,7 +25,7 @@ 232.4 * @test 232.5 * @bug 7098660 232.6 * @summary Write better overload resolution/inference tests 232.7 - * @library ../lib 232.8 + * @library /tools/javac/lib 232.9 * @build JavacTestingAbstractProcessor ResolveHarness 232.10 * @run main ResolveHarness 232.11 */
233.1 --- a/test/tools/javac/util/T6597678.java Thu Dec 27 12:15:17 2012 -0800 233.2 +++ b/test/tools/javac/util/T6597678.java Fri Dec 28 18:39:09 2012 -0800 233.3 @@ -25,7 +25,7 @@ 233.4 * @test 233.5 * @bug 6597678 6449184 233.6 * @summary Ensure Messages propogated between rounds 233.7 - * @library ../lib 233.8 + * @library /tools/javac/lib 233.9 * @build JavacTestingAbstractProcessor T6597678 233.10 * @run main T6597678 233.11 */
234.1 --- a/test/tools/javac/util/context/T7021650.java Thu Dec 27 12:15:17 2012 -0800 234.2 +++ b/test/tools/javac/util/context/T7021650.java Fri Dec 28 18:39:09 2012 -0800 234.3 @@ -25,7 +25,7 @@ 234.4 * @test 234.5 * @bug 7021650 234.6 * @summary Fix Context issues 234.7 - * @library ../../lib 234.8 + * @library /tools/javac/lib 234.9 * @build JavacTestingAbstractProcessor T7021650 234.10 * @run main T7021650 234.11 */