Mercurial > hg > openjdk > lambda > langtools
changeset 2545:86e57f576e65
Merge
author | chegar |
---|---|
date | Fri, 11 Oct 2013 19:05:18 +0100 |
parents | 872c4a898b38 (diff) 2c13a5da6854 (current diff) |
children | 46feacb99698 |
files | src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlWriter.java |
diffstat | 259 files changed, 4853 insertions(+), 1522 deletions(-) [+] |
line wrap: on
line diff
--- a/.hgtags Thu Oct 03 19:28:07 2013 +0100 +++ b/.hgtags Fri Oct 11 19:05:18 2013 +0100 @@ -232,3 +232,4 @@ 252f872b8a2f81a416f9127e77924ca56a4578b0 jdk8-b108 985abf1cd327169a317d4ff4f318a8162a5cd47d jdk8-b109 41541097533aa3933a018c8c1c426c1871dfd76e jdk8-b110 +af6244ba81b6b8d1bf4ab06587a2067e021e4570 jdk8-b111
--- a/make/build.xml Thu Oct 03 19:28:07 2013 +0100 +++ b/make/build.xml Fri Oct 11 19:05:18 2013 +0100 @@ -360,7 +360,7 @@ datafile="${build.coverage.dir}/cobertura.ser"/> </target> - <target name="diags-examples" depends="build-javac"> + <target name="diags-examples" depends="build-javac,build-javap"> <!-- can override the following on the command line if desired. --> <property name="diags.examples.out" location="${build.dir}/diag-examples/diags-examples.html"/> <mkdir dir="${build.dir}/diag-examples/classes"/> @@ -370,7 +370,7 @@ destdir="${build.dir}/diag-examples/classes" includes="ArgTypeCompilerFactory.java,Example.java,FileManager.java,HTMLWriter.java,RunExamples.java,DocCommentProcessor.java" sourcepath="" - classpath="${dist.lib.dir}/javac.jar" + classpath="${dist.lib.dir}/javac.jar;${dist.lib.dir}/javap.jar" includeAntRuntime="no" debug="${javac.debug}" debuglevel="${javac.debuglevel}"> @@ -379,7 +379,7 @@ <java fork="true" jvm="${target.java.home}/bin/java" dir="test/tools/javac/diags" - classpath="${build.dir}/diag-examples/classes;${dist.lib.dir}/javac.jar" + classpath="${build.dir}/diag-examples/classes;${dist.lib.dir}/javac.jar;${dist.lib.dir}/javap.jar" classname="RunExamples"> <jvmarg value="-Dtest.classes=${build.dir}/diag-examples/classes"/> <arg value="-examples"/>
--- a/src/share/classes/com/sun/source/doctree/AttributeTree.java Thu Oct 03 19:28:07 2013 +0100 +++ b/src/share/classes/com/sun/source/doctree/AttributeTree.java Fri Oct 11 19:05:18 2013 +0100 @@ -33,9 +33,9 @@ * * @since 1.8 */ -@jdk.Supported +@jdk.Exported public interface AttributeTree extends DocTree { - @jdk.Supported + @jdk.Exported enum ValueKind { EMPTY, UNQUOTED, SINGLE, DOUBLE }; Name getName();
--- a/src/share/classes/com/sun/source/doctree/AuthorTree.java Thu Oct 03 19:28:07 2013 +0100 +++ b/src/share/classes/com/sun/source/doctree/AuthorTree.java Fri Oct 11 19:05:18 2013 +0100 @@ -35,7 +35,7 @@ * * @since 1.8 */ -@jdk.Supported +@jdk.Exported public interface AuthorTree extends BlockTagTree { List<? extends DocTree> getName(); }
--- a/src/share/classes/com/sun/source/doctree/BlockTagTree.java Thu Oct 03 19:28:07 2013 +0100 +++ b/src/share/classes/com/sun/source/doctree/BlockTagTree.java Fri Oct 11 19:05:18 2013 +0100 @@ -31,7 +31,7 @@ * * @since 1.8 */ -@jdk.Supported +@jdk.Exported public interface BlockTagTree extends DocTree { String getTagName(); }
--- a/src/share/classes/com/sun/source/doctree/CommentTree.java Thu Oct 03 19:28:07 2013 +0100 +++ b/src/share/classes/com/sun/source/doctree/CommentTree.java Fri Oct 11 19:05:18 2013 +0100 @@ -33,7 +33,7 @@ * * @since 1.8 */ -@jdk.Supported +@jdk.Exported public interface CommentTree extends DocTree { String getBody(); }
--- a/src/share/classes/com/sun/source/doctree/DeprecatedTree.java Thu Oct 03 19:28:07 2013 +0100 +++ b/src/share/classes/com/sun/source/doctree/DeprecatedTree.java Fri Oct 11 19:05:18 2013 +0100 @@ -35,7 +35,7 @@ * * @since 1.8 */ -@jdk.Supported +@jdk.Exported public interface DeprecatedTree extends BlockTagTree { List<? extends DocTree> getBody(); }
--- a/src/share/classes/com/sun/source/doctree/DocCommentTree.java Thu Oct 03 19:28:07 2013 +0100 +++ b/src/share/classes/com/sun/source/doctree/DocCommentTree.java Fri Oct 11 19:05:18 2013 +0100 @@ -35,7 +35,7 @@ * * @since 1.8 */ -@jdk.Supported +@jdk.Exported public interface DocCommentTree extends DocTree { List<? extends DocTree> getFirstSentence(); List<? extends DocTree> getBody();
--- a/src/share/classes/com/sun/source/doctree/DocRootTree.java Thu Oct 03 19:28:07 2013 +0100 +++ b/src/share/classes/com/sun/source/doctree/DocRootTree.java Fri Oct 11 19:05:18 2013 +0100 @@ -33,5 +33,5 @@ * * @since 1.8 */ -@jdk.Supported +@jdk.Exported public interface DocRootTree extends InlineTagTree { }
--- a/src/share/classes/com/sun/source/doctree/DocTree.java Thu Oct 03 19:28:07 2013 +0100 +++ b/src/share/classes/com/sun/source/doctree/DocTree.java Fri Oct 11 19:05:18 2013 +0100 @@ -30,9 +30,9 @@ * * @since 1.8 */ -@jdk.Supported +@jdk.Exported public interface DocTree { - @jdk.Supported + @jdk.Exported enum Kind { /** * Used for instances of {@link AttributeTree}
--- a/src/share/classes/com/sun/source/doctree/DocTreeVisitor.java Thu Oct 03 19:28:07 2013 +0100 +++ b/src/share/classes/com/sun/source/doctree/DocTreeVisitor.java Fri Oct 11 19:05:18 2013 +0100 @@ -54,7 +54,7 @@ * * @since 1.8 */ -@jdk.Supported +@jdk.Exported public interface DocTreeVisitor<R,P> { R visitAttribute(AttributeTree node, P p); R visitAuthor(AuthorTree node, P p);
--- a/src/share/classes/com/sun/source/doctree/EndElementTree.java Thu Oct 03 19:28:07 2013 +0100 +++ b/src/share/classes/com/sun/source/doctree/EndElementTree.java Fri Oct 11 19:05:18 2013 +0100 @@ -35,7 +35,7 @@ * * @since 1.8 */ -@jdk.Supported +@jdk.Exported public interface EndElementTree extends DocTree { Name getName(); }
--- a/src/share/classes/com/sun/source/doctree/EntityTree.java Thu Oct 03 19:28:07 2013 +0100 +++ b/src/share/classes/com/sun/source/doctree/EntityTree.java Fri Oct 11 19:05:18 2013 +0100 @@ -36,7 +36,7 @@ * * @since 1.8 */ -@jdk.Supported +@jdk.Exported public interface EntityTree extends DocTree { Name getName(); }
--- a/src/share/classes/com/sun/source/doctree/ErroneousTree.java Thu Oct 03 19:28:07 2013 +0100 +++ b/src/share/classes/com/sun/source/doctree/ErroneousTree.java Fri Oct 11 19:05:18 2013 +0100 @@ -32,7 +32,7 @@ * * @since 1.8 */ -@jdk.Supported +@jdk.Exported public interface ErroneousTree extends TextTree { /** * Gets a diagnostic object giving details about
--- a/src/share/classes/com/sun/source/doctree/IdentifierTree.java Thu Oct 03 19:28:07 2013 +0100 +++ b/src/share/classes/com/sun/source/doctree/IdentifierTree.java Fri Oct 11 19:05:18 2013 +0100 @@ -35,7 +35,7 @@ * * @since 1.8 */ -@jdk.Supported +@jdk.Exported public interface IdentifierTree extends DocTree { Name getName(); }
--- a/src/share/classes/com/sun/source/doctree/InheritDocTree.java Thu Oct 03 19:28:07 2013 +0100 +++ b/src/share/classes/com/sun/source/doctree/InheritDocTree.java Fri Oct 11 19:05:18 2013 +0100 @@ -34,5 +34,5 @@ * * @since 1.8 */ -@jdk.Supported +@jdk.Exported public interface InheritDocTree extends InlineTagTree { }
--- a/src/share/classes/com/sun/source/doctree/InlineTagTree.java Thu Oct 03 19:28:07 2013 +0100 +++ b/src/share/classes/com/sun/source/doctree/InlineTagTree.java Fri Oct 11 19:05:18 2013 +0100 @@ -31,7 +31,7 @@ * * @since 1.8 */ -@jdk.Supported +@jdk.Exported public interface InlineTagTree extends DocTree { String getTagName(); }
--- a/src/share/classes/com/sun/source/doctree/LinkTree.java Thu Oct 03 19:28:07 2013 +0100 +++ b/src/share/classes/com/sun/source/doctree/LinkTree.java Fri Oct 11 19:05:18 2013 +0100 @@ -36,7 +36,7 @@ * * @since 1.8 */ -@jdk.Supported +@jdk.Exported public interface LinkTree extends InlineTagTree { ReferenceTree getReference(); List<? extends DocTree> getLabel();
--- a/src/share/classes/com/sun/source/doctree/LiteralTree.java Thu Oct 03 19:28:07 2013 +0100 +++ b/src/share/classes/com/sun/source/doctree/LiteralTree.java Fri Oct 11 19:05:18 2013 +0100 @@ -34,7 +34,7 @@ * * @since 1.8 */ -@jdk.Supported +@jdk.Exported public interface LiteralTree extends InlineTagTree { TextTree getBody(); }
--- a/src/share/classes/com/sun/source/doctree/ParamTree.java Thu Oct 03 19:28:07 2013 +0100 +++ b/src/share/classes/com/sun/source/doctree/ParamTree.java Fri Oct 11 19:05:18 2013 +0100 @@ -35,7 +35,7 @@ * * @since 1.8 */ -@jdk.Supported +@jdk.Exported public interface ParamTree extends BlockTagTree { boolean isTypeParameter(); IdentifierTree getName();
--- a/src/share/classes/com/sun/source/doctree/ReferenceTree.java Thu Oct 03 19:28:07 2013 +0100 +++ b/src/share/classes/com/sun/source/doctree/ReferenceTree.java Fri Oct 11 19:05:18 2013 +0100 @@ -33,7 +33,7 @@ * * @since 1.8 */ -@jdk.Supported +@jdk.Exported public interface ReferenceTree extends DocTree { String getSignature(); }
--- a/src/share/classes/com/sun/source/doctree/ReturnTree.java Thu Oct 03 19:28:07 2013 +0100 +++ b/src/share/classes/com/sun/source/doctree/ReturnTree.java Fri Oct 11 19:05:18 2013 +0100 @@ -35,7 +35,7 @@ * * @since 1.8 */ -@jdk.Supported +@jdk.Exported public interface ReturnTree extends BlockTagTree { List<? extends DocTree> getDescription(); }
--- a/src/share/classes/com/sun/source/doctree/SeeTree.java Thu Oct 03 19:28:07 2013 +0100 +++ b/src/share/classes/com/sun/source/doctree/SeeTree.java Fri Oct 11 19:05:18 2013 +0100 @@ -38,7 +38,7 @@ * * @since 1.8 */ -@jdk.Supported +@jdk.Exported public interface SeeTree extends BlockTagTree { List<? extends DocTree> getReference(); }
--- a/src/share/classes/com/sun/source/doctree/SerialDataTree.java Thu Oct 03 19:28:07 2013 +0100 +++ b/src/share/classes/com/sun/source/doctree/SerialDataTree.java Fri Oct 11 19:05:18 2013 +0100 @@ -35,7 +35,7 @@ * * @since 1.8 */ -@jdk.Supported +@jdk.Exported public interface SerialDataTree extends BlockTagTree { List<? extends DocTree> getDescription(); }
--- a/src/share/classes/com/sun/source/doctree/SerialFieldTree.java Thu Oct 03 19:28:07 2013 +0100 +++ b/src/share/classes/com/sun/source/doctree/SerialFieldTree.java Fri Oct 11 19:05:18 2013 +0100 @@ -35,7 +35,7 @@ * * @since 1.8 */ -@jdk.Supported +@jdk.Exported public interface SerialFieldTree extends BlockTagTree { IdentifierTree getName(); ReferenceTree getType();
--- a/src/share/classes/com/sun/source/doctree/SerialTree.java Thu Oct 03 19:28:07 2013 +0100 +++ b/src/share/classes/com/sun/source/doctree/SerialTree.java Fri Oct 11 19:05:18 2013 +0100 @@ -35,7 +35,7 @@ * * @since 1.8 */ -@jdk.Supported +@jdk.Exported public interface SerialTree extends BlockTagTree { List<? extends DocTree> getDescription(); }
--- a/src/share/classes/com/sun/source/doctree/SinceTree.java Thu Oct 03 19:28:07 2013 +0100 +++ b/src/share/classes/com/sun/source/doctree/SinceTree.java Fri Oct 11 19:05:18 2013 +0100 @@ -35,7 +35,7 @@ * * @since 1.8 */ -@jdk.Supported +@jdk.Exported public interface SinceTree extends BlockTagTree { List<? extends DocTree> getBody(); }
--- a/src/share/classes/com/sun/source/doctree/StartElementTree.java Thu Oct 03 19:28:07 2013 +0100 +++ b/src/share/classes/com/sun/source/doctree/StartElementTree.java Fri Oct 11 19:05:18 2013 +0100 @@ -36,7 +36,7 @@ * * @since 1.8 */ -@jdk.Supported +@jdk.Exported public interface StartElementTree extends DocTree { Name getName(); List<? extends DocTree> getAttributes();
--- a/src/share/classes/com/sun/source/doctree/TextTree.java Thu Oct 03 19:28:07 2013 +0100 +++ b/src/share/classes/com/sun/source/doctree/TextTree.java Fri Oct 11 19:05:18 2013 +0100 @@ -30,7 +30,7 @@ * * @since 1.8 */ -@jdk.Supported +@jdk.Exported public interface TextTree extends DocTree { String getBody(); }
--- a/src/share/classes/com/sun/source/doctree/ThrowsTree.java Thu Oct 03 19:28:07 2013 +0100 +++ b/src/share/classes/com/sun/source/doctree/ThrowsTree.java Fri Oct 11 19:05:18 2013 +0100 @@ -38,7 +38,7 @@ * * @since 1.8 */ -@jdk.Supported +@jdk.Exported public interface ThrowsTree extends BlockTagTree { ReferenceTree getExceptionName(); List<? extends DocTree> getDescription();
--- a/src/share/classes/com/sun/source/doctree/UnknownBlockTagTree.java Thu Oct 03 19:28:07 2013 +0100 +++ b/src/share/classes/com/sun/source/doctree/UnknownBlockTagTree.java Fri Oct 11 19:05:18 2013 +0100 @@ -35,7 +35,7 @@ * @since 1.8 * */ -@jdk.Supported +@jdk.Exported public interface UnknownBlockTagTree extends BlockTagTree { List<? extends DocTree> getContent(); }
--- a/src/share/classes/com/sun/source/doctree/UnknownInlineTagTree.java Thu Oct 03 19:28:07 2013 +0100 +++ b/src/share/classes/com/sun/source/doctree/UnknownInlineTagTree.java Fri Oct 11 19:05:18 2013 +0100 @@ -35,7 +35,7 @@ * @since 1.8 * */ -@jdk.Supported +@jdk.Exported public interface UnknownInlineTagTree extends InlineTagTree { List<? extends DocTree> getContent(); }
--- a/src/share/classes/com/sun/source/doctree/ValueTree.java Thu Oct 03 19:28:07 2013 +0100 +++ b/src/share/classes/com/sun/source/doctree/ValueTree.java Fri Oct 11 19:05:18 2013 +0100 @@ -33,7 +33,7 @@ * * @since 1.8 */ -@jdk.Supported +@jdk.Exported public interface ValueTree extends InlineTagTree { ReferenceTree getReference(); }
--- a/src/share/classes/com/sun/source/doctree/VersionTree.java Thu Oct 03 19:28:07 2013 +0100 +++ b/src/share/classes/com/sun/source/doctree/VersionTree.java Fri Oct 11 19:05:18 2013 +0100 @@ -36,7 +36,7 @@ * * @since 1.8 */ -@jdk.Supported +@jdk.Exported public interface VersionTree extends BlockTagTree { List<? extends DocTree> getBody(); }
--- a/src/share/classes/com/sun/source/doctree/package-info.java Thu Oct 03 19:28:07 2013 +0100 +++ b/src/share/classes/com/sun/source/doctree/package-info.java Fri Oct 11 19:05:18 2013 +0100 @@ -31,5 +31,5 @@ * @since 1.8 * @see <a href="http://download.oracle.com/javase/6/docs/technotes/tools/solaris/javadoc.html#javadoctags">http://download.oracle.com/javase/6/docs/technotes/tools/solaris/javadoc.html#javadoctags</a> */ -@jdk.Supported +@jdk.Exported package com.sun.source.doctree;
--- a/src/share/classes/com/sun/source/tree/AnnotatedTypeTree.java Thu Oct 03 19:28:07 2013 +0100 +++ b/src/share/classes/com/sun/source/tree/AnnotatedTypeTree.java Fri Oct 11 19:05:18 2013 +0100 @@ -41,7 +41,7 @@ * @author Mahmood Ali * @since 1.8 */ -@jdk.Supported +@jdk.Exported public interface AnnotatedTypeTree extends ExpressionTree { List<? extends AnnotationTree> getAnnotations(); ExpressionTree getUnderlyingType();
--- a/src/share/classes/com/sun/source/tree/AnnotationTree.java Thu Oct 03 19:28:07 2013 +0100 +++ b/src/share/classes/com/sun/source/tree/AnnotationTree.java Fri Oct 11 19:05:18 2013 +0100 @@ -42,7 +42,7 @@ * @author Jonathan Gibbons * @since 1.6 */ -@jdk.Supported +@jdk.Exported public interface AnnotationTree extends ExpressionTree { Tree getAnnotationType(); List<? extends ExpressionTree> getArguments();
--- a/src/share/classes/com/sun/source/tree/ArrayAccessTree.java Thu Oct 03 19:28:07 2013 +0100 +++ b/src/share/classes/com/sun/source/tree/ArrayAccessTree.java Fri Oct 11 19:05:18 2013 +0100 @@ -39,7 +39,7 @@ * @author Jonathan Gibbons * @since 1.6 */ -@jdk.Supported +@jdk.Exported public interface ArrayAccessTree extends ExpressionTree { ExpressionTree getExpression(); ExpressionTree getIndex();
--- a/src/share/classes/com/sun/source/tree/ArrayTypeTree.java Thu Oct 03 19:28:07 2013 +0100 +++ b/src/share/classes/com/sun/source/tree/ArrayTypeTree.java Fri Oct 11 19:05:18 2013 +0100 @@ -39,7 +39,7 @@ * @author Jonathan Gibbons * @since 1.6 */ -@jdk.Supported +@jdk.Exported public interface ArrayTypeTree extends Tree { Tree getType(); }
--- a/src/share/classes/com/sun/source/tree/AssertTree.java Thu Oct 03 19:28:07 2013 +0100 +++ b/src/share/classes/com/sun/source/tree/AssertTree.java Fri Oct 11 19:05:18 2013 +0100 @@ -41,7 +41,7 @@ * @author Jonathan Gibbons * @since 1.6 */ -@jdk.Supported +@jdk.Exported public interface AssertTree extends StatementTree { ExpressionTree getCondition(); ExpressionTree getDetail();
--- a/src/share/classes/com/sun/source/tree/AssignmentTree.java Thu Oct 03 19:28:07 2013 +0100 +++ b/src/share/classes/com/sun/source/tree/AssignmentTree.java Fri Oct 11 19:05:18 2013 +0100 @@ -39,7 +39,7 @@ * @author Jonathan Gibbons * @since 1.6 */ -@jdk.Supported +@jdk.Exported public interface AssignmentTree extends ExpressionTree { ExpressionTree getVariable(); ExpressionTree getExpression();
--- a/src/share/classes/com/sun/source/tree/BinaryTree.java Thu Oct 03 19:28:07 2013 +0100 +++ b/src/share/classes/com/sun/source/tree/BinaryTree.java Fri Oct 11 19:05:18 2013 +0100 @@ -40,7 +40,7 @@ * @author Jonathan Gibbons * @since 1.6 */ -@jdk.Supported +@jdk.Exported public interface BinaryTree extends ExpressionTree { ExpressionTree getLeftOperand(); ExpressionTree getRightOperand();
--- a/src/share/classes/com/sun/source/tree/BlockTree.java Thu Oct 03 19:28:07 2013 +0100 +++ b/src/share/classes/com/sun/source/tree/BlockTree.java Fri Oct 11 19:05:18 2013 +0100 @@ -45,7 +45,7 @@ * @author Jonathan Gibbons * @since 1.6 */ -@jdk.Supported +@jdk.Exported public interface BlockTree extends StatementTree { boolean isStatic(); List<? extends StatementTree> getStatements();
--- a/src/share/classes/com/sun/source/tree/BreakTree.java Thu Oct 03 19:28:07 2013 +0100 +++ b/src/share/classes/com/sun/source/tree/BreakTree.java Fri Oct 11 19:05:18 2013 +0100 @@ -43,7 +43,7 @@ * @author Jonathan Gibbons * @since 1.6 */ -@jdk.Supported +@jdk.Exported public interface BreakTree extends StatementTree { Name getLabel(); }
--- a/src/share/classes/com/sun/source/tree/CaseTree.java Thu Oct 03 19:28:07 2013 +0100 +++ b/src/share/classes/com/sun/source/tree/CaseTree.java Fri Oct 11 19:05:18 2013 +0100 @@ -45,7 +45,7 @@ * @author Jonathan Gibbons * @since 1.6 */ -@jdk.Supported +@jdk.Exported public interface CaseTree extends Tree { /** * @return null if and only if this Case is {@code default:}
--- a/src/share/classes/com/sun/source/tree/CatchTree.java Thu Oct 03 19:28:07 2013 +0100 +++ b/src/share/classes/com/sun/source/tree/CatchTree.java Fri Oct 11 19:05:18 2013 +0100 @@ -40,7 +40,7 @@ * @author Jonathan Gibbons * @since 1.6 */ -@jdk.Supported +@jdk.Exported public interface CatchTree extends Tree { VariableTree getParameter(); BlockTree getBlock();
--- a/src/share/classes/com/sun/source/tree/ClassTree.java Thu Oct 03 19:28:07 2013 +0100 +++ b/src/share/classes/com/sun/source/tree/ClassTree.java Fri Oct 11 19:05:18 2013 +0100 @@ -48,7 +48,7 @@ * @author Jonathan Gibbons * @since 1.6 */ -@jdk.Supported +@jdk.Exported public interface ClassTree extends StatementTree { ModifiersTree getModifiers(); Name getSimpleName();
--- a/src/share/classes/com/sun/source/tree/CompilationUnitTree.java Thu Oct 03 19:28:07 2013 +0100 +++ b/src/share/classes/com/sun/source/tree/CompilationUnitTree.java Fri Oct 11 19:05:18 2013 +0100 @@ -37,7 +37,7 @@ * @author Peter von der Ahé * @since 1.6 */ -@jdk.Supported +@jdk.Exported public interface CompilationUnitTree extends Tree { List<? extends AnnotationTree> getPackageAnnotations(); ExpressionTree getPackageName();
--- a/src/share/classes/com/sun/source/tree/CompoundAssignmentTree.java Thu Oct 03 19:28:07 2013 +0100 +++ b/src/share/classes/com/sun/source/tree/CompoundAssignmentTree.java Fri Oct 11 19:05:18 2013 +0100 @@ -40,7 +40,7 @@ * @author Jonathan Gibbons * @since 1.6 */ -@jdk.Supported +@jdk.Exported public interface CompoundAssignmentTree extends ExpressionTree { ExpressionTree getVariable(); ExpressionTree getExpression();
--- a/src/share/classes/com/sun/source/tree/ConditionalExpressionTree.java Thu Oct 03 19:28:07 2013 +0100 +++ b/src/share/classes/com/sun/source/tree/ConditionalExpressionTree.java Fri Oct 11 19:05:18 2013 +0100 @@ -39,7 +39,7 @@ * @author Jonathan Gibbons * @since 1.6 */ -@jdk.Supported +@jdk.Exported public interface ConditionalExpressionTree extends ExpressionTree { ExpressionTree getCondition(); ExpressionTree getTrueExpression();
--- a/src/share/classes/com/sun/source/tree/ContinueTree.java Thu Oct 03 19:28:07 2013 +0100 +++ b/src/share/classes/com/sun/source/tree/ContinueTree.java Fri Oct 11 19:05:18 2013 +0100 @@ -42,7 +42,7 @@ * @author Jonathan Gibbons * @since 1.6 */ -@jdk.Supported +@jdk.Exported public interface ContinueTree extends StatementTree { Name getLabel(); }
--- a/src/share/classes/com/sun/source/tree/DoWhileLoopTree.java Thu Oct 03 19:28:07 2013 +0100 +++ b/src/share/classes/com/sun/source/tree/DoWhileLoopTree.java Fri Oct 11 19:05:18 2013 +0100 @@ -41,7 +41,7 @@ * @author Jonathan Gibbons * @since 1.6 */ -@jdk.Supported +@jdk.Exported public interface DoWhileLoopTree extends StatementTree { ExpressionTree getCondition(); StatementTree getStatement();
--- a/src/share/classes/com/sun/source/tree/EmptyStatementTree.java Thu Oct 03 19:28:07 2013 +0100 +++ b/src/share/classes/com/sun/source/tree/EmptyStatementTree.java Fri Oct 11 19:05:18 2013 +0100 @@ -39,5 +39,5 @@ * @author Jonathan Gibbons * @since 1.6 */ -@jdk.Supported +@jdk.Exported public interface EmptyStatementTree extends StatementTree {}
--- a/src/share/classes/com/sun/source/tree/EnhancedForLoopTree.java Thu Oct 03 19:28:07 2013 +0100 +++ b/src/share/classes/com/sun/source/tree/EnhancedForLoopTree.java Fri Oct 11 19:05:18 2013 +0100 @@ -40,7 +40,7 @@ * @author Jonathan Gibbons * @since 1.6 */ -@jdk.Supported +@jdk.Exported public interface EnhancedForLoopTree extends StatementTree { VariableTree getVariable(); ExpressionTree getExpression();
--- a/src/share/classes/com/sun/source/tree/ErroneousTree.java Thu Oct 03 19:28:07 2013 +0100 +++ b/src/share/classes/com/sun/source/tree/ErroneousTree.java Fri Oct 11 19:05:18 2013 +0100 @@ -34,7 +34,7 @@ * @author Jonathan Gibbons * @since 1.6 */ -@jdk.Supported +@jdk.Exported public interface ErroneousTree extends ExpressionTree { List<? extends Tree> getErrorTrees(); }
--- a/src/share/classes/com/sun/source/tree/ExpressionStatementTree.java Thu Oct 03 19:28:07 2013 +0100 +++ b/src/share/classes/com/sun/source/tree/ExpressionStatementTree.java Fri Oct 11 19:05:18 2013 +0100 @@ -39,7 +39,7 @@ * @author Jonathan Gibbons * @since 1.6 */ -@jdk.Supported +@jdk.Exported public interface ExpressionStatementTree extends StatementTree { ExpressionTree getExpression(); }
--- a/src/share/classes/com/sun/source/tree/ExpressionTree.java Thu Oct 03 19:28:07 2013 +0100 +++ b/src/share/classes/com/sun/source/tree/ExpressionTree.java Fri Oct 11 19:05:18 2013 +0100 @@ -35,5 +35,5 @@ * @author Jonathan Gibbons * @since 1.6 */ -@jdk.Supported +@jdk.Exported public interface ExpressionTree extends Tree {}
--- a/src/share/classes/com/sun/source/tree/ForLoopTree.java Thu Oct 03 19:28:07 2013 +0100 +++ b/src/share/classes/com/sun/source/tree/ForLoopTree.java Fri Oct 11 19:05:18 2013 +0100 @@ -42,7 +42,7 @@ * @author Jonathan Gibbons * @since 1.6 */ -@jdk.Supported +@jdk.Exported public interface ForLoopTree extends StatementTree { List<? extends StatementTree> getInitializer(); ExpressionTree getCondition();
--- a/src/share/classes/com/sun/source/tree/IdentifierTree.java Thu Oct 03 19:28:07 2013 +0100 +++ b/src/share/classes/com/sun/source/tree/IdentifierTree.java Fri Oct 11 19:05:18 2013 +0100 @@ -41,7 +41,7 @@ * @author Jonathan Gibbons * @since 1.6 */ -@jdk.Supported +@jdk.Exported public interface IdentifierTree extends ExpressionTree { Name getName(); }
--- a/src/share/classes/com/sun/source/tree/IfTree.java Thu Oct 03 19:28:07 2013 +0100 +++ b/src/share/classes/com/sun/source/tree/IfTree.java Fri Oct 11 19:05:18 2013 +0100 @@ -45,7 +45,7 @@ * @author Jonathan Gibbons * @since 1.6 */ -@jdk.Supported +@jdk.Exported public interface IfTree extends StatementTree { ExpressionTree getCondition(); StatementTree getThenStatement();
--- a/src/share/classes/com/sun/source/tree/ImportTree.java Thu Oct 03 19:28:07 2013 +0100 +++ b/src/share/classes/com/sun/source/tree/ImportTree.java Fri Oct 11 19:05:18 2013 +0100 @@ -41,7 +41,7 @@ * @author Jonathan Gibbons * @since 1.6 */ -@jdk.Supported +@jdk.Exported public interface ImportTree extends Tree { boolean isStatic(); /**
--- a/src/share/classes/com/sun/source/tree/InstanceOfTree.java Thu Oct 03 19:28:07 2013 +0100 +++ b/src/share/classes/com/sun/source/tree/InstanceOfTree.java Fri Oct 11 19:05:18 2013 +0100 @@ -39,7 +39,7 @@ * @author Jonathan Gibbons * @since 1.6 */ -@jdk.Supported +@jdk.Exported public interface InstanceOfTree extends ExpressionTree { ExpressionTree getExpression(); Tree getType();
--- a/src/share/classes/com/sun/source/tree/IntersectionTypeTree.java Thu Oct 03 19:28:07 2013 +0100 +++ b/src/share/classes/com/sun/source/tree/IntersectionTypeTree.java Fri Oct 11 19:05:18 2013 +0100 @@ -34,7 +34,7 @@ * * @since 1.8 */ -@jdk.Supported +@jdk.Exported public interface IntersectionTypeTree extends Tree { List<? extends Tree> getBounds(); }
--- a/src/share/classes/com/sun/source/tree/LabeledStatementTree.java Thu Oct 03 19:28:07 2013 +0100 +++ b/src/share/classes/com/sun/source/tree/LabeledStatementTree.java Fri Oct 11 19:05:18 2013 +0100 @@ -41,7 +41,7 @@ * @author Jonathan Gibbons * @since 1.6 */ -@jdk.Supported +@jdk.Exported public interface LabeledStatementTree extends StatementTree { Name getLabel(); StatementTree getStatement();
--- a/src/share/classes/com/sun/source/tree/LambdaExpressionTree.java Thu Oct 03 19:28:07 2013 +0100 +++ b/src/share/classes/com/sun/source/tree/LambdaExpressionTree.java Fri Oct 11 19:05:18 2013 +0100 @@ -37,14 +37,14 @@ * (x,y)-> { return x + y; } * }</pre> */ -@jdk.Supported +@jdk.Exported public interface LambdaExpressionTree extends ExpressionTree { /** * Lambda expressions come in two forms: (i) expression lambdas, whose body * is an expression, and (ii) statement lambdas, whose body is a block */ - @jdk.Supported + @jdk.Exported public enum BodyKind { /** enum constant for expression lambdas */ EXPRESSION,
--- a/src/share/classes/com/sun/source/tree/LineMap.java Thu Oct 03 19:28:07 2013 +0100 +++ b/src/share/classes/com/sun/source/tree/LineMap.java Fri Oct 11 19:05:18 2013 +0100 @@ -31,7 +31,7 @@ * * @since 1.6 */ -@jdk.Supported +@jdk.Exported public interface LineMap { /** * Find the start position of a line.
--- a/src/share/classes/com/sun/source/tree/LiteralTree.java Thu Oct 03 19:28:07 2013 +0100 +++ b/src/share/classes/com/sun/source/tree/LiteralTree.java Fri Oct 11 19:05:18 2013 +0100 @@ -40,7 +40,7 @@ * @author Jonathan Gibbons * @since 1.6 */ -@jdk.Supported +@jdk.Exported public interface LiteralTree extends ExpressionTree { Object getValue(); }
--- a/src/share/classes/com/sun/source/tree/MemberReferenceTree.java Thu Oct 03 19:28:07 2013 +0100 +++ b/src/share/classes/com/sun/source/tree/MemberReferenceTree.java Fri Oct 11 19:05:18 2013 +0100 @@ -39,14 +39,14 @@ * * @since 1.8 */ -@jdk.Supported +@jdk.Exported public interface MemberReferenceTree extends ExpressionTree { /** * There are two kinds of member references: (i) method references and * (ii) constructor references */ - @jdk.Supported + @jdk.Exported public enum ReferenceMode { /** enum constant for method references */ INVOKE,
--- a/src/share/classes/com/sun/source/tree/MemberSelectTree.java Thu Oct 03 19:28:07 2013 +0100 +++ b/src/share/classes/com/sun/source/tree/MemberSelectTree.java Fri Oct 11 19:05:18 2013 +0100 @@ -41,7 +41,7 @@ * @author Jonathan Gibbons * @since 1.6 */ -@jdk.Supported +@jdk.Exported public interface MemberSelectTree extends ExpressionTree { ExpressionTree getExpression(); Name getIdentifier();
--- a/src/share/classes/com/sun/source/tree/MethodInvocationTree.java Thu Oct 03 19:28:07 2013 +0100 +++ b/src/share/classes/com/sun/source/tree/MethodInvocationTree.java Fri Oct 11 19:05:18 2013 +0100 @@ -43,7 +43,7 @@ * @author Jonathan Gibbons * @since 1.6 */ -@jdk.Supported +@jdk.Exported public interface MethodInvocationTree extends ExpressionTree { List<? extends Tree> getTypeArguments(); ExpressionTree getMethodSelect();
--- a/src/share/classes/com/sun/source/tree/MethodTree.java Thu Oct 03 19:28:07 2013 +0100 +++ b/src/share/classes/com/sun/source/tree/MethodTree.java Fri Oct 11 19:05:18 2013 +0100 @@ -46,7 +46,7 @@ * @author Jonathan Gibbons * @since 1.6 */ -@jdk.Supported +@jdk.Exported public interface MethodTree extends Tree { ModifiersTree getModifiers(); Name getName();
--- a/src/share/classes/com/sun/source/tree/ModifiersTree.java Thu Oct 03 19:28:07 2013 +0100 +++ b/src/share/classes/com/sun/source/tree/ModifiersTree.java Fri Oct 11 19:05:18 2013 +0100 @@ -45,7 +45,7 @@ * @author Jonathan Gibbons * @since 1.6 */ -@jdk.Supported +@jdk.Exported public interface ModifiersTree extends Tree { Set<Modifier> getFlags(); List<? extends AnnotationTree> getAnnotations();
--- a/src/share/classes/com/sun/source/tree/NewArrayTree.java Thu Oct 03 19:28:07 2013 +0100 +++ b/src/share/classes/com/sun/source/tree/NewArrayTree.java Fri Oct 11 19:05:18 2013 +0100 @@ -43,7 +43,7 @@ * @author Jonathan Gibbons * @since 1.6 */ -@jdk.Supported +@jdk.Exported public interface NewArrayTree extends ExpressionTree { Tree getType(); List<? extends ExpressionTree> getDimensions();
--- a/src/share/classes/com/sun/source/tree/NewClassTree.java Thu Oct 03 19:28:07 2013 +0100 +++ b/src/share/classes/com/sun/source/tree/NewClassTree.java Fri Oct 11 19:05:18 2013 +0100 @@ -48,7 +48,7 @@ * @author Jonathan Gibbons * @since 1.6 */ -@jdk.Supported +@jdk.Exported public interface NewClassTree extends ExpressionTree { ExpressionTree getEnclosingExpression(); List<? extends Tree> getTypeArguments();
--- a/src/share/classes/com/sun/source/tree/ParameterizedTypeTree.java Thu Oct 03 19:28:07 2013 +0100 +++ b/src/share/classes/com/sun/source/tree/ParameterizedTypeTree.java Fri Oct 11 19:05:18 2013 +0100 @@ -41,7 +41,7 @@ * @author Jonathan Gibbons * @since 1.6 */ -@jdk.Supported +@jdk.Exported public interface ParameterizedTypeTree extends Tree { Tree getType(); List<? extends Tree> getTypeArguments();
--- a/src/share/classes/com/sun/source/tree/ParenthesizedTree.java Thu Oct 03 19:28:07 2013 +0100 +++ b/src/share/classes/com/sun/source/tree/ParenthesizedTree.java Fri Oct 11 19:05:18 2013 +0100 @@ -40,7 +40,7 @@ * @author Jonathan Gibbons * @since 1.6 */ -@jdk.Supported +@jdk.Exported public interface ParenthesizedTree extends ExpressionTree { ExpressionTree getExpression(); }
--- a/src/share/classes/com/sun/source/tree/PrimitiveTypeTree.java Thu Oct 03 19:28:07 2013 +0100 +++ b/src/share/classes/com/sun/source/tree/PrimitiveTypeTree.java Fri Oct 11 19:05:18 2013 +0100 @@ -41,7 +41,7 @@ * @author Jonathan Gibbons * @since 1.6 */ -@jdk.Supported +@jdk.Exported public interface PrimitiveTypeTree extends Tree { TypeKind getPrimitiveTypeKind(); }
--- a/src/share/classes/com/sun/source/tree/ReturnTree.java Thu Oct 03 19:28:07 2013 +0100 +++ b/src/share/classes/com/sun/source/tree/ReturnTree.java Fri Oct 11 19:05:18 2013 +0100 @@ -40,7 +40,7 @@ * @author Jonathan Gibbons * @since 1.6 */ -@jdk.Supported +@jdk.Exported public interface ReturnTree extends StatementTree { ExpressionTree getExpression(); }
--- a/src/share/classes/com/sun/source/tree/Scope.java Thu Oct 03 19:28:07 2013 +0100 +++ b/src/share/classes/com/sun/source/tree/Scope.java Fri Oct 11 19:05:18 2013 +0100 @@ -48,7 +48,7 @@ * * @since 1.6 */ -@jdk.Supported +@jdk.Exported public interface Scope { /** * Returns the enclosing scope.
--- a/src/share/classes/com/sun/source/tree/StatementTree.java Thu Oct 03 19:28:07 2013 +0100 +++ b/src/share/classes/com/sun/source/tree/StatementTree.java Fri Oct 11 19:05:18 2013 +0100 @@ -35,5 +35,5 @@ * @author Jonathan Gibbons * @since 1.6 */ -@jdk.Supported +@jdk.Exported public interface StatementTree extends Tree {}
--- a/src/share/classes/com/sun/source/tree/SwitchTree.java Thu Oct 03 19:28:07 2013 +0100 +++ b/src/share/classes/com/sun/source/tree/SwitchTree.java Fri Oct 11 19:05:18 2013 +0100 @@ -43,7 +43,7 @@ * @author Jonathan Gibbons * @since 1.6 */ -@jdk.Supported +@jdk.Exported public interface SwitchTree extends StatementTree { ExpressionTree getExpression(); List<? extends CaseTree> getCases();
--- a/src/share/classes/com/sun/source/tree/SynchronizedTree.java Thu Oct 03 19:28:07 2013 +0100 +++ b/src/share/classes/com/sun/source/tree/SynchronizedTree.java Fri Oct 11 19:05:18 2013 +0100 @@ -40,7 +40,7 @@ * @author Jonathan Gibbons * @since 1.6 */ -@jdk.Supported +@jdk.Exported public interface SynchronizedTree extends StatementTree { ExpressionTree getExpression(); BlockTree getBlock();
--- a/src/share/classes/com/sun/source/tree/ThrowTree.java Thu Oct 03 19:28:07 2013 +0100 +++ b/src/share/classes/com/sun/source/tree/ThrowTree.java Fri Oct 11 19:05:18 2013 +0100 @@ -39,7 +39,7 @@ * @author Jonathan Gibbons * @since 1.6 */ -@jdk.Supported +@jdk.Exported public interface ThrowTree extends StatementTree { ExpressionTree getExpression(); }
--- a/src/share/classes/com/sun/source/tree/Tree.java Thu Oct 03 19:28:07 2013 +0100 +++ b/src/share/classes/com/sun/source/tree/Tree.java Fri Oct 11 19:05:18 2013 +0100 @@ -39,13 +39,13 @@ * * @since 1.6 */ -@jdk.Supported +@jdk.Exported public interface Tree { /** * Enumerates all kinds of trees. */ - @jdk.Supported + @jdk.Exported public enum Kind { ANNOTATED_TYPE(AnnotatedTypeTree.class),
--- a/src/share/classes/com/sun/source/tree/TreeVisitor.java Thu Oct 03 19:28:07 2013 +0100 +++ b/src/share/classes/com/sun/source/tree/TreeVisitor.java Fri Oct 11 19:05:18 2013 +0100 @@ -56,7 +56,7 @@ * * @since 1.6 */ -@jdk.Supported +@jdk.Exported public interface TreeVisitor<R,P> { R visitAnnotatedType(AnnotatedTypeTree node, P p); R visitAnnotation(AnnotationTree node, P p);
--- a/src/share/classes/com/sun/source/tree/TryTree.java Thu Oct 03 19:28:07 2013 +0100 +++ b/src/share/classes/com/sun/source/tree/TryTree.java Fri Oct 11 19:05:18 2013 +0100 @@ -45,7 +45,7 @@ * @author Jonathan Gibbons * @since 1.6 */ -@jdk.Supported +@jdk.Exported public interface TryTree extends StatementTree { BlockTree getBlock(); List<? extends CatchTree> getCatches();
--- a/src/share/classes/com/sun/source/tree/TypeCastTree.java Thu Oct 03 19:28:07 2013 +0100 +++ b/src/share/classes/com/sun/source/tree/TypeCastTree.java Fri Oct 11 19:05:18 2013 +0100 @@ -39,7 +39,7 @@ * @author Jonathan Gibbons * @since 1.6 */ -@jdk.Supported +@jdk.Exported public interface TypeCastTree extends ExpressionTree { Tree getType(); ExpressionTree getExpression();
--- a/src/share/classes/com/sun/source/tree/TypeParameterTree.java Thu Oct 03 19:28:07 2013 +0100 +++ b/src/share/classes/com/sun/source/tree/TypeParameterTree.java Fri Oct 11 19:05:18 2013 +0100 @@ -46,7 +46,7 @@ * @author Jonathan Gibbons * @since 1.6 */ -@jdk.Supported +@jdk.Exported public interface TypeParameterTree extends Tree { Name getName(); List<? extends Tree> getBounds();
--- a/src/share/classes/com/sun/source/tree/UnaryTree.java Thu Oct 03 19:28:07 2013 +0100 +++ b/src/share/classes/com/sun/source/tree/UnaryTree.java Fri Oct 11 19:05:18 2013 +0100 @@ -42,7 +42,7 @@ * @author Jonathan Gibbons * @since 1.6 */ -@jdk.Supported +@jdk.Exported public interface UnaryTree extends ExpressionTree { ExpressionTree getExpression(); }
--- a/src/share/classes/com/sun/source/tree/UnionTypeTree.java Thu Oct 03 19:28:07 2013 +0100 +++ b/src/share/classes/com/sun/source/tree/UnionTypeTree.java Fri Oct 11 19:05:18 2013 +0100 @@ -34,7 +34,7 @@ * * @since 1.7 */ -@jdk.Supported +@jdk.Exported public interface UnionTypeTree extends Tree { List<? extends Tree> getTypeAlternatives(); }
--- a/src/share/classes/com/sun/source/tree/VariableTree.java Thu Oct 03 19:28:07 2013 +0100 +++ b/src/share/classes/com/sun/source/tree/VariableTree.java Fri Oct 11 19:05:18 2013 +0100 @@ -42,7 +42,7 @@ * @author Jonathan Gibbons * @since 1.6 */ -@jdk.Supported +@jdk.Exported public interface VariableTree extends StatementTree { ModifiersTree getModifiers(); Name getName();
--- a/src/share/classes/com/sun/source/tree/WhileLoopTree.java Thu Oct 03 19:28:07 2013 +0100 +++ b/src/share/classes/com/sun/source/tree/WhileLoopTree.java Fri Oct 11 19:05:18 2013 +0100 @@ -41,7 +41,7 @@ * @author Jonathan Gibbons * @since 1.6 */ -@jdk.Supported +@jdk.Exported public interface WhileLoopTree extends StatementTree { ExpressionTree getCondition(); StatementTree getStatement();
--- a/src/share/classes/com/sun/source/tree/WildcardTree.java Thu Oct 03 19:28:07 2013 +0100 +++ b/src/share/classes/com/sun/source/tree/WildcardTree.java Fri Oct 11 19:05:18 2013 +0100 @@ -44,7 +44,7 @@ * @author Jonathan Gibbons * @since 1.6 */ -@jdk.Supported +@jdk.Exported public interface WildcardTree extends Tree { Tree getBound(); }
--- a/src/share/classes/com/sun/source/tree/package-info.java Thu Oct 03 19:28:07 2013 +0100 +++ b/src/share/classes/com/sun/source/tree/package-info.java Fri Oct 11 19:05:18 2013 +0100 @@ -31,5 +31,5 @@ * @author Jonathan Gibbons * @since 1.6 */ -@jdk.Supported +@jdk.Exported package com.sun.source.tree;
--- a/src/share/classes/com/sun/source/util/DocSourcePositions.java Thu Oct 03 19:28:07 2013 +0100 +++ b/src/share/classes/com/sun/source/util/DocSourcePositions.java Fri Oct 11 19:05:18 2013 +0100 @@ -36,7 +36,7 @@ * * @since 1.8 */ -@jdk.Supported +@jdk.Exported public interface DocSourcePositions extends SourcePositions { /**
--- a/src/share/classes/com/sun/source/util/DocTreePath.java Thu Oct 03 19:28:07 2013 +0100 +++ b/src/share/classes/com/sun/source/util/DocTreePath.java Fri Oct 11 19:05:18 2013 +0100 @@ -35,7 +35,7 @@ * * @since 1.8 */ -@jdk.Supported +@jdk.Exported public class DocTreePath implements Iterable<DocTree> { /** * Gets a documentation tree path for a tree node within a compilation unit.
--- a/src/share/classes/com/sun/source/util/DocTreePathScanner.java Thu Oct 03 19:28:07 2013 +0100 +++ b/src/share/classes/com/sun/source/util/DocTreePathScanner.java Fri Oct 11 19:05:18 2013 +0100 @@ -36,7 +36,7 @@ * * @since 1.8 */ -@jdk.Supported +@jdk.Exported public class DocTreePathScanner<R, P> extends DocTreeScanner<R, P> { /** * Scan a tree from a position identified by a TreePath.
--- a/src/share/classes/com/sun/source/util/DocTreeScanner.java Thu Oct 03 19:28:07 2013 +0100 +++ b/src/share/classes/com/sun/source/util/DocTreeScanner.java Fri Oct 11 19:05:18 2013 +0100 @@ -67,7 +67,7 @@ * * @since 1.8 */ -@jdk.Supported +@jdk.Exported public class DocTreeScanner<R,P> implements DocTreeVisitor<R,P> { /**
--- a/src/share/classes/com/sun/source/util/DocTrees.java Thu Oct 03 19:28:07 2013 +0100 +++ b/src/share/classes/com/sun/source/util/DocTrees.java Fri Oct 11 19:05:18 2013 +0100 @@ -37,7 +37,7 @@ * * @since 1.8 */ -@jdk.Supported +@jdk.Exported public abstract class DocTrees extends Trees { /** * Gets a DocTrees object for a given CompilationTask.
--- a/src/share/classes/com/sun/source/util/JavacTask.java Thu Oct 03 19:28:07 2013 +0100 +++ b/src/share/classes/com/sun/source/util/JavacTask.java Fri Oct 11 19:05:18 2013 +0100 @@ -48,7 +48,7 @@ * @author Jonathan Gibbons * @since 1.6 */ -@jdk.Supported +@jdk.Exported public abstract class JavacTask implements CompilationTask { /**
--- a/src/share/classes/com/sun/source/util/Plugin.java Thu Oct 03 19:28:07 2013 +0100 +++ b/src/share/classes/com/sun/source/util/Plugin.java Fri Oct 11 19:05:18 2013 +0100 @@ -48,7 +48,7 @@ * * @since 1.8 */ -@jdk.Supported +@jdk.Exported public interface Plugin { /** * Get the user-friendly name of this plug-in.
--- a/src/share/classes/com/sun/source/util/SimpleDocTreeVisitor.java Thu Oct 03 19:28:07 2013 +0100 +++ b/src/share/classes/com/sun/source/util/SimpleDocTreeVisitor.java Fri Oct 11 19:05:18 2013 +0100 @@ -32,7 +32,7 @@ * * @since 1.8 */ -@jdk.Supported +@jdk.Exported public class SimpleDocTreeVisitor<R,P> implements DocTreeVisitor<R, P> { protected final R DEFAULT_VALUE;
--- a/src/share/classes/com/sun/source/util/SimpleTreeVisitor.java Thu Oct 03 19:28:07 2013 +0100 +++ b/src/share/classes/com/sun/source/util/SimpleTreeVisitor.java Fri Oct 11 19:05:18 2013 +0100 @@ -33,7 +33,7 @@ * @author Peter von der Ahé * @since 1.6 */ -@jdk.Supported +@jdk.Exported public class SimpleTreeVisitor <R,P> implements TreeVisitor<R,P> { protected final R DEFAULT_VALUE;
--- a/src/share/classes/com/sun/source/util/SourcePositions.java Thu Oct 03 19:28:07 2013 +0100 +++ b/src/share/classes/com/sun/source/util/SourcePositions.java Fri Oct 11 19:05:18 2013 +0100 @@ -35,7 +35,7 @@ * @author Peter von der Ahé * @since 1.6 */ -@jdk.Supported +@jdk.Exported public interface SourcePositions { /**
--- a/src/share/classes/com/sun/source/util/TaskEvent.java Thu Oct 03 19:28:07 2013 +0100 +++ b/src/share/classes/com/sun/source/util/TaskEvent.java Fri Oct 11 19:05:18 2013 +0100 @@ -36,14 +36,14 @@ * @author Jonathan Gibbons * @since 1.6 */ -@jdk.Supported +@jdk.Exported public final class TaskEvent { /** * Kind of task event. * @since 1.6 */ - @jdk.Supported + @jdk.Exported public enum Kind { /** * For events related to the parsing of a file.
--- a/src/share/classes/com/sun/source/util/TaskListener.java Thu Oct 03 19:28:07 2013 +0100 +++ b/src/share/classes/com/sun/source/util/TaskListener.java Fri Oct 11 19:05:18 2013 +0100 @@ -32,7 +32,7 @@ * @author Jonathan Gibbons * @since 1.6 */ -@jdk.Supported +@jdk.Exported public interface TaskListener { public void started(TaskEvent e);
--- a/src/share/classes/com/sun/source/util/TreePath.java Thu Oct 03 19:28:07 2013 +0100 +++ b/src/share/classes/com/sun/source/util/TreePath.java Fri Oct 11 19:05:18 2013 +0100 @@ -36,7 +36,7 @@ * @author Jonathan Gibbons * @since 1.6 */ -@jdk.Supported +@jdk.Exported public class TreePath implements Iterable<Tree> { /** * Gets a tree path for a tree node within a compilation unit.
--- a/src/share/classes/com/sun/source/util/TreePathScanner.java Thu Oct 03 19:28:07 2013 +0100 +++ b/src/share/classes/com/sun/source/util/TreePathScanner.java Fri Oct 11 19:05:18 2013 +0100 @@ -38,7 +38,7 @@ * @author Jonathan Gibbons * @since 1.6 */ -@jdk.Supported +@jdk.Exported public class TreePathScanner<R, P> extends TreeScanner<R, P> { /**
--- a/src/share/classes/com/sun/source/util/TreeScanner.java Thu Oct 03 19:28:07 2013 +0100 +++ b/src/share/classes/com/sun/source/util/TreeScanner.java Fri Oct 11 19:05:18 2013 +0100 @@ -68,7 +68,7 @@ * @author Jonathan Gibbons * @since 1.6 */ -@jdk.Supported +@jdk.Exported public class TreeScanner<R,P> implements TreeVisitor<R,P> { /** Scan a single node.
--- a/src/share/classes/com/sun/source/util/Trees.java Thu Oct 03 19:28:07 2013 +0100 +++ b/src/share/classes/com/sun/source/util/Trees.java Fri Oct 11 19:05:18 2013 +0100 @@ -51,7 +51,7 @@ * * @author Peter von der Ahé */ -@jdk.Supported +@jdk.Exported public abstract class Trees { /** * Gets a Trees object for a given CompilationTask.
--- a/src/share/classes/com/sun/source/util/package-info.java Thu Oct 03 19:28:07 2013 +0100 +++ b/src/share/classes/com/sun/source/util/package-info.java Fri Oct 11 19:05:18 2013 +0100 @@ -30,5 +30,5 @@ * @author Jonathan Gibbons * @since 1.6 */ -@jdk.Supported +@jdk.Exported package com.sun.source.util;
--- a/src/share/classes/com/sun/tools/doclets/formats/html/AbstractExecutableMemberWriter.java Thu Oct 03 19:28:07 2013 +0100 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/AbstractExecutableMemberWriter.java Fri Oct 11 19:05:18 2013 +0100 @@ -305,6 +305,6 @@ buf.append(t.dimension()); } buf.append(")"); - return foundTypeVariable ? buf.toString() : null; + return foundTypeVariable ? writer.getName(buf.toString()) : null; } }
--- a/src/share/classes/com/sun/tools/doclets/formats/html/AbstractIndexWriter.java Thu Oct 03 19:28:07 2013 +0100 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/AbstractIndexWriter.java Fri Oct 11 19:05:18 2013 +0100 @@ -89,10 +89,11 @@ * @param memberlist List of members for the unicode character * @param contentTree the content tree to which the information will be added */ - protected void addContents(Character unicode, List<? extends Doc> memberlist, + protected void addContents(Character uc, List<? extends Doc> memberlist, Content contentTree) { - contentTree.addContent(getMarkerAnchor("_" + unicode + "_")); - Content headContent = new StringContent(unicode.toString()); + String unicode = uc.toString(); + contentTree.addContent(getMarkerAnchorForIndex(unicode)); + Content headContent = new StringContent(unicode); Content heading = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING, false, HtmlStyle.title, headContent); contentTree.addContent(heading); @@ -253,4 +254,24 @@ addPreQualifiedClassLink(LinkInfoImpl.Kind.INDEX, containing, false, contentTree); } + + /** + * Get the marker anchor which will be added to the index documentation tree. + * + * @param anchorNameForIndex the anchor name attribute for index page + * @return a content tree for the marker anchor + */ + public Content getMarkerAnchorForIndex(String anchorNameForIndex) { + return getMarkerAnchor(getNameForIndex(anchorNameForIndex), null); + } + + /** + * Generate a valid HTML name for member index page. + * + * @param unicode the string that needs to be converted to valid HTML name. + * @return a valid HTML name string. + */ + public String getNameForIndex(String unicode) { + return "I:" + getName(unicode); + } }
--- a/src/share/classes/com/sun/tools/doclets/formats/html/AbstractMemberWriter.java Thu Oct 03 19:28:07 2013 +0100 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/AbstractMemberWriter.java Fri Oct 11 19:05:18 2013 +0100 @@ -413,7 +413,7 @@ protected void addDeprecatedAPI(List<Doc> deprmembers, String headingKey, String tableSummary, String[] tableHeader, Content contentTree) { if (deprmembers.size() > 0) { - Content table = HtmlTree.TABLE(0, 3, 0, tableSummary, + Content table = HtmlTree.TABLE(HtmlStyle.deprecatedSummary, 0, 3, 0, tableSummary, writer.getTableCaption(configuration.getResource(headingKey))); table.addContent(writer.getSummaryTableHeader(tableHeader, "col")); Content tbody = new HtmlTree(HtmlTag.TBODY); @@ -453,7 +453,7 @@ List<? extends ProgramElementDoc> members = mems; boolean printedUseTableHeader = false; if (members.size() > 0) { - Content table = HtmlTree.TABLE(0, 3, 0, tableSummary, + Content table = HtmlTree.TABLE(HtmlStyle.useSummary, 0, 3, 0, tableSummary, writer.getTableCaption(heading)); Content tbody = new HtmlTree(HtmlTag.TBODY); Iterator<? extends ProgramElementDoc> it = members.iterator();
--- a/src/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeFieldWriterImpl.java Thu Oct 03 19:28:07 2013 +0100 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeFieldWriterImpl.java Fri Oct 11 19:05:18 2013 +0100 @@ -88,7 +88,7 @@ Content memberDetailsTree) { if (!writer.printedAnnotationFieldHeading) { memberDetailsTree.addContent(writer.getMarkerAnchor( - "annotation_type_field_detail")); + SectionName.ANNOTATION_TYPE_FIELD_DETAIL)); Content heading = HtmlTree.HEADING(HtmlConstants.DETAILS_HEADING, writer.fieldDetailsLabel); memberDetailsTree.addContent(heading); @@ -217,7 +217,7 @@ */ public void addSummaryAnchor(ClassDoc cd, Content memberTree) { memberTree.addContent(writer.getMarkerAnchor( - "annotation_type_field_summary")); + SectionName.ANNOTATION_TYPE_FIELD_SUMMARY)); } /** @@ -272,7 +272,8 @@ */ protected Content getNavSummaryLink(ClassDoc cd, boolean link) { if (link) { - return writer.getHyperLink("annotation_type_field_summary", + return writer.getHyperLink( + SectionName.ANNOTATION_TYPE_FIELD_SUMMARY, writer.getResource("doclet.navField")); } else { return writer.getResource("doclet.navField"); @@ -284,7 +285,8 @@ */ protected void addNavDetailLink(boolean link, Content liNav) { if (link) { - liNav.addContent(writer.getHyperLink("annotation_type_field_detail", + liNav.addContent(writer.getHyperLink( + SectionName.ANNOTATION_TYPE_FIELD_DETAIL, writer.getResource("doclet.navField"))); } else { liNav.addContent(writer.getResource("doclet.navField"));
--- a/src/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeOptionalMemberWriterImpl.java Thu Oct 03 19:28:07 2013 +0100 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeOptionalMemberWriterImpl.java Fri Oct 11 19:05:18 2013 +0100 @@ -133,7 +133,7 @@ */ public void addSummaryAnchor(ClassDoc cd, Content memberTree) { memberTree.addContent(writer.getMarkerAnchor( - "annotation_type_optional_element_summary")); + SectionName.ANNOTATION_TYPE_OPTIONAL_ELEMENT_SUMMARY)); } /** @@ -141,7 +141,8 @@ */ protected Content getNavSummaryLink(ClassDoc cd, boolean link) { if (link) { - return writer.getHyperLink("annotation_type_optional_element_summary", + return writer.getHyperLink( + SectionName.ANNOTATION_TYPE_OPTIONAL_ELEMENT_SUMMARY, writer.getResource("doclet.navAnnotationTypeOptionalMember")); } else { return writer.getResource("doclet.navAnnotationTypeOptionalMember");
--- a/src/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeRequiredMemberWriterImpl.java Thu Oct 03 19:28:07 2013 +0100 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeRequiredMemberWriterImpl.java Fri Oct 11 19:05:18 2013 +0100 @@ -89,7 +89,7 @@ Content memberDetailsTree) { if (!writer.printedAnnotationHeading) { memberDetailsTree.addContent(writer.getMarkerAnchor( - "annotation_type_element_detail")); + SectionName.ANNOTATION_TYPE_ELEMENT_DETAIL)); Content heading = HtmlTree.HEADING(HtmlConstants.DETAILS_HEADING, writer.annotationTypeDetailsLabel); memberDetailsTree.addContent(heading); @@ -219,7 +219,7 @@ */ public void addSummaryAnchor(ClassDoc cd, Content memberTree) { memberTree.addContent(writer.getMarkerAnchor( - "annotation_type_required_element_summary")); + SectionName.ANNOTATION_TYPE_REQUIRED_ELEMENT_SUMMARY)); } /** @@ -274,7 +274,8 @@ */ protected Content getNavSummaryLink(ClassDoc cd, boolean link) { if (link) { - return writer.getHyperLink("annotation_type_required_element_summary", + return writer.getHyperLink( + SectionName.ANNOTATION_TYPE_REQUIRED_ELEMENT_SUMMARY, writer.getResource("doclet.navAnnotationTypeRequiredMember")); } else { return writer.getResource("doclet.navAnnotationTypeRequiredMember"); @@ -286,7 +287,8 @@ */ protected void addNavDetailLink(boolean link, Content liNav) { if (link) { - liNav.addContent(writer.getHyperLink("annotation_type_element_detail", + liNav.addContent(writer.getHyperLink( + SectionName.ANNOTATION_TYPE_ELEMENT_DETAIL, writer.getResource("doclet.navAnnotationTypeMember"))); } else { liNav.addContent(writer.getResource("doclet.navAnnotationTypeMember"));
--- a/src/share/classes/com/sun/tools/doclets/formats/html/ClassUseWriter.java Thu Oct 03 19:28:07 2013 +0100 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/ClassUseWriter.java Fri Oct 11 19:05:18 2013 +0100 @@ -263,7 +263,7 @@ * @param contentTree the content tree to which the packages list will be added */ protected void addPackageList(Content contentTree) throws IOException { - Content table = HtmlTree.TABLE(0, 3, 0, useTableSummary, + Content table = HtmlTree.TABLE(HtmlStyle.useSummary, 0, 3, 0, useTableSummary, getTableCaption(configuration.getResource( "doclet.ClassUse_Packages.that.use.0", getLink(new LinkInfoImpl(configuration, LinkInfoImpl.Kind.CLASS_USE_HEADER, classdoc @@ -298,7 +298,7 @@ pkgToPackageAnnotations.isEmpty()) { return; } - Content table = HtmlTree.TABLE(0, 3, 0, useTableSummary, + Content table = HtmlTree.TABLE(HtmlStyle.useSummary, 0, 3, 0, useTableSummary, getTableCaption(configuration.getResource( "doclet.ClassUse_PackageAnnotation", getLink(new LinkInfoImpl(configuration,
--- a/src/share/classes/com/sun/tools/doclets/formats/html/ConstantsSummaryWriterImpl.java Thu Oct 03 19:28:07 2013 +0100 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/ConstantsSummaryWriterImpl.java Fri Oct 11 19:05:18 2013 +0100 @@ -107,7 +107,8 @@ //add link to summary Content link; if (packageName.length() == 0) { - link = getHyperLink(DocLink.fragment(DocletConstants.UNNAMED_PACKAGE_ANCHOR), + link = getHyperLink(getDocLink( + SectionName.UNNAMED_PACKAGE_ANCHOR), defaultPackageLabel, "", ""); } else { Content packageNameContent = getPackageLabel(parsedPackageName); @@ -153,7 +154,7 @@ Content pkgNameContent; if (parsedPackageName.length() == 0) { summariesTree.addContent(getMarkerAnchor( - DocletConstants.UNNAMED_PACKAGE_ANCHOR)); + SectionName.UNNAMED_PACKAGE_ANCHOR)); pkgNameContent = defaultPackageLabel; } else { summariesTree.addContent(getMarkerAnchor( @@ -207,7 +208,7 @@ * @return the table caption and header */ protected Content getClassName(Content classStr) { - Content table = HtmlTree.TABLE(0, 3, 0, constantsTableSummary, + Content table = HtmlTree.TABLE(HtmlStyle.constantsSummary, 0, 3, 0, constantsTableSummary, getTableCaption(classStr)); table.addContent(getSummaryTableHeader(constantsTableHeader, "col")); return table;
--- a/src/share/classes/com/sun/tools/doclets/formats/html/ConstructorWriterImpl.java Thu Oct 03 19:28:07 2013 +0100 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/ConstructorWriterImpl.java Fri Oct 11 19:05:18 2013 +0100 @@ -97,7 +97,8 @@ Content memberDetailsTree) { memberDetailsTree.addContent(HtmlConstants.START_OF_CONSTRUCTOR_DETAILS); Content constructorDetailsTree = writer.getMemberTreeHeader(); - constructorDetailsTree.addContent(writer.getMarkerAnchor("constructor_detail")); + constructorDetailsTree.addContent(writer.getMarkerAnchor( + SectionName.CONSTRUCTOR_DETAIL)); Content heading = HtmlTree.HEADING(HtmlConstants.DETAILS_HEADING, writer.constructorDetailsLabel); constructorDetailsTree.addContent(heading); @@ -256,7 +257,8 @@ * {@inheritDoc} */ public void addSummaryAnchor(ClassDoc cd, Content memberTree) { - memberTree.addContent(writer.getMarkerAnchor("constructor_summary")); + memberTree.addContent(writer.getMarkerAnchor( + SectionName.CONSTRUCTOR_SUMMARY)); } /** @@ -280,7 +282,7 @@ */ protected Content getNavSummaryLink(ClassDoc cd, boolean link) { if (link) { - return writer.getHyperLink("constructor_summary", + return writer.getHyperLink(SectionName.CONSTRUCTOR_SUMMARY, writer.getResource("doclet.navConstructor")); } else { return writer.getResource("doclet.navConstructor"); @@ -292,7 +294,8 @@ */ protected void addNavDetailLink(boolean link, Content liNav) { if (link) { - liNav.addContent(writer.getHyperLink("constructor_detail", + liNav.addContent(writer.getHyperLink( + SectionName.CONSTRUCTOR_DETAIL, writer.getResource("doclet.navConstructor"))); } else { liNav.addContent(writer.getResource("doclet.navConstructor"));
--- a/src/share/classes/com/sun/tools/doclets/formats/html/DeprecatedListWriter.java Thu Oct 03 19:28:07 2013 +0100 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/DeprecatedListWriter.java Fri Oct 11 19:05:18 2013 +0100 @@ -48,8 +48,8 @@ private static final String[] ANCHORS = new String[] { "package", "interface", "class", "enum", "exception", "error", - "annotation_type", "field", "method", "constructor", "enum_constant", - "annotation_type_member" + "annotation.type", "field", "method", "constructor", "enum.constant", + "annotation.type.member" }; private static final String[] HEADING_KEYS = new String[] {
--- a/src/share/classes/com/sun/tools/doclets/formats/html/EnumConstantWriterImpl.java Thu Oct 03 19:28:07 2013 +0100 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/EnumConstantWriterImpl.java Fri Oct 11 19:05:18 2013 +0100 @@ -73,7 +73,8 @@ Content memberDetailsTree) { memberDetailsTree.addContent(HtmlConstants.START_OF_ENUM_CONSTANT_DETAILS); Content enumConstantsDetailsTree = writer.getMemberTreeHeader(); - enumConstantsDetailsTree.addContent(writer.getMarkerAnchor("enum_constant_detail")); + enumConstantsDetailsTree.addContent(writer.getMarkerAnchor( + SectionName.ENUM_CONSTANT_DETAIL)); Content heading = HtmlTree.HEADING(HtmlConstants.DETAILS_HEADING, writer.enumConstantsDetailsLabel); enumConstantsDetailsTree.addContent(heading); @@ -202,7 +203,8 @@ * {@inheritDoc} */ public void addSummaryAnchor(ClassDoc cd, Content memberTree) { - memberTree.addContent(writer.getMarkerAnchor("enum_constant_summary")); + memberTree.addContent(writer.getMarkerAnchor( + SectionName.ENUM_CONSTANT_SUMMARY)); } /** @@ -263,11 +265,14 @@ */ protected Content getNavSummaryLink(ClassDoc cd, boolean link) { if (link) { - return writer.getHyperLink((cd == null)? - "enum_constant_summary": - "enum_constants_inherited_from_class_" + - configuration.getClassName(cd), - writer.getResource("doclet.navEnum")); + if (cd == null) { + return writer.getHyperLink(SectionName.ENUM_CONSTANT_SUMMARY, + writer.getResource("doclet.navEnum")); + } else { + return writer.getHyperLink( + SectionName.ENUM_CONSTANTS_INHERITANCE, + configuration.getClassName(cd), writer.getResource("doclet.navEnum")); + } } else { return writer.getResource("doclet.navEnum"); } @@ -278,7 +283,8 @@ */ protected void addNavDetailLink(boolean link, Content liNav) { if (link) { - liNav.addContent(writer.getHyperLink("enum_constant_detail", + liNav.addContent(writer.getHyperLink( + SectionName.ENUM_CONSTANT_DETAIL, writer.getResource("doclet.navEnum"))); } else { liNav.addContent(writer.getResource("doclet.navEnum"));
--- a/src/share/classes/com/sun/tools/doclets/formats/html/FieldWriterImpl.java Thu Oct 03 19:28:07 2013 +0100 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/FieldWriterImpl.java Fri Oct 11 19:05:18 2013 +0100 @@ -74,7 +74,8 @@ Content memberDetailsTree) { memberDetailsTree.addContent(HtmlConstants.START_OF_FIELD_DETAILS); Content fieldDetailsTree = writer.getMemberTreeHeader(); - fieldDetailsTree.addContent(writer.getMarkerAnchor("field_detail")); + fieldDetailsTree.addContent(writer.getMarkerAnchor( + SectionName.FIELD_DETAIL)); Content heading = HtmlTree.HEADING(HtmlConstants.DETAILS_HEADING, writer.fieldDetailsLabel); fieldDetailsTree.addContent(heading); @@ -224,7 +225,8 @@ * {@inheritDoc} */ public void addSummaryAnchor(ClassDoc cd, Content memberTree) { - memberTree.addContent(writer.getMarkerAnchor("field_summary")); + memberTree.addContent(writer.getMarkerAnchor( + SectionName.FIELD_SUMMARY)); } /** @@ -232,7 +234,7 @@ */ public void addInheritedSummaryAnchor(ClassDoc cd, Content inheritedTree) { inheritedTree.addContent(writer.getMarkerAnchor( - "fields_inherited_from_class_" + configuration.getClassName(cd))); + SectionName.FIELDS_INHERITANCE, configuration.getClassName(cd))); } /** @@ -293,11 +295,15 @@ */ protected Content getNavSummaryLink(ClassDoc cd, boolean link) { if (link) { - return writer.getHyperLink((cd == null)? - "field_summary": - "fields_inherited_from_class_" + - configuration.getClassName(cd), - writer.getResource("doclet.navField")); + if (cd == null) { + return writer.getHyperLink( + SectionName.FIELD_SUMMARY, + writer.getResource("doclet.navField")); + } else { + return writer.getHyperLink( + SectionName.FIELDS_INHERITANCE, + configuration.getClassName(cd), writer.getResource("doclet.navField")); + } } else { return writer.getResource("doclet.navField"); } @@ -308,7 +314,8 @@ */ protected void addNavDetailLink(boolean link, Content liNav) { if (link) { - liNav.addContent(writer.getHyperLink("field_detail", + liNav.addContent(writer.getHyperLink( + SectionName.FIELD_DETAIL, writer.getResource("doclet.navField"))); } else { liNav.addContent(writer.getResource("doclet.navField"));
--- a/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDoclet.java Thu Oct 03 19:28:07 2013 +0100 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDoclet.java Fri Oct 11 19:05:18 2013 +0100 @@ -194,6 +194,10 @@ .getClassBuilder(curr, prev, next, classtree); classBuilder.build(); } + } catch (IOException e) { + throw new DocletAbortException(e); + } catch (DocletAbortException de) { + throw de; } catch (Exception e) { e.printStackTrace(); throw new DocletAbortException(e);
--- a/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java Thu Oct 03 19:28:07 2013 +0100 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java Fri Oct 11 19:05:18 2013 +0100 @@ -356,7 +356,7 @@ if(classes.length > 0) { Arrays.sort(classes); Content caption = getTableCaption(new RawHtml(label)); - Content table = HtmlTree.TABLE(HtmlStyle.packageSummary, 0, 3, 0, + Content table = HtmlTree.TABLE(HtmlStyle.typeSummary, 0, 3, 0, tableSummary, caption); table.addContent(getSummaryTableHeader(tableHeader, "col")); Content tbody = new HtmlTree(HtmlTag.TBODY); @@ -509,28 +509,28 @@ body.addContent(HtmlConstants.START_OF_TOP_NAVBAR); navDiv.addStyle(HtmlStyle.topNav); allClassesId += "navbar_top"; - Content a = getMarkerAnchor("navbar_top"); + Content a = getMarkerAnchor(SectionName.NAVBAR_TOP); //WCAG - Hyperlinks should contain text or an image with alt text - for AT tools navDiv.addContent(a); Content skipLinkContent = HtmlTree.DIV(HtmlStyle.skipNav, getHyperLink( - DocLink.fragment("skip-navbar_top"), skipNavLinks, + getDocLink(SectionName.SKIP_NAVBAR_TOP), skipNavLinks, skipNavLinks.toString(), "")); navDiv.addContent(skipLinkContent); } else { body.addContent(HtmlConstants.START_OF_BOTTOM_NAVBAR); navDiv.addStyle(HtmlStyle.bottomNav); allClassesId += "navbar_bottom"; - Content a = getMarkerAnchor("navbar_bottom"); + Content a = getMarkerAnchor(SectionName.NAVBAR_BOTTOM); navDiv.addContent(a); Content skipLinkContent = HtmlTree.DIV(HtmlStyle.skipNav, getHyperLink( - DocLink.fragment("skip-navbar_bottom"), skipNavLinks, + getDocLink(SectionName.SKIP_NAVBAR_BOTTOM), skipNavLinks, skipNavLinks.toString(), "")); navDiv.addContent(skipLinkContent); } if (header) { - navDiv.addContent(getMarkerAnchor("navbar_top_firstrow")); + navDiv.addContent(getMarkerAnchor(SectionName.NAVBAR_TOP_FIRSTROW)); } else { - navDiv.addContent(getMarkerAnchor("navbar_bottom_firstrow")); + navDiv.addContent(getMarkerAnchor(SectionName.NAVBAR_BOTTOM_FIRSTROW)); } HtmlTree navList = new HtmlTree(HtmlTag.UL); navList.addStyle(HtmlStyle.navList); @@ -577,11 +577,11 @@ subDiv.addContent(getAllClassesLinkScript(allClassesId.toString())); addSummaryDetailLinks(subDiv); if (header) { - subDiv.addContent(getMarkerAnchor("skip-navbar_top")); + subDiv.addContent(getMarkerAnchor(SectionName.SKIP_NAVBAR_TOP)); body.addContent(subDiv); body.addContent(HtmlConstants.END_OF_TOP_NAVBAR); } else { - subDiv.addContent(getMarkerAnchor("skip-navbar_bottom")); + subDiv.addContent(getMarkerAnchor(SectionName.SKIP_NAVBAR_BOTTOM)); body.addContent(subDiv); body.addContent(HtmlConstants.END_OF_BOTTOM_NAVBAR); } @@ -886,7 +886,28 @@ * @return a content tree for the marker anchor */ public Content getMarkerAnchor(String anchorName) { - return getMarkerAnchor(anchorName, null); + return getMarkerAnchor(getName(anchorName), null); + } + + /** + * Get the marker anchor which will be added to the documentation tree. + * + * @param sectionName the section name anchor attribute for page + * @return a content tree for the marker anchor + */ + public Content getMarkerAnchor(SectionName sectionName) { + return getMarkerAnchor(sectionName.getName(), null); + } + + /** + * Get the marker anchor which will be added to the documentation tree. + * + * @param sectionName the section name anchor attribute for page + * @param anchorName the anchor name combined with section name attribute for the page + * @return a content tree for the marker anchor + */ + public Content getMarkerAnchor(SectionName sectionName, String anchorName) { + return getMarkerAnchor(sectionName.getName() + getName(anchorName), null); } /** @@ -937,7 +958,7 @@ protected void addPackageDeprecatedAPI(List<Doc> deprPkgs, String headingKey, String tableSummary, String[] tableHeader, Content contentTree) { if (deprPkgs.size() > 0) { - Content table = HtmlTree.TABLE(0, 3, 0, tableSummary, + Content table = HtmlTree.TABLE(HtmlStyle.deprecatedSummary, 0, 3, 0, tableSummary, getTableCaption(configuration.getResource(headingKey))); table.addContent(getSummaryTableHeader(tableHeader, "col")); Content tbody = new HtmlTree(HtmlTag.TBODY); @@ -1291,10 +1312,10 @@ } else if (doc instanceof ExecutableMemberDoc) { ExecutableMemberDoc emd = (ExecutableMemberDoc)doc; return getLink(new LinkInfoImpl(configuration, context, classDoc) - .label(label).where(getAnchor(emd, isProperty)).strong(strong)); + .label(label).where(getName(getAnchor(emd, isProperty))).strong(strong)); } else if (doc instanceof MemberDoc) { return getLink(new LinkInfoImpl(configuration, context, classDoc) - .label(label).where(doc.name()).strong(strong)); + .label(label).where(getName(doc.name())).strong(strong)); } else { return label; } @@ -1319,10 +1340,10 @@ } else if (doc instanceof ExecutableMemberDoc) { ExecutableMemberDoc emd = (ExecutableMemberDoc) doc; return getLink(new LinkInfoImpl(configuration, context, classDoc) - .label(label).where(getAnchor(emd))); + .label(label).where(getName(getAnchor(emd)))); } else if (doc instanceof MemberDoc) { return getLink(new LinkInfoImpl(configuration, context, classDoc) - .label(label).where(doc.name())); + .label(label).where(getName(doc.name()))); } else { return label; }
--- a/src/share/classes/com/sun/tools/doclets/formats/html/HtmlSerialFieldWriter.java Thu Oct 03 19:28:07 2013 +0100 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/HtmlSerialFieldWriter.java Fri Oct 11 19:05:18 2013 +0100 @@ -49,8 +49,6 @@ implements SerializedFormWriter.SerialFieldWriter { ProgramElementDoc[] members = null; - private boolean printedOverallAnchor = false; - public HtmlSerialFieldWriter(SubWriterHolderWriter writer, ClassDoc classdoc) { super(writer, classdoc); @@ -98,10 +96,6 @@ HtmlTree li = new HtmlTree(HtmlTag.LI); li.addStyle(HtmlStyle.blockList); if (serializableFieldsTree.isValid()) { - if (!printedOverallAnchor) { - li.addContent(writer.getMarkerAnchor("serializedForm")); - printedOverallAnchor = true; - } Content headingContent = new StringContent(heading); Content serialHeading = HtmlTree.HEADING(HtmlConstants.SERIALIZED_MEMBER_HEADING, headingContent);
--- a/src/share/classes/com/sun/tools/doclets/formats/html/HtmlSerialMethodWriter.java Thu Oct 03 19:28:07 2013 +0100 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/HtmlSerialMethodWriter.java Fri Oct 11 19:05:18 2013 +0100 @@ -85,12 +85,10 @@ * @return a content tree for the serializable methods content */ public Content getSerializableMethods(String heading, Content serializableMethodContent) { - Content li = HtmlTree.LI(HtmlStyle.blockList, writer.getMarkerAnchor( - "serialized_methods")); Content headingContent = new StringContent(heading); Content serialHeading = HtmlTree.HEADING(HtmlConstants.SERIALIZED_MEMBER_HEADING, headingContent); - li.addContent(serialHeading); + Content li = HtmlTree.LI(HtmlStyle.blockList, serialHeading); li.addContent(serializableMethodContent); return li; } @@ -113,8 +111,6 @@ * @param methodsContentTree the content tree to which the member header will be added */ public void addMemberHeader(MethodDoc member, Content methodsContentTree) { - methodsContentTree.addContent(writer.getMarkerAnchor( - writer.getAnchor(member))); methodsContentTree.addContent(getHead(member)); methodsContentTree.addContent(getSignature(member)); }
--- a/src/share/classes/com/sun/tools/doclets/formats/html/MethodWriterImpl.java Thu Oct 03 19:28:07 2013 +0100 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/MethodWriterImpl.java Fri Oct 11 19:05:18 2013 +0100 @@ -85,7 +85,8 @@ Content memberDetailsTree) { memberDetailsTree.addContent(HtmlConstants.START_OF_METHOD_DETAILS); Content methodDetailsTree = writer.getMemberTreeHeader(); - methodDetailsTree.addContent(writer.getMarkerAnchor("method_detail")); + methodDetailsTree.addContent(writer.getMarkerAnchor( + SectionName.METHOD_DETAIL)); Content heading = HtmlTree.HEADING(HtmlConstants.DETAILS_HEADING, writer.methodDetailsLabel); methodDetailsTree.addContent(heading); @@ -244,7 +245,8 @@ * {@inheritDoc} */ public void addSummaryAnchor(ClassDoc cd, Content memberTree) { - memberTree.addContent(writer.getMarkerAnchor("method_summary")); + memberTree.addContent(writer.getMarkerAnchor( + SectionName.METHOD_SUMMARY)); } /** @@ -252,8 +254,7 @@ */ public void addInheritedSummaryAnchor(ClassDoc cd, Content inheritedTree) { inheritedTree.addContent(writer.getMarkerAnchor( - "methods_inherited_from_class_" + - configuration.getClassName(cd))); + SectionName.METHODS_INHERITANCE, configuration.getClassName(cd))); } /** @@ -318,7 +319,7 @@ Content methlink = writer.getLink( new LinkInfoImpl(writer.configuration, LinkInfoImpl.Kind.MEMBER, overriddenType.asClassDoc()) - .where(writer.getAnchor(method)).label(name)); + .where(writer.getName(writer.getAnchor(method))).label(name)); Content codeMethLink = HtmlTree.CODE(methlink); Content dd = HtmlTree.DD(codeMethLink); dd.addContent(writer.getSpace()); @@ -400,11 +401,15 @@ */ protected Content getNavSummaryLink(ClassDoc cd, boolean link) { if (link) { - return writer.getHyperLink((cd == null)? - "method_summary": - "methods_inherited_from_class_" + - configuration.getClassName(cd), - writer.getResource("doclet.navMethod")); + if (cd == null) { + return writer.getHyperLink( + SectionName.METHOD_SUMMARY, + writer.getResource("doclet.navMethod")); + } else { + return writer.getHyperLink( + SectionName.METHODS_INHERITANCE, + configuration.getClassName(cd), writer.getResource("doclet.navMethod")); + } } else { return writer.getResource("doclet.navMethod"); } @@ -415,8 +420,8 @@ */ protected void addNavDetailLink(boolean link, Content liNav) { if (link) { - liNav.addContent(writer.getHyperLink("method_detail", - writer.getResource("doclet.navMethod"))); + liNav.addContent(writer.getHyperLink( + SectionName.METHOD_DETAIL, writer.getResource("doclet.navMethod"))); } else { liNav.addContent(writer.getResource("doclet.navMethod")); }
--- a/src/share/classes/com/sun/tools/doclets/formats/html/NestedClassWriterImpl.java Thu Oct 03 19:28:07 2013 +0100 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/NestedClassWriterImpl.java Fri Oct 11 19:05:18 2013 +0100 @@ -132,7 +132,8 @@ * {@inheritDoc} */ public void addSummaryAnchor(ClassDoc cd, Content memberTree) { - memberTree.addContent(writer.getMarkerAnchor("nested_class_summary")); + memberTree.addContent(writer.getMarkerAnchor( + SectionName.NESTED_CLASS_SUMMARY)); } /** @@ -140,7 +141,8 @@ */ public void addInheritedSummaryAnchor(ClassDoc cd, Content inheritedTree) { inheritedTree.addContent(writer.getMarkerAnchor( - "nested_classes_inherited_from_class_" + cd.qualifiedName())); + SectionName.NESTED_CLASSES_INHERITANCE, + cd.qualifiedName())); } /** @@ -202,9 +204,15 @@ */ protected Content getNavSummaryLink(ClassDoc cd, boolean link) { if (link) { - return writer.getHyperLink((cd == null) ? "nested_class_summary": - "nested_classes_inherited_from_class_" + cd.qualifiedName(), - writer.getResource("doclet.navNested")); + if (cd == null) { + return writer.getHyperLink( + SectionName.NESTED_CLASS_SUMMARY, + writer.getResource("doclet.navNested")); + } else { + return writer.getHyperLink( + SectionName.NESTED_CLASSES_INHERITANCE, + cd.qualifiedName(), writer.getResource("doclet.navNested")); + } } else { return writer.getResource("doclet.navNested"); }
--- a/src/share/classes/com/sun/tools/doclets/formats/html/PackageIndexWriter.java Thu Oct 03 19:28:07 2013 +0100 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/PackageIndexWriter.java Fri Oct 11 19:05:18 2013 +0100 @@ -203,8 +203,9 @@ Content see = seeLabel; see.addContent(" "); Content descPara = HtmlTree.P(see); - Content descLink = getHyperLink(DocLink.fragment("overview_description"), - descriptionLabel, "", ""); + Content descLink = getHyperLink(getDocLink( + SectionName.OVERVIEW_DESCRIPTION), + descriptionLabel, "", ""); descPara.addContent(descLink); div.addContent(descPara); body.addContent(div); @@ -220,7 +221,8 @@ */ protected void addOverviewComment(Content htmltree) { if (root.inlineTags().length > 0) { - htmltree.addContent(getMarkerAnchor("overview_description")); + htmltree.addContent( + getMarkerAnchor(SectionName.OVERVIEW_DESCRIPTION)); addInlineComment(root, htmltree); } }
--- a/src/share/classes/com/sun/tools/doclets/formats/html/PackageUseWriter.java Thu Oct 03 19:28:07 2013 +0100 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/PackageUseWriter.java Fri Oct 11 19:05:18 2013 +0100 @@ -151,7 +151,7 @@ * @param contentTree the content tree to which the package list will be added */ protected void addPackageList(Content contentTree) throws IOException { - Content table = HtmlTree.TABLE(0, 3, 0, useTableSummary, + Content table = HtmlTree.TABLE(HtmlStyle.useSummary, 0, 3, 0, useTableSummary, getTableCaption(configuration.getResource( "doclet.ClassUse_Packages.that.use.0", getPackageLink(pkgdoc, Util.getPackageName(pkgdoc))))); @@ -196,7 +196,7 @@ } String tableSummary = configuration.getText("doclet.Use_Table_Summary", configuration.getText("doclet.classes")); - Content table = HtmlTree.TABLE(0, 3, 0, tableSummary, + Content table = HtmlTree.TABLE(HtmlStyle.useSummary, 0, 3, 0, tableSummary, getTableCaption(configuration.getResource( "doclet.ClassUse_Classes.in.0.used.by.1", getPackageLink(pkgdoc, Util.getPackageName(pkgdoc)),
--- a/src/share/classes/com/sun/tools/doclets/formats/html/PackageWriterImpl.java Thu Oct 03 19:28:07 2013 +0100 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/PackageWriterImpl.java Fri Oct 11 19:05:18 2013 +0100 @@ -112,7 +112,8 @@ addSummaryComment(packageDoc, docSummaryDiv); div.addContent(docSummaryDiv); Content space = getSpace(); - Content descLink = getHyperLink(DocLink.fragment("package_description"), + Content descLink = getHyperLink(getDocLink( + SectionName.PACKAGE_DESCRIPTION), descriptionLabel, "", ""); Content descPara = new HtmlTree(HtmlTag.P, seeLabel, space, descLink); div.addContent(descPara); @@ -169,7 +170,7 @@ if(classes.length > 0) { Arrays.sort(classes); Content caption = getTableCaption(new RawHtml(label)); - Content table = HtmlTree.TABLE(HtmlStyle.packageSummary, 0, 3, 0, + Content table = HtmlTree.TABLE(HtmlStyle.typeSummary, 0, 3, 0, tableSummary, caption); table.addContent(getSummaryTableHeader(tableHeader, "col")); Content tbody = new HtmlTree(HtmlTag.TBODY); @@ -211,7 +212,8 @@ */ public void addPackageDescription(Content packageContentTree) { if (packageDoc.inlineTags().length > 0) { - packageContentTree.addContent(getMarkerAnchor("package_description")); + packageContentTree.addContent( + getMarkerAnchor(SectionName.PACKAGE_DESCRIPTION)); Content h2Content = new StringContent( configuration.getText("doclet.Package_Description", packageDoc.name()));
--- a/src/share/classes/com/sun/tools/doclets/formats/html/ProfilePackageWriterImpl.java Thu Oct 03 19:28:07 2013 +0100 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/ProfilePackageWriterImpl.java Fri Oct 11 19:05:18 2013 +0100 @@ -129,7 +129,8 @@ addSummaryComment(packageDoc, docSummaryDiv); div.addContent(docSummaryDiv); Content space = getSpace(); - Content descLink = getHyperLink(DocLink.fragment("package_description"), + Content descLink = getHyperLink(getDocLink( + SectionName.PACKAGE_DESCRIPTION), descriptionLabel, "", ""); Content descPara = new HtmlTree(HtmlTag.P, seeLabel, space, descLink); div.addContent(descPara); @@ -192,7 +193,8 @@ */ public void addPackageDescription(Content packageContentTree) { if (packageDoc.inlineTags().length > 0) { - packageContentTree.addContent(getMarkerAnchor("package_description")); + packageContentTree.addContent( + getMarkerAnchor(SectionName.PACKAGE_DESCRIPTION)); Content h2Content = new StringContent( configuration.getText("doclet.Package_Description", packageDoc.name()));
--- a/src/share/classes/com/sun/tools/doclets/formats/html/PropertyWriterImpl.java Thu Oct 03 19:28:07 2013 +0100 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/PropertyWriterImpl.java Fri Oct 11 19:05:18 2013 +0100 @@ -70,7 +70,8 @@ Content memberDetailsTree) { memberDetailsTree.addContent(HtmlConstants.START_OF_PROPERTY_DETAILS); Content propertyDetailsTree = writer.getMemberTreeHeader(); - propertyDetailsTree.addContent(writer.getMarkerAnchor("property_detail")); + propertyDetailsTree.addContent(writer.getMarkerAnchor( + SectionName.PROPERTY_DETAIL)); Content heading = HtmlTree.HEADING(HtmlConstants.DETAILS_HEADING, writer.propertyDetailsLabel); propertyDetailsTree.addContent(heading); @@ -220,7 +221,8 @@ * {@inheritDoc} */ public void addSummaryAnchor(ClassDoc cd, Content memberTree) { - memberTree.addContent(writer.getMarkerAnchor("property_summary")); + memberTree.addContent(writer.getMarkerAnchor( + SectionName.PROPERTY_SUMMARY)); } /** @@ -228,7 +230,8 @@ */ public void addInheritedSummaryAnchor(ClassDoc cd, Content inheritedTree) { inheritedTree.addContent(writer.getMarkerAnchor( - "properties_inherited_from_class_" + configuration.getClassName(cd))); + SectionName.PROPERTIES_INHERITANCE, + configuration.getClassName(cd))); } /** @@ -297,11 +300,15 @@ */ protected Content getNavSummaryLink(ClassDoc cd, boolean link) { if (link) { - return writer.getHyperLink((cd == null)? - "property_summary": - "properties_inherited_from_class_" + - configuration.getClassName(cd), + if (cd == null) { + return writer.getHyperLink( + SectionName.PROPERTY_SUMMARY, writer.getResource("doclet.navProperty")); + } else { + return writer.getHyperLink( + SectionName.PROPERTIES_INHERITANCE, + configuration.getClassName(cd), writer.getResource("doclet.navProperty")); + } } else { return writer.getResource("doclet.navProperty"); } @@ -312,7 +319,8 @@ */ protected void addNavDetailLink(boolean link, Content liNav) { if (link) { - liNav.addContent(writer.getHyperLink("property_detail", + liNav.addContent(writer.getHyperLink( + SectionName.PROPERTY_DETAIL, writer.getResource("doclet.navProperty"))); } else { liNav.addContent(writer.getResource("doclet.navProperty"));
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/SectionName.java Fri Oct 11 19:05:18 2013 +0100 @@ -0,0 +1,80 @@ +/* + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package com.sun.tools.doclets.formats.html; + +/** + * Enum representing various section names of generated API documentation. + * + * <p><b>This is NOT part of any supported API. + * If you write code that depends on this, you do so at your own risk. + * This code and its internal interfaces are subject to change or + * deletion without notice.</b> + * + * @author Bhavesh Patel + */ +public enum SectionName { + + ANNOTATION_TYPE_ELEMENT_DETAIL("annotation.type.element.detail"), + ANNOTATION_TYPE_FIELD_DETAIL("annotation.type.field.detail"), + ANNOTATION_TYPE_FIELD_SUMMARY("annotation.type.field.summary"), + ANNOTATION_TYPE_OPTIONAL_ELEMENT_SUMMARY("annotation.type.optional.element.summary"), + ANNOTATION_TYPE_REQUIRED_ELEMENT_SUMMARY("annotation.type.required.element.summary"), + CONSTRUCTOR_DETAIL("constructor.detail"), + CONSTRUCTOR_SUMMARY("constructor.summary"), + ENUM_CONSTANT_DETAIL("enum.constant.detail"), + ENUM_CONSTANTS_INHERITANCE("enum.constants.inherited.from.class."), + ENUM_CONSTANT_SUMMARY("enum.constant.summary"), + FIELD_DETAIL("field.detail"), + FIELDS_INHERITANCE("fields.inherited.from.class."), + FIELD_SUMMARY("field.summary"), + METHOD_DETAIL("method.detail"), + METHODS_INHERITANCE("methods.inherited.from.class."), + METHOD_SUMMARY("method.summary"), + NAVBAR_BOTTOM("navbar.bottom"), + NAVBAR_BOTTOM_FIRSTROW("navbar.bottom.firstrow"), + NAVBAR_TOP("navbar.top"), + NAVBAR_TOP_FIRSTROW("navbar.top.firstrow"), + NESTED_CLASSES_INHERITANCE("nested.classes.inherited.from.class."), + NESTED_CLASS_SUMMARY("nested.class.summary"), + OVERVIEW_DESCRIPTION("overview.description"), + PACKAGE_DESCRIPTION("package.description"), + PROPERTY_DETAIL("property.detail"), + PROPERTIES_INHERITANCE("properties.inherited.from.class."), + PROPERTY_SUMMARY("property.summary"), + SKIP_NAVBAR_BOTTOM("skip.navbar.bottom"), + SKIP_NAVBAR_TOP("skip.navbar.top"), + UNNAMED_PACKAGE_ANCHOR("unnamed.package"); + + private final String value; + + SectionName(String sName) { + this.value = sName; + } + + public String getName() { + return this.value; + } +}
--- a/src/share/classes/com/sun/tools/doclets/formats/html/SingleIndexWriter.java Thu Oct 03 19:28:07 2013 +0100 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/SingleIndexWriter.java Fri Oct 11 19:05:18 2013 +0100 @@ -115,7 +115,8 @@ for (int i = 0; i < indexbuilder.elements().length; i++) { String unicode = (indexbuilder.elements())[i].toString(); contentTree.addContent( - getHyperLink("_" + unicode + "_", new StringContent(unicode))); + getHyperLink(getNameForIndex(unicode), + new StringContent(unicode))); contentTree.addContent(getSpace()); } }
--- a/src/share/classes/com/sun/tools/doclets/formats/html/SubWriterHolderWriter.java Thu Oct 03 19:28:07 2013 +0100 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/SubWriterHolderWriter.java Fri Oct 11 19:05:18 2013 +0100 @@ -92,7 +92,7 @@ else { caption = getTableCaption(mw.getCaption()); } - Content table = HtmlTree.TABLE(HtmlStyle.overviewSummary, 0, 3, 0, + Content table = HtmlTree.TABLE(HtmlStyle.memberSummary, 0, 3, 0, mw.getTableSummary(), caption); table.addContent(getSummaryTableHeader(mw.getSummaryTableHeader(cd), "col")); for (int i = 0; i < tableContents.size(); i++) {
--- a/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlDocWriter.java Thu Oct 03 19:28:07 2013 +0100 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlDocWriter.java Fri Oct 11 19:05:18 2013 +0100 @@ -30,6 +30,7 @@ import com.sun.javadoc.*; import com.sun.tools.doclets.formats.html.ConfigurationImpl; +import com.sun.tools.doclets.formats.html.SectionName; import com.sun.tools.doclets.internal.toolkit.*; import com.sun.tools.doclets.internal.toolkit.util.DocFile; import com.sun.tools.doclets.internal.toolkit.util.DocLink; @@ -78,7 +79,7 @@ } /** - * Get Html Hyper Link string. + * Get Html Hyper Link Content. * * @param where Position of the link in the file. Character '#' is not * needed. @@ -87,7 +88,125 @@ */ public Content getHyperLink(String where, Content label) { - return getHyperLink(DocLink.fragment(where), label, "", ""); + return getHyperLink(getDocLink(where), label, "", ""); + } + + /** + * Get Html Hyper Link Content. + * + * @param sectionName The section name to which the link will be created. + * @param label Tag for the link. + * @return a content tree for the hyper link + */ + public Content getHyperLink(SectionName sectionName, + Content label) { + return getHyperLink(getDocLink(sectionName), label, "", ""); + } + + /** + * Get Html Hyper Link Content. + * + * @param sectionName The section name combined with where to which the link + * will be created. + * @param where The fragment combined with sectionName to which the link + * will be created. + * @param label Tag for the link. + * @return a content tree for the hyper link + */ + public Content getHyperLink(SectionName sectionName, String where, + Content label) { + return getHyperLink(getDocLink(sectionName, where), label, "", ""); + } + + /** + * Get the link. + * + * @param where Position of the link in the file. + * @return a DocLink object for the hyper link + */ + public DocLink getDocLink(String where) { + return DocLink.fragment(getName(where)); + } + + /** + * Get the link. + * + * @param sectionName The section name to which the link will be created. + * @return a DocLink object for the hyper link + */ + public DocLink getDocLink(SectionName sectionName) { + return DocLink.fragment(sectionName.getName()); + } + + /** + * Get the link. + * + * @param sectionName The section name combined with where to which the link + * will be created. + * @param where The fragment combined with sectionName to which the link + * will be created. + * @return a DocLink object for the hyper link + */ + public DocLink getDocLink(SectionName sectionName, String where) { + return DocLink.fragment(sectionName.getName() + getName(where)); + } + + /** + * Convert the name to a valid HTML name. + * + * @param name the name that needs to be converted to valid HTML name. + * @return a valid HTML name string. + */ + public String getName(String name) { + StringBuilder sb = new StringBuilder(); + char ch; + /* The HTML 4 spec at http://www.w3.org/TR/html4/types.html#h-6.2 mentions + * that the name/id should begin with a letter followed by other valid characters. + * The HTML 5 spec (draft) is more permissive on names/ids where the only restriction + * is that it should be at least one character long and should not contain spaces. + * The spec draft is @ http://www.w3.org/html/wg/drafts/html/master/dom.html#the-id-attribute. + * + * For HTML 4, we need to check for non-characters at the beginning of the name and + * substitute it accordingly, "_" and "$" can appear at the beginning of a member name. + * The method substitutes "$" with "Z:Z:D" and will prefix "_" with "Z:Z". + */ + for (int i = 0; i < name.length(); i++) { + ch = name.charAt(i); + switch (ch) { + case '(': + case ')': + case '<': + case '>': + case ',': + sb.append('-'); + break; + case ' ': + case '[': + break; + case ']': + sb.append(":A"); + break; + // Any appearance of $ needs to be substituted with ":D" and not with hyphen + // since a field name "P$$ and a method P(), both valid member names, can end + // up as "P--". A member name beginning with $ needs to be substituted with + // "Z:Z:D". + case '$': + if (i == 0) + sb.append("Z:Z"); + sb.append(":D"); + break; + // A member name beginning with _ needs to be prefixed with "Z:Z" since valid anchor + // names can only begin with a letter. + case '_': + if (i == 0) + sb.append("Z:Z"); + sb.append(ch); + break; + default: + sb.append(ch); + } + } + return sb.toString(); } /**
--- a/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlStyle.java Thu Oct 03 19:28:07 2013 +0100 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlStyle.java Fri Oct 11 19:05:18 2013 +0100 @@ -48,8 +48,11 @@ colFirst, colLast, colOne, + constantsSummary, constantValuesContainer, contentContainer, + deprecatedContent, + deprecatedSummary, description, details, docSummary, @@ -61,11 +64,11 @@ inheritance, italic, legalCopy, + memberSummary, nameValue, navBarCell1Rev, navList, overviewSummary, - packageSummary, rowColor, serializedFormContainer, skipNav, @@ -76,9 +79,10 @@ subNavList, subTitle, summary, - deprecatedContent, tabEnd, tableTab, title, - topNav; + topNav, + typeSummary, + useSummary; }
--- a/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlTree.java Thu Oct 03 19:28:07 2013 +0100 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlTree.java Fri Oct 11 19:05:18 2013 +0100 @@ -619,25 +619,6 @@ } /** - * Generates a Table tag with border, width and summary attributes and - * some content. - * - * @param border border for the table - * @param width width of the table - * @param summary summary for the table - * @param body content for the table - * @return an HtmlTree object for the TABLE tag - */ - public static HtmlTree TABLE(int border, int width, String summary, - Content body) { - HtmlTree htmltree = new HtmlTree(HtmlTag.TABLE, nullCheck(body)); - htmltree.addAttr(HtmlAttr.BORDER, Integer.toString(border)); - htmltree.addAttr(HtmlAttr.WIDTH, Integer.toString(width)); - htmltree.addAttr(HtmlAttr.SUMMARY, nullCheck(summary)); - return htmltree; - } - - /** * Generates a Table tag with style class, border, cell padding, * cellspacing and summary attributes and some content. * @@ -662,22 +643,6 @@ } /** - * Generates a Table tag with border, cell padding, - * cellspacing and summary attributes and some content. - * - * @param border border for the table - * @param cellPadding cell padding for the table - * @param cellSpacing cell spacing for the table - * @param summary summary for the table - * @param body content for the table - * @return an HtmlTree object for the TABLE tag - */ - public static HtmlTree TABLE(int border, int cellPadding, - int cellSpacing, String summary, Content body) { - return TABLE(null, border, cellPadding, cellSpacing, summary, body); - } - - /** * Generates a TD tag with style class attribute and some content. * * @param styleClass style for the tag
--- a/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlWriter.java Thu Oct 03 19:28:07 2013 +0100 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlWriter.java Fri Oct 11 19:05:18 2013 +0100 @@ -310,8 +310,12 @@ if(winTitle != null && winTitle.length() > 0) { script.addAttr(HtmlAttr.TYPE, "text/javascript"); String scriptCode = "<!--" + DocletConstants.NL + - " if (location.href.indexOf('is-external=true') == -1) {" + DocletConstants.NL + - " parent.document.title=\"" + escapeJavaScriptChars(winTitle) + "\";" + DocletConstants.NL + + " try {" + DocletConstants.NL + + " if (location.href.indexOf('is-external=true') == -1) {" + DocletConstants.NL + + " parent.document.title=\"" + escapeJavaScriptChars(winTitle) + "\";" + DocletConstants.NL + + " }" + DocletConstants.NL + + " }" + DocletConstants.NL + + " catch(err) {" + DocletConstants.NL + " }" + DocletConstants.NL + "//-->" + DocletConstants.NL; RawHtml scriptContent = new RawHtml(scriptCode);
--- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/AbstractDoclet.java Thu Oct 03 19:28:07 2013 +0100 +++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/AbstractDoclet.java Fri Oct 11 19:05:18 2013 +0100 @@ -83,6 +83,16 @@ } catch (Configuration.Fault f) { root.printError(f.getMessage()); return false; + } catch (DocletAbortException e) { + Throwable cause = e.getCause(); + if (cause != null) { + if (cause.getLocalizedMessage() != null) { + root.printError(cause.getLocalizedMessage()); + } else { + root.printError(cause.toString()); + } + } + return false; } catch (Exception exc) { exc.printStackTrace(); return false;
--- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/AbstractBuilder.java Thu Oct 03 19:28:07 2013 +0100 +++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/AbstractBuilder.java Fri Oct 11 19:05:18 2013 +0100 @@ -140,7 +140,7 @@ configuration.root.printError("Unknown element: " + component); throw new DocletAbortException(e); } catch (InvocationTargetException e) { - e.getCause().printStackTrace(); + throw new DocletAbortException(e.getCause()); } catch (Exception e) { e.printStackTrace(); configuration.root.printError("Exception " +
--- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/resources/stylesheet.css Thu Oct 03 19:28:07 2013 +0100 +++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/resources/stylesheet.css Fri Oct 11 19:05:18 2013 +0100 @@ -348,27 +348,16 @@ /* Table styles */ -.contentContainer table, .classUseContainer table, .constantValuesContainer table { +.overviewSummary, .memberSummary, .typeSummary, .useSummary, .constantsSummary, .deprecatedSummary { border-bottom:1px solid #9eadc0; - width:100%; -} -.contentContainer ul li table, .classUseContainer ul li table, .constantValuesContainer ul li table { + margin:0 0 12px 0px; width:100%; } -.contentContainer .description table, .contentContainer .details table { - border-bottom:none; -} -.contentContainer ul li table th.colOne, .contentContainer ul li table th.colFirst, .contentContainer ul li table th.colLast, .classUseContainer ul li table th, .constantValuesContainer ul li table th, .contentContainer ul li table td.colOne, .contentContainer ul li table td.colFirst, .contentContainer ul li table td.colLast, .classUseContainer ul li table td, .constantValuesContainer ul li table td{ - vertical-align:top; - padding-right:20px; +.overviewSummary, .memberSummary { + padding:0px; } -.contentContainer ul li table th.colLast, .classUseContainer ul li table th.colLast,.constantValuesContainer ul li table th.colLast, -.contentContainer ul li table td.colLast, .classUseContainer ul li table td.colLast,.constantValuesContainer ul li table td.colLast, -.contentContainer ul li table th.colOne, .classUseContainer ul li table th.colOne, -.contentContainer ul li table td.colOne, .classUseContainer ul li table td.colOne { - padding-right:3px; -} -.overviewSummary caption, .packageSummary caption, .contentContainer ul.blockList li.blockList caption, .summary caption, .classUseContainer caption, .constantValuesContainer caption { +.overviewSummary caption, .memberSummary caption, .typeSummary caption, +.useSummary caption, .constantsSummary caption, .deprecatedSummary caption { position:relative; text-align:left; background-repeat:no-repeat; @@ -379,10 +368,18 @@ padding:0px; margin:0px; } -caption a:link, caption a:hover, caption a:active, caption a:visited { +.overviewSummary caption a:link, .memberSummary caption a:link, .typeSummary caption a:link, +.useSummary caption a:link, .constantsSummary caption a:link, .deprecatedSummary caption a:link, +.overviewSummary caption a:hover, .memberSummary caption a:hover, .typeSummary caption a:hover, +.useSummary caption a:hover, .constantsSummary caption a:hover, .deprecatedSummary caption a:hover, +.overviewSummary caption a:active, .memberSummary caption a:active, .typeSummary caption a:active, +.useSummary caption a:active, .constantsSummary caption a:active, .deprecatedSummary caption a:active, +.overviewSummary caption a:visited, .memberSummary caption a:visited, .typeSummary caption a:visited, +.useSummary caption a:visited, .constantsSummary caption a:visited, .deprecatedSummary caption a:visited { color:#FFFFFF; } -.overviewSummary caption span, .packageSummary caption span, .contentContainer ul.blockList li.blockList caption span, .summary caption span, .classUseContainer caption span, .constantValuesContainer caption span { +.overviewSummary caption span, .memberSummary caption span, .typeSummary caption span, +.useSummary caption span, .constantsSummary caption span, .deprecatedSummary caption span { white-space:nowrap; padding-top:8px; padding-left:8px; @@ -390,7 +387,7 @@ float:left; background-image:url(resources/titlebar.gif); } -.contentContainer ul.blockList li.blockList caption span.activeTableTab span { +.memberSummary caption span.activeTableTab span { white-space:nowrap; padding-top:8px; padding-left:8px; @@ -398,7 +395,7 @@ float:left; background-image:url(resources/activetitlebar.gif); } -.contentContainer ul.blockList li.blockList caption span.tableTab span { +.memberSummary caption span.tableTab span { white-space:nowrap; padding-top:8px; padding-left:8px; @@ -406,14 +403,15 @@ float:left; background-image:url(resources/titlebar.gif); } -.contentContainer ul.blockList li.blockList caption span.tableTab, .contentContainer ul.blockList li.blockList caption span.activeTableTab { +.memberSummary caption span.tableTab, .memberSummary caption span.activeTableTab { padding-top:0px; padding-left:0px; background-image:none; float:none; display:inline-block; } -.overviewSummary .tabEnd, .packageSummary .tabEnd, .contentContainer ul.blockList li.blockList .tabEnd, .summary .tabEnd, .classUseContainer .tabEnd, .constantValuesContainer .tabEnd { +.overviewSummary .tabEnd, .memberSummary .tabEnd, .typeSummary .tabEnd, +.useSummary .tabEnd, .constantsSummary .tabEnd, .deprecatedSummary .tabEnd { width:10px; background-image:url(resources/titlebar_end.gif); background-repeat:no-repeat; @@ -421,7 +419,7 @@ position:relative; float:left; } -.contentContainer ul.blockList li.blockList .activeTableTab .tabEnd { +.memberSummary .activeTableTab .tabEnd { width:10px; margin-right:5px; background-image:url(resources/activetitlebar_end.gif); @@ -430,7 +428,7 @@ position:relative; float:left; } -.contentContainer ul.blockList li.blockList .tableTab .tabEnd { +.memberSummary .tableTab .tabEnd { width:10px; margin-right:5px; background-image:url(resources/titlebar_end.gif); @@ -439,33 +437,23 @@ position:relative; float:left; } -ul.blockList ul.blockList li.blockList table { - margin:0 0 12px 0px; - width:100%; -} -.tableSubHeadingColor { - background-color: #EEEEFF; -} -.altColor { - background-color:#eeeeef; -} -.rowColor { - background-color:#ffffff; -} -.overviewSummary td, .packageSummary td, .contentContainer ul.blockList li.blockList td, .summary td, .classUseContainer td, .constantValuesContainer td { +.overviewSummary td, .memberSummary td, .typeSummary td, +.useSummary td, .constantsSummary td, .deprecatedSummary td { text-align:left; padding:3px 3px 3px 7px; } -th.colFirst, th.colLast, th.colOne, .constantValuesContainer th { +th.colOne, th.colFirst, th.colLast, .useSummary th, .constantsSummary th, +td.colOne, td.colFirst, td.colLast, .useSummary td, .constantsSummary td{ + vertical-align:top; + padding-right:3px; +} +th.colFirst, th.colLast, th.colOne, .constantsSummary th { background:#dee3e9; border-top:1px solid #9eadc0; border-bottom:1px solid #9eadc0; text-align:left; padding:3px 3px 3px 7px; } -td.colOne a:link, td.colOne a:active, td.colOne a:visited, td.colOne a:hover, td.colFirst a:link, td.colFirst a:active, td.colFirst a:visited, td.colFirst a:hover, td.colLast a:link, td.colLast a:active, td.colLast a:visited, td.colLast a:hover, .constantValuesContainer td a:link, .constantValuesContainer td a:active, .constantValuesContainer td a:visited, .constantValuesContainer td a:hover { - font-weight:bold; -} td.colFirst, th.colFirst { border-left:1px solid #9eadc0; white-space:nowrap; @@ -477,18 +465,25 @@ border-right:1px solid #9eadc0; border-left:1px solid #9eadc0; } -table.overviewSummary { - padding:0px; - margin-left:0px; -} -table.overviewSummary td.colFirst, table.overviewSummary th.colFirst, -table.overviewSummary td.colOne, table.overviewSummary th.colOne { +.overviewSummary td.colFirst, .overviewSummary th.colFirst, +.overviewSummary td.colOne, .overviewSummary th.colOne, +.memberSummary td.colFirst, .memberSummary th.colFirst, +.memberSummary td.colOne, .memberSummary th.colOne, +.typeSummary td.colFirst{ width:25%; vertical-align:middle; } -table.packageSummary td.colFirst, table.overviewSummary th.colFirst { - width:25%; - vertical-align:middle; +td.colOne a:link, td.colOne a:active, td.colOne a:visited, td.colOne a:hover, td.colFirst a:link, td.colFirst a:active, td.colFirst a:visited, td.colFirst a:hover, td.colLast a:link, td.colLast a:active, td.colLast a:visited, td.colLast a:hover, .constantValuesContainer td a:link, .constantValuesContainer td a:active, .constantValuesContainer td a:visited, .constantValuesContainer td a:hover { + font-weight:bold; +} +.tableSubHeadingColor { + background-color: #EEEEFF; +} +.altColor { + background-color:#eeeeef; +} +.rowColor { + background-color:#ffffff; } /* Content styles
--- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/DocletConstants.java Thu Oct 03 19:28:07 2013 +0100 +++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/DocletConstants.java Fri Oct 11 19:05:18 2013 +0100 @@ -58,9 +58,4 @@ * The default package file name. */ public static final String DEFAULT_PACKAGE_FILE_NAME = "default"; - - /** - * The anchor for the default package. - */ - public static final String UNNAMED_PACKAGE_ANCHOR = "unnamed_package"; }
--- a/src/share/classes/com/sun/tools/javac/Main.java Thu Oct 03 19:28:07 2013 +0100 +++ b/src/share/classes/com/sun/tools/javac/Main.java Fri Oct 11 19:05:18 2013 +0100 @@ -31,7 +31,7 @@ * The programmatic interface for the Java Programming Language * compiler, javac. */ -@jdk.Supported +@jdk.Exported public class Main { /** Main entry point for the launcher.
--- a/src/share/classes/com/sun/tools/javac/api/JavacTool.java Thu Oct 03 19:28:07 2013 +0100 +++ b/src/share/classes/com/sun/tools/javac/api/JavacTool.java Fri Oct 11 19:05:18 2013 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -120,7 +120,6 @@ try { ClientCodeWrapper ccw = ClientCodeWrapper.instance(context); - final String kindMsg = "All compilation units must be of SOURCE kind"; if (options != null) for (String option : options) option.getClass(); // null check @@ -132,8 +131,11 @@ if (compilationUnits != null) { compilationUnits = ccw.wrapJavaFileObjects(compilationUnits); // implicit null check for (JavaFileObject cu : compilationUnits) { - if (cu.getKind() != JavaFileObject.Kind.SOURCE) + if (cu.getKind() != JavaFileObject.Kind.SOURCE) { + String kindMsg = "Compilation unit is not of SOURCE kind: " + + "\"" + cu.getName() + "\""; throw new IllegalArgumentException(kindMsg); + } } }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/share/classes/com/sun/tools/javac/code/AnnoConstruct.java Fri Oct 11 19:05:18 2013 +0100 @@ -0,0 +1,238 @@ +/* + * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.sun.tools.javac.code; + +import java.lang.annotation.Annotation; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; + +import javax.lang.model.AnnotatedConstruct; + +import com.sun.tools.javac.model.AnnotationProxyMaker; +import com.sun.tools.javac.util.List; +import com.sun.tools.javac.util.ListBuffer; + +/** + * Common super type for annotated constructs such as Types and Symbols. + * + * This class should *not* contain any fields since it would have a significant + * impact on the javac memory footprint. + * + * <p><b>This is NOT part of any supported API. + * If you write code that depends on this, you do so at your own + * risk. This code and its internal interfaces are subject to change + * or deletion without notice.</b></p> + */ +public abstract class AnnoConstruct implements AnnotatedConstruct { + + + // Override to enforce a narrower return type. + @Override + public abstract List<? extends Attribute.Compound> getAnnotationMirrors(); + + + // This method is part of the javax.lang.model API, do not use this in javac code. + protected <A extends Annotation> Attribute.Compound getAttribute(Class<A> annoType) { + String name = annoType.getName(); + + for (Attribute.Compound anno : getAnnotationMirrors()) { + if (name.equals(anno.type.tsym.flatName().toString())) + return anno; + } + + return null; + } + + + @SuppressWarnings("unchecked") + protected <A extends Annotation> A[] getInheritedAnnotations(Class<A> annoType) { + return (A[]) java.lang.reflect.Array.newInstance(annoType, 0); // annoType is the Class for A + } + + + // This method is part of the javax.lang.model API, do not use this in javac code. + public <A extends Annotation> A[] getAnnotationsByType(Class<A> annoType) { + + if (!annoType.isAnnotation()) + throw new IllegalArgumentException("Not an annotation type: " + + annoType); + // If annoType does not declare a container this is equivalent to wrapping + // getAnnotation(...) in an array. + Class <? extends Annotation> containerType = getContainer(annoType); + if (containerType == null) { + A res = getAnnotation(annoType); + int size = res == null ? 0 : 1; + + @SuppressWarnings("unchecked") // annoType is the Class for A + A[] arr = (A[])java.lang.reflect.Array.newInstance(annoType, size); + if (res != null) + arr[0] = res; + return arr; + } + + // So we have a containing type + String annoTypeName = annoType.getName(); + String containerTypeName = containerType.getName(); + int directIndex = -1, containerIndex = -1; + Attribute.Compound direct = null, container = null; + // Find directly (explicit or implicit) present annotations + int index = -1; + for (Attribute.Compound attribute : getAnnotationMirrors()) { + index++; + if (attribute.type.tsym.flatName().contentEquals(annoTypeName)) { + directIndex = index; + direct = attribute; + } else if(containerTypeName != null && + attribute.type.tsym.flatName().contentEquals(containerTypeName)) { + containerIndex = index; + container = attribute; + } + } + + // Deal with inherited annotations + if (direct == null && container == null) + return getInheritedAnnotations(annoType); + + // Pack them in an array + Attribute[] contained0 = null; + if (container != null) + contained0 = unpackAttributes(container); + ListBuffer<Attribute.Compound> compounds = new ListBuffer<>(); + if (contained0 != null) { + for (Attribute a : contained0) + if (a instanceof Attribute.Compound) + compounds = compounds.append((Attribute.Compound)a); + } + Attribute.Compound[] contained = compounds.toArray(new Attribute.Compound[compounds.size()]); + + int size = (direct == null ? 0 : 1) + contained.length; + @SuppressWarnings("unchecked") // annoType is the Class for A + A[] arr = (A[])java.lang.reflect.Array.newInstance(annoType, size); + + // if direct && container, which is first? + int insert = -1; + int length = arr.length; + if (directIndex >= 0 && containerIndex >= 0) { + if (directIndex < containerIndex) { + arr[0] = AnnotationProxyMaker.generateAnnotation(direct, annoType); + insert = 1; + } else { + arr[arr.length - 1] = AnnotationProxyMaker.generateAnnotation(direct, annoType); + insert = 0; + length--; + } + } else if (directIndex >= 0) { + arr[0] = AnnotationProxyMaker.generateAnnotation(direct, annoType); + return arr; + } else { + // Only container + insert = 0; + } + + for (int i = 0; i + insert < length; i++) + arr[insert + i] = AnnotationProxyMaker.generateAnnotation(contained[i], annoType); + + return arr; + } + + + // This method is part of the javax.lang.model API, do not use this in javac code. + public <A extends Annotation> A getAnnotation(Class<A> annoType) { + + if (!annoType.isAnnotation()) + throw new IllegalArgumentException("Not an annotation type: " + annoType); + + Attribute.Compound c = getAttribute(annoType); + return c == null ? null : AnnotationProxyMaker.generateAnnotation(c, annoType); + } + + // Needed to unpack the runtime view of containing annotations + private static final Class<? extends Annotation> REPEATABLE_CLASS = initRepeatable(); + private static final Method VALUE_ELEMENT_METHOD = initValueElementMethod(); + + private static Class<? extends Annotation> initRepeatable() { + try { + // Repeatable will not be available when bootstrapping on + // JDK 7 so use a reflective lookup instead of a class + // literal for Repeatable.class. + return Class.forName("java.lang.annotation.Repeatable").asSubclass(Annotation.class); + } catch (ClassNotFoundException | SecurityException e) { + return null; + } + } + + private static Method initValueElementMethod() { + if (REPEATABLE_CLASS == null) + return null; + + Method m = null; + try { + m = REPEATABLE_CLASS.getMethod("value"); + if (m != null) + m.setAccessible(true); + return m; + } catch (NoSuchMethodException e) { + return null; + } + } + + + // Helper to getAnnotationsByType + private static Class<? extends Annotation> getContainer(Class<? extends Annotation> annoType) { + // Since we can not refer to java.lang.annotation.Repeatable until we are + // bootstrapping with java 8 we need to get the Repeatable annotation using + // reflective invocations instead of just using its type and element method. + if (REPEATABLE_CLASS != null && + VALUE_ELEMENT_METHOD != null) { + // Get the Repeatable instance on the annotations declaration + Annotation repeatable = (Annotation)annoType.getAnnotation(REPEATABLE_CLASS); + if (repeatable != null) { + try { + // Get the value element, it should be a class + // indicating the containing annotation type + @SuppressWarnings("unchecked") + Class<? extends Annotation> containerType = (Class)VALUE_ELEMENT_METHOD.invoke(repeatable); + if (containerType == null) + return null; + + return containerType; + } catch (ClassCastException | IllegalAccessException | InvocationTargetException e) { + return null; + } + } + } + return null; + } + + + // Helper to getAnnotationsByType + private static Attribute[] unpackAttributes(Attribute.Compound container) { + // We now have an instance of the container, + // unpack it returning an instance of the + // contained type or null + return ((Attribute.Array)container.member(container.type.tsym.name.table.names.value)).values; + } + +}
--- a/src/share/classes/com/sun/tools/javac/code/Attribute.java Thu Oct 03 19:28:07 2013 +0100 +++ b/src/share/classes/com/sun/tools/javac/code/Attribute.java Fri Oct 11 19:05:18 2013 +0100 @@ -64,6 +64,8 @@ return false; } + public TypeAnnotationPosition getPosition() { return null; }; + /** The value for an annotation element of primitive type or String. */ public static class Constant extends Attribute { public final Object value; @@ -191,8 +193,13 @@ } public Attribute member(Name member) { + Pair<MethodSymbol,Attribute> res = getElemPair(member); + return res == null ? null : res.snd; + } + + private Pair<MethodSymbol, Attribute> getElemPair(Name member) { for (Pair<MethodSymbol,Attribute> pair : values) - if (pair.fst.name == member) return pair.snd; + if (pair.fst.name == member) return pair; return null; } @@ -208,6 +215,16 @@ return (DeclaredType) type; } + @Override + public TypeAnnotationPosition getPosition() { + if (values.size() != 0) { + Name valueName = values.head.fst.name.table.names.value; + Pair<MethodSymbol, Attribute> res = getElemPair(valueName); + return res == null ? null : res.snd.getPosition(); + } + return null; + } + public Map<MethodSymbol, Attribute> getElementValues() { Map<MethodSymbol, Attribute> valmap = new LinkedHashMap<MethodSymbol, Attribute>(); @@ -230,6 +247,14 @@ this.position = position; } + @Override + public TypeAnnotationPosition getPosition() { + if (hasUnknownPosition()) { + position = super.getPosition(); + } + return position; + } + public boolean hasUnknownPosition() { return position == null || position.type == TargetType.UNKNOWN; } @@ -302,6 +327,14 @@ public <R, P> R accept(AnnotationValueVisitor<R, P> v, P p) { return v.visitArray(getValue(), p); } + + @Override + public TypeAnnotationPosition getPosition() { + if (values.length != 0) + return values[0].getPosition(); + else + return null; + } } /** The value for an annotation element of an enum type.
--- a/src/share/classes/com/sun/tools/javac/code/Symbol.java Thu Oct 03 19:28:07 2013 +0100 +++ b/src/share/classes/com/sun/tools/javac/code/Symbol.java Fri Oct 11 19:05:18 2013 +0100 @@ -25,6 +25,8 @@ package com.sun.tools.javac.code; +import java.lang.annotation.Annotation; +import java.lang.annotation.Inherited; import java.util.Set; import java.util.concurrent.Callable; @@ -37,8 +39,6 @@ import com.sun.tools.javac.comp.AttrContext; import com.sun.tools.javac.comp.Env; import com.sun.tools.javac.jvm.*; -import com.sun.tools.javac.model.*; -import com.sun.tools.javac.tree.JCTree; import com.sun.tools.javac.util.*; import com.sun.tools.javac.util.Name; import static com.sun.tools.javac.code.Flags.*; @@ -58,8 +58,7 @@ * This code and its internal interfaces are subject to change or * deletion without notice.</b> */ -public abstract class Symbol implements Element { - // public Throwable debug = new Throwable(); +public abstract class Symbol extends AnnoConstruct implements Element { /** The kind of this symbol. * @see Kinds @@ -103,6 +102,7 @@ */ protected SymbolMetadata annotations; + /** An accessor method for the attributes of this symbol. * Attributes of class symbols should be accessed through the accessor * method to make sure that the class symbol is loaded. @@ -327,7 +327,8 @@ public boolean isStatic() { return (flags() & STATIC) != 0 || - (owner.flags() & INTERFACE) != 0 && kind != MTH; + (owner.flags() & INTERFACE) != 0 && kind != MTH && + name != name.table.names._this; } public boolean isInterface() { @@ -595,18 +596,6 @@ return getRawAttributes(); } - /** - * @deprecated this method should never be used by javac internally. - */ - @Deprecated - public <A extends java.lang.annotation.Annotation> A getAnnotation(Class<A> annoType) { - return JavacAnnoConstructs.getAnnotation(this, annoType); - } - - // This method is part of the javax.lang.model API, do not use this in javac code. - public <A extends java.lang.annotation.Annotation> A[] getAnnotationsByType(Class<A> annoType) { - return JavacAnnoConstructs.getAnnotationsByType(this, annoType); - } // TODO: getEnclosedElements should return a javac List, fix in FilteredMemberList public java.util.List<Symbol> getEnclosedElements() { @@ -792,6 +781,28 @@ return res = res.reverse(); } + + + // Helper to getAnnotation[s] + @Override + public <A extends Annotation> Attribute.Compound getAttribute(Class<A> annoType) { + + String name = annoType.getName(); + + // Declaration annotations on type variables are stored in type attributes + // on the owner of the TypeVariableSymbol + List<Attribute.TypeCompound> candidates = owner.getRawTypeAttributes(); + for (Attribute.TypeCompound anno : candidates) + if (anno.position.type == TargetType.CLASS_TYPE_PARAMETER || + anno.position.type == TargetType.METHOD_TYPE_PARAMETER) + if (name.contentEquals(anno.type.tsym.flatName())) + return anno; + + return null; + } + + + @Override public <R, P> R accept(ElementVisitor<R, P> v, P p) { return v.visitTypeParameter(this, p); @@ -1048,6 +1059,31 @@ } } + /** + * Returns the next class to search for inherited annotations or {@code null} + * if the next class can't be found. + */ + private ClassSymbol getSuperClassToSearchForAnnotations() { + + Type sup = getSuperclass(); + + if (!sup.hasTag(CLASS) || sup.isErroneous()) + return null; + + return (ClassSymbol) sup.tsym; + } + + + @Override + protected <A extends Annotation> A[] getInheritedAnnotations(Class<A> annoType) { + + ClassSymbol sup = getSuperClassToSearchForAnnotations(); + + return sup == null ? super.getInheritedAnnotations(annoType) + : sup.getAnnotationsByType(annoType); + } + + public ElementKind getKind() { long flags = flags(); if ((flags & ANNOTATION) != 0) @@ -1060,6 +1096,12 @@ return ElementKind.CLASS; } + @Override + public Set<Modifier> getModifiers() { + long flags = flags(); + return Flags.asModifierSet(flags & ~DEFAULT); + } + public NestingKind getNestingKind() { complete(); if (owner.kind == PCK) @@ -1072,15 +1114,25 @@ return NestingKind.MEMBER; } - /** - * Since this method works in terms of the runtime representation - * of annotations, it should never be used by javac internally. - */ + @Override - public <A extends java.lang.annotation.Annotation> A getAnnotation(Class<A> annoType) { - return JavacAnnoConstructs.getAnnotation(this, annoType); + protected <A extends Annotation> Attribute.Compound getAttribute(final Class<A> annoType) { + + Attribute.Compound attrib = super.getAttribute(annoType); + + boolean inherited = annoType.isAnnotationPresent(Inherited.class); + if (attrib != null || !inherited) + return attrib; + + // Search supertypes + ClassSymbol superType = getSuperClassToSearchForAnnotations(); + return superType == null ? null + : superType.getAttribute(annoType); } + + + public <R, P> R accept(ElementVisitor<R, P> v, P p) { return v.visitType(this, p); }
--- a/src/share/classes/com/sun/tools/javac/code/Type.java Thu Oct 03 19:28:07 2013 +0100 +++ b/src/share/classes/com/sun/tools/javac/code/Type.java Fri Oct 11 19:05:18 2013 +0100 @@ -35,7 +35,6 @@ import javax.lang.model.type.*; import com.sun.tools.javac.code.Symbol.*; -import com.sun.tools.javac.model.JavacAnnoConstructs; import com.sun.tools.javac.util.*; import static com.sun.tools.javac.code.BoundKind.*; import static com.sun.tools.javac.code.Flags.*; @@ -70,7 +69,7 @@ * * @see TypeTag */ -public abstract class Type implements TypeMirror { +public abstract class Type extends AnnoConstruct implements TypeMirror { /** Constant type: no type at all. */ public static final JCNoType noType = new JCNoType(); @@ -166,6 +165,12 @@ return lb.toList(); } + /**For ErrorType, returns the original type, otherwise returns the type itself. + */ + public Type getOriginalType() { + return this; + } + public <R,S> R accept(Type.Visitor<R,S> v, S s) { return v.visitType(this, s); } /** Define a type given its tag and type symbol @@ -233,15 +238,17 @@ } @Override - public List<? extends Attribute.TypeCompound> getAnnotationMirrors() { + public List<Attribute.TypeCompound> getAnnotationMirrors() { return List.nil(); } + @Override public <A extends Annotation> A getAnnotation(Class<A> annotationType) { return null; } + @Override public <A extends Annotation> A[] getAnnotationsByType(Class<A> annotationType) { @SuppressWarnings("unchecked") @@ -1651,6 +1658,9 @@ public <R, P> R accept(TypeVisitor<R, P> v, P p) { return v.visitNoType(this, p); } + + @Override + public boolean isCompound() { return false; } } /** Represents VOID. @@ -1672,6 +1682,9 @@ } @Override + public boolean isCompound() { return false; } + + @Override public <R, P> R accept(TypeVisitor<R, P> v, P p) { return v.visitNoType(this, p); } @@ -1698,6 +1711,9 @@ } @Override + public boolean isCompound() { return false; } + + @Override public <R, P> R accept(TypeVisitor<R, P> v, P p) { return v.visitNull(this, p); } @@ -1837,19 +1853,10 @@ } @Override - public List<? extends Attribute.TypeCompound> getAnnotationMirrors() { + public List<Attribute.TypeCompound> getAnnotationMirrors() { return typeAnnotations; } - @Override - public <A extends Annotation> A getAnnotation(Class<A> annotationType) { - return JavacAnnoConstructs.getAnnotation(this, annotationType); - } - - @Override - public <A extends Annotation> A[] getAnnotationsByType(Class<A> annotationType) { - return JavacAnnoConstructs.getAnnotationsByType(this, annotationType); - } @Override public TypeKind getKind() {
--- a/src/share/classes/com/sun/tools/javac/code/TypeAnnotations.java Thu Oct 03 19:28:07 2013 +0100 +++ b/src/share/classes/com/sun/tools/javac/code/TypeAnnotations.java Fri Oct 11 19:05:18 2013 +0100 @@ -71,6 +71,7 @@ import com.sun.tools.javac.util.ListBuffer; import com.sun.tools.javac.util.Log; import com.sun.tools.javac.util.Names; +import com.sun.tools.javac.util.Options; /** * Contains operations specific to processing type annotations. @@ -94,6 +95,7 @@ final Names names; final Symtab syms; final Annotate annotate; + private final boolean typeAnnoAsserts; protected TypeAnnotations(Context context) { context.put(typeAnnosKey, this); @@ -101,6 +103,8 @@ log = Log.instance(context); syms = Symtab.instance(context); annotate = Annotate.instance(context); + Options options = Options.instance(context); + typeAnnoAsserts = options.isSet("TypeAnnotationAsserts"); } /** @@ -265,10 +269,6 @@ */ private void separateAnnotationsKinds(JCTree typetree, Type type, Symbol sym, TypeAnnotationPosition pos) { - /* - System.out.printf("separateAnnotationsKinds(typetree: %s, type: %s, symbol: %s, pos: %s%n", - typetree, type, sym, pos); - */ List<Attribute.Compound> annotations = sym.getRawAttributes(); ListBuffer<Attribute.Compound> declAnnos = new ListBuffer<Attribute.Compound>(); ListBuffer<Attribute.TypeCompound> typeAnnos = new ListBuffer<Attribute.TypeCompound>(); @@ -1023,10 +1023,12 @@ @Override public void visitMethodDef(final JCMethodDecl tree) { if (tree.sym == null) { - // Something most be wrong, e.g. a class not found. - // Quietly ignore. (See test FailOver15.java) + if (typeAnnoAsserts) { + Assert.error("Visiting tree node before memberEnter"); + } else { return; } + } if (sigOnly) { if (!tree.mods.annotations.isEmpty()) { // Nothing to do for separateAnnotationsKinds if @@ -1129,6 +1131,9 @@ // Nothing to do for separateAnnotationsKinds if // there are no annotations of either kind. } else if (tree.sym == null) { + if (typeAnnoAsserts) { + Assert.error("Visiting tree node before memberEnter"); + } // Something is wrong already. Quietly ignore. } else if (tree.sym.getKind() == ElementKind.PARAMETER) { // Parameters are handled in visitMethodDef or visitLambda. @@ -1282,9 +1287,9 @@ private void findPosition(JCTree tree, JCTree frame, List<JCAnnotation> annotations) { if (!annotations.isEmpty()) { /* - System.out.println("Finding pos for: " + annotations); - System.out.println(" tree: " + tree + " kind: " + tree.getKind()); - System.out.println(" frame: " + frame + " kind: " + frame.getKind()); + System.err.println("Finding pos for: " + annotations); + System.err.println(" tree: " + tree + " kind: " + tree.getKind()); + System.err.println(" frame: " + frame + " kind: " + frame.getKind()); */ TypeAnnotationPosition p = new TypeAnnotationPosition(); p.onLambda = currentLambda;
--- a/src/share/classes/com/sun/tools/javac/code/Types.java Thu Oct 03 19:28:07 2013 +0100 +++ b/src/share/classes/com/sun/tools/javac/code/Types.java Fri Oct 11 19:05:18 2013 +0100 @@ -244,7 +244,7 @@ public Type visitClassType(ClassType t, Symbol sym) { if (t.tsym == sym) return t; - Type base = asSuper(sym.type, t.tsym); + Type base = asSuper(sym.type, t); if (base == null) return null; ListBuffer<Type> from = new ListBuffer<Type>(); @@ -687,7 +687,7 @@ (t.flags() & SYNTHETIC) == 0; } }; - private boolean pendingBridges(ClassSymbol origin, TypeSymbol s) { + private boolean pendingBridges(ClassSymbol origin, TypeSymbol sym) { //a symbol will be completed from a classfile if (a) symbol has //an associated file object with CLASS kind and (b) the symbol has //not been entered @@ -696,11 +696,11 @@ enter.getEnv(origin) == null) { return false; } - if (origin == s) { + if (origin == sym) { return true; } for (Type t : interfaces(origin.type)) { - if (pendingBridges((ClassSymbol)t.tsym, s)) { + if (pendingBridges((ClassSymbol)t.tsym, sym)) { return true; } } @@ -761,7 +761,7 @@ } else if (t.hasTag(TYPEVAR)) { return isSubtypeUnchecked(t.getUpperBound(), s, warn); } else if (!s.isRaw()) { - Type t2 = asSuper(t, s.tsym); + Type t2 = asSuper(t, s); if (t2 != null && t2.isRaw()) { if (isReifiable(s)) { warn.silentWarn(LintCategory.UNCHECKED); @@ -914,7 +914,7 @@ @Override public Boolean visitClassType(ClassType t, Type s) { - Type sup = asSuper(t, s.tsym); + Type sup = asSuper(t, s); return sup != null && sup.tsym == s.tsym // You're not allowed to write @@ -1935,30 +1935,42 @@ * @param t a type * @param sym a symbol */ - public Type asSuper(Type t, Symbol sym) { - return asSuper.visit(t, sym); + public Type asSuper(Type t, Symbol s) { + return asSuper(t, s.type); + } + + public Type asSuper(Type t, Type s) { + return asSuper.visit(t, s); } // where - private SimpleVisitor<Type,Symbol> asSuper = new SimpleVisitor<Type,Symbol>() { - - public Type visitType(Type t, Symbol sym) { + private SimpleVisitor<Type,Type> asSuper = new SimpleVisitor<Type,Type>() { + + public Type visitType(Type t, Type s) { return null; } @Override - public Type visitClassType(ClassType t, Symbol sym) { - if (t.tsym == sym) + public Type visitClassType(ClassType t, Type s) { + if (t.tsym == s.tsym) return t; Type st = supertype(t); - if (st.hasTag(CLASS) || st.hasTag(TYPEVAR) || st.hasTag(ERROR)) { - Type x = asSuper(st, sym); + + switch(st.getTag()) { + default: break; + case CLASS: + case ARRAY: + case TYPEVAR: + case ERROR: { + Type x = asSuper(st, s); if (x != null) return x; + } break; } - if ((sym.flags() & INTERFACE) != 0) { + + if ((s.tsym.flags() & INTERFACE) != 0) { for (List<Type> l = interfaces(t); l.nonEmpty(); l = l.tail) { - Type x = asSuper(l.head, sym); + Type x = asSuper(l.head, s); if (x != null) return x; } @@ -1967,22 +1979,20 @@ } @Override - public Type visitArrayType(ArrayType t, Symbol sym) { - return isSubtype(t, sym.type) ? sym.type : null; + public Type visitArrayType(ArrayType t, Type s) { + return isSubtype(t, s) ? s : null; } @Override - public Type visitTypeVar(TypeVar t, Symbol sym) { - if (t.tsym == sym) + public Type visitTypeVar(TypeVar t, Type s) { + if (t.tsym == s.tsym) return t; else - return asSuper(t.bound, sym); + return asSuper(t.bound, s); } @Override - public Type visitErrorType(ErrorType t, Symbol sym) { - return t; - } + public Type visitErrorType(ErrorType t, Type s) { return t; } }; /** @@ -3563,9 +3573,9 @@ //step 3 - for each element G in MEC, compute lci(Inv(G)) List<Type> candidates = List.nil(); for (Type erasedSupertype : mec) { - List<Type> lci = List.of(asSuper(ts.head, erasedSupertype.tsym)); + List<Type> lci = List.of(asSuper(ts.head, erasedSupertype)); for (Type t : ts) { - lci = intersect(lci, List.of(asSuper(t, erasedSupertype.tsym))); + lci = intersect(lci, List.of(asSuper(t, erasedSupertype))); } candidates = candidates.appendList(lci); } @@ -3985,7 +3995,7 @@ // The arguments to the supers could be unified here to // get a more accurate analysis while (commonSupers.nonEmpty()) { - Type t1 = asSuper(from, commonSupers.head.tsym); + Type t1 = asSuper(from, commonSupers.head); Type t2 = commonSupers.head; // same as asSuper(to, commonSupers.head.tsym); if (disjointTypes(t1.getTypeArguments(), t2.getTypeArguments())) return false; @@ -4016,7 +4026,7 @@ from = target; } Assert.check((from.tsym.flags() & FINAL) != 0); - Type t1 = asSuper(from, to.tsym); + Type t1 = asSuper(from, to); if (t1 == null) return false; Type t2 = to; if (disjointTypes(t1.getTypeArguments(), t2.getTypeArguments()))
--- a/src/share/classes/com/sun/tools/javac/comp/Annotate.java Thu Oct 03 19:28:07 2013 +0100 +++ b/src/share/classes/com/sun/tools/javac/comp/Annotate.java Fri Oct 11 19:05:18 2013 +0100 @@ -37,6 +37,7 @@ import static com.sun.tools.javac.code.TypeTag.ARRAY; import static com.sun.tools.javac.code.TypeTag.CLASS; import static com.sun.tools.javac.tree.JCTree.Tag.*; +import javax.lang.model.type.ErrorType; /** Enter annotations on symbols. Annotations accumulate in a queue, * which is processed at the top level of any set of recursive calls @@ -317,50 +318,9 @@ expected.tsym.complete(); } catch(CompletionFailure e) { log.error(tree.pos(), "cant.resolve", Kinds.kindName(e.sym), e.sym); - return new Attribute.Error(expected); - } - if (expected.isPrimitive() || types.isSameType(expected, syms.stringType)) { - Type result = attr.attribExpr(tree, env, expected); - if (result.isErroneous()) - return new Attribute.Error(expected); - if (result.constValue() == null) { - log.error(tree.pos(), "attribute.value.must.be.constant"); - return new Attribute.Error(expected); - } - result = cfolder.coerce(result, expected); - return new Attribute.Constant(expected, result.constValue()); + expected = syms.errType; } - if (expected.tsym == syms.classType.tsym) { - Type result = attr.attribExpr(tree, env, expected); - if (result.isErroneous()) { - // Does it look like a class literal? - if (TreeInfo.name(tree) == names._class) { - Name n = (((JCFieldAccess) tree).selected).type.tsym.flatName(); - return new Attribute.UnresolvedClass(expected, - types.createErrorType(n, - syms.unknownSymbol, syms.classType)); - } else { - return new Attribute.Error(expected); - } - } - - // Class literals look like field accesses of a field named class - // at the tree level - if (TreeInfo.name(tree) != names._class) { - log.error(tree.pos(), "annotation.value.must.be.class.literal"); - return new Attribute.Error(expected); - } - return new Attribute.Class(types, - (((JCFieldAccess) tree).selected).type); - } - if ((expected.tsym.flags() & Flags.ANNOTATION) != 0) { - if (!tree.hasTag(ANNOTATION)) { - log.error(tree.pos(), "annotation.value.must.be.annotation"); - expected = syms.errorType; - } - return enterAnnotation((JCAnnotation)tree, expected, env); - } - if (expected.hasTag(ARRAY)) { // should really be isArray() + if (expected.hasTag(ARRAY)) { if (!tree.hasTag(NEWARRAY)) { tree = make.at(tree.pos). NewArray(null, List.<JCExpression>nil(), List.of(tree)); @@ -368,7 +328,6 @@ JCNewArray na = (JCNewArray)tree; if (na.elemtype != null) { log.error(na.elemtype.pos(), "new.not.allowed.in.annotation"); - return new Attribute.Error(expected); } ListBuffer<Attribute> buf = new ListBuffer<Attribute>(); for (List<JCExpression> l = na.elems; l.nonEmpty(); l=l.tail) { @@ -380,20 +339,84 @@ return new Attribute. Array(expected, buf.toArray(new Attribute[buf.length()])); } + if (tree.hasTag(NEWARRAY)) { //error recovery + if (!expected.isErroneous()) + log.error(tree.pos(), "annotation.value.not.allowable.type"); + JCNewArray na = (JCNewArray)tree; + if (na.elemtype != null) { + log.error(na.elemtype.pos(), "new.not.allowed.in.annotation"); + } + for (List<JCExpression> l = na.elems; l.nonEmpty(); l=l.tail) { + enterAttributeValue(syms.errType, + l.head, + env); + } + return new Attribute.Error(syms.errType); + } + if ((expected.tsym.flags() & Flags.ANNOTATION) != 0) { + if (tree.hasTag(ANNOTATION)) { + return enterAnnotation((JCAnnotation)tree, expected, env); + } else { + log.error(tree.pos(), "annotation.value.must.be.annotation"); + expected = syms.errType; + } + } + if (tree.hasTag(ANNOTATION)) { //error recovery + if (!expected.isErroneous()) + log.error(tree.pos(), "annotation.not.valid.for.type", expected); + enterAnnotation((JCAnnotation)tree, syms.errType, env); + return new Attribute.Error(((JCAnnotation)tree).annotationType.type); + } + if (expected.isPrimitive() || types.isSameType(expected, syms.stringType)) { + Type result = attr.attribExpr(tree, env, expected); + if (result.isErroneous()) + return new Attribute.Error(result.getOriginalType()); + if (result.constValue() == null) { + log.error(tree.pos(), "attribute.value.must.be.constant"); + return new Attribute.Error(expected); + } + result = cfolder.coerce(result, expected); + return new Attribute.Constant(expected, result.constValue()); + } + if (expected.tsym == syms.classType.tsym) { + Type result = attr.attribExpr(tree, env, expected); + if (result.isErroneous()) { + // Does it look like an unresolved class literal? + if (TreeInfo.name(tree) == names._class && + ((JCFieldAccess) tree).selected.type.isErroneous()) { + Name n = (((JCFieldAccess) tree).selected).type.tsym.flatName(); + return new Attribute.UnresolvedClass(expected, + types.createErrorType(n, + syms.unknownSymbol, syms.classType)); + } else { + return new Attribute.Error(result.getOriginalType()); + } + } + + // Class literals look like field accesses of a field named class + // at the tree level + if (TreeInfo.name(tree) != names._class) { + log.error(tree.pos(), "annotation.value.must.be.class.literal"); + return new Attribute.Error(syms.errType); + } + return new Attribute.Class(types, + (((JCFieldAccess) tree).selected).type); + } if (expected.hasTag(CLASS) && (expected.tsym.flags() & Flags.ENUM) != 0) { - attr.attribExpr(tree, env, expected); + Type result = attr.attribExpr(tree, env, expected); Symbol sym = TreeInfo.symbol(tree); if (sym == null || TreeInfo.nonstaticSelect(tree) || sym.kind != Kinds.VAR || (sym.flags() & Flags.ENUM) == 0) { log.error(tree.pos(), "enum.annotation.must.be.enum.constant"); - return new Attribute.Error(expected); + return new Attribute.Error(result.getOriginalType()); } VarSymbol enumerator = (VarSymbol) sym; return new Attribute.Enum(expected, enumerator); } + //error recovery: if (!expected.isErroneous()) log.error(tree.pos(), "annotation.value.not.allowable.type"); return new Attribute.Error(attr.attribExpr(tree, env, expected));
--- a/src/share/classes/com/sun/tools/javac/comp/Attr.java Thu Oct 03 19:28:07 2013 +0100 +++ b/src/share/classes/com/sun/tools/javac/comp/Attr.java Fri Oct 11 19:05:18 2013 +0100 @@ -58,6 +58,7 @@ import static com.sun.tools.javac.code.Kinds.ERRONEOUS; import static com.sun.tools.javac.code.TypeTag.*; import static com.sun.tools.javac.code.TypeTag.WILDCARD; +import static com.sun.tools.javac.code.TypeTag.ARRAY; import static com.sun.tools.javac.tree.JCTree.Tag.*; /** This is the main context-dependent analysis phase in GJC. It @@ -791,34 +792,45 @@ Type t = tree.type != null ? tree.type : attribType(tree, env); - return checkBase(t, tree, env, classExpected, interfaceExpected, checkExtensible); + return checkBase(t, tree, env, classExpected, interfaceExpected, false, checkExtensible); } Type checkBase(Type t, JCTree tree, Env<AttrContext> env, boolean classExpected, - boolean interfaceExpected, + boolean interfacesOnlyExpected, + boolean interfacesOrArraysExpected, boolean checkExtensible) { if (t.isErroneous()) return t; - if (t.hasTag(TYPEVAR) && !classExpected && !interfaceExpected) { + if (t.hasTag(TYPEVAR) && !classExpected && + !interfacesOrArraysExpected && !interfacesOnlyExpected) { // check that type variable is already visible if (t.getUpperBound() == null) { log.error(tree.pos(), "illegal.forward.ref"); return types.createErrorType(t); } + } else if (classExpected) { + t = chk.checkClassType(tree.pos(), t, checkExtensible|!allowGenerics); } else { - t = chk.checkClassType(tree.pos(), t, checkExtensible|!allowGenerics); + t = chk.checkClassOrArrayType(tree.pos(), t, + checkExtensible|!allowGenerics); } - if (interfaceExpected && (t.tsym.flags() & INTERFACE) == 0) { + if (interfacesOnlyExpected && !t.tsym.isInterface()) { log.error(tree.pos(), "intf.expected.here"); // return errType is necessary since otherwise there might // be undetected cycles which cause attribution to loop return types.createErrorType(t); + } else if (interfacesOrArraysExpected && + !(t.tsym.isInterface() || t.getTag() == ARRAY)) { + log.error(tree.pos(), "intf.or.array.expected.here"); + // return errType is necessary since otherwise there might + // be undetected cycles which cause attribution to loop + return types.createErrorType(t); } else if (checkExtensible && classExpected && - (t.tsym.flags() & INTERFACE) != 0) { - log.error(tree.pos(), "no.intf.expected.here"); + t.tsym.isInterface()) { + log.error(tree.pos(), "no.intf.expected.here"); return types.createErrorType(t); } if (checkExtensible && @@ -829,6 +841,12 @@ chk.checkNonCyclic(tree.pos(), t); return t; } + //where + private Object asTypeParam(Type t) { + return (t.hasTag(TYPEVAR)) + ? diags.fragment("type.parameter", t) + : t; + } Type attribIdentAsEnumType(Env<AttrContext> env, JCIdent id) { Assert.check((env.enclClass.sym.flags() & ENUM) != 0); @@ -3977,7 +3995,7 @@ Set<Type> boundSet = new HashSet<Type>(); if (bounds.nonEmpty()) { // accept class or interface or typevar as first bound. - bounds.head.type = checkBase(bounds.head.type, bounds.head, env, false, false, false); + bounds.head.type = checkBase(bounds.head.type, bounds.head, env, false, false, false, false); boundSet.add(types.erasure(bounds.head.type)); if (bounds.head.type.isErroneous()) { return bounds.head.type; @@ -3993,7 +4011,7 @@ // if first bound was a class or interface, accept only interfaces // as further bounds. for (JCExpression bound : bounds.tail) { - bound.type = checkBase(bound.type, bound, env, false, true, false); + bound.type = checkBase(bound.type, bound, env, false, false, true, false); if (bound.type.isErroneous()) { bounds = List.of(bound); } @@ -4058,8 +4076,7 @@ } public void visitAnnotation(JCAnnotation tree) { - log.error(tree.pos(), "annotation.not.valid.for.type", pt()); - result = tree.type = syms.errType; + Assert.error("should be handled in Annotate"); } public void visitAnnotatedType(JCAnnotatedType tree) {
--- a/src/share/classes/com/sun/tools/javac/comp/Check.java Thu Oct 03 19:28:07 2013 +0100 +++ b/src/share/classes/com/sun/tools/javac/comp/Check.java Fri Oct 11 19:05:18 2013 +0100 @@ -706,6 +706,37 @@ return t; } + // Analog of checkClassType that calls checkClassOrArrayType instead + Type checkClassOrArrayType(DiagnosticPosition pos, + Type t, boolean noBounds) { + t = checkClassOrArrayType(pos, t); + if (noBounds && t.isParameterized()) { + List<Type> args = t.getTypeArguments(); + while (args.nonEmpty()) { + if (args.head.hasTag(WILDCARD)) + return typeTagError(pos, + diags.fragment("type.req.exact"), + args.head); + args = args.tail; + } + } + return t; + } + + /** Check that type is a reifiable class, interface or array type. + * @param pos Position to be used for error reporting. + * @param t The type to be checked. + */ + Type checkReifiableReferenceType(DiagnosticPosition pos, Type t) { + t = checkClassOrArrayType(pos, t); + if (!t.isErroneous() && !types.isReifiable(t)) { + log.error(pos, "illegal.generic.type.for.instof"); + return types.createErrorType(t); + } else { + return t; + } + } + /** Check that type is a reference type, i.e. a class, interface or array type * or a type variable. * @param pos Position to be used for error reporting. @@ -2210,6 +2241,9 @@ seen = seen.prepend(tv); for (Type b : types.getBounds(tv)) checkNonCyclic1(pos, b, seen); + } else if (t.hasTag(ARRAY)) { + final ArrayType at = (ArrayType)t.unannotatedType(); + checkNonCyclic1(pos, at.elemtype, seen); } } @@ -3386,15 +3420,14 @@ sym.name != names.error && (!staticImport || !e.isStaticallyImported())) { if (!e.sym.type.isErroneous()) { - String what = e.sym.toString(); if (!isClassDecl) { if (staticImport) - log.error(pos, "already.defined.static.single.import", what); + log.error(pos, "already.defined.static.single.import", e.sym); else - log.error(pos, "already.defined.single.import", what); + log.error(pos, "already.defined.single.import", e.sym); } else if (sym != e.sym) - log.error(pos, "already.defined.this.unit", what); + log.error(pos, "already.defined.this.unit", e.sym); } return false; }
--- a/src/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java Thu Oct 03 19:28:07 2013 +0100 +++ b/src/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java Fri Oct 11 19:05:18 2013 +0100 @@ -128,10 +128,9 @@ private KlassInfo(Symbol kSym) { appendedMethodList = new ListBuffer<>(); deserializeCases = new HashMap<String, ListBuffer<JCStatement>>(); - long flags = PRIVATE | STATIC | SYNTHETIC; MethodType type = new MethodType(List.of(syms.serializedLambdaType), syms.objectType, List.<Type>nil(), syms.methodClass); - deserMethodSym = makeSyntheticMethod(flags, names.deserializeLambda, type, kSym); + deserMethodSym = makePrivateSyntheticMethod(STATIC, names.deserializeLambda, type, kSym); deserParamSym = new VarSymbol(FINAL, names.fromString("lambda"), syms.serializedLambdaType, deserMethodSym); } @@ -671,8 +670,8 @@ /** * Create new synthetic method with given flags, name, type, owner */ - private MethodSymbol makeSyntheticMethod(long flags, Name name, Type type, Symbol owner) { - return new MethodSymbol(flags | SYNTHETIC, name, type, owner); + private MethodSymbol makePrivateSyntheticMethod(long flags, Name name, Type type, Symbol owner) { + return new MethodSymbol(flags | SYNTHETIC | PRIVATE, name, type, owner); } /** @@ -1067,12 +1066,12 @@ } else { if (refSym.isStatic()) { return ClassFile.REF_invokeStatic; + } else if ((refSym.flags() & PRIVATE) != 0) { + return ClassFile.REF_invokeSpecial; } else if (refSym.enclClass().isInterface()) { return ClassFile.REF_invokeInterface; } else { - return (refSym.flags() & PRIVATE) != 0 ? - ClassFile.REF_invokeSpecial : - ClassFile.REF_invokeVirtual; + return ClassFile.REF_invokeVirtual; } } } @@ -1480,7 +1479,7 @@ //static clinits are generated in Gen - so we need to fake them Symbol clinit = clinits.get(csym); if (clinit == null) { - clinit = makeSyntheticMethod(STATIC, + clinit = makePrivateSyntheticMethod(STATIC, names.clinit, new MethodType(List.<Type>nil(), syms.voidType, List.<Type>nil(), syms.methodClass), csym); @@ -1729,7 +1728,7 @@ self = ((JCVariableDecl)frame.tree).sym; } Name name = isSerializable() ? serializedLambdaName(owner) : lambdaName(); - this.translatedSym = makeSyntheticMethod(0, name, null, owner.enclClass()); + this.translatedSym = makePrivateSyntheticMethod(0, name, null, owner.enclClass()); if (dumpLambdaToMethodStats) { log.note(tree, "lambda.stat", needsAltMetafactory(), translatedSym); } @@ -1845,9 +1844,9 @@ // If instance access isn't needed, make it static. // Interface instance methods must be default methods. - // Awaiting VM channges, default methods are public + // Lambda methods are private synthetic. translatedSym.flags_field = SYNTHETIC | - ((inInterface && thisReferenced)? PUBLIC : PRIVATE) | + PRIVATE | (thisReferenced? (inInterface? DEFAULT : 0) : STATIC); //compute synthetic params @@ -1890,7 +1889,7 @@ super(tree); this.isSuper = tree.hasKind(ReferenceKind.SUPER); this.bridgeSym = needsBridge() - ? makeSyntheticMethod(isSuper ? 0 : STATIC, + ? makePrivateSyntheticMethod(isSuper ? 0 : STATIC, lambdaName().append(names.fromString("$bridge")), null, owner.enclClass()) : null;
--- a/src/share/classes/com/sun/tools/javac/comp/Lower.java Thu Oct 03 19:28:07 2013 +0100 +++ b/src/share/classes/com/sun/tools/javac/comp/Lower.java Fri Oct 11 19:05:18 2013 +0100 @@ -2172,6 +2172,18 @@ * Code for enabling/disabling assertions. *************************************************************************/ + private ClassSymbol assertionsDisabledClassCache; + + /**Used to create an auxiliary class to hold $assertionsDisabled for interfaces. + */ + private ClassSymbol assertionsDisabledClass() { + if (assertionsDisabledClassCache != null) return assertionsDisabledClassCache; + + assertionsDisabledClassCache = makeEmptyClass(STATIC | SYNTHETIC, outermostClassDef.sym).sym; + + return assertionsDisabledClassCache; + } + // This code is not particularly robust if the user has // previously declared a member named '$assertionsDisabled'. // The same faulty idiom also appears in the translation of @@ -2182,8 +2194,9 @@ // Outermost class may be either true class or an interface. ClassSymbol outermostClass = outermostClassDef.sym; - // note that this is a class, as an interface can't contain a statement. - ClassSymbol container = currentClass; + //only classes can hold a non-public field, look for a usable one: + ClassSymbol container = !currentClass.isInterface() ? currentClass : + assertionsDisabledClass(); VarSymbol assertDisabledSym = (VarSymbol)lookupSynthetic(dollarAssertionsDisabled, @@ -2208,6 +2221,16 @@ JCVariableDecl assertDisabledDef = make.VarDef(assertDisabledSym, notStatus); containerDef.defs = containerDef.defs.prepend(assertDisabledDef); + + if (currentClass.isInterface()) { + //need to load the assertions enabled/disabled state while + //initializing the interface: + JCClassDecl currentClassDef = classDef(currentClass); + make_at(currentClassDef.pos()); + JCStatement dummy = make.If(make.QualIdent(assertDisabledSym), make.Skip(), null); + JCBlock clinit = make.Block(STATIC, List.<JCStatement>of(dummy)); + currentClassDef.defs = currentClassDef.defs.prepend(clinit); + } } make_at(pos); return makeUnary(NOT, make.Ident(assertDisabledSym)); @@ -3929,6 +3952,7 @@ accessConstrTags = null; accessed = null; enumSwitchMap.clear(); + assertionsDisabledClassCache = null; } return translated.toList(); }
--- a/src/share/classes/com/sun/tools/javac/comp/MemberEnter.java Thu Oct 03 19:28:07 2013 +0100 +++ b/src/share/classes/com/sun/tools/javac/comp/MemberEnter.java Fri Oct 11 19:05:18 2013 +0100 @@ -114,12 +114,15 @@ deferredLintHandler = DeferredLintHandler.instance(context); lint = Lint.instance(context); allowTypeAnnos = source.allowTypeAnnotations(); + allowRepeatedAnnos = source.allowRepeatedAnnotations(); } /** Switch: support type annotations. */ boolean allowTypeAnnos; + boolean allowRepeatedAnnos; + /** A queue for classes whose members still need to be entered into the * symbol table. */ @@ -640,9 +643,6 @@ if (TreeInfo.isEnumInit(tree)) { attr.attribIdentAsEnumType(localEnv, (JCIdent)tree.vartype); } else { - // Make sure type annotations are processed. - // But we don't have a symbol to attach them to yet - use null. - typeAnnotate(tree.vartype, env, null, tree.pos()); attr.attribType(tree.vartype, localEnv); if (tree.nameexpr != null) { attr.attribExpr(tree.nameexpr, localEnv); @@ -693,7 +693,6 @@ } annotateLater(tree.mods.annotations, localEnv, v, tree.pos()); typeAnnotate(tree.vartype, env, v, tree.pos()); - annotate.flush(); v.pos = tree.pos; } // where @@ -906,14 +905,14 @@ } if (annotated.containsKey(a.type.tsym)) { - if (source.allowRepeatedAnnotations()) { - ListBuffer<Attribute.Compound> l = annotated.get(a.type.tsym); - l = l.append(c); - annotated.put(a.type.tsym, l); - pos.put(c, a.pos()); - } else { - log.error(a.pos(), "duplicate.annotation"); + if (!allowRepeatedAnnos) { + log.error(a.pos(), "repeatable.annotations.not.supported.in.source"); + allowRepeatedAnnos = true; } + ListBuffer<Attribute.Compound> l = annotated.get(a.type.tsym); + l = l.append(c); + annotated.put(a.type.tsym, l); + pos.put(c, a.pos()); } else { annotated.put(a.type.tsym, ListBuffer.of(c)); pos.put(c, a.pos()); @@ -1081,7 +1080,6 @@ // Do this here, where we have the symbol. for (JCTypeParameter tp : tree.typarams) typeAnnotate(tp, baseEnv, sym, tree.pos()); - annotate.flush(); // Add default constructor if needed. if ((c.flags() & INTERFACE) == 0 && @@ -1197,7 +1195,7 @@ annotated.put(a.type.tsym, l); pos.put(tc, a.pos()); } else { - log.error(a.pos(), "duplicate.annotation"); + log.error(a.pos(), "repeatable.annotations.not.supported.in.source"); } } else { annotated.put(a.type.tsym, ListBuffer.of(tc)); @@ -1381,7 +1379,7 @@ if (!t.hasTag(ERROR)) return t; - return new ErrorType(((ErrorType) t).getOriginalType(), t.tsym) { + return new ErrorType(t.getOriginalType(), t.tsym) { private Type modelType; @Override
--- a/src/share/classes/com/sun/tools/javac/jvm/ClassReader.java Thu Oct 03 19:28:07 2013 +0100 +++ b/src/share/classes/com/sun/tools/javac/jvm/ClassReader.java Fri Oct 11 19:05:18 2013 +0100 @@ -1993,11 +1993,15 @@ (flags & ABSTRACT) == 0 && !name.equals(names.clinit)) { if (majorVersion > Target.JDK1_8.majorVersion || (majorVersion == Target.JDK1_8.majorVersion && minorVersion >= Target.JDK1_8.minorVersion)) { - currentOwner.flags_field |= DEFAULT; - flags |= DEFAULT | ABSTRACT; + if ((flags & STATIC) == 0) { + currentOwner.flags_field |= DEFAULT; + flags |= DEFAULT | ABSTRACT; + } } else { //protect against ill-formed classfiles - throw new CompletionFailure(currentOwner, "default method found in pre JDK 8 classfile"); + throw badClassFile((flags & STATIC) == 0 ? "invalid.default.interface" : "invalid.static.interface", + Integer.toString(majorVersion), + Integer.toString(minorVersion)); } } if (name == names.init && currentOwner.hasOuterInstance()) {
--- a/src/share/classes/com/sun/tools/javac/jvm/Gen.java Thu Oct 03 19:28:07 2013 +0100 +++ b/src/share/classes/com/sun/tools/javac/jvm/Gen.java Fri Oct 11 19:05:18 2013 +0100 @@ -104,6 +104,8 @@ */ private LVTRanges lvtRanges; + private final boolean typeAnnoAsserts; + protected Gen(Context context) { context.put(genKey, this); @@ -140,6 +142,7 @@ debugCode = options.isSet("debugcode"); allowInvokedynamic = target.hasInvokedynamic() || options.isSet("invokedynamic"); pool = new Pool(types); + typeAnnoAsserts = options.isSet("TypeAnnotationAsserts"); generateIproxies = target.requiresIproxy() || @@ -562,9 +565,13 @@ ListBuffer<Attribute.TypeCompound> fieldTAs = new ListBuffer<Attribute.TypeCompound>(); ListBuffer<Attribute.TypeCompound> nonfieldTAs = new ListBuffer<Attribute.TypeCompound>(); for (TypeCompound ta : tas) { - if (ta.position.type == TargetType.FIELD) { + if (ta.getPosition().type == TargetType.FIELD) { fieldTAs.add(ta); } else { + if (typeAnnoAsserts) { + Assert.error("Type annotation does not have a valid positior"); + } + nonfieldTAs.add(ta); } }
--- a/src/share/classes/com/sun/tools/javac/jvm/Pool.java Thu Oct 03 19:28:07 2013 +0100 +++ b/src/share/classes/com/sun/tools/javac/jvm/Pool.java Fri Oct 11 19:05:18 2013 +0100 @@ -296,7 +296,10 @@ interfaceOwner = true; staticOk = true; case ClassFile.REF_invokeVirtual: + expectedKind = Kinds.MTH; + break; case ClassFile.REF_invokeSpecial: + interfaceOwner = true; expectedKind = Kinds.MTH; break; }
--- a/src/share/classes/com/sun/tools/javac/main/JavaCompiler.java Thu Oct 03 19:28:07 2013 +0100 +++ b/src/share/classes/com/sun/tools/javac/main/JavaCompiler.java Fri Oct 11 19:05:18 2013 +0100 @@ -1743,13 +1743,4 @@ shouldStopPolicyIfError = prev.shouldStopPolicyIfError; shouldStopPolicyIfNoError = prev.shouldStopPolicyIfNoError; } - - public static void enableLogging() { - Logger logger = Logger.getLogger(com.sun.tools.javac.Main.class.getPackage().getName()); - logger.setLevel(Level.ALL); - for (Handler h : logger.getParent().getHandlers()) { - h.setLevel(Level.ALL); - } - - } }
--- a/src/share/classes/com/sun/tools/javac/model/JavacAnnoConstructs.java Thu Oct 03 19:28:07 2013 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,445 +0,0 @@ -/* - * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package com.sun.tools.javac.model; - -import java.lang.annotation.Annotation; -import java.lang.annotation.Inherited; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; - -import com.sun.tools.javac.code.Attribute; -import com.sun.tools.javac.code.Kinds; -import com.sun.tools.javac.code.Symbol; -import com.sun.tools.javac.code.Symbol.ClassSymbol; -import com.sun.tools.javac.code.Symbol.TypeVariableSymbol; -import com.sun.tools.javac.code.TargetType; -import com.sun.tools.javac.code.Type; -import com.sun.tools.javac.code.Type.AnnotatedType; -import com.sun.tools.javac.util.ListBuffer; -import static com.sun.tools.javac.code.TypeTag.CLASS; -import com.sun.tools.javac.util.List; - -/** - * Utility methods for operating on annotated constructs. - * - * <p><b>This is NOT part of any supported API. - * If you write code that depends on this, you do so at your own - * risk. This code and its internal interfaces are subject to change - * or deletion without notice.</b></p> - */ -public class JavacAnnoConstructs { - - // <editor-fold defaultstate="collapsed" desc="Symbols"> - - /** - * An internal-use utility that creates a runtime view of an - * annotation. This is the implementation of - * Element.getAnnotation(Class). - */ - public static <A extends Annotation> A getAnnotation(Symbol annotated, - Class<A> annoType) { - if (!annoType.isAnnotation()) - throw new IllegalArgumentException("Not an annotation type: " - + annoType); - Attribute.Compound c; - if (annotated.kind == Kinds.TYP && - annotated instanceof ClassSymbol) { - c = getAttributeOnClass((ClassSymbol)annotated, annoType); - } else if (annotated.kind == Kinds.TYP && - annotated instanceof TypeVariableSymbol) { - c = getAttributeOnTypeVariable((TypeVariableSymbol)annotated, annoType); - } else { - c = getAttribute(annotated, annoType); - } - return c == null ? null : AnnotationProxyMaker.generateAnnotation(c, annoType); - } - - // Helper to getAnnotation[s] - private static <A extends Annotation> Attribute.Compound getAttribute(Symbol annotated, - Class<A> annoType) { - String name = annoType.getName(); - - for (Attribute.Compound anno : annotated.getRawAttributes()) { - if (name.equals(anno.type.tsym.flatName().toString())) - return anno; - } - - return null; - } - - // Helper to getAnnotation[s] - private static <A extends Annotation> Attribute.Compound - getAttributeOnTypeVariable(TypeVariableSymbol annotated, Class<A> annoType) { - String name = annoType.getName(); - - // Declaration annotations on type variables are stored in type attributes - // on the owner of the TypeVariableSymbol - List<Attribute.Compound> res = List.nil(); - List<Attribute.TypeCompound> candidates = annotated.owner.getRawTypeAttributes(); - for (Attribute.TypeCompound anno : candidates) - if (anno.position.type == TargetType.CLASS_TYPE_PARAMETER || - anno.position.type == TargetType.METHOD_TYPE_PARAMETER) - if (name.equals(anno.type.tsym.flatName().toString())) - return anno; - - return null; - } - - // Helper to getAnnotation[s] - private static <A extends Annotation> Attribute.Compound getAttributeOnClass( - ClassSymbol annotated, - final Class<A> annoType) - { - boolean inherited = annoType.isAnnotationPresent(Inherited.class); - Attribute.Compound result = null; - - result = getAttribute(annotated, annoType); - if (result != null || !inherited) - return result; - - while ((annotated = nextSupertypeToSearch(annotated)) != null) { - result = getAttribute(annotated, annoType); - if (result != null) - return result; - } - return null; // no more supertypes to search - } - - /** - * Returns the next type to search for inherited annotations or {@code null} - * if the next type can't be found. - */ - private static ClassSymbol nextSupertypeToSearch(ClassSymbol annotated) { - if (annotated.name == annotated.name.table.names.java_lang_Object) - return null; - - Type sup = annotated.getSuperclass(); - if (!sup.hasTag(CLASS) || sup.isErroneous()) - return null; - - return (ClassSymbol) sup.tsym; - } - - /** - * An internal-use utility that creates a runtime view of - * annotations. This is the implementation of - * Element.getAnnotations(Class). - */ - public static <A extends Annotation> A[] getAnnotationsByType(Symbol annotated, - Class<A> annoType) - { - if (!annoType.isAnnotation()) - throw new IllegalArgumentException("Not an annotation type: " - + annoType); - // If annoType does not declare a container this is equivalent to wrapping - // getAnnotation(...) in an array. - Class <? extends Annotation> containerType = getContainer(annoType); - if (containerType == null) { - A res = getAnnotation(annotated, annoType); - int size; - if (res == null) { - size = 0; - } else { - size = 1; - } - @SuppressWarnings("unchecked") // annoType is the Class for A - A[] arr = (A[])java.lang.reflect.Array.newInstance(annoType, size); - if (res != null) - arr[0] = res; - return arr; - } - - // So we have a containing type - String annoTypeName = annoType.getName(); - String containerTypeName = containerType.getName(); - int directIndex = -1, containerIndex = -1; - Attribute.Compound direct = null, container = null; - // Find directly (explicit or implicit) present annotations - int index = -1; - for (List<Attribute.Compound> list = annotated.getAnnotationMirrors(); - !list.isEmpty(); - list = list.tail) { - Attribute.Compound attribute = list.head; - index++; - if (attribute.type.tsym.flatName().contentEquals(annoTypeName)) { - directIndex = index; - direct = attribute; - } else if(containerTypeName != null && - attribute.type.tsym.flatName().contentEquals(containerTypeName)) { - containerIndex = index; - container = attribute; - } - } - - // Deal with inherited annotations - if (direct == null && container == null) { - if (annotated.kind == Kinds.TYP && - (annotated instanceof ClassSymbol)) { - ClassSymbol s = nextSupertypeToSearch((ClassSymbol)annotated); - if (s != null) - return getAnnotationsByType(s, annoType); - } - } - - // Pack them in an array - Attribute[] contained0 = null; - if (container != null) - contained0 = unpackAttributes(container); - ListBuffer<Attribute.Compound> compounds = new ListBuffer<>(); - if (contained0 != null) { - for (Attribute a : contained0) - if (a instanceof Attribute.Compound) - compounds = compounds.append((Attribute.Compound)a); - } - Attribute.Compound[] contained = compounds.toArray(new Attribute.Compound[compounds.size()]); - - int size = (direct == null ? 0 : 1) + contained.length; - @SuppressWarnings("unchecked") // annoType is the Class for A - A[] arr = (A[])java.lang.reflect.Array.newInstance(annoType, size); - - // if direct && container, which is first? - int insert = -1; - int length = arr.length; - if (directIndex >= 0 && containerIndex >= 0) { - if (directIndex < containerIndex) { - arr[0] = AnnotationProxyMaker.generateAnnotation(direct, annoType); - insert = 1; - } else { - arr[arr.length - 1] = AnnotationProxyMaker.generateAnnotation(direct, annoType); - insert = 0; - length--; - } - } else if (directIndex >= 0) { - arr[0] = AnnotationProxyMaker.generateAnnotation(direct, annoType); - return arr; - } else { - // Only container - insert = 0; - } - - for (int i = 0; i + insert < length; i++) - arr[insert + i] = AnnotationProxyMaker.generateAnnotation(contained[i], annoType); - - return arr; - } - - // </editor-fold> - - // <editor-fold defaultstate="collapsed" desc="Types"> - - /** - * An internal-use utility that creates a runtime view of an - * annotation. This is the implementation of - * TypeMirror.getAnnotation(Class). - */ - public static <A extends Annotation> A getAnnotation(AnnotatedType annotated, Class<A> annoType) { - if (!annoType.isAnnotation()) - throw new IllegalArgumentException("Not an annotation type: " - + annoType); - Attribute.Compound c = getAttribute(annotated, annoType); - return c == null ? null : AnnotationProxyMaker.generateAnnotation(c, annoType); - } - - // Helper to getAnnotation[s] - private static <A extends Annotation> Attribute.Compound getAttribute(Type annotated, - Class<A> annoType) { - String name = annoType.getName(); - - for (Attribute.Compound anno : annotated.getAnnotationMirrors()) { - if (name.equals(anno.type.tsym.flatName().toString())) - return anno; - } - - return null; - } - - /** - * An internal-use utility that creates a runtime view of - * annotations. This is the implementation of - * TypeMirror.getAnnotationsByType(Class). - */ - public static <A extends Annotation> A[] getAnnotationsByType(AnnotatedType annotated, Class<A> annoType) { - if (!annoType.isAnnotation()) - throw new IllegalArgumentException("Not an annotation type: " - + annoType); - // If annoType does not declare a container this is equivalent to wrapping - // getAnnotation(...) in an array. - Class <? extends Annotation> containerType = getContainer(annoType); - if (containerType == null) { - A res = getAnnotation(annotated, annoType); - int size; - if (res == null) { - size = 0; - } else { - size = 1; - } - @SuppressWarnings("unchecked") // annoType is the Class for A - A[] arr = (A[])java.lang.reflect.Array.newInstance(annoType, size); - if (res != null) - arr[0] = res; - return arr; - } - - // So we have a containing type - String annoTypeName = annoType.getName(); - String containerTypeName = containerType.getName(); - int directIndex = -1, containerIndex = -1; - Attribute.Compound direct = null, container = null; - // Find directly (explicit or implicit) present annotations - int index = -1; - for (List<? extends Attribute.Compound> list = annotated.getAnnotationMirrors(); - !list.isEmpty(); - list = list.tail) { - Attribute.Compound attribute = list.head; - index++; - if (attribute.type.tsym.flatName().contentEquals(annoTypeName)) { - directIndex = index; - direct = attribute; - } else if(containerTypeName != null && - attribute.type.tsym.flatName().contentEquals(containerTypeName)) { - containerIndex = index; - container = attribute; - } - } - - // Pack them in an array - Attribute[] contained0 = null; - if (container != null) - contained0 = unpackAttributes(container); - ListBuffer<Attribute.Compound> compounds = new ListBuffer<>(); - if (contained0 != null) { - for (Attribute a : contained0) - if (a instanceof Attribute.Compound) - compounds = compounds.append((Attribute.Compound)a); - } - Attribute.Compound[] contained = compounds.toArray(new Attribute.Compound[compounds.size()]); - - int size = (direct == null ? 0 : 1) + contained.length; - @SuppressWarnings("unchecked") // annoType is the Class for A - A[] arr = (A[])java.lang.reflect.Array.newInstance(annoType, size); - - // if direct && container, which is first? - int insert = -1; - int length = arr.length; - if (directIndex >= 0 && containerIndex >= 0) { - if (directIndex < containerIndex) { - arr[0] = AnnotationProxyMaker.generateAnnotation(direct, annoType); - insert = 1; - } else { - arr[arr.length - 1] = AnnotationProxyMaker.generateAnnotation(direct, annoType); - insert = 0; - length--; - } - } else if (directIndex >= 0) { - arr[0] = AnnotationProxyMaker.generateAnnotation(direct, annoType); - return arr; - } else { - // Only container - insert = 0; - } - - for (int i = 0; i + insert < length; i++) - arr[insert + i] = AnnotationProxyMaker.generateAnnotation(contained[i], annoType); - - return arr; - } - - // </editor-fold> - - // <editor-fold defaultstate="collapsed" desc="Container support"> - - // Needed to unpack the runtime view of containing annotations - private static final Class<? extends Annotation> REPEATABLE_CLASS = initRepeatable(); - private static final Method VALUE_ELEMENT_METHOD = initValueElementMethod(); - - private static Class<? extends Annotation> initRepeatable() { - try { - // Repeatable will not be available when bootstrapping on - // JDK 7 so use a reflective lookup instead of a class - // literal for Repeatable.class. - return Class.forName("java.lang.annotation.Repeatable").asSubclass(Annotation.class); - } catch (ClassNotFoundException e) { - return null; - } catch (SecurityException e) { - return null; - } - } - - private static Method initValueElementMethod() { - if (REPEATABLE_CLASS == null) - return null; - - Method m = null; - try { - m = REPEATABLE_CLASS.getMethod("value"); - if (m != null) - m.setAccessible(true); - return m; - } catch (NoSuchMethodException e) { - return null; - } - } - - // Helper to getAnnotations - private static Class<? extends Annotation> getContainer(Class<? extends Annotation> annoType) { - // Since we can not refer to java.lang.annotation.Repeatable until we are - // bootstrapping with java 8 we need to get the Repeatable annotation using - // reflective invocations instead of just using its type and element method. - if (REPEATABLE_CLASS != null && - VALUE_ELEMENT_METHOD != null) { - // Get the Repeatable instance on the annotations declaration - Annotation repeatable = (Annotation)annoType.getAnnotation(REPEATABLE_CLASS); - if (repeatable != null) { - try { - // Get the value element, it should be a class - // indicating the containing annotation type - @SuppressWarnings("unchecked") - Class<? extends Annotation> containerType = (Class)VALUE_ELEMENT_METHOD.invoke(repeatable); - if (containerType == null) - return null; - - return containerType; - } catch (ClassCastException e) { - return null; - } catch (IllegalAccessException e) { - return null; - } catch (InvocationTargetException e ) { - return null; - } - } - } - return null; - } - - // Helper to getAnnotations - private static Attribute[] unpackAttributes(Attribute.Compound container) { - // We now have an instance of the container, - // unpack it returning an instance of the - // contained type or null - return ((Attribute.Array)container.member(container.type.tsym.name.table.names.value)).values; - } - - // </editor-fold> -}
--- a/src/share/classes/com/sun/tools/javac/parser/JavacParser.java Thu Oct 03 19:28:07 2013 +0100 +++ b/src/share/classes/com/sun/tools/javac/parser/JavacParser.java Fri Oct 11 19:05:18 2013 +0100 @@ -3002,8 +3002,9 @@ int pos = token.pos; Name name; if (lambdaParameter && token.kind == UNDERSCORE) { - syntaxError(pos, "expected", IDENTIFIER); + log.error(pos, "underscore.as.identifier.in.lambda"); name = token.name(); + nextToken(); } else { if (allowThisIdent) { JCExpression pn = qualident(false);
--- a/src/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java Thu Oct 03 19:28:07 2013 +0100 +++ b/src/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java Fri Oct 11 19:05:18 2013 +0100 @@ -1034,6 +1034,13 @@ } else { discoverAndRunProcs(context, annotationsPresent, topLevelClasses, packageInfoFiles); } + } catch (Throwable t) { + // we're specifically expecting Abort here, but if any Throwable + // comes by, we should flush all deferred diagnostics, rather than + // drop them on the ground. + deferredDiagnosticHandler.reportDeferredDiagnostics(); + log.popDiagnosticHandler(deferredDiagnosticHandler); + throw t; } finally { if (!taskListener.isEmpty()) taskListener.finished(new TaskEvent(TaskEvent.Kind.ANNOTATION_PROCESSING_ROUND));
--- a/src/share/classes/com/sun/tools/javac/resources/compiler.properties Thu Oct 03 19:28:07 2013 +0100 +++ b/src/share/classes/com/sun/tools/javac/resources/compiler.properties Fri Oct 11 19:05:18 2013 +0100 @@ -78,26 +78,26 @@ # 0: string compiler.err.already.defined.single.import=\ - {0} is already defined in a single-type import + a type with the same simple name is already defined by the single-type-import of {0} # 0: string compiler.err.already.defined.static.single.import=\ - {0} is already defined in a static single-type import + a type with the same simple name is already defined by the static single-type-import of {0} compiler.err.already.defined.this.unit=\ {0} is already defined in this compilation unit # 0: type, 1: list of name compiler.err.annotation.missing.default.value=\ - annotation {0} is missing value for the attribute {1} + annotation @{0} is missing a default value for the element ''{1}'' # 0: type, 1: list of name compiler.err.annotation.missing.default.value.1=\ - annotation {0} is missing values for attributes {1} + annotation @{0} is missing default values for elements {1} # 0: type compiler.err.annotation.not.valid.for.type=\ - annotation not valid for a value of type {0} + annotation not valid for an element of type {0} compiler.err.annotation.type.not.applicable=\ annotation type not applicable to this kind of declaration @@ -135,7 +135,7 @@ array required, but {0} found compiler.err.attribute.value.must.be.constant=\ - attribute value must be constant + element value must be a constant expression # 0: statement type compiler.err.bad.initializer=\ @@ -298,8 +298,9 @@ compiler.err.cyclic.inheritance=\ cyclic inheritance involving {0} +# 0: symbol compiler.err.cyclic.annotation.element=\ - cyclic annotation element type + type of element {0} is cyclic # 0: unused compiler.err.call.to.super.not.allowed.in.enum.ctor=\ @@ -307,73 +308,70 @@ # 0: type compiler.err.no.superclass=\ - {0} has no superclass + {0} has no superclass. # 0: symbol, 1: type, 2: symbol, 3: type, 4: unused compiler.err.concrete.inheritance.conflict=\ methods {0} from {1} and {2} from {3} are inherited with the same signature compiler.err.default.allowed.in.intf.annotation.member=\ - default value only allowed in an @interface member + default value only allowed in an annotation type declaration # 0: symbol compiler.err.doesnt.exist=\ package {0} does not exist -compiler.err.duplicate.annotation=\ - duplicate annotation - # 0: type compiler.err.duplicate.annotation.invalid.repeated=\ - annotation {0} cannot be repeated\nIt does not define a valid containing annotation. + annotation {0} is not a valid repeatable annotation # 0: name, 1: type compiler.err.duplicate.annotation.member.value=\ - duplicate annotation member value {0} in {1} - -# 0: type, 1: type + duplicate element ''{0}'' in annotation @{1}. + +# 0: name, 1: unused compiler.err.duplicate.annotation.missing.container=\ - duplicate annotation: the declaration of {0} does not have a valid {1} annotation - -# 0: type + {0} is not a repeatable annotation type + +# 0: type, 1: unused compiler.err.invalid.repeatable.annotation=\ - duplicate annotation: {0} is annotated with an invalid Repeatable annotation + duplicate annotation: {0} is annotated with an invalid @Repeatable annotation # 0: symbol or type compiler.err.invalid.repeatable.annotation.no.value=\ - duplicate annotation: {0} is not a valid Repeatable, no value element method declared + {0} is not a valid @Repeatable, no value element method declared # 0: type, 1: number compiler.err.invalid.repeatable.annotation.multiple.values=\ - duplicate annotation: {0} is not a valid Repeatable, {1} value element methods declared + {0} is not a valid @Repeatable, {1} element methods named ''value'' declared # 0: type compiler.err.invalid.repeatable.annotation.invalid.value=\ - duplicate annotation: {0} is not a valid Repeatable: invalid value element - -# 0: symbol type, 1: type, 2: type + {0} is not a valid @Repeatable: invalid value element + +# 0: symbol type, 1: unused, 2: type compiler.err.invalid.repeatable.annotation.value.return=\ - duplicate annotation: value element of containing annotation {0} should have type {2}, found {1} + containing annotation type ({0}) must declare an element named ''value'' of type {2} # 0: symbol or type, 1: symbol compiler.err.invalid.repeatable.annotation.elem.nondefault=\ - containing annotation {0} does not have a default value for element {1} - -# 0: symbol, 1: type, 2: symbol, 3: type + containing annotation type ({0}) does not have a default value for element {1} + +# 0: symbol, 1: unused, 2: symbol, 3: unused compiler.err.invalid.repeatable.annotation.retention=\ - containing annotation {0} has shorter retention ({1}) than the contained annotation {2} with retention {3} + retention of containing annotation type ({0}) is shorter than the retention of repeatable annotation type ({2}) # 0: symbol, 1: symbol compiler.err.invalid.repeatable.annotation.not.documented=\ - containing annotation type, {0}, is not @Documented while repeated annotation type, {1}, is + repeatable annotation type ({1}) is @Documented while containing annotation type ({0}) is not # 0: symbol, 1: symbol compiler.err.invalid.repeatable.annotation.not.inherited=\ - containing annotation type, {0}, is not @Inherited while repeated annotation type, {1}, is + repeatable annotation type ({1}) is @Inherited while containing annotation type ({0}) is not # 0: symbol, 1: symbol compiler.err.invalid.repeatable.annotation.incompatible.target=\ - target of container annotation {0} is not a subset of target of repeated annotation {1} + containing annotation type ({0}) is applicable to more targets than repeatable annotation type ({1}) # 0: symbol compiler.err.invalid.repeatable.annotation.repeated.and.container.present=\ @@ -561,26 +559,31 @@ integer number too large: {0} compiler.err.intf.annotation.members.cant.have.params=\ - @interface members may not have parameters - + elements in annotation type declarations cannot declare formal parameters + +# 0: symbol compiler.err.intf.annotation.cant.have.type.params=\ - @interface may not have type parameters + annotation type {0} cannot be generic compiler.err.intf.annotation.members.cant.have.type.params=\ - @interface members may not have type parameters + elements in annotation type declarations cannot be generic methods # 0: symbol, 1: type compiler.err.intf.annotation.member.clash=\ - @interface member clashes with method ''{0}'' in {1} + annotation type {1} declares an element with the same name as method {0} compiler.err.intf.expected.here=\ interface expected here +compiler.err.intf.or.array.expected.here=\ + interface or array type expected here + compiler.err.intf.meth.cant.have.body=\ interface abstract methods cannot have body +# 0: symbol compiler.err.invalid.annotation.member.type=\ - invalid type for annotation member + invalid type for element {0} of annotation type compiler.err.invalid.binary.number=\ binary numbers must contain at least one binary digit @@ -1699,6 +1702,7 @@ cannot access {0}\n\ {1} +# 0: file name, 1: message segment compiler.misc.bad.class.file.header=\ bad class file: {0}\n\ {1}\n\ @@ -1744,6 +1748,14 @@ compiler.misc.class.file.not.found=\ class file for {0} not found +# 0: classfile major version, 1: classfile minor version +compiler.misc.invalid.default.interface=\ + default method found in version {0}.{1} classfile + +# 0: classfile major version, 1: classfile minor version +compiler.misc.invalid.static.interface=\ + static method found in version {0}.{1} classfile + # 0: name compiler.misc.file.doesnt.contain.class=\ file does not contain class {0} @@ -2224,6 +2236,10 @@ ''_'' used as an identifier\n\ (use of ''_'' as an identifier might not be supported in releases after Java SE 8) +compiler.err.underscore.as.identifier.in.lambda=\ + ''_'' used as an identifier\n\ + (use of ''_'' as an identifier is forbidden for lambda parameters) + compiler.err.enum.as.identifier=\ as of release 5, ''enum'' is a keyword, and may not be used as an identifier\n\ (use -source 1.4 or lower to use ''enum'' as an identifier) @@ -2297,8 +2313,13 @@ (use -source 8 or higher to enable type annotations) # 0: string +compiler.err.repeatable.annotations.not.supported.in.source=\ + repeated annotations are not supported in -source {0}\n\ +(use -source 8 or higher to enable repeated annotations) + +# 0: string compiler.err.foreach.not.supported.in.source=\ - for-each loops are not supported in -source {0}\n\ + enhanced for loops are not supported in -source {0}\n\ (use -source 5 or higher to enable for-each loops) # 0: string
--- a/src/share/classes/com/sun/tools/javac/sym/CreateSymbols.java Thu Oct 03 19:28:07 2013 +0100 +++ b/src/share/classes/com/sun/tools/javac/sym/CreateSymbols.java Fri Oct 11 19:05:18 2013 +0100 @@ -107,15 +107,21 @@ if (renv.processingOver()) createSymbols(); } catch (IOException e) { + CharSequence msg = e.getLocalizedMessage(); + if (msg == null) + msg = e.toString(); processingEnv.getMessager() - .printMessage(Diagnostic.Kind.ERROR, e.getLocalizedMessage()); + .printMessage(Diagnostic.Kind.ERROR, msg); } catch (Throwable t) { t.printStackTrace(); Throwable cause = t.getCause(); if (cause == null) cause = t; + CharSequence msg = cause.getLocalizedMessage(); + if (msg == null) + msg = cause.toString(); processingEnv.getMessager() - .printMessage(Diagnostic.Kind.ERROR, cause.getLocalizedMessage()); + .printMessage(Diagnostic.Kind.ERROR, msg); } return true; }
--- a/src/share/classes/com/sun/tools/javac/tree/Pretty.java Thu Oct 03 19:28:07 2013 +0100 +++ b/src/share/classes/com/sun/tools/javac/tree/Pretty.java Fri Oct 11 19:05:18 2013 +0100 @@ -782,9 +782,9 @@ public void visitConditional(JCConditional tree) { try { open(prec, TreeInfo.condPrec); - printExpr(tree.cond, TreeInfo.condPrec); + printExpr(tree.cond, TreeInfo.condPrec + 1); print(" ? "); - printExpr(tree.truepart, TreeInfo.condPrec); + printExpr(tree.truepart); print(" : "); printExpr(tree.falsepart, TreeInfo.condPrec); close(prec, TreeInfo.condPrec);
--- a/src/share/classes/com/sun/tools/javap/ClassWriter.java Thu Oct 03 19:28:07 2013 +0100 +++ b/src/share/classes/com/sun/tools/javap/ClassWriter.java Fri Oct 11 19:05:18 2013 +0100 @@ -232,6 +232,12 @@ return t.accept(this, new StringBuilder()).toString(); } + String printTypeArgs(List<? extends TypeParamType> typeParamTypes) { + StringBuilder builder = new StringBuilder(); + appendIfNotEmpty(builder, "<", typeParamTypes, "> "); + return builder.toString(); + } + public StringBuilder visitSimpleType(SimpleType type, StringBuilder sb) { sb.append(getJavaName(type.name)); return sb; @@ -438,7 +444,7 @@ writeModifiers(flags.getMethodModifiers()); if (methodType != null) { - writeListIfNotEmpty("<", methodType.typeParamTypes, "> "); + print(new JavaTypePrinter(false).printTypeArgs(methodType.typeParamTypes)); } if (getName(m).equals("<init>")) { print(getJavaName(classFile));
--- a/src/share/classes/javax/lang/model/element/Element.java Thu Oct 03 19:28:07 2013 +0100 +++ b/src/share/classes/javax/lang/model/element/Element.java Fri Oct 11 19:05:18 2013 +0100 @@ -202,6 +202,7 @@ * @return {@code true} if the specified object represents the same * element as this */ + @Override boolean equals(Object obj); /** @@ -209,6 +210,7 @@ * * @see #equals */ + @Override int hashCode(); @@ -219,11 +221,18 @@ * Elements#getAllAnnotationMirrors(Element) * getAllAnnotationMirrors}. * - * @see ElementFilter * @since 1.6 */ @Override List<? extends AnnotationMirror> getAnnotationMirrors(); + + /** + * {@inheritDoc} + * @since 1.6 + */ + @Override + <A extends Annotation> A getAnnotation(Class<A> annotationType); + /** * Applies a visitor to this element. *
--- a/src/share/classes/javax/tools/Diagnostic.java Thu Oct 03 19:28:07 2013 +0100 +++ b/src/share/classes/javax/tools/Diagnostic.java Fri Oct 11 19:05:18 2013 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -49,6 +49,15 @@ /** * Kinds of diagnostics, for example, error or warning. + * + * The kind of a diagnostic can be used to determine how the + * diagnostic should be presented to the user. For example, + * errors might be colored red or prefixed with the word "Error", + * while warnings might be colored yellow or prefixed with the + * word "Warning". There is no requirement that the Kind + * should imply any inherent semantic meaning to the message + * of the diagnostic: for example, a tool might provide an + * option to report all warnings as errors. */ enum Kind { /** @@ -63,7 +72,7 @@ /** * Problem similar to a warning, but is mandated by the tool's * specification. For example, the Java™ Language - * Specification, 3rd Ed. mandates warnings on certain + * Specification mandates warnings on certain * unchecked operations and the use of deprecated methods. */ MANDATORY_WARNING,
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/share/classes/jdk/Exported.java Fri Oct 11 19:05:18 2013 +0100 @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package jdk; + +import java.lang.annotation.*; + +/** + * Indicates whether or not a JDK specific type or package is an + * exported part of the JDK suitable for use outside of the JDK + * implementation itself. + * + * This annotation should only be applied to types and packages + * <em>outside</em> of the Java SE namespaces of {@code java.*} and + * {@code javax.*} packages. For example, certain portions of {@code + * com.sun.*} are official parts of the JDK meant to be generally + * usable while other portions of {@code com.sun.*} are not. This + * annotation type allows those portions to be easily and + * programmaticly distinguished. + * + * @since 1.8 + */ +@Documented +@Retention(RetentionPolicy.RUNTIME) +@Target({ElementType.TYPE, ElementType.PACKAGE}) +@Exported +public @interface Exported { + /** + * Whether or not the annotated type or package is an exported part of the JDK. + */ + boolean value() default true; +}
--- a/src/share/classes/jdk/Supported.java Thu Oct 03 19:28:07 2013 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,53 +0,0 @@ -/* - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package jdk; - -import java.lang.annotation.*; - -/** - * Indicates whether or not a JDK specific type or package is a - * supported part of the JDK. - * - * This annotation should only be applied to types and packages - * <em>outside</em> of the Java SE namespaces of {@code java.*} and - * {@code javax.*} packages. For example, certain portions of {@code - * com.sun.*} are official parts of the JDK meant to be generally - * usable while other portions of {@code com.sun.*} are not. This - * annotation type allows those portions to be easily and - * programmaticly distinguished. - * - * @since 1.8 - */ -@Documented -@Retention(RetentionPolicy.RUNTIME) -@Target({ElementType.TYPE, ElementType.PACKAGE}) -@Supported -public @interface Supported { - /** - * Whether or not this package or type is a supported part of the JDK. - */ - boolean value() default true; -}
--- a/test/Makefile Thu Oct 03 19:28:07 2013 +0100 +++ b/test/Makefile Fri Oct 11 19:05:18 2013 +0100 @@ -7,7 +7,7 @@ # A full product build (or "control" build) creates a complete JDK image. # To test a product build, set TESTJAVA to the path for the image. # -# A langtools build just builds the langtools components of a JDK. +# A langtools build just builds the langtools components of a JDK. # To test a langtools build, set TESTJAVA to the path for a recent JDK # build, and set TESTBOOTCLASSPATH to the compiled langtools classes -- # for example build/classes or dist/lib/classes.jar. @@ -122,10 +122,10 @@ TESTJAVA = $(SLASH_JAVA)/re/jdk/1.7.0/promoted/latest/binaries/$(PLATFORM)-$(ARCH) endif -# PRODUCT_HOME is a JPRT variable pointing to a directory containing the output from +# PRODUCT_HOME is a JPRT variable pointing to a directory containing the output from # make/Makefile # For langtools, this is a directory containing build and dist -# For a control build, this is build/$(PRODUCT)-$(ARCH)/XYZ-image +# For a control build, this is build/$(PRODUCT)-$(ARCH)/XYZ-image # (i.e, j2sdk-image or jdk-module-image) ifdef PRODUCT_HOME ifeq ($(shell [ -r $(PRODUCT_HOME)/dist/lib/classes.jar ]; echo $$?),0) @@ -139,13 +139,13 @@ ifdef TESTBOOTCLASSPATH JTREG_OPTIONS += -Xbootclasspath/p:$(TESTBOOTCLASSPATH) ### In the following, -refvmoptions is an undocumented option -### The following does not work JCK 7 b30 2/6/2010. Awaiting b31. +### The following does not work JCK 7 b30 2/6/2010. Awaiting b31. JCK_OPTIONS += \ -vmoptions:-Xbootclasspath/p:$(TESTBOOTCLASSPATH) \ -refvmoptions:-Xbootclasspath/p:$(TESTBOOTCLASSPATH) endif -# Concurrency is the number of tests that can execute at once. +# Concurrency is the number of tests that can execute at once. # On an otherwise empty machine, suggest setting to (#cpus + 2) # If unset, the default is (#cpus) ### RFE: determine and use #cpus @@ -206,7 +206,7 @@ # Exit -- used for final "normal" exit from "make". Redefine to "true" to avoid # having make exit with non-zero return code. EXIT = exit -# Function to exit shell if exit code of preceding command is greater than or equal +# Function to exit shell if exit code of preceding command is greater than or equal # to a given level. Redefine function or preceding FATAL_*_EXIT codes as needed. EXIT_IF_FATAL = status=$$?; if [ $$status -ge $(1) ]; then exit $$status ; fi @@ -217,8 +217,8 @@ # Root of all test results TEST_OUTPUT_DIR = $(TEST_ROOT)/../build/$(PLATFORM)-$(ARCH)/test/langtools ABS_TEST_OUTPUT_DIR := \ - $(shell mkdir -p $(TEST_ROOT)/../build/$(PLATFORM)-$(ARCH)/test/langtools; \ - cd $(TEST_ROOT)/../build/$(PLATFORM)-$(ARCH)/test/langtools; \ + $(shell mkdir -p $(TEST_OUTPUT_DIR); \ + cd $(TEST_OUTPUT_DIR); \ pwd $(CYGPATH)) # Subdirectories for different test runs JTREG_OUTPUT_DIR = $(ABS_TEST_OUTPUT_DIR)/jtreg @@ -255,7 +255,7 @@ # JT_JAVA # Version of java used to run jtreg. Should normally be the same as TESTJAVA # TESTJAVA -# Version of java to be tested. +# Version of java to be tested. # JTREG_OPTIONS # Additional options for jtreg # JTREG_TESTDIRS @@ -311,7 +311,7 @@ # Version of java used to run JCK. Should normally be the same as TESTJAVA # Default is JDK 7 # TESTJAVA -# Version of java to be tested. +# Version of java to be tested. # JCK_COMPILER_OPTIONS # Additional options for JCK-compiler # JCK_COMPILER_TESTDIRS @@ -360,7 +360,7 @@ # JT_JAVA # Version of java used to run JCK. Should normally be the same as TESTJAVA # TESTJAVA -# Version of java to be tested. +# Version of java to be tested. # JCK_RUNTIME_OPTIONS # Additional options for JCK-runtime # JCK_RUNTIME_TESTDIRS
--- a/test/com/sun/javadoc/AccessSkipNav/AccessSkipNav.java Thu Oct 03 19:28:07 2013 +0100 +++ b/test/com/sun/javadoc/AccessSkipNav/AccessSkipNav.java Fri Oct 11 19:05:18 2013 +0100 @@ -23,7 +23,7 @@ /* * @test - * @bug 4638136 7198273 + * @bug 4638136 7198273 8025633 * @summary Add ability to skip over nav bar for accessibility * @author dkramer * @run main AccessSkipNav @@ -86,20 +86,20 @@ // Testing only for the presence of the <a href> and <a name> // Top navbar <a href> - { "<a href=\"#skip-navbar_top\" title=\"Skip navigation links\">Skip navigation links</a>", + { "<a href=\"#skip.navbar.top\" title=\"Skip navigation links\">Skip navigation links</a>", TMPDEST_DIR1 + "p1" + FS + "C1.html" }, // Top navbar <a name> - { "<a name=\"skip-navbar_top\">" + LS + + { "<a name=\"skip.navbar.top\">" + LS + "<!-- -->" + LS + "</a>", TMPDEST_DIR1 + "p1" + FS + "C1.html" }, // Bottom navbar <a href> - { "<a href=\"#skip-navbar_bottom\" title=\"Skip navigation links\">Skip navigation links</a>", + { "<a href=\"#skip.navbar.bottom\" title=\"Skip navigation links\">Skip navigation links</a>", TMPDEST_DIR1 + "p1" + FS + "C1.html" }, // Bottom navbar <a name> - { "<a name=\"skip-navbar_bottom\">" + LS + + { "<a name=\"skip.navbar.bottom\">" + LS + "<!-- -->" + LS + "</a>", TMPDEST_DIR1 + "p1" + FS + "C1.html" } };
--- a/test/com/sun/javadoc/JavascriptWinTitle/JavascriptWinTitle.java Thu Oct 03 19:28:07 2013 +0100 +++ b/test/com/sun/javadoc/JavascriptWinTitle/JavascriptWinTitle.java Fri Oct 11 19:05:18 2013 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -23,7 +23,7 @@ /* * @test - * @bug 4645058 4747738 4855054 + * @bug 4645058 4747738 4855054 8024756 * @summary Javascript IE load error when linked by -linkoffline * Window title shouldn't change when loading left frames (javascript) * @author dkramer @@ -115,9 +115,13 @@ // Test that win title javascript is followed by NOSCRIPT code. {"<script type=\"text/javascript\"><!--" + LS + - " if (location.href.indexOf('is-external=true') == -1) {" + LS + - " parent.document.title=\"C (Window Title)\";" + LS + - " }" + LS + "//-->" + LS + "</script>", + " try {" + LS + + " if (location.href.indexOf('is-external=true') == -1) {" + LS + + " parent.document.title=\"C (Window Title)\";" + LS + + " }" + LS + + " }" + LS + + " catch(err) {" + LS + + " }" + LS + "//-->" + LS + "</script>", TMPDEST_DIR1 + FS + "p1" + FS + "C.html" }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/com/sun/javadoc/testAnchorNames/TestAnchorNames.java Fri Oct 11 19:05:18 2013 +0100 @@ -0,0 +1,290 @@ +/* + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 8025633 + * @summary Test for valid name attribute in HTML anchors. + * @author Bhavesh Patel + * @library ../lib/ + * @build JavadocTester TestAnchorNames + * @run main TestAnchorNames + */ + +public class TestAnchorNames extends JavadocTester { + + private static final String BUG_ID = "8025633"; + + //Input for string search tests. + private static final String[][] TEST = { + + //Test some section markers and links to these markers + + {BUG_ID + FS + "pkg1" + FS + "RegClass.html", + "<a name=\"skip.navbar.top\">" + }, + {BUG_ID + FS + "pkg1" + FS + "RegClass.html", + "<a href=\"#skip.navbar.top\" title=\"Skip navigation links\">" + }, + {BUG_ID + FS + "pkg1" + FS + "RegClass.html", + "<a name=\"nested.class.summary\">" + }, + {BUG_ID + FS + "pkg1" + FS + "RegClass.html", + "<a href=\"#nested.class.summary\">" + }, + {BUG_ID + FS + "pkg1" + FS + "RegClass.html", + "<a name=\"method.summary\">" + }, + {BUG_ID + FS + "pkg1" + FS + "RegClass.html", + "<a href=\"#method.summary\">" + }, + {BUG_ID + FS + "pkg1" + FS + "RegClass.html", + "<a name=\"field.detail\">" + }, + {BUG_ID + FS + "pkg1" + FS + "RegClass.html", + "<a href=\"#field.detail\">" + }, + {BUG_ID + FS + "pkg1" + FS + "RegClass.html", + "<a name=\"constructor.detail\">" + }, + {BUG_ID + FS + "pkg1" + FS + "RegClass.html", + "<a href=\"#constructor.detail\">" + }, + + //Test some members and link to these members + + //The marker for this appears in the serialized-form.html which we will + //test below + {BUG_ID + FS + "pkg1" + FS + "RegClass.html", + "<a href=\"../serialized-form.html#pkg1.RegClass\">" + }, + //Test some fields + {BUG_ID + FS + "pkg1" + FS + "RegClass.html", + "<a name=\"Z:Z_\">" + }, + {BUG_ID + FS + "pkg1" + FS + "RegClass.html", + "<a href=\"../pkg1/RegClass.html#Z:Z_\">" + }, + {BUG_ID + FS + "pkg1" + FS + "RegClass.html", + "<a name=\"Z:Z_:D\">" + }, + {BUG_ID + FS + "pkg1" + FS + "RegClass.html", + "<a href=\"../pkg1/RegClass.html#Z:Z_:D\">" + }, + {BUG_ID + FS + "pkg1" + FS + "RegClass.html", + "<a name=\"Z:Z:D_\">" + }, + {BUG_ID + FS + "pkg1" + FS + "RegClass.html", + "<a href=\"../pkg1/RegClass.html#Z:Z:D_\">" + }, + {BUG_ID + FS + "pkg1" + FS + "RegClass.html", + "<a name=\"Z:Z:Dfield\">" + }, + {BUG_ID + FS + "pkg1" + FS + "RegClass.html", + "<a href=\"../pkg1/RegClass.html#Z:Z:Dfield\">" + }, + {BUG_ID + FS + "pkg1" + FS + "RegClass.html", + "<a name=\"fieldInCla:D:D\">" + }, + {BUG_ID + FS + "pkg1" + FS + "RegClass.html", + "<a href=\"../pkg1/RegClass.html#fieldInCla:D:D\">" + }, + {BUG_ID + FS + "pkg1" + FS + "RegClass.html", + "<a name=\"S_:D:D:D:D:DINT\">" + }, + {BUG_ID + FS + "pkg1" + FS + "RegClass.html", + "<a href=\"../pkg1/RegClass.html#S_:D:D:D:D:DINT\">" + }, + {BUG_ID + FS + "pkg1" + FS + "RegClass.html", + "<a name=\"method:D:D\">" + }, + {BUG_ID + FS + "pkg1" + FS + "RegClass.html", + "<a href=\"../pkg1/RegClass.html#method:D:D\">" + }, + {BUG_ID + FS + "pkg1" + FS + "DeprMemClass.html", + "<a name=\"Z:Z_field_In_Class\">" + }, + {BUG_ID + FS + "pkg1" + FS + "DeprMemClass.html", + "<a href=\"../pkg1/DeprMemClass.html#Z:Z_field_In_Class\">" + }, + //Test constructor + {BUG_ID + FS + "pkg1" + FS + "RegClass.html", + "<a name=\"RegClass-java.lang.String-int-\">" + }, + {BUG_ID + FS + "pkg1" + FS + "RegClass.html", + "<a href=\"../pkg1/RegClass.html#RegClass-java.lang.String-int-\">" + }, + //Test some methods + {BUG_ID + FS + "pkg1" + FS + "RegClass.html", + "<a name=\"Z:Z_methodInClass-java.lang.String-\">" + }, + {BUG_ID + FS + "pkg1" + FS + "RegClass.html", + "<a href=\"../pkg1/RegClass.html#Z:Z_methodInClass-java.lang.String-\">" + }, + {BUG_ID + FS + "pkg1" + FS + "RegClass.html", + "<a name=\"method--\">" + }, + {BUG_ID + FS + "pkg1" + FS + "RegClass.html", + "<a href=\"../pkg1/RegClass.html#method--\">" + }, + {BUG_ID + FS + "pkg1" + FS + "RegClass.html", + "<a name=\"foo-java.util.Map-\">" + }, + {BUG_ID + FS + "pkg1" + FS + "RegClass.html", + "<a href=\"../pkg1/RegClass.html#foo-java.util.Map-\">" + }, + {BUG_ID + FS + "pkg1" + FS + "RegClass.html", + "<a name=\"methodInCla:Ds-java.lang.String:A-\">" + }, + {BUG_ID + FS + "pkg1" + FS + "RegClass.html", + "<a href=\"../pkg1/RegClass.html#methodInCla:Ds-java.lang.String:A-\">" + }, + {BUG_ID + FS + "pkg1" + FS + "RegClass.html", + "<a name=\"Z:Z_methodInClas:D-java.lang.String-int-\">" + }, + {BUG_ID + FS + "pkg1" + FS + "RegClass.html", + "<a href=\"../pkg1/RegClass.html#Z:Z_methodInClas:D-java.lang.String-int-\">" + }, + {BUG_ID + FS + "pkg1" + FS + "RegClass.html", + "<a name=\"methodD-pkg1.RegClass.:DA-\">" + }, + {BUG_ID + FS + "pkg1" + FS + "RegClass.html", + "<a href=\"../pkg1/RegClass.html#methodD-pkg1.RegClass.:DA-\">" + }, + {BUG_ID + FS + "pkg1" + FS + "RegClass.html", + "<a name=\"methodD-pkg1.RegClass.D:A-\">" + }, + {BUG_ID + FS + "pkg1" + FS + "RegClass.html", + "<a href=\"../pkg1/RegClass.html#methodD-pkg1.RegClass.D:A-\">" + }, + {BUG_ID + FS + "pkg1" + FS + "DeprMemClass.html", + "<a name=\"Z:Z:Dmethod_In_Class--\">" + }, + {BUG_ID + FS + "pkg1" + FS + "DeprMemClass.html", + "<a href=\"../pkg1/DeprMemClass.html#Z:Z:Dmethod_In_Class--\">" + }, + + //Test enum + + {BUG_ID + FS + "pkg1" + FS + "RegClass.Te$t_Enum.html", + "<a name=\"Z:Z:DFLD2\">" + }, + {BUG_ID + FS + "pkg1" + FS + "RegClass.Te$t_Enum.html", + "<a href=\"../pkg1/RegClass.Te$t_Enum.html#Z:Z:DFLD2\">" + }, + + //Test nested class + + {BUG_ID + FS + "pkg1" + FS + "RegClass._NestedClas$.html", + "<a name=\"RegClass._NestedClas:D--\">" + }, + {BUG_ID + FS + "pkg1" + FS + "RegClass._NestedClas$.html", + "<a href=\"../pkg1/RegClass._NestedClas$.html#RegClass._NestedClas:D--\">" + }, + + //Test class use page + + {BUG_ID + FS + "pkg1" + FS + "class-use" + FS + "DeprMemClass.html", + "<a href=\"../../pkg1/RegClass.html#d____mc\">" + }, + + //Test deprecated list page + + {BUG_ID + FS + "deprecated-list.html", + "<a href=\"pkg1/DeprMemClass.html#Z:Z_field_In_Class\">" + }, + {BUG_ID + FS + "deprecated-list.html", + "<a href=\"pkg1/DeprMemClass.html#Z:Z:Dmethod_In_Class--\">" + }, + + //Test constant values page + + {BUG_ID + FS + "constant-values.html", + "<a href=\"pkg1/RegClass.html#S_:D:D:D:D:DINT\">" + }, + + //Test serialized form page + + //This is the marker for the link that appears in the pkg1.RegClass.html page + {BUG_ID + FS + "serialized-form.html", + "<a name=\"pkg1.RegClass\">" + }, + + //Test member name index page + + {BUG_ID + FS + "index-all.html", + "<a name=\"I:Z:Z:D\">" + }, + {BUG_ID + FS + "index-all.html", + "<a href=\"#I:Z:Z:D\">$" + }, + {BUG_ID + FS + "index-all.html", + "<a href=\"#I:Z:Z_\">_" + } + }; + + private static final String[][] NEGATED_TEST = { + //The marker name conversion should only affect HTML anchors. It should not + //affect the lables. + {BUG_ID + FS + "pkg1" + FS + "RegClass.html", + " Z:Z_" + }, + {BUG_ID + FS + "pkg1" + FS + "RegClass.html", + " Z:Z:Dfield" + }, + {BUG_ID + FS + "pkg1" + FS + "RegClass.html", + " Z:Z_field_In_Class" + }, + {BUG_ID + FS + "pkg1" + FS + "RegClass.html", + " S_:D:D:D:D:DINT" + }, + }; + + private static final String[] ARGS = new String[] { + "-d", BUG_ID, "-sourcepath", SRC_DIR, "-use", "pkg1" + }; + + /** + * The entry point of the test. + * @param args the array of command line arguments. + */ + public static void main(String[] args) throws Exception { + TestAnchorNames tester = new TestAnchorNames(); + run(tester, ARGS, TEST, NEGATED_TEST); + tester.printSummary(); + } + + /** + * {@inheritDoc} + */ + public String getBugId() { + return BUG_ID; + } + + /** + * {@inheritDoc} + */ + public String getBugName() { + return getClass().getName(); + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/com/sun/javadoc/testAnchorNames/pkg1/DeprMemClass.java Fri Oct 11 19:05:18 2013 +0100 @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package pkg1; + +public class DeprMemClass +{ + /** + * Field in the class. + * @deprecated Do not use this field. + */ + public int _field_In_Class; + + public int _fld; + + /** + * Method in the class. + * @deprecated Do not use this method. + */ + public void $method_In_Class() { + } + + public void regularMethod() { + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/com/sun/javadoc/testAnchorNames/pkg1/RegClass.java Fri Oct 11 19:05:18 2013 +0100 @@ -0,0 +1,186 @@ +/* + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package pkg1; + +import java.io.Serializable; +import java.util.Map; + +/** + * @serial This is the serial tag's comment. + */ +public class RegClass implements Serializable { + + /** + * Normal field in class. + */ + public String field; + + /** + * Normal field in class. + */ + public String method$$; + + /** + * Filed staring with $. + */ + public String $field; + + /** + * Filed staring with underscore. + */ + public String _field; + + /** + * Serial field + * @serial + */ + public boolean t_e$t; + + /** + * Field in class with a $ in the name. + */ + public String fieldInCla$$; + + /** + * Field name as just an underscore. + */ + public int _; + + /** + * Field name as just a $. + */ + public int $; + + /** + * Field name with underscore and $. + */ + public int _$; + + /** + * Field name with $ and underscore. + */ + public int $_; + + /** + * An array. + */ + public int arr[]; + + /** + * Another array. + */ + public int[] arr1; + + /** + * A constant field. + */ + public static final int S_$$$$$INT = 0; + + /** + * Another field. + */ + public DeprMemClass d____mc; + + /** + * An enum. + */ + public static enum Te$t_Enum { + FLD_1, + $FLD2 + }; + + /** + * A constructor. + */ + public RegClass(String p, int i) { + } + + /** + * Method in Class. + * @param p a string + */ + public void _methodInClass(String p) { + } + + /** + * Method in Class. + * @param p a string + * @param i an int + */ + public void _methodInClas$(String p, int i) { + } + + /** + * Method with $ in the name. + * @param p a string array + */ + public void methodInCla$s(String[] p) { + } + + /** + * Method with D[] as a parameter. + * @param p an array of D + */ + public void methodD(D[] p) { + } + + /** + * Method with $A as a parameter. + * @param p an object of $A + */ + public void methodD($A p) { + } + + /** + * Serial test. + * @serialData This is a serial data comment. + * @return null + */ + protected Object $readResolve(){return null;} + + /** + * Simple method. + */ + public void method() {} + + /** + * Generics. + */ + public static <A> void foo(Map<A, Map<A, A>> map) {} + + /** + * A nested class. + */ + public class _NestedClas$ {} + + /** + * Nested class D. + */ + class D {} + + /** + * Nested class $A. + */ + class $A {} +}
--- a/test/com/sun/javadoc/testAnnotationOptional/TestAnnotationOptional.java Thu Oct 03 19:28:07 2013 +0100 +++ b/test/com/sun/javadoc/testAnnotationOptional/TestAnnotationOptional.java Fri Oct 11 19:05:18 2013 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -23,7 +23,8 @@ /* * @test - * @summary Make sure that annotations types with optional elements has + * @bug 8025633 + * @summary Make sure that annotations types with optional elements have * element headers * @author Mahmood Ali * @library ../lib/ @@ -45,7 +46,7 @@ //Input for string search tests. private static final String[][] TEST = { {BUG_ID + FS + "pkg" + FS + "AnnotationOptional.html", - "<a name=\"annotation_type_element_detail\">" + "<a name=\"annotation.type.element.detail\">" } };
--- a/test/com/sun/javadoc/testAnnotationTypes/TestAnnotationTypes.java Thu Oct 03 19:28:07 2013 +0100 +++ b/test/com/sun/javadoc/testAnnotationTypes/TestAnnotationTypes.java Fri Oct 11 19:05:18 2013 +0100 @@ -23,7 +23,7 @@ /* * @test - * @bug 4973609 8015249 + * @bug 4973609 8015249 8025633 * @summary Make sure that annotation types with 0 members does not have * extra HR tags. * @author jamieh @@ -45,11 +45,11 @@ //Input for string search tests. private static final String[][] TEST = { {BUG_ID + FS + "pkg" + FS + "AnnotationTypeField.html", - "<li>Summary: </li>" + NL + "<li><a href=\"#annotation_type_" + - "field_summary\">Field</a> | </li>"}, + "<li>Summary: </li>" + NL + "<li><a href=\"#annotation.type." + + "field.summary\">Field</a> | </li>"}, {BUG_ID + FS + "pkg" + FS + "AnnotationTypeField.html", - "<li>Detail: </li>" + NL + "<li><a href=\"#annotation_type_" + - "field_detail\">Field</a> | </li>"}, + "<li>Detail: </li>" + NL + "<li><a href=\"#annotation.type." + + "field.detail\">Field</a> | </li>"}, {BUG_ID + FS + "pkg" + FS + "AnnotationTypeField.html", "<!-- =========== ANNOTATION TYPE FIELD SUMMARY =========== -->"}, {BUG_ID + FS + "pkg" + FS + "AnnotationTypeField.html",
--- a/test/com/sun/javadoc/testClassCrossReferences/TestClassCrossReferences.java Thu Oct 03 19:28:07 2013 +0100 +++ b/test/com/sun/javadoc/testClassCrossReferences/TestClassCrossReferences.java Fri Oct 11 19:05:18 2013 +0100 @@ -23,7 +23,7 @@ /* * @test - * @bug 4652655 4857717 + * @bug 4652655 4857717 8025633 * @summary This test verifies that class cross references work properly. * @author jamieh * @library ../lib/ @@ -45,7 +45,7 @@ "<a href=\"http://java.sun.com/j2se/1.4/docs/api/java/math/BigDecimal.html?is-external=true\" " + "title=\"class or interface in java.math\"><code>Link to external class BigDecimal</code></a>"}, {BUG_ID + FS + "C.html", - "<a href=\"http://java.sun.com/j2se/1.4/docs/api/java/math/BigInteger.html?is-external=true#gcd(java.math.BigInteger)\" " + + "<a href=\"http://java.sun.com/j2se/1.4/docs/api/java/math/BigInteger.html?is-external=true#gcd-java.math.BigInteger-\" " + "title=\"class or interface in java.math\"><code>Link to external member gcd</code></a>"}, {BUG_ID + FS + "C.html", "<dl>" + NL + "<dt><span class=\"strong\">Overrides:</span></dt>" + NL +
--- a/test/com/sun/javadoc/testExternalOverridenMethod/TestExternalOverridenMethod.java Thu Oct 03 19:28:07 2013 +0100 +++ b/test/com/sun/javadoc/testExternalOverridenMethod/TestExternalOverridenMethod.java Fri Oct 11 19:05:18 2013 +0100 @@ -23,14 +23,13 @@ /* * @test - * @bug 4857717 + * @bug 4857717 8025633 * @summary Test to make sure that externally overriden and implemented methods * are documented properly. The method should still include "implements" or * "overrides" documentation even though the method is external. * @author jamieh * @library ../lib/ - * @build JavadocTester - * @build TestExternalOverridenMethod + * @build JavadocTester TestExternalOverridenMethod * @run main TestExternalOverridenMethod */ @@ -40,13 +39,13 @@ private static final String[][] TEST = { {BUG_ID + FS + "pkg" + FS + "XReader.html", "<dt><span class=\"strong\">Overrides:</span></dt>" + NL + - "<dd><code><a href=\"http://java.sun.com/j2se/1.4.1/docs/api/java/io/FilterReader.html?is-external=true#read()\" " + + "<dd><code><a href=\"http://java.sun.com/j2se/1.4.1/docs/api/java/io/FilterReader.html?is-external=true#read--\" " + "title=\"class or interface in java.io\">read</a></code> in class <code>" + "<a href=\"http://java.sun.com/j2se/1.4.1/docs/api/java/io/FilterReader.html?is-external=true\" " + "title=\"class or interface in java.io\">FilterReader</a></code></dd>"}, {BUG_ID + FS + "pkg" + FS + "XReader.html", "<dt><span class=\"strong\">Specified by:</span></dt>" + NL + - "<dd><code><a href=\"http://java.sun.com/j2se/1.4.1/docs/api/java/io/DataInput.html?is-external=true#readInt()\" " + + "<dd><code><a href=\"http://java.sun.com/j2se/1.4.1/docs/api/java/io/DataInput.html?is-external=true#readInt--\" " + "title=\"class or interface in java.io\">readInt</a></code> in interface <code>" + "<a href=\"http://java.sun.com/j2se/1.4.1/docs/api/java/io/DataInput.html?is-external=true\" " + "title=\"class or interface in java.io\">DataInput</a></code></dd>"}};
--- a/test/com/sun/javadoc/testHref/TestHref.java Thu Oct 03 19:28:07 2013 +0100 +++ b/test/com/sun/javadoc/testHref/TestHref.java Fri Oct 11 19:05:18 2013 +0100 @@ -23,7 +23,7 @@ /* * @test - * @bug 4663254 8016328 + * @bug 4663254 8016328 8025633 * @summary Verify that spaces do not appear in hrefs and anchors. * @author jamieh * @library ../lib/ @@ -46,31 +46,31 @@ private static final String[][] TEST = { //External link. {BUG_ID + FS + "pkg" + FS + "C1.html", - "href=\"http://java.sun.com/j2se/1.4/docs/api/java/lang/Object.html?is-external=true#wait(long,%20int)\"" + "href=\"http://java.sun.com/j2se/1.4/docs/api/java/lang/Object.html?is-external=true#wait-long-int-\"" }, //Member summary table link. {BUG_ID + FS + "pkg" + FS + "C1.html", - "href=\"../pkg/C1.html#method(int,%20int,%20java.util.ArrayList)\"" + "href=\"../pkg/C1.html#method-int-int-java.util.ArrayList-\"" }, //Anchor test. {BUG_ID + FS + "pkg" + FS + "C1.html", - "<a name=\"method(int, int, java.util.ArrayList)\">" + NL + + "<a name=\"method-int-int-java.util.ArrayList-\">" + NL + "<!-- -->" + NL + "</a>" }, //Backward compatibility anchor test. {BUG_ID + FS + "pkg" + FS + "C1.html", - "<a name=\"method(int, int, java.util.ArrayList)\">" + NL + + "<a name=\"method-int-int-java.util.ArrayList-\">" + NL + "<!-- -->" + NL + "</a>" }, //{@link} test. {BUG_ID + FS + "pkg" + FS + "C2.html", - "Link: <a href=\"../pkg/C1.html#method(int,%20int,%20java.util.ArrayList)\">" + "Link: <a href=\"../pkg/C1.html#method-int-int-java.util.ArrayList-\">" }, //@see test. {BUG_ID + FS + "pkg" + FS + "C2.html", - "See Also:</span></dt>" + NL + "<dd><a href=\"../pkg/C1.html#method(int,%20int,%20java.util.ArrayList)\">" + "See Also:</span></dt>" + NL + "<dd><a href=\"../pkg/C1.html#method-int-int-java.util.ArrayList-\">" }, //Header does not link to the page itself.
--- a/test/com/sun/javadoc/testHtmlDefinitionListTag/TestHtmlDefinitionListTag.java Thu Oct 03 19:28:07 2013 +0100 +++ b/test/com/sun/javadoc/testHtmlDefinitionListTag/TestHtmlDefinitionListTag.java Fri Oct 11 19:05:18 2013 +0100 @@ -25,7 +25,7 @@ /* * @test - * @bug 6786690 6820360 + * @bug 6786690 6820360 8025633 * @summary This test verifies the nesting of definition list tags. * @author Bhavesh Patel * @library ../lib/ @@ -64,7 +64,7 @@ {BUG_ID + FS + "pkg1" + FS + "C1.html", "<dl>" + NL + "<dt><span class=\"strong\">Since:</span></dt>" + NL + "<dd>1.4</dd>" + NL + "<dt><span class=\"strong\">See Also:</span></dt>" + NL + "<dd>" + - "<a href=\"../pkg1/C1.html#setUndecorated(boolean)\">" + + "<a href=\"../pkg1/C1.html#setUndecorated-boolean-\">" + "<code>setUndecorated(boolean)</code></a></dd>" + NL + "</dl>"}, {BUG_ID + FS + "pkg1" + FS + "C1.html", "<dl>"+ NL + "<dt><span class=\"strong\">Parameters:</span></dt>" + NL + "<dd><code>title" + "</code> - the title</dd>" + NL + "<dd><code>test</code> - boolean value" + @@ -79,11 +79,11 @@ "if decorations are to be enabled.</dd>" + NL + "<dt><span class=\"strong\">Since:" + "</span></dt>" + NL + "<dd>1.4</dd>" + NL + "<dt><span class=\"strong\">See Also:</span></dt>" + NL + "<dd>" + - "<a href=\"../pkg1/C1.html#readObject()\"><code>readObject()" + + "<a href=\"../pkg1/C1.html#readObject--\"><code>readObject()" + "</code></a></dd>" + NL + "</dl>"}, {BUG_ID + FS + "pkg1" + FS + "C1.html", "<dl>" + NL + "<dt><span class=\"strong\">Throws:</span></dt>" + NL + "<dd><code>java.io.IOException</code></dd>" + NL + "<dt><span class=\"strong\">See Also:" + - "</span></dt>" + NL + "<dd><a href=\"../pkg1/C1.html#setUndecorated(boolean)\">" + + "</span></dt>" + NL + "<dd><a href=\"../pkg1/C1.html#setUndecorated-boolean-\">" + "<code>setUndecorated(boolean)</code></a></dd>" + NL + "</dl>"}, {BUG_ID + FS + "pkg1" + FS + "C2.html", "<dl>" + NL + "<dt><span class=\"strong\">Parameters:" + "</span></dt>" + NL + "<dd><code>set</code> - boolean</dd>" + NL + "<dt><span class=\"strong\">" + @@ -91,20 +91,20 @@ {BUG_ID + FS + "serialized-form.html", "<dl>" + NL + "<dt><span class=\"strong\">Throws:</span>" + "</dt>" + NL + "<dd><code>" + "java.io.IOException</code></dd>" + NL + "<dt><span class=\"strong\">See Also:</span>" + - "</dt>" + NL + "<dd><a href=\"pkg1/C1.html#setUndecorated(boolean)\">" + + "</dt>" + NL + "<dd><a href=\"pkg1/C1.html#setUndecorated-boolean-\">" + "<code>C1.setUndecorated(boolean)</code></a></dd>" + NL + "</dl>"}, {BUG_ID + FS + "serialized-form.html", "<span class=\"strong\">Deprecated.</span>" + " <span class=\"italic\">As of JDK version 1.5, replaced by" + NL + - " <a href=\"pkg1/C1.html#setUndecorated(boolean)\">" + + " <a href=\"pkg1/C1.html#setUndecorated-boolean-\">" + "<code>setUndecorated(boolean)</code></a>.</span></div>" + NL + "<div class=\"block\">This field indicates whether the C1 is " + "undecorated.</div>" + NL + " " + NL + "<dl>" + NL + "<dt><span class=\"strong\">Since:</span></dt>" + NL + "<dd>1.4</dd>" + NL + "<dt><span class=\"strong\">See Also:</span>" + - "</dt>" + NL + "<dd><a href=\"pkg1/C1.html#setUndecorated(boolean)\">" + + "</dt>" + NL + "<dd><a href=\"pkg1/C1.html#setUndecorated-boolean-\">" + "<code>C1.setUndecorated(boolean)</code></a></dd>" + NL + "</dl>"}, {BUG_ID + FS + "serialized-form.html", "<span class=\"strong\">Deprecated.</span>" + " <span class=\"italic\">As of JDK version 1.5, replaced by" + NL + - " <a href=\"pkg1/C1.html#setUndecorated(boolean)\">" + + " <a href=\"pkg1/C1.html#setUndecorated-boolean-\">" + "<code>setUndecorated(boolean)</code></a>.</span></div>" + NL + "<div class=\"block\">Reads the object stream.</div>" + NL + "<dl>" + NL + "<dt><span class=\"strong\">Throws:" + @@ -141,29 +141,29 @@ " if no decorations are" + NL + " to be enabled;" + NL + " <code>false</code> if decorations are to be enabled." + "</dd>" + NL + "<dt><span class=\"strong\">Since:</span></dt>" + NL + "<dd>1.4</dd>" + NL + - "<dt><span class=\"strong\">See Also:</span></dt>" + NL + "<dd><a href=\"../pkg1/C1.html#readObject()\">" + + "<dt><span class=\"strong\">See Also:</span></dt>" + NL + "<dd><a href=\"../pkg1/C1.html#readObject--\">" + "<code>readObject()</code></a></dd>" + NL + "</dl>"}, {BUG_ID + FS + "pkg1" + FS + "C1.html", "<dl>" + NL + "<dt><span class=\"strong\">Throws:</span>" + "</dt>" + NL + "<dd><code>java.io.IOException</code></dd>" + NL + "<dt>" + - "<span class=\"strong\">See Also:</span></dt>" + NL + "<dd><a href=\"../pkg1/C1.html#setUndecorated(boolean)\">" + + "<span class=\"strong\">See Also:</span></dt>" + NL + "<dd><a href=\"../pkg1/C1.html#setUndecorated-boolean-\">" + "<code>setUndecorated(boolean)</code></a></dd>" + NL + "</dl>"}, {BUG_ID + FS + "serialized-form.html", "<dl>" + NL + "<dt><span class=\"strong\">Throws:</span>" + "</dt>" + NL + "<dd><code>" + "java.io.IOException</code></dd>" + NL + "<dt><span class=\"strong\">See Also:</span>" + - "</dt>" + NL + "<dd><a href=\"pkg1/C1.html#setUndecorated(boolean)\">" + + "</dt>" + NL + "<dd><a href=\"pkg1/C1.html#setUndecorated-boolean-\">" + "<code>C1.setUndecorated(boolean)</code></a></dd>" + NL + "</dl>"}, {BUG_ID + FS + "serialized-form.html", "<span class=\"strong\">Deprecated.</span>" + " <span class=\"italic\">As of JDK version 1.5, replaced by" + NL + - " <a href=\"pkg1/C1.html#setUndecorated(boolean)\">" + + " <a href=\"pkg1/C1.html#setUndecorated-boolean-\">" + "<code>setUndecorated(boolean)</code></a>.</span></div>" + NL + "<div class=\"block\">This field indicates whether the C1 is " + "undecorated.</div>" + NL + " " + NL + "<dl>" + NL + "<dt><span class=\"strong\">Since:</span></dt>" + NL + "<dd>1.4</dd>" + NL + "<dt><span class=\"strong\">See Also:</span>" + - "</dt>" + NL + "<dd><a href=\"pkg1/C1.html#setUndecorated(boolean)\">" + + "</dt>" + NL + "<dd><a href=\"pkg1/C1.html#setUndecorated-boolean-\">" + "<code>C1.setUndecorated(boolean)</code></a></dd>" + NL + "</dl>"}, {BUG_ID + FS + "serialized-form.html", "<span class=\"strong\">Deprecated.</span>" + " <span class=\"italic\">As of JDK version 1.5, replaced by" + NL + - " <a href=\"pkg1/C1.html#setUndecorated(boolean)\">" + + " <a href=\"pkg1/C1.html#setUndecorated-boolean-\">" + "<code>setUndecorated(boolean)</code></a>.</span></div>" + NL + "<div class=\"block\">Reads the object stream.</div>" + NL + "<dl>" + NL + "<dt><span class=\"strong\">Throws:" + @@ -188,12 +188,12 @@ {BUG_ID + FS + "serialized-form.html", "<pre>boolean " + "undecorated</pre>" + NL + "<div class=\"block\"><span class=\"strong\">" + "Deprecated.</span> <span class=\"italic\">As of JDK version 1.5, replaced by" + NL + - " <a href=\"pkg1/C1.html#setUndecorated(boolean)\"><code>" + + " <a href=\"pkg1/C1.html#setUndecorated-boolean-\"><code>" + "setUndecorated(boolean)</code></a>.</span></div>" + NL + "</li>"}, {BUG_ID + FS + "serialized-form.html", "<span class=\"strong\">" + "Deprecated.</span> <span class=\"italic\">As of JDK version" + " 1.5, replaced by" + NL + - " <a href=\"pkg1/C1.html#setUndecorated(boolean)\">" + + " <a href=\"pkg1/C1.html#setUndecorated-boolean-\">" + "<code>setUndecorated(boolean)</code></a>.</span></div>" + NL + "</li>"}}; // Test for valid HTML generation which should not comprise of empty
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/com/sun/javadoc/testHtmlTableStyles/TestHtmlTableStyles.java Fri Oct 11 19:05:18 2013 +0100 @@ -0,0 +1,110 @@ +/* + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 8008164 + * @summary Test styles on HTML tables generated by javadoc. + * @author Bhavesh Patel + * @library ../lib/ + * @build JavadocTester TestHtmlTableStyles + * @run main TestHtmlTableStyles + */ + +public class TestHtmlTableStyles extends JavadocTester { + + private static final String BUG_ID = "8008164"; + + //Input for string search tests. + private static final String[][] TEST = { + {BUG_ID + FS + "pkg1" + FS + "TestTable.html", + "<table border cellpadding=3 cellspacing=1>" + }, + {BUG_ID + FS + "pkg1" + FS + "TestTable.html", + "<table class=\"memberSummary\" border=\"0\" cellpadding=\"3\" " + + "cellspacing=\"0\" summary=\"Field Summary table, listing fields, " + + "and an explanation\">" + }, + {BUG_ID + FS + "pkg1" + FS + "TestTable.html", + "<table class=\"memberSummary\" border=\"0\" cellpadding=\"3\" " + + "cellspacing=\"0\" summary=\"Constructor Summary table, listing " + + "constructors, and an explanation\">" + }, + {BUG_ID + FS + "pkg1" + FS + "TestTable.html", + "<table class=\"memberSummary\" border=\"0\" cellpadding=\"3\" " + + "cellspacing=\"0\" summary=\"Method Summary table, listing methods, " + + "and an explanation\">" + }, + {BUG_ID + FS + "pkg1" + FS + "package-summary.html", + "<table class=\"typeSummary\" border=\"0\" cellpadding=\"3\" " + + "cellspacing=\"0\" summary=\"Class Summary table, listing classes, " + + "and an explanation\">" + }, + {BUG_ID + FS + "pkg1" + FS + "class-use" + FS + "TestTable.html", + "<table class=\"useSummary\" border=\"0\" cellpadding=\"3\" " + + "cellspacing=\"0\" summary=\"Use table, listing fields, and an explanation\">" + }, + {BUG_ID + FS + "overview-summary.html", + "<table class=\"overviewSummary\" border=\"0\" cellpadding=\"3\" " + + "cellspacing=\"0\" summary=\"Packages table, listing packages, and an explanation\">" + }, + {BUG_ID + FS + "deprecated-list.html", + "<table class=\"deprecatedSummary\" border=\"0\" cellpadding=\"3\" " + + "cellspacing=\"0\" summary=\"Deprecated Methods table, listing " + + "deprecated methods, and an explanation\">" + }, + {BUG_ID + FS + "constant-values.html", + "<table class=\"constantsSummary\" border=\"0\" cellpadding=\"3\" " + + "cellspacing=\"0\" summary=\"Constant Field Values table, listing " + + "constant fields, and values\">" + }, + }; + + private static final String[] ARGS = new String[] { + "-d", BUG_ID, "-sourcepath", SRC_DIR, "-use", "pkg1", "pkg2" + }; + + /** + * The entry point of the test. + * @param args the array of command line arguments. + */ + public static void main(String[] args) throws Exception { + TestHtmlTableStyles tester = new TestHtmlTableStyles(); + run(tester, ARGS, TEST, NO_TEST); + tester.printSummary(); + } + + /** + * {@inheritDoc} + */ + public String getBugId() { + return BUG_ID; + } + + /** + * {@inheritDoc} + */ + public String getBugName() { + return getClass().getName(); + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/com/sun/javadoc/testHtmlTableStyles/pkg1/TestTable.java Fri Oct 11 19:05:18 2013 +0100 @@ -0,0 +1,84 @@ +/* + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package pkg1; + +/** + * Testing table in documentation comment. In the generated documentation, it + * should be displayed as a regular table and not have any styles that the javadoc + * generated tables have. + * + * <table border cellpadding=3 cellspacing=1> + * <caption>Summary of test table</caption> + * <tr> + * <td></td> + * <td align=center colspan = 2> First Element (Head)</td> + * <td align=center colspan = 2> Last Element (Tail)</td> + * </tr> + * <tr> + * <td></td> + * <td align=center><em>Throws exception</em></td> + * <td align=center><em>Special value</em></td> + * <td align=center><em>Throws exception</em></td> + * <td align=center><em>Special value</em></td> + * </tr> + * <tr> + * <td>Insert</td> + * <td>addFirst(e)</td> + * <td>offerFirst(e)</td> + * <td>addLast(e)</td> + * <td>offerLast(e)</td> + * </tr> + * <tr> + * <td>Remove</td> + * <td>removeFirst()</td> + * <td>pollFirst()</td> + * <td>removeLast()</td> + * <td>pollLast()</td> + * </tr> + * </table> + */ +public class TestTable +{ + /** + * Field in Class. + */ + public String field; + + /** + * Field constant in Class. + */ + public static final int fieldCnst = 0; + + /** + * Method in Class. + */ + public void methodInClass(int i) {} + + /** + * Deprecated method in Class. + * @deprecated Do not use it. + */ + public void deprMethod() {} + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/com/sun/javadoc/testHtmlTableStyles/pkg2/TestUse.java Fri Oct 11 19:05:18 2013 +0100 @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package pkg2; + +import pkg1.*; + +/** + * Testing use of TestTable. + */ +public class TestUse +{ + public TestTable tTable; +}
--- a/test/com/sun/javadoc/testHtmlTableTags/TestHtmlTableTags.java Thu Oct 03 19:28:07 2013 +0100 +++ b/test/com/sun/javadoc/testHtmlTableTags/TestHtmlTableTags.java Fri Oct 11 19:05:18 2013 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -23,7 +23,7 @@ /* * @test - * @bug 6786688 + * @bug 6786688 8008164 * @summary HTML tables should have table summary, caption and table headers. * @author Bhavesh Patel * @library ../lib/ @@ -50,121 +50,121 @@ //Package summary {BUG_ID + FS + "pkg1" + FS + "package-summary.html", - "<table class=\"packageSummary\" border=\"0\" cellpadding=\"3\"" + + "<table class=\"typeSummary\" border=\"0\" cellpadding=\"3\"" + " cellspacing=\"0\" summary=\"Class Summary table, " + "listing classes, and an explanation\">" }, {BUG_ID + FS + "pkg1" + FS + "package-summary.html", - "<table class=\"packageSummary\" border=\"0\" cellpadding=\"3\"" + + "<table class=\"typeSummary\" border=\"0\" cellpadding=\"3\"" + " cellspacing=\"0\" summary=\"Interface Summary table, " + "listing interfaces, and an explanation\">" }, {BUG_ID + FS + "pkg2" + FS + "package-summary.html", - "<table class=\"packageSummary\" border=\"0\" cellpadding=\"3\"" + + "<table class=\"typeSummary\" border=\"0\" cellpadding=\"3\"" + " cellspacing=\"0\" summary=\"Enum Summary table, " + "listing enums, and an explanation\">" }, {BUG_ID + FS + "pkg2" + FS + "package-summary.html", - "<table class=\"packageSummary\" border=\"0\" cellpadding=\"3\"" + + "<table class=\"typeSummary\" border=\"0\" cellpadding=\"3\"" + " cellspacing=\"0\" summary=\"Annotation Types Summary table, " + "listing annotation types, and an explanation\">" }, // Class documentation {BUG_ID + FS + "pkg1" + FS + "C1.html", - "<table class=\"overviewSummary\" border=\"0\" cellpadding=\"3\" " + + "<table class=\"memberSummary\" border=\"0\" cellpadding=\"3\" " + "cellspacing=\"0\" summary=\"Field Summary table, listing fields, " + "and an explanation\">" }, {BUG_ID + FS + "pkg1" + FS + "C1.html", - "<table class=\"overviewSummary\" border=\"0\" cellpadding=\"3\" " + + "<table class=\"memberSummary\" border=\"0\" cellpadding=\"3\" " + "cellspacing=\"0\" summary=\"Method Summary table, listing methods, " + "and an explanation\">" }, {BUG_ID + FS + "pkg2" + FS + "C2.html", - "<table class=\"overviewSummary\" border=\"0\" cellpadding=\"3\" " + + "<table class=\"memberSummary\" border=\"0\" cellpadding=\"3\" " + "cellspacing=\"0\" summary=\"Nested Class Summary table, listing " + "nested classes, and an explanation\">" }, {BUG_ID + FS + "pkg2" + FS + "C2.html", - "<table class=\"overviewSummary\" border=\"0\" cellpadding=\"3\" " + + "<table class=\"memberSummary\" border=\"0\" cellpadding=\"3\" " + "cellspacing=\"0\" summary=\"Constructor Summary table, listing " + "constructors, and an explanation\">" }, {BUG_ID + FS + "pkg2" + FS + "C2.ModalExclusionType.html", - "<table class=\"overviewSummary\" border=\"0\" cellpadding=\"3\" " + + "<table class=\"memberSummary\" border=\"0\" cellpadding=\"3\" " + "cellspacing=\"0\" summary=\"Enum Constant Summary table, listing " + "enum constants, and an explanation\">" }, {BUG_ID + FS + "pkg2" + FS + "C3.html", - "<table class=\"overviewSummary\" border=\"0\" cellpadding=\"3\" " + + "<table class=\"memberSummary\" border=\"0\" cellpadding=\"3\" " + "cellspacing=\"0\" summary=\"Required Element Summary table, " + "listing required elements, and an explanation\">" }, {BUG_ID + FS + "pkg2" + FS + "C4.html", - "<table class=\"overviewSummary\" border=\"0\" cellpadding=\"3\" " + + "<table class=\"memberSummary\" border=\"0\" cellpadding=\"3\" " + "cellspacing=\"0\" summary=\"Optional Element Summary table, " + "listing optional elements, and an explanation\">" }, // Class use documentation {BUG_ID + FS + "pkg1" + FS + "class-use" + FS + "I1.html", - "<table border=\"0\" cellpadding=\"3\" cellspacing=\"0\" summary=\"Use " + + "<table class=\"useSummary\" border=\"0\" cellpadding=\"3\" cellspacing=\"0\" summary=\"Use " + "table, listing packages, and an explanation\">" }, {BUG_ID + FS + "pkg1" + FS + "class-use" + FS + "C1.html", - "<table border=\"0\" cellpadding=\"3\" cellspacing=\"0\" summary=\"Use " + + "<table class=\"useSummary\" border=\"0\" cellpadding=\"3\" cellspacing=\"0\" summary=\"Use " + "table, listing fields, and an explanation\">" }, {BUG_ID + FS + "pkg1" + FS + "class-use" + FS + "C1.html", - "<table border=\"0\" cellpadding=\"3\" cellspacing=\"0\" summary=\"Use " + + "<table class=\"useSummary\" border=\"0\" cellpadding=\"3\" cellspacing=\"0\" summary=\"Use " + "table, listing methods, and an explanation\">" }, {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "C2.html", - "<table border=\"0\" cellpadding=\"3\" cellspacing=\"0\" summary=\"Use " + + "<table class=\"useSummary\" border=\"0\" cellpadding=\"3\" cellspacing=\"0\" summary=\"Use " + "table, listing fields, and an explanation\">" }, {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "C2.html", - "<table border=\"0\" cellpadding=\"3\" cellspacing=\"0\" summary=\"Use " + + "<table class=\"useSummary\" border=\"0\" cellpadding=\"3\" cellspacing=\"0\" summary=\"Use " + "table, listing methods, and an explanation\">" }, {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "C2.ModalExclusionType.html", - "<table border=\"0\" cellpadding=\"3\" cellspacing=\"0\" summary=\"Use " + + "<table class=\"useSummary\" border=\"0\" cellpadding=\"3\" cellspacing=\"0\" summary=\"Use " + "table, listing packages, and an explanation\">" }, {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "C2.ModalExclusionType.html", - "<table border=\"0\" cellpadding=\"3\" cellspacing=\"0\" summary=\"Use " + + "<table class=\"useSummary\" border=\"0\" cellpadding=\"3\" cellspacing=\"0\" summary=\"Use " + "table, listing methods, and an explanation\">" }, // Package use documentation {BUG_ID + FS + "pkg1" + FS + "package-use.html", - "<table border=\"0\" cellpadding=\"3\" cellspacing=\"0\" summary=\"Use " + + "<table class=\"useSummary\" border=\"0\" cellpadding=\"3\" cellspacing=\"0\" summary=\"Use " + "table, listing packages, and an explanation\">" }, {BUG_ID + FS + "pkg1" + FS + "package-use.html", - "<table border=\"0\" cellpadding=\"3\" cellspacing=\"0\" summary=\"Use " + + "<table class=\"useSummary\" border=\"0\" cellpadding=\"3\" cellspacing=\"0\" summary=\"Use " + "table, listing classes, and an explanation\">" }, {BUG_ID + FS + "pkg2" + FS + "package-use.html", - "<table border=\"0\" cellpadding=\"3\" cellspacing=\"0\" summary=\"Use " + + "<table class=\"useSummary\" border=\"0\" cellpadding=\"3\" cellspacing=\"0\" summary=\"Use " + "table, listing packages, and an explanation\">" }, {BUG_ID + FS + "pkg2" + FS + "package-use.html", - "<table border=\"0\" cellpadding=\"3\" cellspacing=\"0\" summary=\"Use " + + "<table class=\"useSummary\" border=\"0\" cellpadding=\"3\" cellspacing=\"0\" summary=\"Use " + "table, listing classes, and an explanation\">" }, // Deprecated {BUG_ID + FS + "deprecated-list.html", - "<table border=\"0\" cellpadding=\"3\" cellspacing=\"0\" " + + "<table class=\"deprecatedSummary\" border=\"0\" cellpadding=\"3\" cellspacing=\"0\" " + "summary=\"Deprecated Fields table, listing deprecated fields, " + "and an explanation\">" }, {BUG_ID + FS + "deprecated-list.html", - "<table border=\"0\" cellpadding=\"3\" cellspacing=\"0\" " + + "<table class=\"deprecatedSummary\" border=\"0\" cellpadding=\"3\" cellspacing=\"0\" " + "summary=\"Deprecated Methods table, listing deprecated methods, " + "and an explanation\">" }, // Constant values {BUG_ID + FS + "constant-values.html", - "<table border=\"0\" cellpadding=\"3\" cellspacing=\"0\" " + + "<table class=\"constantsSummary\" border=\"0\" cellpadding=\"3\" cellspacing=\"0\" " + "summary=\"Constant Field Values table, listing " + "constant fields, and values\">" },
--- a/test/com/sun/javadoc/testInterface/TestInterface.java Thu Oct 03 19:28:07 2013 +0100 +++ b/test/com/sun/javadoc/testInterface/TestInterface.java Fri Oct 11 19:05:18 2013 +0100 @@ -23,7 +23,7 @@ /* * @test - * @bug 4682448 4947464 5029946 + * @bug 4682448 4947464 5029946 8025633 * @summary Verify that the public modifier does not show up in the * documentation for public methods, as recommended by the JLS. * If A implements I and B extends A, B should be in the list of @@ -84,7 +84,7 @@ //Make sure "Specified By" has substituted type parameters. {BUG_ID + FS + "pkg" + FS + "Child.html", "<dt><span class=\"strong\">Specified by:</span></dt>" + NL + - "<dd><code><a href=\"../pkg/Interface.html#method()\">method</a>" + + "<dd><code><a href=\"../pkg/Interface.html#method--\">method</a>" + "</code> in interface <code>" + "<a href=\"../pkg/Interface.html\" title=\"interface in pkg\">" + "Interface</a><<a href=\"../pkg/Child.html\" title=\"type parameter in Child\">" + @@ -93,7 +93,7 @@ //Make sure "Overrides" has substituted type parameters. {BUG_ID + FS + "pkg" + FS + "Child.html", "<dt><span class=\"strong\">Overrides:</span></dt>" + NL + - "<dd><code><a href=\"../pkg/Parent.html#method()\">method</a>" + + "<dd><code><a href=\"../pkg/Parent.html#method--\">method</a>" + "</code> in class <code><a href=\"../pkg/Parent.html\" " + "title=\"class in pkg\">Parent</a><<a href=\"../pkg/Child.html\" " + "title=\"type parameter in Child\">T</a>></code></dd>"
--- a/test/com/sun/javadoc/testJavaFX/TestJavaFX.java Thu Oct 03 19:28:07 2013 +0100 +++ b/test/com/sun/javadoc/testJavaFX/TestJavaFX.java Fri Oct 11 19:05:18 2013 +0100 @@ -23,7 +23,7 @@ /* * @test - * @bug 7112427 8012295 + * @bug 7112427 8012295 8025633 * @summary Test of the JavaFX doclet features. * @author jvalenta * @library ../lib/ @@ -38,8 +38,8 @@ private static final String[][] TEST = new String[][] { {"./" + BUG_ID + "/C.html", - "<dt><span class=\"strong\">See Also:</span></dt>" + NL + "<dd><a href=\"C.html#getRate()\"><code>getRate()</code></a>, " + NL + - "<a href=\"C.html#setRate(double)\"><code>setRate(double)</code></a></dd>"}, + "<dt><span class=\"strong\">See Also:</span></dt>" + NL + "<dd><a href=\"C.html#getRate--\"><code>getRate()</code></a>, " + NL + + "<a href=\"C.html#setRate-double-\"><code>setRate(double)</code></a></dd>"}, {"./" + BUG_ID + "/C.html", "<pre>public final void setRate(double value)</pre>" + NL + "<div class=\"block\">Sets the value of the property rate.</div>" + NL + @@ -63,7 +63,7 @@ {"./" + BUG_ID + "/C.html", "<span class=\"strong\">Property description:</span>"}, {"./" + BUG_ID + "/C.html", - "<td class=\"colLast\"><code><span class=\"strong\"><a href=\"C.html#setTestMethodProperty()\">setTestMethodProperty</a></span>()</code> </td>" }, + "<td class=\"colLast\"><code><span class=\"strong\"><a href=\"C.html#setTestMethodProperty--\">setTestMethodProperty</a></span>()</code> </td>" }, {"./" + BUG_ID + "/C.html", "<h4>isPaused</h4>" + NL + "<pre>public final double isPaused()</pre>" + NL +
--- a/test/com/sun/javadoc/testJavascript/TestJavascript.java Thu Oct 03 19:28:07 2013 +0100 +++ b/test/com/sun/javadoc/testJavascript/TestJavascript.java Fri Oct 11 19:05:18 2013 +0100 @@ -23,7 +23,7 @@ /* * @test - * @bug 4665566 4855876 7025314 8012375 8015997 8016328 + * @bug 4665566 4855876 7025314 8012375 8015997 8016328 8024756 * @summary Verify that the output has the right javascript. * @author jamieh * @library ../lib/ @@ -104,9 +104,13 @@ //Make sure title javascript only runs if is-external is not true {BUG_ID + FS + "pkg" + FS + "C.html", - " if (location.href.indexOf('is-external=true') == -1) {" + NL + - " parent.document.title=\"C\";" + NL + - " }"}, + " try {" + NL + + " if (location.href.indexOf('is-external=true') == -1) {" + NL + + " parent.document.title=\"C\";" + NL + + " }" + NL + + " }" + NL + + " catch(err) {" + NL + + " }"}, }; private static final String[][] NEGATED_TEST = NO_TEST;
--- a/test/com/sun/javadoc/testLinkTaglet/TestLinkTaglet.java Thu Oct 03 19:28:07 2013 +0100 +++ b/test/com/sun/javadoc/testLinkTaglet/TestLinkTaglet.java Fri Oct 11 19:05:18 2013 +0100 @@ -23,7 +23,7 @@ /* * @test - * @bug 4732864 6280605 7064544 8014636 8016328 + * @bug 4732864 6280605 7064544 8014636 8016328 8025633 * @summary Make sure that you can link from one member to another using * non-qualified name, furthermore, ensure the right one is linked. * @author jamieh @@ -49,9 +49,9 @@ "Qualified Link: <a href=\"../pkg/C.InnerC.html\" title=\"class in pkg\"><code>C.InnerC</code></a>.<br/>" + NL + " Unqualified Link1: <a href=\"../pkg/C.InnerC.html\" title=\"class in pkg\"><code>C.InnerC</code></a>.<br/>" + NL + " Unqualified Link2: <a href=\"../pkg/C.InnerC.html\" title=\"class in pkg\"><code>C.InnerC</code></a>.<br/>" + NL + - " Qualified Link: <a href=\"../pkg/C.html#method(pkg.C.InnerC,%20pkg.C.InnerC2)\"><code>method(pkg.C.InnerC, pkg.C.InnerC2)</code></a>.<br/>" + NL + - " Unqualified Link: <a href=\"../pkg/C.html#method(pkg.C.InnerC,%20pkg.C.InnerC2)\"><code>method(C.InnerC, C.InnerC2)</code></a>.<br/>" + NL + - " Unqualified Link: <a href=\"../pkg/C.html#method(pkg.C.InnerC,%20pkg.C.InnerC2)\"><code>method(InnerC, InnerC2)</code></a>.<br/>" + " Qualified Link: <a href=\"../pkg/C.html#method-pkg.C.InnerC-pkg.C.InnerC2-\"><code>method(pkg.C.InnerC, pkg.C.InnerC2)</code></a>.<br/>" + NL + + " Unqualified Link: <a href=\"../pkg/C.html#method-pkg.C.InnerC-pkg.C.InnerC2-\"><code>method(C.InnerC, C.InnerC2)</code></a>.<br/>" + NL + + " Unqualified Link: <a href=\"../pkg/C.html#method-pkg.C.InnerC-pkg.C.InnerC2-\"><code>method(InnerC, InnerC2)</code></a>.<br/>" }, {BUG_ID + FS + "pkg" + FS + "C.InnerC.html", "Link to member in outer class: <a href=\"../pkg/C.html#MEMBER\"><code>C.MEMBER</code></a> <br/>" + NL +
--- a/test/com/sun/javadoc/testMemberInheritence/TestMemberInheritence.java Thu Oct 03 19:28:07 2013 +0100 +++ b/test/com/sun/javadoc/testMemberInheritence/TestMemberInheritence.java Fri Oct 11 19:05:18 2013 +0100 @@ -23,7 +23,7 @@ /* * @test - * @bug 4638588 4635809 6256068 6270645 + * @bug 4638588 4635809 6256068 6270645 8025633 * @summary Test to make sure that members are inherited properly in the Javadoc. * Verify that inheritence labels are correct. * @author jamieh @@ -44,7 +44,7 @@ //Public method should be inherited {BUG_ID + FS + "pkg" + FS + "SubClass.html", - "<a href=\"../pkg/BaseClass.html#pubMethod()\">"}, + "<a href=\"../pkg/BaseClass.html#pubMethod--\">"}, //Public inner class should be inherited. {BUG_ID + FS + "pkg" + FS + "SubClass.html", @@ -56,7 +56,7 @@ //Protected method should be inherited {BUG_ID + FS + "pkg" + FS + "SubClass.html", - "<a href=\"../pkg/BaseClass.html#proMethod()\">"}, + "<a href=\"../pkg/BaseClass.html#proMethod--\">"}, //Protected inner class should be inherited. {BUG_ID + FS + "pkg" + FS + "SubClass.html", @@ -73,14 +73,14 @@ // Test overriding/implementing methods with generic parameters. {BUG_ID + FS + "pkg" + FS + "BaseClass.html", "<dl>" + NL + "<dt><span class=\"strong\">Specified by:</span></dt>" + NL + - "<dd><code><a href=\"../pkg/BaseInterface.html#getAnnotation(java.lang.Class)\">" + + "<dd><code><a href=\"../pkg/BaseInterface.html#getAnnotation-java.lang.Class-\">" + "getAnnotation</a></code> in interface <code>" + "<a href=\"../pkg/BaseInterface.html\" title=\"interface in pkg\">" + "BaseInterface</a></code></dd>" + NL + "</dl>"}, // Test diamond inheritence member summary (6256068) {BUG_ID + FS + "diamond" + FS + "Z.html", - "<code><a href=\"../diamond/A.html#aMethod()\">aMethod</a></code>"}, + "<code><a href=\"../diamond/A.html#aMethod--\">aMethod</a></code>"}, // Test that doc is inherited from closed parent (6270645) {BUG_ID + FS + "inheritDist" + FS + "C.html", @@ -90,7 +90,7 @@ private static final String[][] NEGATED_TEST = { {BUG_ID + FS + "pkg" + FS + "SubClass.html", - "<a href=\"../pkg/BaseClass.html#staticMethod()\">staticMethod</a></code>"}, + "<a href=\"../pkg/BaseClass.html#staticMethod--\">staticMethod</a></code>"}, }; private static final String[] ARGS = new String[] {
--- a/test/com/sun/javadoc/testMemberSummary/TestMemberSummary.java Thu Oct 03 19:28:07 2013 +0100 +++ b/test/com/sun/javadoc/testMemberSummary/TestMemberSummary.java Fri Oct 11 19:05:18 2013 +0100 @@ -23,7 +23,7 @@ /* * @test - * @bug 4951228 6290760 + * @bug 4951228 6290760 8025633 * @summary Test the case where the overriden method returns a different * type than the method in the child class. Make sure the * documentation is inherited but the return type isn't. @@ -49,7 +49,7 @@ // Check return type in member summary. {BUG_ID + FS + "pkg" + FS + "PublicChild.html", "<code><a href=\"../pkg/PublicChild.html\" title=\"class in pkg\">PublicChild</a></code></td>" + NL + - "<td class=\"colLast\"><code><span class=\"strong\"><a href=\"../pkg/PublicChild.html#returnTypeTest()\">" + + "<td class=\"colLast\"><code><span class=\"strong\"><a href=\"../pkg/PublicChild.html#returnTypeTest--\">" + "returnTypeTest</a></span>()</code>" }, // Check return type in member detail. @@ -60,9 +60,9 @@ // Legacy anchor dimensions (6290760) {BUG_ID + FS + "pkg2" + FS + "A.html", - "<a name=\"f(java.lang.Object[])\">" + NL + + "<a name=\"f-java.lang.Object:A-\">" + NL + "<!-- -->" + NL + - "</a><a name=\"f(T[])\">" + NL + + "</a><a name=\"f-T:A-\">" + NL + "<!-- -->" + NL + "</a>" },
--- a/test/com/sun/javadoc/testNavigation/TestNavigation.java Thu Oct 03 19:28:07 2013 +0100 +++ b/test/com/sun/javadoc/testNavigation/TestNavigation.java Fri Oct 11 19:05:18 2013 +0100 @@ -23,7 +23,7 @@ /* * @test - * @bug 4131628 4664607 7025314 8023700 7198273 + * @bug 4131628 4664607 7025314 8023700 7198273 8025633 * @summary Make sure the Next/Prev Class links iterate through all types. * Make sure the navagation is 2 columns, not 3. * @author jamieh @@ -60,7 +60,7 @@ {BUG_ID + FS + "pkg" + FS + "I.html", "<li>Next Class</li>"}, // Test for 4664607 {BUG_ID + FS + "pkg" + FS + "I.html", - "<div class=\"skipNav\"><a href=\"#skip-navbar_top\" title=\"Skip navigation links\">Skip navigation links</a></div>" + NL + "<a name=\"navbar_top_firstrow\">" + NL + + "<div class=\"skipNav\"><a href=\"#skip.navbar.top\" title=\"Skip navigation links\">Skip navigation links</a></div>" + NL + "<a name=\"navbar.top.firstrow\">" + NL + "<!-- -->" + NL + "</a>"} }; private static final String[][] NEGATED_TEST = NO_TEST;
--- a/test/com/sun/javadoc/testNestedGenerics/TestNestedGenerics.java Thu Oct 03 19:28:07 2013 +0100 +++ b/test/com/sun/javadoc/testNestedGenerics/TestNestedGenerics.java Fri Oct 11 19:05:18 2013 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -23,7 +23,7 @@ /* * @test - * @bug 6758050 + * @bug 6758050 8025633 * @summary Test HTML output for nested generic types. * @author bpatel * @library ../lib/ @@ -46,7 +46,7 @@ private static final String[][] TEST = { {BUG_ID + FS + "pkg" + FS + "NestedGenerics.html", "<div class=\"block\">Contains <a " + - "href=\"../pkg/NestedGenerics.html#foo(java.util.Map)\"><code>foo" + + "href=\"../pkg/NestedGenerics.html#foo-java.util.Map-\"><code>foo" + "(java.util.Map<A, java.util.Map<A, A>>)</code></a></div>" } };
--- a/test/com/sun/javadoc/testNewLanguageFeatures/TestNewLanguageFeatures.java Thu Oct 03 19:28:07 2013 +0100 +++ b/test/com/sun/javadoc/testNewLanguageFeatures/TestNewLanguageFeatures.java Fri Oct 11 19:05:18 2013 +0100 @@ -23,7 +23,7 @@ /* * @test - * @bug 4789689 4905985 4927164 4827184 4993906 5004549 7025314 7010344 + * @bug 4789689 4905985 4927164 4827184 4993906 5004549 7025314 7010344 8025633 * @summary Run Javadoc on a set of source files that demonstrate new * language features. Check the output to ensure that the new * language features are properly documented. @@ -145,7 +145,7 @@ //================================= {BUG_ID + FS + "pkg" + FS + "VarArgs.html", "(int... i)"}, {BUG_ID + FS + "pkg" + FS + "VarArgs.html", "(int[][]... i)"}, - {BUG_ID + FS + "pkg" + FS + "VarArgs.html", "(int[]...)"}, + {BUG_ID + FS + "pkg" + FS + "VarArgs.html", "-int:A...-"}, {BUG_ID + FS + "pkg" + FS + "VarArgs.html", "<a href=\"../pkg/TypeParameters.html\" title=\"class in pkg\">" + "TypeParameters</a>... t"}, @@ -156,13 +156,13 @@ //Make sure the summary links are correct. {BUG_ID + FS + "pkg" + FS + "AnnotationType.html", "<li>Summary: </li>" + NL + "<li>Field | </li>" + NL + - "<li><a href=\"#annotation_type_required_element_summary\">" + + "<li><a href=\"#annotation.type.required.element.summary\">" + "Required</a> | </li>" + NL + "<li>" + - "<a href=\"#annotation_type_optional_element_summary\">Optional</a></li>"}, + "<a href=\"#annotation.type.optional.element.summary\">Optional</a></li>"}, //Make sure the detail links are correct. {BUG_ID + FS + "pkg" + FS + "AnnotationType.html", "<li>Detail: </li>" + NL + "<li>Field | </li>" + NL + - "<li><a href=\"#annotation_type_element_detail\">Element</a></li>"}, + "<li><a href=\"#annotation.type.element.detail\">Element</a></li>"}, //Make sure the heading is correct. {BUG_ID + FS + "pkg" + FS + "AnnotationType.html", "Annotation Type AnnotationType</h2>"}, @@ -188,16 +188,16 @@ //PACKAGE {BUG_ID + FS + "pkg" + FS + "package-summary.html", - "<a href=\"../pkg/AnnotationType.html\" title=\"annotation in pkg\">@AnnotationType</a>(<a href=\"../pkg/AnnotationType.html#optional()\">optional</a>=\"Package Annotation\"," + NL + - " <a href=\"../pkg/AnnotationType.html#required()\">required</a>=1994)"}, + "<a href=\"../pkg/AnnotationType.html\" title=\"annotation in pkg\">@AnnotationType</a>(<a href=\"../pkg/AnnotationType.html#optional--\">optional</a>=\"Package Annotation\"," + NL + + " <a href=\"../pkg/AnnotationType.html#required--\">required</a>=1994)"}, //CLASS {BUG_ID + FS + "pkg" + FS + "AnnotationTypeUsage.html", "<pre><a href=\"../pkg/AnnotationType.html\" " + "title=\"annotation in pkg\">@AnnotationType</a>(" + - "<a href=\"../pkg/AnnotationType.html#optional()\">optional</a>" + + "<a href=\"../pkg/AnnotationType.html#optional--\">optional</a>" + "=\"Class Annotation\"," + NL + - " <a href=\"../pkg/AnnotationType.html#required()\">" + + " <a href=\"../pkg/AnnotationType.html#required--\">" + "required</a>=1994)" + NL + "public class <span class=\"strong\">" + "AnnotationTypeUsage</span>" + NL + "extends java.lang.Object</pre>"}, @@ -205,36 +205,36 @@ {BUG_ID + FS + "pkg" + FS + "AnnotationTypeUsage.html", "<pre><a href=\"../pkg/AnnotationType.html\" " + "title=\"annotation in pkg\">@AnnotationType</a>(" + - "<a href=\"../pkg/AnnotationType.html#optional()\">optional</a>" + + "<a href=\"../pkg/AnnotationType.html#optional--\">optional</a>" + "=\"Field Annotation\"," + NL + - " <a href=\"../pkg/AnnotationType.html#required()\">" + + " <a href=\"../pkg/AnnotationType.html#required--\">" + "required</a>=1994)" + NL + "public int field</pre>"}, //CONSTRUCTOR {BUG_ID + FS + "pkg" + FS + "AnnotationTypeUsage.html", "<pre><a href=\"../pkg/AnnotationType.html\" " + "title=\"annotation in pkg\">@AnnotationType</a>(" + - "<a href=\"../pkg/AnnotationType.html#optional()\">optional</a>" + + "<a href=\"../pkg/AnnotationType.html#optional--\">optional</a>" + "=\"Constructor Annotation\"," + NL + - " <a href=\"../pkg/AnnotationType.html#required()\">" + + " <a href=\"../pkg/AnnotationType.html#required--\">" + "required</a>=1994)" + NL + "public AnnotationTypeUsage()</pre>"}, //METHOD {BUG_ID + FS + "pkg" + FS + "AnnotationTypeUsage.html", "<pre><a href=\"../pkg/AnnotationType.html\" " + "title=\"annotation in pkg\">@AnnotationType</a>(" + - "<a href=\"../pkg/AnnotationType.html#optional()\">optional</a>" + + "<a href=\"../pkg/AnnotationType.html#optional--\">optional</a>" + "=\"Method Annotation\"," + NL + - " <a href=\"../pkg/AnnotationType.html#required()\">" + + " <a href=\"../pkg/AnnotationType.html#required--\">" + "required</a>=1994)" + NL + "public void method()</pre>"}, //METHOD PARAMS {BUG_ID + FS + "pkg" + FS + "AnnotationTypeUsage.html", "<pre>public void methodWithParams(" + "<a href=\"../pkg/AnnotationType.html\" title=\"annotation in pkg\">" + - "@AnnotationType</a>(<a href=\"../pkg/AnnotationType.html#optional()\">" + + "@AnnotationType</a>(<a href=\"../pkg/AnnotationType.html#optional--\">" + "optional</a>=\"Parameter Annotation\",<a " + - "href=\"../pkg/AnnotationType.html#required()\">required</a>=1994)" + NL + + "href=\"../pkg/AnnotationType.html#required--\">required</a>=1994)" + NL + " int documented," + NL + " int undocmented)</pre>"}, @@ -242,9 +242,9 @@ {BUG_ID + FS + "pkg" + FS + "AnnotationTypeUsage.html", "<pre>public AnnotationTypeUsage(<a " + "href=\"../pkg/AnnotationType.html\" title=\"annotation in pkg\">" + - "@AnnotationType</a>(<a href=\"../pkg/AnnotationType.html#optional()\">" + + "@AnnotationType</a>(<a href=\"../pkg/AnnotationType.html#optional--\">" + "optional</a>=\"Constructor Param Annotation\",<a " + - "href=\"../pkg/AnnotationType.html#required()\">required</a>=1994)" + NL + + "href=\"../pkg/AnnotationType.html#required--\">required</a>=1994)" + NL + " int documented," + NL + " int undocmented)</pre>"}, @@ -254,43 +254,43 @@ //Integer {BUG_ID + FS + "pkg1" + FS + "B.html", - "<a href=\"../pkg1/A.html#d()\">d</a>=3.14,"}, + "<a href=\"../pkg1/A.html#d--\">d</a>=3.14,"}, //Double {BUG_ID + FS + "pkg1" + FS + "B.html", - "<a href=\"../pkg1/A.html#d()\">d</a>=3.14,"}, + "<a href=\"../pkg1/A.html#d--\">d</a>=3.14,"}, //Boolean {BUG_ID + FS + "pkg1" + FS + "B.html", - "<a href=\"../pkg1/A.html#b()\">b</a>=true,"}, + "<a href=\"../pkg1/A.html#b--\">b</a>=true,"}, //String {BUG_ID + FS + "pkg1" + FS + "B.html", - "<a href=\"../pkg1/A.html#s()\">s</a>=\"sigh\","}, + "<a href=\"../pkg1/A.html#s--\">s</a>=\"sigh\","}, //Class {BUG_ID + FS + "pkg1" + FS + "B.html", - "<a href=\"../pkg1/A.html#c()\">c</a>=<a href=\"../pkg2/Foo.html\" title=\"class in pkg2\">Foo.class</a>,"}, + "<a href=\"../pkg1/A.html#c--\">c</a>=<a href=\"../pkg2/Foo.html\" title=\"class in pkg2\">Foo.class</a>,"}, //Bounded Class {BUG_ID + FS + "pkg1" + FS + "B.html", - "<a href=\"../pkg1/A.html#w()\">w</a>=<a href=\"../pkg/TypeParameterSubClass.html\" title=\"class in pkg\">TypeParameterSubClass.class</a>,"}, + "<a href=\"../pkg1/A.html#w--\">w</a>=<a href=\"../pkg/TypeParameterSubClass.html\" title=\"class in pkg\">TypeParameterSubClass.class</a>,"}, //Enum {BUG_ID + FS + "pkg1" + FS + "B.html", - "<a href=\"../pkg1/A.html#e()\">e</a>=<a href=\"../pkg/Coin.html#Penny\">Penny</a>,"}, + "<a href=\"../pkg1/A.html#e--\">e</a>=<a href=\"../pkg/Coin.html#Penny\">Penny</a>,"}, //Annotation Type {BUG_ID + FS + "pkg1" + FS + "B.html", - "<a href=\"../pkg1/A.html#a()\">a</a>=<a href=\"../pkg/AnnotationType.html\" title=\"annotation in pkg\">@AnnotationType</a>(<a href=\"../pkg/AnnotationType.html#optional()\">optional</a>=\"foo\",<a href=\"../pkg/AnnotationType.html#required()\">required</a>=1994),"}, + "<a href=\"../pkg1/A.html#a--\">a</a>=<a href=\"../pkg/AnnotationType.html\" title=\"annotation in pkg\">@AnnotationType</a>(<a href=\"../pkg/AnnotationType.html#optional--\">optional</a>=\"foo\",<a href=\"../pkg/AnnotationType.html#required--\">required</a>=1994),"}, //String Array {BUG_ID + FS + "pkg1" + FS + "B.html", - "<a href=\"../pkg1/A.html#sa()\">sa</a>={\"up\",\"down\"},"}, + "<a href=\"../pkg1/A.html#sa--\">sa</a>={\"up\",\"down\"},"}, //Primitive {BUG_ID + FS + "pkg1" + FS + "B.html", - "<a href=\"../pkg1/A.html#primitiveClassTest()\">primitiveClassTest</a>=boolean.class,"}, + "<a href=\"../pkg1/A.html#primitiveClassTest--\">primitiveClassTest</a>=boolean.class,"}, //XXX: Add array test case after this if fixed: //5020899: Incorrect internal representation of class-valued annotation elements @@ -335,7 +335,7 @@ {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "Foo.html", "<td class=\"colLast\"><span class=\"strong\">ClassUseTest1." + "</span><code><span class=\"strong\"><a href=\"../../pkg2/" + - "ClassUseTest1.html#method(T)\">method</a></span>" + + "ClassUseTest1.html#method-T-\">method</a></span>" + "(T t)</code> </td>" }, {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "Foo.html", @@ -388,7 +388,7 @@ {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "Foo2.html", "<td class=\"colLast\"><span class=\"strong\">" + "ClassUseTest1.</span><code><span class=\"strong\"><a href=\"../../" + - "pkg2/ClassUseTest1.html#method(T)\">method</a></span>" + + "pkg2/ClassUseTest1.html#method-T-\">method</a></span>" + "(T t)</code> </td>" }, @@ -417,7 +417,7 @@ {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "ParamTest.html", "<td class=\"colLast\"><span class=\"strong\">ClassUseTest2." + "</span><code><span class=\"strong\"><a href=\"../../pkg2/" + - "ClassUseTest2.html#method(T)\">method</a></span>" + + "ClassUseTest2.html#method-T-\">method</a></span>" + "(T t)</code> </td>" }, {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "ParamTest.html", @@ -472,7 +472,7 @@ {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "Foo3.html", "<td class=\"colLast\"><span class=\"strong\">ClassUseTest2." + "</span><code><span class=\"strong\"><a href=\"../../pkg2/" + - "ClassUseTest2.html#method(T)\">method</a></span>" + + "ClassUseTest2.html#method-T-\">method</a></span>" + "(T t)</code> </td>" }, {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "Foo3.html", @@ -517,7 +517,7 @@ {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "ParamTest2.html", "<td class=\"colLast\"><span class=\"strong\">ClassUseTest3" + ".</span><code><span class=\"strong\"><a href=\"../../pkg2/ClassUseTest3." + - "html#method(T)\">method</a></span>(T t)</code> </td>" + "html#method-T-\">method</a></span>(T t)</code> </td>" }, {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "ParamTest2.html", "<td class=\"colFirst\"><code><T extends <a href=\"../" + @@ -554,7 +554,7 @@ {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "Foo4.html", "<td class=\"colLast\"><span class=\"strong\">ClassUseTest3." + "</span><code><span class=\"strong\"><a href=\"../../pkg2/ClassUseTest3." + - "html#method(T)\">method</a></span>(T t)</code>" + + "html#method-T-\">method</a></span>(T t)</code>" + " </td>" }, {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "Foo4.html", @@ -588,7 +588,7 @@ "<td class=\"colFirst\"><code>void</code></td>" + NL + "<td class=\"colLast\"><span class=\"strong\">ClassUseTest3." + "</span><code><span class=\"strong\"><a href=\"../../pkg2/ClassUseTest3." + - "html#method(java.util.Set)\">method</a></span>(java." + + "html#method-java.util.Set-\">method</a></span>(java." + "util.Set<<a href=\"../../pkg2/Foo4.html\" title=\"" + "class in pkg2\">Foo4</a>> p)</code> </td>" + NL + "</tr>" + NL + "</tbody>" @@ -663,14 +663,14 @@ // TYPE PARAMETER IN INDEX //================================= {BUG_ID + FS + "index-all.html", - "<span class=\"strong\"><a href=\"pkg2/Foo.html#method(java.util.Vector)\">" + + "<span class=\"strong\"><a href=\"pkg2/Foo.html#method-java.util.Vector-\">" + "method(Vector<Object>)</a></span>" }, //================================= // TYPE PARAMETER IN INDEX //================================= {BUG_ID + FS + "index-all.html", - "<span class=\"strong\"><a href=\"pkg2/Foo.html#method(java.util.Vector)\">" + + "<span class=\"strong\"><a href=\"pkg2/Foo.html#method-java.util.Vector-\">" + "method(Vector<Object>)</a></span>" }, };
--- a/test/com/sun/javadoc/testOverridenMethods/TestOverridenMethodDocCopy.java Thu Oct 03 19:28:07 2013 +0100 +++ b/test/com/sun/javadoc/testOverridenMethods/TestOverridenMethodDocCopy.java Fri Oct 11 19:05:18 2013 +0100 @@ -23,7 +23,7 @@ /* * @test - * @bug 4368820 + * @bug 4368820 8025633 * @summary Inherited comment should link directly to member, not just * class * @author jamieh @@ -47,7 +47,7 @@ private static final String[][] TEST = { {BUG_ID + FS + "pkg1" + FS + "SubClass.html", "<span class=\"strong\">Description copied from class: <code>" + - "<a href=\"../pkg1/BaseClass.html#overridenMethodWithDocsToCopy()\">" + + "<a href=\"../pkg1/BaseClass.html#overridenMethodWithDocsToCopy--\">" + "BaseClass</a></code></span>" } };
--- a/test/com/sun/javadoc/testOverridenMethods/TestOverridenPrivateMethodsWithPackageFlag.java Thu Oct 03 19:28:07 2013 +0100 +++ b/test/com/sun/javadoc/testOverridenMethods/TestOverridenPrivateMethodsWithPackageFlag.java Fri Oct 11 19:05:18 2013 +0100 @@ -23,7 +23,7 @@ /* * @test - * @bug 4634891 + * @bug 4634891 8025633 * @summary Determine if overriden methods are properly documented when * -protected (default) visibility flag is used. * @author jamieh @@ -41,14 +41,14 @@ //The public method should be overriden {BUG_ID + FS + "pkg1" + FS + "SubClass.html", "<dt><span class=\"strong\">Overrides:</span></dt>" + NL + - "<dd><code><a href=\"../pkg1/BaseClass.html#publicMethod()\">" + + "<dd><code><a href=\"../pkg1/BaseClass.html#publicMethod--\">" + "publicMethod</a></code> in class <code>" + "<a href=\"../pkg1/BaseClass.html\" title=\"class in pkg1\">BaseClass</a></code></dd>"}, //The public method in different package should be overriden {BUG_ID + FS + "pkg2" + FS + "SubClass.html", "<dt><span class=\"strong\">Overrides:</span></dt>" + NL + - "<dd><code><a href=\"../pkg1/BaseClass.html#publicMethod()\">" + + "<dd><code><a href=\"../pkg1/BaseClass.html#publicMethod--\">" + "publicMethod</a></code> in class <code>" + "<a href=\"../pkg1/BaseClass.html\" title=\"class in pkg1\">BaseClass</a></code></dd>"}, @@ -56,7 +56,7 @@ //package. {BUG_ID + FS + "pkg1" + FS + "SubClass.html", "<dt><span class=\"strong\">Overrides:</span></dt>" + NL + - "<dd><code><a href=\"../pkg1/BaseClass.html#packagePrivateMethod()\">" + + "<dd><code><a href=\"../pkg1/BaseClass.html#packagePrivateMethod--\">" + "packagePrivateMethod</a></code> in class <code>" + "<a href=\"../pkg1/BaseClass.html\" title=\"class in pkg1\">BaseClass</a></code></dd>"} };
--- a/test/com/sun/javadoc/testPrivateClasses/TestPrivateClasses.java Thu Oct 03 19:28:07 2013 +0100 +++ b/test/com/sun/javadoc/testPrivateClasses/TestPrivateClasses.java Fri Oct 11 19:05:18 2013 +0100 @@ -23,7 +23,7 @@ /* * @test - * @bug 4780441 4874845 4978816 8014017 8016328 + * @bug 4780441 4874845 4978816 8014017 8016328 8025633 * @summary Make sure that when the -private flag is not used, members * inherited from package private class are documented in the child. * @@ -66,7 +66,7 @@ // Method inheritence from non-public superclass. {BUG_ID + "-1" + FS + "pkg" + FS + "PublicChild.html", - "<a href=\"../pkg/PublicChild.html#methodInheritedFromParent(int)\">" + + "<a href=\"../pkg/PublicChild.html#methodInheritedFromParent-int-\">" + "methodInheritedFromParent</a>" }, @@ -78,7 +78,7 @@ // Method inheritence from non-public superinterface. {BUG_ID + "-1" + FS + "pkg" + FS + "PublicInterface.html", - "<a href=\"../pkg/PublicInterface.html#methodInterface(int)\">" + + "<a href=\"../pkg/PublicInterface.html#methodInterface-int-\">" + "methodInterface</a>" }, @@ -139,7 +139,7 @@ //Do not inherit private interface method with generic parameters. //This method has been implemented. {BUG_ID + "-1" + FS + "pkg2" + FS + "C.html", - "<span class=\"strong\"><a href=\"../pkg2/I.html#hello(T)\">hello</a></span>"}, + "<span class=\"strong\"><a href=\"../pkg2/I.html#hello-T-\">hello</a></span>"}, }; // Test output when -private flag is used. @@ -171,20 +171,20 @@ "PrivateParent</a>" }, {BUG_ID + "-2" + FS + "pkg" + FS + "PublicChild.html", - "<a href=\"../pkg/PrivateParent.html#methodInheritedFromParent(int)\">" + + "<a href=\"../pkg/PrivateParent.html#methodInheritedFromParent-int-\">" + "methodInheritedFromParent</a>" }, // Should document that a method overrides method from private class. {BUG_ID + "-2" + FS + "pkg" + FS + "PublicChild.html", "<dt><span class=\"strong\">Overrides:</span></dt>" + NL + - "<dd><code><a href=\"../pkg/PrivateParent.html#methodOverridenFromParent(char[],%20int,%20T,%20V,%20java.util.List)\">" + + "<dd><code><a href=\"../pkg/PrivateParent.html#methodOverridenFromParent-char:A-int-T-V-java.util.List-\">" + "methodOverridenFromParent</a></code> in class <code>" + "<a href=\"../pkg/PrivateParent.html\" title=\"class in pkg\">" + "PrivateParent</a></code></dd>"}, // Should document that a method is specified by private interface. {BUG_ID + "-2" + FS + "pkg" + FS + "PublicChild.html", "<dt><span class=\"strong\">Specified by:</span></dt>" + NL + - "<dd><code><a href=\"../pkg/PrivateInterface.html#methodInterface(int)\">" + + "<dd><code><a href=\"../pkg/PrivateInterface.html#methodInterface-int-\">" + "methodInterface</a></code> in interface <code>" + "<a href=\"../pkg/PrivateInterface.html\" title=\"interface in pkg\">" + "PrivateInterface</a></code></dd>"}, @@ -195,7 +195,7 @@ "PrivateInterface</a>" }, {BUG_ID + "-2" + FS + "pkg" + FS + "PrivateInterface.html", - "<a href=\"../pkg/PrivateInterface.html#methodInterface(int)\">" + + "<a href=\"../pkg/PrivateInterface.html#methodInterface-int-\">" + "methodInterface</a>" }, // Should mention that any documentation was copied. @@ -228,11 +228,11 @@ //with generic parameters has been implemented. {BUG_ID + "-2" + FS + "pkg2" + FS + "C.html", "<span class=\"strong\">Description copied from interface: <code>" + - "<a href=\"../pkg2/I.html#hello(T)\">I</a></code></span>"}, + "<a href=\"../pkg2/I.html#hello-T-\">I</a></code></span>"}, {BUG_ID + "-2" + FS + "pkg2" + FS + "C.html", "<dt><span class=\"strong\">Specified by:</span></dt>" + NL + - "<dd><code><a href=\"../pkg2/I.html#hello(T)\">hello</a></code>" + + "<dd><code><a href=\"../pkg2/I.html#hello-T-\">hello</a></code>" + " in interface <code>" + "<a href=\"../pkg2/I.html\" title=\"interface in pkg2\">I</a>" + "<java.lang.String></code></dd>"},
--- a/test/com/sun/javadoc/testProfiles/TestProfiles.java Thu Oct 03 19:28:07 2013 +0100 +++ b/test/com/sun/javadoc/testProfiles/TestProfiles.java Fri Oct 11 19:05:18 2013 +0100 @@ -23,7 +23,7 @@ /* * @test - * @bug 8006124 8009684 8016921 8023700 8024096 + * @bug 8006124 8009684 8016921 8023700 8024096 8008164 * @summary Test javadoc support for profiles. * @author Bhavesh Patel, Evgeniya Stepanova * @library ../lib/ @@ -137,7 +137,7 @@ }, // need to add teststring when JDK-8015496 will be fixed //Test exception in profiles - {PROFILE_BUG_ID + FS + "compact1-summary.html","<table class=\"packageSummary\" " + {PROFILE_BUG_ID + FS + "compact1-summary.html","<table class=\"typeSummary\" " + "border=\"0\" cellpadding=\"3\" cellspacing=\"0\" " + "summary=\"Exception Summary table, listing exceptions, and an explanation\">" + NL + "<caption><span>Exception Summary</span><span class=\"tabEnd\">" @@ -149,7 +149,7 @@ }, //Test errors in profiles {PROFILE_BUG_ID + FS + "compact1-summary.html", - "<table class=\"packageSummary\" border=\"0\" cellpadding=\"3\" cellspacing=\"0\" " + "<table class=\"typeSummary\" border=\"0\" cellpadding=\"3\" cellspacing=\"0\" " + "summary=\"Error Summary table, listing errors, and an explanation\">" + NL + "<caption><span>Error Summary</span><span class=\"tabEnd\"> " + "</span></caption>" + NL + "<tr>" + NL + "<th class=\"colFirst\""
--- a/test/com/sun/javadoc/testRepeatedAnnotations/TestRepeatedAnnotations.java Thu Oct 03 19:28:07 2013 +0100 +++ b/test/com/sun/javadoc/testRepeatedAnnotations/TestRepeatedAnnotations.java Fri Oct 11 19:05:18 2013 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -56,7 +56,7 @@ {BUG_ID + FS + "pkg" + FS + "C.html", "<a href=\"../pkg/RegContainerDoc.html\" " + "title=\"annotation in pkg\">@RegContainerDoc</a>" + - "(<a href=\"../pkg/RegContainerDoc.html#value()\">value</a>={" + + "(<a href=\"../pkg/RegContainerDoc.html#value--\">value</a>={" + "<a href=\"../pkg/RegContaineeNotDoc.html\" " + "title=\"annotation in pkg\">@RegContaineeNotDoc</a>," + "<a href=\"../pkg/RegContaineeNotDoc.html\" " + @@ -71,7 +71,7 @@ {BUG_ID + FS + "pkg" + FS + "C.html", "<a href=\"../pkg/ContainerSynthDoc.html\" " + "title=\"annotation in pkg\">@ContainerSynthDoc</a>(" + - "<a href=\"../pkg/ContainerSynthDoc.html#value()\">value</a>=" + + "<a href=\"../pkg/ContainerSynthDoc.html#value--\">value</a>=" + "<a href=\"../pkg/ContaineeSynthDoc.html\" " + "title=\"annotation in pkg\">@ContaineeSynthDoc</a>)"}, {BUG_ID + FS + "pkg" + FS + "C.html", @@ -82,37 +82,37 @@ {BUG_ID + FS + "pkg" + FS + "D.html", "<a href=\"../pkg/RegDoc.html\" title=\"annotation in pkg\">@RegDoc</a>" + - "(<a href=\"../pkg/RegDoc.html#x()\">x</a>=1)"}, + "(<a href=\"../pkg/RegDoc.html#x--\">x</a>=1)"}, {BUG_ID + FS + "pkg" + FS + "D.html", "<a href=\"../pkg/RegArryDoc.html\" title=\"annotation in pkg\">@RegArryDoc</a>" + - "(<a href=\"../pkg/RegArryDoc.html#y()\">y</a>=1)"}, + "(<a href=\"../pkg/RegArryDoc.html#y--\">y</a>=1)"}, {BUG_ID + FS + "pkg" + FS + "D.html", "<a href=\"../pkg/RegArryDoc.html\" title=\"annotation in pkg\">@RegArryDoc</a>" + - "(<a href=\"../pkg/RegArryDoc.html#y()\">y</a>={1,2})"}, + "(<a href=\"../pkg/RegArryDoc.html#y--\">y</a>={1,2})"}, {BUG_ID + FS + "pkg" + FS + "D.html", "<a href=\"../pkg/NonSynthDocContainer.html\" " + "title=\"annotation in pkg\">@NonSynthDocContainer</a>" + - "(<a href=\"../pkg/NonSynthDocContainer.html#value()\">value</a>=" + + "(<a href=\"../pkg/NonSynthDocContainer.html#value--\">value</a>=" + "<a href=\"../pkg/RegArryDoc.html\" title=\"annotation in pkg\">@RegArryDoc</a>)"}, {BUG_ID + FS + "pkg1" + FS + "C.html", "<a href=\"../pkg1/RegContainerValDoc.html\" " + "title=\"annotation in pkg1\">@RegContainerValDoc</a>" + - "(<a href=\"../pkg1/RegContainerValDoc.html#value()\">value</a>={" + + "(<a href=\"../pkg1/RegContainerValDoc.html#value--\">value</a>={" + "<a href=\"../pkg1/RegContaineeNotDoc.html\" " + "title=\"annotation in pkg1\">@RegContaineeNotDoc</a>," + "<a href=\"../pkg1/RegContaineeNotDoc.html\" " + "title=\"annotation in pkg1\">@RegContaineeNotDoc</a>}," + - "<a href=\"../pkg1/RegContainerValDoc.html#y()\">y</a>=3)"}, + "<a href=\"../pkg1/RegContainerValDoc.html#y--\">y</a>=3)"}, {BUG_ID + FS + "pkg1" + FS + "C.html", "<a href=\"../pkg1/ContainerValDoc.html\" " + "title=\"annotation in pkg1\">@ContainerValDoc</a>" + - "(<a href=\"../pkg1/ContainerValDoc.html#value()\">value</a>={" + + "(<a href=\"../pkg1/ContainerValDoc.html#value--\">value</a>={" + "<a href=\"../pkg1/ContaineeNotDoc.html\" " + "title=\"annotation in pkg1\">@ContaineeNotDoc</a>," + "<a href=\"../pkg1/ContaineeNotDoc.html\" " + "title=\"annotation in pkg1\">@ContaineeNotDoc</a>}," + - "<a href=\"../pkg1/ContainerValDoc.html#x()\">x</a>=1)"} + "<a href=\"../pkg1/ContainerValDoc.html#x--\">x</a>=1)"} }; private static final String[][] NEGATED_TEST = { @@ -124,7 +124,7 @@ {BUG_ID + FS + "pkg" + FS + "C.html", "<a href=\"../pkg/RegContainerNotDoc.html\" " + "title=\"annotation in pkg\">@RegContainerNotDoc</a>" + - "(<a href=\"../pkg/RegContainerNotDoc.html#value()\">value</a>={" + + "(<a href=\"../pkg/RegContainerNotDoc.html#value--\">value</a>={" + "<a href=\"../pkg/RegContaineeNotDoc.html\" " + "title=\"annotation in pkg\">@RegContaineeNotDoc</a>," + "<a href=\"../pkg/RegContaineeNotDoc.html\" " + @@ -138,25 +138,25 @@ {BUG_ID + FS + "pkg1" + FS + "C.html", "<a href=\"../pkg1/RegContainerValNotDoc.html\" " + "title=\"annotation in pkg1\">@RegContainerValNotDoc</a>" + - "(<a href=\"../pkg1/RegContainerValNotDoc.html#value()\">value</a>={" + + "(<a href=\"../pkg1/RegContainerValNotDoc.html#value--\">value</a>={" + "<a href=\"../pkg1/RegContaineeDoc.html\" " + "title=\"annotation in pkg1\">@RegContaineeDoc</a>," + "<a href=\"../pkg1/RegContaineeDoc.html\" " + "title=\"annotation in pkg1\">@RegContaineeDoc</a>}," + - "<a href=\"../pkg1/RegContainerValNotDoc.html#y()\">y</a>=4)"}, + "<a href=\"../pkg1/RegContainerValNotDoc.html#y--\">y</a>=4)"}, {BUG_ID + FS + "pkg1" + FS + "C.html", "<a href=\"../pkg1/ContainerValNotDoc.html\" " + "title=\"annotation in pkg1\">@ContainerValNotDoc</a>" + - "(<a href=\"../pkg1/ContainerValNotDoc.html#value()\">value</a>={" + + "(<a href=\"../pkg1/ContainerValNotDoc.html#value--\">value</a>={" + "<a href=\"../pkg1/ContaineeNotDoc.html\" " + "title=\"annotation in pkg1\">@ContaineeNotDoc</a>," + "<a href=\"../pkg1/ContaineeNotDoc.html\" " + "title=\"annotation in pkg1\">@ContaineeNotDoc</a>}," + - "<a href=\"../pkg1/ContainerValNotDoc.html#x()\">x</a>=2)"}, + "<a href=\"../pkg1/ContainerValNotDoc.html#x--\">x</a>=2)"}, {BUG_ID + FS + "pkg1" + FS + "C.html", "<a href=\"../pkg1/ContainerSynthNotDoc.html\" " + "title=\"annotation in pkg1\">@ContainerSynthNotDoc</a>(" + - "<a href=\"../pkg1/ContainerSynthNotDoc.html#value()\">value</a>=" + + "<a href=\"../pkg1/ContainerSynthNotDoc.html#value--\">value</a>=" + "<a href=\"../pkg1/ContaineeSynthDoc.html\" " + "title=\"annotation in pkg1\">@ContaineeSynthDoc</a>)"} };
--- a/test/com/sun/javadoc/testSerializedFormDeprecationInfo/TestSerializedFormDeprecationInfo.java Thu Oct 03 19:28:07 2013 +0100 +++ b/test/com/sun/javadoc/testSerializedFormDeprecationInfo/TestSerializedFormDeprecationInfo.java Fri Oct 11 19:05:18 2013 +0100 @@ -25,7 +25,7 @@ /* * @test - * @bug 6802694 + * @bug 6802694 8025633 * @summary This test verifies deprecation info in serialized-form.html. * @author Bhavesh Patel * @library ../lib/ @@ -44,21 +44,21 @@ {BUG_ID + FS + "serialized-form.html", "<dl>" + NL + "<dt><span class=\"strong\">Throws:</span></dt>" + NL + "<dd><code>" + "java.io.IOException</code></dd>"+ NL + "<dt><span class=\"strong\">See Also:</span>" + - "</dt>" + NL + "<dd><a href=\"pkg1/C1.html#setUndecorated(boolean)\">" + + "</dt>" + NL + "<dd><a href=\"pkg1/C1.html#setUndecorated-boolean-\">" + "<code>C1.setUndecorated(boolean)</code></a></dd>" + NL + "</dl>"}, {BUG_ID + FS + "serialized-form.html", "<span class=\"strong\">Deprecated.</span>" + " <span class=\"italic\">As of JDK version 1.5, replaced by" + NL + - " <a href=\"pkg1/C1.html#setUndecorated(boolean)\">" + + " <a href=\"pkg1/C1.html#setUndecorated-boolean-\">" + "<code>setUndecorated(boolean)</code></a>.</span></div>" + NL + "<div class=\"block\">This field indicates whether the C1 " + "is undecorated.</div>" + NL + " " + NL + "<dl>" + NL + "<dt><span class=\"strong\">Since:</span></dt>" + NL + "<dd>1.4</dd>" + NL + "<dt><span class=\"strong\">See Also:</span>" + - "</dt>" + NL + "<dd><a href=\"pkg1/C1.html#setUndecorated(boolean)\">" + + "</dt>" + NL + "<dd><a href=\"pkg1/C1.html#setUndecorated-boolean-\">" + "<code>C1.setUndecorated(boolean)</code></a></dd>" + NL + "</dl>"}, {BUG_ID + FS + "serialized-form.html", "<span class=\"strong\">Deprecated.</span>" + " <span class=\"italic\">As of JDK version 1.5, replaced by" + NL + - " <a href=\"pkg1/C1.html#setUndecorated(boolean)\">" + + " <a href=\"pkg1/C1.html#setUndecorated-boolean-\">" + "<code>setUndecorated(boolean)</code></a>.</span></div>" + NL + "<div class=\"block\">Reads the object stream.</div>" + NL + "<dl>" + NL + "<dt><span class=\"strong\">Throws:</span></dt>" + NL + "<dd><code><code>" + @@ -75,12 +75,12 @@ {BUG_ID + FS + "serialized-form.html", "<pre>boolean undecorated</pre>" + NL + "<div class=\"block\"><span class=\"strong\">Deprecated.</span> <span class=\"italic\">" + "As of JDK version 1.5, replaced by" + NL + - " <a href=\"pkg1/C1.html#setUndecorated(boolean)\"><code>" + + " <a href=\"pkg1/C1.html#setUndecorated-boolean-\"><code>" + "setUndecorated(boolean)</code></a>.</span></div>" + NL + "</li>"}, {BUG_ID + FS + "serialized-form.html", "<span class=\"strong\">" + "Deprecated.</span> <span class=\"italic\">As of JDK version" + " 1.5, replaced by" + NL + - " <a href=\"pkg1/C1.html#setUndecorated(boolean)\">" + + " <a href=\"pkg1/C1.html#setUndecorated-boolean-\">" + "<code>setUndecorated(boolean)</code></a>.</span></div>" + NL + "</li>"}}; // Test with -nodeprecated option. The serialized-form.html should
--- a/test/com/sun/javadoc/testStylesheet/TestStylesheet.java Thu Oct 03 19:28:07 2013 +0100 +++ b/test/com/sun/javadoc/testStylesheet/TestStylesheet.java Fri Oct 11 19:05:18 2013 +0100 @@ -23,7 +23,7 @@ /* * @test - * @bug 4494033 7028815 7052425 8007338 8023608 + * @bug 4494033 7028815 7052425 8007338 8023608 8008164 * @summary Run tests on doclet stylesheet. * @author jamieh * @library ../lib/ @@ -59,10 +59,8 @@ {BUG_ID + FS + "stylesheet.css", "ul {" + NL + " list-style-type:disc;" + NL + "}"}, {BUG_ID + FS + "stylesheet.css", - ".overviewSummary caption, .packageSummary caption, " + - ".contentContainer ul.blockList li.blockList caption, " + - ".summary caption, .classUseContainer caption, " + - ".constantValuesContainer caption {" + NL + + ".overviewSummary caption, .memberSummary caption, .typeSummary caption," + NL + + ".useSummary caption, .constantsSummary caption, .deprecatedSummary caption {" + NL + " position:relative;" + NL + " text-align:left;" + NL + " background-repeat:no-repeat;" + NL + @@ -74,10 +72,8 @@ " margin:0px;" + NL + "}"}, {BUG_ID + FS + "stylesheet.css", - ".overviewSummary caption span, .packageSummary caption span, " + - ".contentContainer ul.blockList li.blockList caption span, " + - ".summary caption span, .classUseContainer caption span, " + - ".constantValuesContainer caption span {" + NL + + ".overviewSummary caption span, .memberSummary caption span, .typeSummary caption span," + NL + + ".useSummary caption span, .constantsSummary caption span, .deprecatedSummary caption span {" + NL + " white-space:nowrap;" + NL + " padding-top:8px;" + NL + " padding-left:8px;" + NL + @@ -86,8 +82,7 @@ " background-image:url(resources/titlebar.gif);" + NL + "}"}, {BUG_ID + FS + "stylesheet.css", - ".contentContainer ul.blockList li.blockList caption " + - "span.activeTableTab span {" + NL + + ".memberSummary caption span.activeTableTab span {" + NL + " white-space:nowrap;" + NL + " padding-top:8px;" + NL + " padding-left:8px;" + NL + @@ -96,7 +91,7 @@ " background-image:url(resources/activetitlebar.gif);" + NL + "}"}, {BUG_ID + FS + "stylesheet.css", - ".contentContainer ul.blockList li.blockList caption span.tableTab span {" + NL + + ".memberSummary caption span.tableTab span {" + NL + " white-space:nowrap;" + NL + " padding-top:8px;" + NL + " padding-left:8px;" + NL + @@ -105,8 +100,7 @@ " background-image:url(resources/titlebar.gif);" + NL + "}"}, {BUG_ID + FS + "stylesheet.css", - ".contentContainer ul.blockList li.blockList caption span.tableTab, " + - ".contentContainer ul.blockList li.blockList caption span.activeTableTab {" + NL + + ".memberSummary caption span.tableTab, .memberSummary caption span.activeTableTab {" + NL + " padding-top:0px;" + NL + " padding-left:0px;" + NL + " background-image:none;" + NL +
--- a/test/com/sun/javadoc/testTaglets/TestTaglets.java Thu Oct 03 19:28:07 2013 +0100 +++ b/test/com/sun/javadoc/testTaglets/TestTaglets.java Fri Oct 11 19:05:18 2013 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -23,7 +23,7 @@ /* * @test - * @bug 4654308 4767038 + * @bug 4654308 4767038 8025633 * @summary Use a Taglet and include some inline tags such as {@link}. The * inline tags should be interpreted properly. * Run Javadoc on some sample source that uses {@inheritDoc}. Make @@ -56,7 +56,7 @@ //Input for string search tests. private static final String[][] TEST_4654308 = new String[][] { {"4654308" + FS + "C.html", "<span class=\"strong\">Foo:</span></dt>" + - "<dd>my only method is <a href=\"C.html#method()\"><code>here" + + "<dd>my only method is <a href=\"C.html#method--\"><code>here" + "</code></a></dd></dl>"} }; private static final String[][] NEGATED_TEST_4654308 = NO_TEST;
--- a/test/com/sun/javadoc/testTypeAnnotations/TestTypeAnnotations.java Thu Oct 03 19:28:07 2013 +0100 +++ b/test/com/sun/javadoc/testTypeAnnotations/TestTypeAnnotations.java Fri Oct 11 19:05:18 2013 +0100 @@ -23,7 +23,7 @@ /* * @test - * @bug 8005091 8009686 + * @bug 8005091 8009686 8025633 * @summary Make sure that type annotations are displayed correctly * @author Bhavesh Patel * @library ../lib/ @@ -272,13 +272,13 @@ "<pre>void oneException()" + NL + " throws <a href=\"../typeannos/ThrB.html\" title=\"" + "annotation in typeannos\">@ThrB</a>(<a href=\"../typeannos/" + - "ThrB.html#value()\">value</a>=\"m\") java.lang.Exception</pre>" + "ThrB.html#value--\">value</a>=\"m\") java.lang.Exception</pre>" }, {BUG_ID + FS + "typeannos" + FS + "ThrWithValue.html", "<pre>void twoExceptions()" + NL + " throws <a href=\"../typeannos/ThrB.html\" title=\"" + "annotation in typeannos\">@ThrB</a>(<a href=\"../typeannos/" + - "ThrB.html#value()\">value</a>=\"m\") java.lang.RuntimeException," + NL + + "ThrB.html#value--\">value</a>=\"m\") java.lang.RuntimeException," + NL + " <a href=\"../typeannos/ThrA.html\" title=\"" + "annotation in typeannos\">@ThrA</a> java.lang.Exception</pre>" }, @@ -307,14 +307,14 @@ "<pre>void wcSuper(<a href=\"../typeannos/MyList.html\" title=\"" + "class in typeannos\">MyList</a><? super <a href=\"../typeannos/" + "WldB.html\" title=\"annotation in typeannos\">@WldB</a>(<a href=\"" + - "../typeannos/WldB.html#value()\">value</a>=\"m\") java.lang." + + "../typeannos/WldB.html#value--\">value</a>=\"m\") java.lang." + "String> l)</pre>" }, {BUG_ID + FS + "typeannos" + FS + "BoundWithValue.html", "<pre><a href=\"../typeannos/MyList.html\" title=\"class in " + "typeannos\">MyList</a><? extends <a href=\"../typeannos/WldB." + "html\" title=\"annotation in typeannos\">@WldB</a>(<a href=\"../" + - "typeannos/WldB.html#value()\">value</a>=\"m\") java.lang.String" + + "typeannos/WldB.html#value--\">value</a>=\"m\") java.lang.String" + "> returnWcExtends()</pre>" }, @@ -329,7 +329,7 @@ "<pre>java.lang.String nonVoid(<a href=\"../typeannos/RcvrA." + "html\" title=\"annotation in typeannos\">@RcvrA</a> <a href=\"../" + "typeannos/RcvrB.html\" title=\"annotation in typeannos\">@RcvrB" + - "</a>(<a href=\"../typeannos/RcvrB.html#value()\">value</a>=\"m\")" + + "</a>(<a href=\"../typeannos/RcvrB.html#value--\">value</a>=\"m\")" + " DefaultUnmodified this)</pre>" }, {BUG_ID + FS + "typeannos" + FS + "DefaultUnmodified.html", @@ -354,7 +354,7 @@ {BUG_ID + FS + "typeannos" + FS + "WithValue.html", "<pre><T extends java.lang.Runnable> void accept(" + "<a href=\"../typeannos/RcvrB.html\" title=\"annotation in " + - "typeannos\">@RcvrB</a>(<a href=\"../typeannos/RcvrB.html#value()\">" + + "typeannos\">@RcvrB</a>(<a href=\"../typeannos/RcvrB.html#value--\">" + "value</a>=\"m\") WithValue this," + NL + " T r)" + NL + " throws java.lang.Exception</pre>" @@ -362,7 +362,7 @@ {BUG_ID + FS + "typeannos" + FS + "WithFinal.html", "<pre>java.lang.String nonVoid(<a href=\"../typeannos/RcvrB." + "html\" title=\"annotation in typeannos\">@RcvrB</a>(<a href=\"../" + - "typeannos/RcvrB.html#value()\">value</a>=\"m\") WithFinal" + + "typeannos/RcvrB.html#value--\">value</a>=\"m\") WithFinal" + " this)</pre>" }, {BUG_ID + FS + "typeannos" + FS + "WithBody.html",
--- a/test/com/sun/javadoc/testTypeParams/TestTypeParameters.java Thu Oct 03 19:28:07 2013 +0100 +++ b/test/com/sun/javadoc/testTypeParams/TestTypeParameters.java Fri Oct 11 19:05:18 2013 +0100 @@ -23,7 +23,7 @@ /* * @test - * @bug 4927167 4974929 7010344 + * @bug 4927167 4974929 7010344 8025633 * @summary When the type parameters are more than 10 characters in length, * make sure there is a line break between type params and return type * in member summary. Also, test for type parameter links in package-summary and @@ -71,7 +71,7 @@ }, //Nested type parameters {BUG_ID + FS + "pkg" + FS + "C.html", - "<a name=\"formatDetails(java.util.Collection, java.util.Collection)\">" + NL + + "<a name=\"formatDetails-java.util.Collection-java.util.Collection-\">" + NL + "<!-- -->" + NL + "</a>" },
--- a/test/com/sun/javadoc/testWarnings/TestWarnings.java Thu Oct 03 19:28:07 2013 +0100 +++ b/test/com/sun/javadoc/testWarnings/TestWarnings.java Fri Oct 11 19:05:18 2013 +0100 @@ -23,7 +23,7 @@ /* * @test - * @bug 4515705 4804296 4702454 4697036 + * @bug 4515705 4804296 4702454 4697036 8025633 * @summary Make sure that first sentence warning only appears once. * Make sure that only warnings/errors are printed when quiet is used. * Make sure that links to private/unincluded methods do not cause @@ -65,8 +65,8 @@ }; private static final String[][] TEST2 = { - {BUG_ID + FS + "pkg" + FS + "X.html", "<a href=\"../pkg/X.html#m()\"><code>m()</code></a><br/>"}, - {BUG_ID + FS + "pkg" + FS + "X.html", "<a href=\"../pkg/X.html#X()\"><code>X()</code></a><br/>"}, + {BUG_ID + FS + "pkg" + FS + "X.html", "<a href=\"../pkg/X.html#m--\"><code>m()</code></a><br/>"}, + {BUG_ID + FS + "pkg" + FS + "X.html", "<a href=\"../pkg/X.html#X--\"><code>X()</code></a><br/>"}, {BUG_ID + FS + "pkg" + FS + "X.html", "<a href=\"../pkg/X.html#f\"><code>f</code></a><br/>"}, };
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/ArraysInIntersections.java Fri Oct 11 19:05:18 2013 +0100 @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 8021339 + * @summary Allow arrays in intersection types + * @compile ArraysInIntersections.java + */ + +import java.io.Serializable; + +public class ArraysInIntersections<T extends Serializable & Integer[]> { + + public <S extends Serializable & Integer[]> Object m() { + return (Serializable & Integer[]) new Integer[1]; + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/InferArraysInIntersections.java Fri Oct 11 19:05:18 2013 +0100 @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 8021339 + * @summary Allow arrays in intersection types + * @compile -doe -XDrawDiagnostics InferArraysInIntersections.java + */ +import java.util.*; + +class InferArraysInIntersections { + <T> T m(List<? super T> t) { return null; } + + void test(List<char[]> lc) { + Runnable r = m(lc); //inference fails here + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/annotations/neg/8022765/T8022765.java Fri Oct 11 19:05:18 2013 +0100 @@ -0,0 +1,141 @@ +/** + * @test /nodynamiccopyright/ + * @bug 8022765 + * @summary javac should not crash for incorrect attribute values + * @build VerifyAnnotationsAttributed + * @run main VerifyAnnotationsAttributed T8022765.java + * @compile/fail/ref=T8022765.out -XDrawDiagnostics T8022765.java + */ +@Ann(@Override) +@Primitive(@Override) +@Str(@Override) +@En(@Override) +@ArrAnn(@Override) +@ArrPrimitive(@Override) +@ArrStr(@Override) +@ArrEn(@Override) +class AnnC { } + +class PrimitiveC { + private static final int C = 1; + @Ann(C) + @Primitive(C) + @Str(C) + @En(C) + @ArrAnn(C) + @ArrPrimitive(C) + @ArrStr(C) + @ArrEn(C) + class I { + } +} + +class StringC { + + private static final String C = ""; + + @Ann(C) + @Primitive(C) + @Str(C) + @En(C) + @ArrAnn(C) + @ArrPrimitive(C) + @ArrStr(C) + @ArrEn(C) + class I { + } +} + +@Ann(E.A) +@Primitive(E.A) +@Str(E.A) +@En(E.A) +@ArrAnn(E.A) +@ArrPrimitive(E.A) +@ArrStr(E.A) +@ArrEn(E.A) +class EnC { } + +@Ann({@Override}) +@Primitive({@Override}) +@Str({@Override}) +@En({@Override}) +@ArrAnn({@Override}) +@ArrPrimitive({@Override}) +@ArrStr({@Override}) +@ArrEn({@Override}) +class ArrAnnC { } + +class ArrPrimitiveC { + private static final int C = 1; + @Ann({C}) + @Primitive({C}) + @Str({C}) + @En({C}) + @ArrAnn({C}) + @ArrPrimitive({C}) + @ArrStr({C}) + @ArrEn({C}) + class I { + } +} + +class ArrStringC { + private static final String C = ""; + @Ann({C}) + @Primitive({C}) + @Str({C}) + @En({C}) + @ArrAnn({C}) + @ArrPrimitive({C}) + @ArrStr({C}) + @ArrEn({C}) + class I { + } +} + +@Ann({E.A}) +@Primitive({E.A}) +@Str({E.A}) +@En({E.A}) +@ArrAnn({E.A}) +@ArrPrimitive({E.A}) +@ArrStr({E.A}) +@ArrEn({E.A}) +class ArrEnC { } + +@interface Ann { + Override value(); +} + +@interface Primitive { + int value(); +} + +@interface Str { + String value(); +} + +@interface En { + E value(); +} + +@interface ArrAnn { + Override[] value(); +} + +@interface ArrPrimitive { + int[] value(); +} + +@interface ArrStr { + String[] value(); +} + +@interface ArrEn { + E[] value(); +} + +enum E { + A; +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/annotations/neg/8022765/T8022765.out Fri Oct 11 19:05:18 2013 +0100 @@ -0,0 +1,57 @@ +T8022765.java:10:12: compiler.err.annotation.not.valid.for.type: int +T8022765.java:11:6: compiler.err.annotation.not.valid.for.type: java.lang.String +T8022765.java:12:5: compiler.err.annotation.not.valid.for.type: E +T8022765.java:14:15: compiler.err.annotation.not.valid.for.type: int +T8022765.java:15:9: compiler.err.annotation.not.valid.for.type: java.lang.String +T8022765.java:16:8: compiler.err.annotation.not.valid.for.type: E +T8022765.java:21:10: compiler.err.annotation.value.must.be.annotation +T8022765.java:23:10: compiler.err.prob.found.req: (compiler.misc.inconvertible.types: int, java.lang.String) +T8022765.java:24:9: compiler.err.prob.found.req: (compiler.misc.inconvertible.types: int, E) +T8022765.java:25:13: compiler.err.annotation.value.must.be.annotation +T8022765.java:27:13: compiler.err.prob.found.req: (compiler.misc.inconvertible.types: int, java.lang.String) +T8022765.java:28:12: compiler.err.prob.found.req: (compiler.misc.inconvertible.types: int, E) +T8022765.java:37:10: compiler.err.annotation.value.must.be.annotation +T8022765.java:38:16: compiler.err.prob.found.req: (compiler.misc.inconvertible.types: java.lang.String, int) +T8022765.java:40:9: compiler.err.prob.found.req: (compiler.misc.inconvertible.types: java.lang.String, E) +T8022765.java:41:13: compiler.err.annotation.value.must.be.annotation +T8022765.java:42:19: compiler.err.prob.found.req: (compiler.misc.inconvertible.types: java.lang.String, int) +T8022765.java:44:12: compiler.err.prob.found.req: (compiler.misc.inconvertible.types: java.lang.String, E) +T8022765.java:49:7: compiler.err.annotation.value.must.be.annotation +T8022765.java:50:13: compiler.err.prob.found.req: (compiler.misc.inconvertible.types: E, int) +T8022765.java:51:7: compiler.err.prob.found.req: (compiler.misc.inconvertible.types: E, java.lang.String) +T8022765.java:53:10: compiler.err.annotation.value.must.be.annotation +T8022765.java:54:16: compiler.err.prob.found.req: (compiler.misc.inconvertible.types: E, int) +T8022765.java:55:10: compiler.err.prob.found.req: (compiler.misc.inconvertible.types: E, java.lang.String) +T8022765.java:59:6: compiler.err.annotation.value.not.allowable.type +T8022765.java:60:12: compiler.err.annotation.value.not.allowable.type +T8022765.java:61:6: compiler.err.annotation.value.not.allowable.type +T8022765.java:62:5: compiler.err.annotation.value.not.allowable.type +T8022765.java:64:16: compiler.err.annotation.not.valid.for.type: int +T8022765.java:65:10: compiler.err.annotation.not.valid.for.type: java.lang.String +T8022765.java:66:9: compiler.err.annotation.not.valid.for.type: E +T8022765.java:71:10: compiler.err.annotation.value.not.allowable.type +T8022765.java:72:16: compiler.err.annotation.value.not.allowable.type +T8022765.java:73:10: compiler.err.annotation.value.not.allowable.type +T8022765.java:74:9: compiler.err.annotation.value.not.allowable.type +T8022765.java:75:14: compiler.err.annotation.value.must.be.annotation +T8022765.java:77:14: compiler.err.prob.found.req: (compiler.misc.inconvertible.types: int, java.lang.String) +T8022765.java:78:13: compiler.err.prob.found.req: (compiler.misc.inconvertible.types: int, E) +T8022765.java:85:10: compiler.err.annotation.value.not.allowable.type +T8022765.java:86:16: compiler.err.annotation.value.not.allowable.type +T8022765.java:87:10: compiler.err.annotation.value.not.allowable.type +T8022765.java:88:9: compiler.err.annotation.value.not.allowable.type +T8022765.java:89:14: compiler.err.annotation.value.must.be.annotation +T8022765.java:90:20: compiler.err.prob.found.req: (compiler.misc.inconvertible.types: java.lang.String, int) +T8022765.java:92:13: compiler.err.prob.found.req: (compiler.misc.inconvertible.types: java.lang.String, E) +T8022765.java:97:6: compiler.err.annotation.value.not.allowable.type +T8022765.java:97:8: compiler.err.attribute.value.must.be.constant +T8022765.java:98:12: compiler.err.annotation.value.not.allowable.type +T8022765.java:98:14: compiler.err.attribute.value.must.be.constant +T8022765.java:99:6: compiler.err.annotation.value.not.allowable.type +T8022765.java:99:8: compiler.err.attribute.value.must.be.constant +T8022765.java:100:5: compiler.err.annotation.value.not.allowable.type +T8022765.java:100:7: compiler.err.attribute.value.must.be.constant +T8022765.java:101:11: compiler.err.annotation.value.must.be.annotation +T8022765.java:102:17: compiler.err.prob.found.req: (compiler.misc.inconvertible.types: E, int) +T8022765.java:103:11: compiler.err.prob.found.req: (compiler.misc.inconvertible.types: E, java.lang.String) +56 errors \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/annotations/neg/8022765/VerifyAnnotationsAttributed.java Fri Oct 11 19:05:18 2013 +0100 @@ -0,0 +1,78 @@ +/* + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +import com.sun.source.tree.CompilationUnitTree; +import com.sun.source.tree.IdentifierTree; +import com.sun.source.tree.MemberSelectTree; +import com.sun.source.util.JavacTask; +import com.sun.source.util.TreePathScanner; +import com.sun.source.util.Trees; +import com.sun.tools.javac.api.JavacTool; +import com.sun.tools.javac.file.JavacFileManager; +import java.io.File; +import java.io.IOException; +import java.net.URISyntaxException; +import java.util.Collections; +import javax.lang.model.element.Element; +import javax.lang.model.element.ElementKind; + +public class VerifyAnnotationsAttributed { + public static void main(String... args) throws IOException, URISyntaxException { + if (args.length != 1) throw new IllegalStateException("Must provide class name!"); + File testSrc = new File(System.getProperty("test.src")); + File testFile = new File(testSrc, args[0]); + if (!testFile.canRead()) throw new IllegalStateException("Cannot read the test source"); + JavacFileManager fm = JavacTool.create().getStandardFileManager(null, null, null); + JavacTask task = JavacTool.create().getTask(null, + fm, + null, + Collections.<String>emptyList(), + null, + fm.getJavaFileObjects(testFile)); + final Trees trees = Trees.instance(task); + final CompilationUnitTree cut = task.parse().iterator().next(); + task.analyze(); + + //ensure all the annotation attributes are annotated meaningfully + //all the attributes in the test file should contain either an identifier + //or a select, so only checking those for a reasonable Element/Symbol. + new TreePathScanner<Void, Void>() { + @Override + public Void visitIdentifier(IdentifierTree node, Void p) { + verifyAttributedMeaningfully(); + return super.visitIdentifier(node, p); + } + @Override + public Void visitMemberSelect(MemberSelectTree node, Void p) { + verifyAttributedMeaningfully(); + return super.visitMemberSelect(node, p); + } + private void verifyAttributedMeaningfully() { + Element el = trees.getElement(getCurrentPath()); + + if (el == null || el.getKind() == ElementKind.OTHER) { + throw new IllegalStateException("Not attributed properly: " + getCurrentPath().getParentPath().getLeaf()); + } + } + }.scan(cut, null); + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/annotations/typeAnnotations/classfile/TestAnonInnerClasses.java Fri Oct 11 19:05:18 2013 +0100 @@ -0,0 +1,439 @@ +/* + * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 8005085 8008762 8008751 8013065 8015323 8015257 + * @summary Type annotations on anonymous and inner class. + * Six TYPE_USE annotations are repeated(or not); Four combinations create + * four test files, and each results in the test class and 2 anonymous classes. + * Each element of these three classes is checked for expected number of the + * four annotation Attributes. Expected annotation counts depend on type of + * annotation place on type of element (a FIELD&TYPE_USE element on a field + * results in 2). Elements with no annotations expect 0. + * Source template is read in from testanoninner.template + * + */ +import java.lang.annotation.*; +import java.io.*; +import java.util.List; +import java.util.LinkedList; +import com.sun.tools.classfile.*; +import java.nio.file.Files; +import java.nio.charset.*; +import java.io.File; +import java.io.IOException; + + +import java.lang.annotation.*; +import static java.lang.annotation.RetentionPolicy.*; +import static java.lang.annotation.ElementType.*; + +/* + * A source template is read in and testname and annotations are inserted + * via replace(). + */ +public class TestAnonInnerClasses extends ClassfileTestHelper { + // tally errors and test cases + int errors = 0; + int checks = 0; + //Note expected test count in case of skips due to bugs. + int tc = 0, xtc = 180; // 45 x 4 variations of repeated annotations. + File testSrc = new File(System.getProperty("test.src")); + + String[] AnnoAttributes = { + Attribute.RuntimeVisibleTypeAnnotations, + Attribute.RuntimeInvisibleTypeAnnotations, + Attribute.RuntimeVisibleAnnotations, + Attribute.RuntimeInvisibleAnnotations + }; + + // template for source files + String srcTemplate = "testanoninner.template"; + + // Four test files generated based on combinations of repeating annotations. + Boolean As= false, Bs=true, Cs=false, Ds=false, TAs=false,TBs=false; + Boolean[][] bRepeat = new Boolean[][]{ + /* no repeats */ {false, false, false, false, false, false}, + /* repeat A,C,TA */ {true, false, true, false, true, false}, + /* repeat B,D,TB */ {false, true, false, true, false, true}, + /* repeat all */ {true, true, true, true, true, true} + }; + // Save descriptions of failed test case; does not terminate upon a failure. + List<String> failed = new LinkedList<>(); + + public static void main(String[] args) throws Exception { + new TestAnonInnerClasses().run(); + } + + // Check annotation counts and make reports sufficiently descriptive to + // easily diagnose. + void check(String testcase, int vtaX, int itaX, int vaX, int iaX, + int vtaA, int itaA, int vaA, int iaA) { + + String descr = " checking " + testcase+" _TYPE_, expected: " + + vtaX + ", " + itaX + ", " + vaX + ", " + iaX + "; actual: " + + vtaA + ", " + itaA + ", " + vaA + ", " + iaA; + String description; + description=descr.replace("_TYPE_","RuntimeVisibleTypeAnnotations"); + if (vtaX != vtaA) { + errors++; + failed.add(++checks + " " + testcase + ": (vtaX) " + vtaX + + " != " + vtaA + " (vtaA)"); + println(checks + " FAIL: " + description); + } else { + println(++checks + " PASS: " + description); + } + description=descr.replace("_TYPE_","RuntimeInvisibleTypeAnnotations"); + if (itaX != itaA) { + errors++; + failed.add(++checks + " " + testcase + ": (itaX) " + itaX + " != " + + itaA + " (itaA)"); + println(checks + " FAIL: " + description); + } else { + println(++checks + " PASS: " + description); + } + description=descr.replace("_TYPE_","RuntimeVisibleAnnotations"); + if (vaX != vaA) { + errors++; + failed.add(++checks + " " + testcase + ": (vaX) " + vaX + " != " + + vaA + " (vaA)"); + println(checks + " FAIL: " + description); + } else { + println(++checks + " PASS: " + description); + } + description=descr.replace("_TYPE_","RuntimeInvisibleAnnotations"); + if (iaX != iaA) { + errors++; + failed.add(++checks + " " + testcase + ": (iaX) " + iaX + " != " + + iaA + " (iaA)"); + println(checks + " FAIL: " + description); + } else { + println(++checks + " PASS: " + description); + } + println(""); + } + + // Print failed cases (if any) and throw exception for fail. + void report() { + if (errors!=0) { + System.err.println("Failed tests: " + errors + + "\nfailed test cases:\n"); + for (String t: failed) System.err.println(" " + t); + throw new RuntimeException("FAIL: There were test failures."); + } else + System.out.println("PASSED all tests."); + } + + void test(String ttype, ClassFile cf, Method m, Field f, boolean visible) { + int vtaActual = 0, + itaActual = 0, + vaActual = 0, + iaActual = 0, + vtaExp = 0, + itaExp = 0, + vaExp = 0, + iaExp = 0, + index = 0, + index2 = 0; + String memberName = null, + testcase = "undefined", + testClassName = null; + Attribute attr = null, + cattr = null; + Code_attribute CAttr = null; + // Get counts of 4 annotation Attributes on element being checked. + for (String AnnoType : AnnoAttributes) { + try { + switch (ttype) { + case "METHOD": + index = m.attributes.getIndex(cf.constant_pool, + AnnoType); + memberName = m.getName(cf.constant_pool); + if (index != -1) + attr = m.attributes.get(index); + //fetch index annotations from code attribute. + index2 = m.attributes.getIndex(cf.constant_pool, + Attribute.Code); + if (index2 != -1) { + cattr = m.attributes.get(index2); + assert cattr instanceof Code_attribute; + CAttr = (Code_attribute)cattr; + index2 = CAttr.attributes.getIndex(cf.constant_pool, + AnnoType); + if (index2 != -1) + cattr = CAttr.attributes.get(index2); + } + break; + case "FIELD": + index = f.attributes.getIndex(cf.constant_pool, + AnnoType); + memberName = f.getName(cf.constant_pool); + if (index != -1) + attr = f.attributes.get(index); + //fetch index annotations from code attribute. + index2 = cf.attributes.getIndex(cf.constant_pool, + Attribute.Code); + if (index2!= -1) { + cattr = cf.attributes.get(index2); + assert cattr instanceof Code_attribute; + CAttr = (Code_attribute)cattr; + index2 = CAttr.attributes.getIndex(cf.constant_pool, + AnnoType); + if (index2!= -1) + cattr = CAttr.attributes.get(index2); + } + break; + + default: + memberName = cf.getName(); + index = cf.attributes.getIndex(cf.constant_pool, + AnnoType); + if (index!= -1) attr = cf.attributes.get(index); + break; + } + } + catch (ConstantPoolException cpe) { cpe.printStackTrace(); } + try { + testClassName=cf.getName(); + testcase = ttype + ": " + testClassName + ": " + + memberName + ", "; + } + catch (ConstantPoolException cpe) { cpe.printStackTrace(); } + if (index != -1) { + switch (AnnoType) { + case Attribute.RuntimeVisibleTypeAnnotations: + //count RuntimeVisibleTypeAnnotations + RuntimeVisibleTypeAnnotations_attribute RVTAa = + (RuntimeVisibleTypeAnnotations_attribute)attr; + vtaActual += RVTAa.annotations.length; + break; + case Attribute.RuntimeVisibleAnnotations: + //count RuntimeVisibleAnnotations + RuntimeVisibleAnnotations_attribute RVAa = + (RuntimeVisibleAnnotations_attribute)attr; + vaActual += RVAa.annotations.length; + break; + case Attribute.RuntimeInvisibleTypeAnnotations: + //count RuntimeInvisibleTypeAnnotations + RuntimeInvisibleTypeAnnotations_attribute RITAa = + (RuntimeInvisibleTypeAnnotations_attribute)attr; + itaActual += RITAa.annotations.length; + break; + case Attribute.RuntimeInvisibleAnnotations: + //count RuntimeInvisibleAnnotations + RuntimeInvisibleAnnotations_attribute RIAa = + (RuntimeInvisibleAnnotations_attribute)attr; + iaActual += RIAa.annotations.length; + break; + } + } + // annotations from code attribute. + if (index2 != -1) { + switch (AnnoType) { + case Attribute.RuntimeVisibleTypeAnnotations: + //count RuntimeVisibleTypeAnnotations + RuntimeVisibleTypeAnnotations_attribute RVTAa = + (RuntimeVisibleTypeAnnotations_attribute)cattr; + vtaActual += RVTAa.annotations.length; + break; + case Attribute.RuntimeVisibleAnnotations: + //count RuntimeVisibleAnnotations + RuntimeVisibleAnnotations_attribute RVAa = + (RuntimeVisibleAnnotations_attribute)cattr; + vaActual += RVAa.annotations.length; + break; + case Attribute.RuntimeInvisibleTypeAnnotations: + //count RuntimeInvisibleTypeAnnotations + RuntimeInvisibleTypeAnnotations_attribute RITAa = + (RuntimeInvisibleTypeAnnotations_attribute)cattr; + itaActual += RITAa.annotations.length; + break; + case Attribute.RuntimeInvisibleAnnotations: + //count RuntimeInvisibleAnnotations + RuntimeInvisibleAnnotations_attribute RIAa = + (RuntimeInvisibleAnnotations_attribute)cattr; + iaActual += RIAa.annotations.length; + break; + } + } + } + + switch (memberName) { + //METHODs + case "test" : vtaExp=4; itaExp=4; vaExp=0; iaExp=0; tc++; break; + case "mtest": vtaExp=4; itaExp=4; vaExp=1; iaExp=1; tc++; break; + case "m1": vtaExp=2; itaExp=2; vaExp=1; iaExp=1; tc++; break; + case "m2": vtaExp=4; itaExp=4; vaExp=1; iaExp=1; tc++; break; + case "m3": vtaExp=10; itaExp=10; vaExp=1; iaExp=1; tc++; break; + case "tm": vtaExp=6; itaExp=6; vaExp=1; iaExp=1; tc++; break; + //inner class + case "i_m1": vtaExp=2; itaExp=2; vaExp=1; iaExp=1; tc++; break; + case "i_m2": vtaExp=4; itaExp=4; vaExp=1; iaExp=1; tc++; break; + case "i_um": vtaExp=6; itaExp=6; vaExp=1; iaExp=1; tc++; break; + //local class + case "l_m1": vtaExp=2; itaExp=2; vaExp=1; iaExp=1; tc++; break; + case "l_m2": vtaExp=4; itaExp=4; vaExp=1; iaExp=1; tc++; break; + case "l_um": vtaExp=6; itaExp=6; vaExp=1; iaExp=1; tc++; break; + //anon class + case "mm_m1": vtaExp=2; itaExp=2; vaExp=1; iaExp=1; tc++; break; + case "mm_m2": vtaExp=4; itaExp=4; vaExp=1; iaExp=1; tc++; break; + case "mm_m3": vtaExp=10; itaExp=10;vaExp=1; iaExp=1; tc++; break; + case "mm_tm": vtaExp=6; itaExp=6; vaExp=1; iaExp=1; tc++; break; + //InnerAnon class + case "ia_m1": vtaExp=2; itaExp=2; vaExp=1; iaExp=1; tc++; break; + case "ia_m2": vtaExp=4; itaExp=4; vaExp=1; iaExp=1; tc++; break; + case "ia_um": vtaExp=6; itaExp=6; vaExp=1; iaExp=1; tc++; break; + //FIELDs + case "data": vtaExp = 2; itaExp=2; vaExp=1; iaExp=1; tc++; break; + case "odata1": vtaExp = 2; itaExp=2; vaExp=1; iaExp=1; tc++; break; + case "pdata1": vtaExp = 2; itaExp=2; vaExp=1; iaExp=1; tc++; break; + case "tdata": vtaExp = 2; itaExp=2; vaExp=1; iaExp=1; tc++; break; + case "sa1": vtaExp = 6; itaExp=6; vaExp=1; iaExp=1; tc++; break; + //inner class + case "i_odata1": vtaExp=2; itaExp=2; vaExp=1; iaExp=1; tc++; break; + case "i_pdata1": vtaExp=2; itaExp=2; vaExp=1; iaExp=1; tc++; break; + case "i_udata": vtaExp=2; itaExp=2; vaExp=1; iaExp=1; tc++; break; + case "i_sa1": vtaExp=6; itaExp=6; vaExp=1; iaExp=1; tc++; break; + case "i_tdata": vtaExp=2; itaExp=2; vaExp=1; iaExp=1; tc++; break; + //local class + case "l_odata1": vtaExp=2; itaExp=2; vaExp=1; iaExp=1; tc++; break; + case "l_pdata1": vtaExp=2; itaExp=2; vaExp=1; iaExp=1; tc++; break; + case "l_udata": vtaExp=2; itaExp=2; vaExp=1; iaExp=1; tc++; break; + case "l_sa1": vtaExp=6; itaExp=6; vaExp=1; iaExp=1; tc++; break; + case "l_tdata": vtaExp=2; itaExp=2; vaExp=1; iaExp=1; tc++; break; + //anon class + case "mm_odata1": vtaExp = 2; itaExp=2; vaExp=1; iaExp=1; tc++; break; + case "mm_pdata1": vtaExp = 2; itaExp=2; vaExp=1; iaExp=1; tc++; break; + case "mm_sa1": vtaExp = 6; itaExp=6; vaExp=1; iaExp=1; tc++; break; + case "mm_tdata": vtaExp = 2; itaExp=2; vaExp=1; iaExp=1; tc++; break; + // InnerAnon class + case "ia_odata1": vtaExp=2; itaExp=2; vaExp=1; iaExp=1; tc++; break; + case "ia_pdata1": vtaExp=2; itaExp=2; vaExp=1; iaExp=1; tc++; break; + case "ia_udata": vtaExp=2; itaExp=2; vaExp=1; iaExp=1; tc++; break; + case "ia_sa1": vtaExp=6; itaExp=6; vaExp=1; iaExp=1; tc++; break; + case "ia_tdata": vtaExp=2; itaExp=2; vaExp=1; iaExp=1; tc++; break; + case "IA": vtaExp=4; itaExp=4; vaExp=1; iaExp=1; tc++; break; + case "IN": vtaExp=4; itaExp=4; vaExp=1; iaExp=1; tc++; break; + // default cases are <init>, this$0, this$1, mmtest, atest + default: vtaExp = 0; itaExp=0; vaExp=0; iaExp=0; break; + } + check(testcase,vtaExp, itaExp, vaExp, iaExp, + vtaActual,itaActual,vaActual,iaActual); + } + + public void run() { + ClassFile cf = null; + InputStream in = null; + int testcount = 1; + File testFile = null; + // Generate source, check methods and fields for each combination. + for (Boolean[] bCombo : bRepeat) { + As=bCombo[0]; Bs=bCombo[1]; Cs=bCombo[2]; + Ds=bCombo[3]; TAs=bCombo[4]; TBs=bCombo[5]; + String testname = "Test" + testcount++; + println("Combinations: " + As + ", " + Bs + ", " + Cs + ", " + Ds + + ", " + TAs + ", " + TBs + + "; see " + testname + ".java"); + String[] classes = {testname + ".class", + testname + "$Inner.class", + testname + "$1Local1.class", + testname + "$1.class", + testname + "$1$1.class", + testname + "$1$InnerAnon.class" + }; + // Create test source, create and compile File. + String sourceString = getSource(srcTemplate, testname, + As, Bs, Cs, Ds, TAs, TBs); + System.out.println(sourceString); + try { + testFile = writeTestFile(testname+".java", sourceString); + } + catch (IOException ioe) { ioe.printStackTrace(); } + // Compile test source and read classfile. + File classFile = null; + try { + classFile = compile(testFile); + } + catch (Error err) { + System.err.println("FAILED compile. Source:\n" + sourceString); + throw err; + } + String testloc = classFile.getAbsolutePath().substring( + 0,classFile.getAbsolutePath().indexOf(classFile.getPath())); + for (String clazz : classes) { + try { + cf = ClassFile.read(new File(testloc+clazz)); + } + catch (Exception e) { e.printStackTrace(); } + // Test for all methods and fields + for (Method m: cf.methods) { + test("METHOD", cf, m, null, true); + } + for (Field f: cf.fields) { + test("FIELD", cf, null, f, true); + } + } + } + report(); + if (tc!=xtc) System.out.println("Test Count: " + tc + " != " + + "expected: " + xtc); + } + + + String getSrcTemplate(String sTemplate) { + List<String> tmpl = null; + String sTmpl = ""; + try { + tmpl = Files.readAllLines(new File(testSrc,sTemplate).toPath(), + Charset.defaultCharset()); + } + catch (IOException ioe) { + String error = "FAILED: Test failed to read template" + sTemplate; + ioe.printStackTrace(); + throw new RuntimeException(error); + } + for (String l : tmpl) + sTmpl=sTmpl.concat(l).concat("\n"); + return sTmpl; + } + + // test class template + String getSource(String templateName, String testname, + Boolean Arepeats, Boolean Brepeats, + Boolean Crepeats, Boolean Drepeats, + Boolean TArepeats, Boolean TBrepeats) { + String As = Arepeats ? "@A @A":"@A", + Bs = Brepeats ? "@B @B":"@B", + Cs = Crepeats ? "@C @C":"@C", + Ds = Drepeats ? "@D @D":"@D", + TAs = TArepeats ? "@TA @TA":"@TA", + TBs = TBrepeats ? "@TB @TB":"@TB"; + + // split up replace() lines for readability + String testsource = getSrcTemplate(templateName).replace("testname",testname); + testsource = testsource.replace("_As",As).replace("_Bs",Bs).replace("_Cs",Cs); + testsource = testsource.replace("_Ds",Ds).replace("_TAs",TAs).replace("_TBs",TBs); + return testsource; + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/annotations/typeAnnotations/classfile/testanoninner.template Fri Oct 11 19:05:18 2013 +0100 @@ -0,0 +1,108 @@ +import java.lang.annotation.*; +import static java.lang.annotation.RetentionPolicy.*; +import static java.lang.annotation.ElementType.*; +import java.util.List; + +class testname <T> { // TestN.class + _As _Bs _Cs _Ds String data = "test"; + _As _Bs _Cs _Ds Object mtest( _As _Bs _Cs _Ds testname <T> t){ return null; } + Object mmtest( testname<T> t){ return null; } + + class Inner<U> { // TestN$1$Inner.class + _As _Bs _Cs _Ds String i_odata1 = "test"; + _As _Bs _Cs _Ds int i_pdata1 = 0; + _As _Bs _Cs _Ds U i_udata = null; +//8015257 + _As _Bs _Cs _Ds Object _As _Bs _Cs _Ds [] _As _Bs _Cs _Ds [] i_sa1 = null; + _As _Bs _Cs _Ds T i_tdata = null; + _As _Bs _Cs _Ds String i_m1(){ return null; }; + _As _Bs _Cs _Ds int i_m2( _As _Bs _Cs _Ds Object o){return 0;} + _As _Bs _Cs _Ds + <_TAs _TBs _Cs _Ds U> Object i_um( _As _Bs _Cs _Ds U u) { return null; } + } +//8015323 + _As _Bs _Cs _Ds Inner< _As _Bs _Cs _Ds String> IN = new Inner< String>(); + + public void test() { + + class Local1<U> { // TestN$Local1.class + _As _Bs _Cs _Ds String l_odata1 = "test"; + _As _Bs _Cs _Ds int l_pdata1 = 0; + _As _Bs _Cs _Ds U l_udata = null; +//8015257 + _As _Bs _Cs _Ds Object _As _Bs _Cs _Ds []_As _Bs _Cs _Ds [] l_sa1 = null; + _TAs _TBs _Cs _Ds T l_tdata = null; + _As _Bs _Cs _Ds String l_m1(){ return null; }; + _As _Bs _Cs _Ds int l_m2(_As _Bs _Cs _Ds Object o){return 0;} + _As _Bs _Cs _Ds + <_TAs _TBs _Cs _Ds U> Object l_um(_As _Bs _Cs _Ds U u) { return null; } + } + // The below, as a local variable, will show up on test() + _As _Bs _Cs _Ds Local1<_As _Bs _Cs _Ds String> LC = new Local1<String>(); + + mtest( new testname<T>() { // TestN$1 + class InnerAnon<U> { // TestN$1$InnerAnon.class + _As _Bs _Cs _Ds String ia_odata1 = "test"; + _As _Bs _Cs _Ds int ia_pdata1 = 0; + _As _Bs _Cs _Ds U ia_udata = null; +//8015257 + _As _Bs _Cs _Ds Object _As _Bs _Cs _Ds []_As _Bs _Cs _Ds [] ia_sa1 = null; + _TAs _TBs _Cs _Ds T ia_tdata = null; + _As _Bs _Cs _Ds String ia_m1(){ return null; }; + _As _Bs _Cs _Ds int ia_m2(_As _Bs _Cs _Ds Object o){return 0;} + _As _Bs _Cs _Ds + <_TAs _TBs _Cs _Ds U> Object ia_um(_As _Bs _Cs _Ds U u) { return null; } + } +//8015257 + _As _Bs _Cs _Ds InnerAnon<_As _Bs _Cs _Ds String> IA = new InnerAnon< String>(); + + _As _Bs _Cs _Ds String odata1 = "test"; + _As _Bs _Cs _Ds int pdata1 = 0; +//8015257 + _As _Bs _Cs _Ds Object _As _Bs _Cs _Ds []_As _Bs _Cs _Ds [] sa1 = null; + _As _Bs _Cs _Ds T tdata = null; + + _As _Bs _Cs _Ds String m1(){ return null; }; + _As _Bs _Cs _Ds int m2(_As _Bs _Cs _Ds Object o){return 0;} + + _As _Bs _Cs _Ds Object _As _Bs _Cs _Ds [] _As _Bs _Cs _Ds [] + m3(String _As _Bs _Cs _Ds []_As _Bs _Cs _Ds [] sa){ return null; } + + _As _Bs _Cs _Ds + <_TAs _TBs _Cs _Ds T> Object tm(_As _Bs _Cs _Ds T t) { return null; } + + public void atest( testname<T> t){ + t.mmtest( new testname<T>() { // TestN$1$1.class + _As _Bs _Cs _Ds String mm_odata1 = "test"; + _As _Bs _Cs _Ds int mm_pdata1 = 0; +//8015257 + _As _Bs _Cs _Ds Object _As _Bs _Cs _Ds []_As _Bs _Cs _Ds [] mm_sa1 = null; + _TAs _TBs _Cs _Ds T mm_tdata = null; + + _As _Bs _Cs _Ds String mm_m1(){ return null; }; + _As _Bs _Cs _Ds int mm_m2(_As _Bs _Cs _Ds Object o){return 0;} + + _As _Bs _Cs _Ds String _As _Bs _Cs _Ds [] _As _Bs _Cs _Ds [] + mm_m3(String _As _Bs _Cs _Ds []_As _Bs _Cs _Ds [] sa){ return null; } + + _As _Bs _Cs _Ds + <_TAs _TBs _Cs _Ds T> Object mm_tm(_As _Bs _Cs _Ds T t) { return null; } + }); + } + }); + } +} +@Retention(RUNTIME) @Target({TYPE_USE,FIELD}) @Repeatable( AC.class ) @interface A { } +@Retention(RUNTIME) @Target({TYPE_USE,METHOD}) @Repeatable( BC.class ) @interface B { } +@Retention(RUNTIME) @Target({TYPE_USE,FIELD}) @interface AC { A[] value(); } +@Retention(RUNTIME) @Target({TYPE_USE,METHOD}) @interface BC { B[] value(); } + +@Retention(CLASS) @Target({TYPE_USE,FIELD}) @Repeatable( CC.class ) @interface C { } +@Retention(CLASS) @Target({TYPE_USE,METHOD}) @Repeatable( DC.class ) @interface D { } +@Retention(CLASS) @Target({TYPE_USE,FIELD}) @interface CC { C[] value(); } +@Retention(CLASS) @Target({TYPE_USE,METHOD}) @interface DC { D[] value(); } + +@Retention(RUNTIME) @Target({TYPE_USE,TYPE_PARAMETER,FIELD}) @Repeatable( TAC.class ) @interface TA { } +@Retention(RUNTIME) @Target({TYPE_USE,TYPE_PARAMETER,METHOD}) @Repeatable( TBC.class ) @interface TB { } +@Retention(RUNTIME) @Target({TYPE_USE,TYPE_PARAMETER,FIELD}) @interface TAC { TA[] value(); } +@Retention(RUNTIME) @Target({TYPE_USE,TYPE_PARAMETER,METHOD}) @interface TBC { TB[] value(); }
--- a/test/tools/javac/annotations/typeAnnotations/failures/CantAnnotateStaticClass.java Thu Oct 03 19:28:07 2013 +0100 +++ b/test/tools/javac/annotations/typeAnnotations/failures/CantAnnotateStaticClass.java Fri Oct 11 19:05:18 2013 +0100 @@ -1,7 +1,7 @@ /* * @test /nodynamiccopyright/ * @bug 8006733 8006775 - * @ignore 8013409: test failures for type annotations + * @summary A static outer class cannot be annotated. * @author Werner Dietl * @compile/fail/ref=CantAnnotateStaticClass.out -XDrawDiagnostics CantAnnotateStaticClass.java
--- a/test/tools/javac/annotations/typeAnnotations/failures/CantAnnotateStaticClass.out Thu Oct 03 19:28:07 2013 +0100 +++ b/test/tools/javac/annotations/typeAnnotations/failures/CantAnnotateStaticClass.out Fri Oct 11 19:05:18 2013 +0100 @@ -1,1 +1,10 @@ -dummy \ No newline at end of file +CantAnnotateStaticClass.java:22:20: compiler.err.cant.annotate.static.class +CantAnnotateStaticClass.java:23:13: compiler.err.cant.annotate.static.class +CantAnnotateStaticClass.java:24:29: compiler.err.cant.annotate.static.class +CantAnnotateStaticClass.java:26:29: compiler.err.cant.annotate.static.class +CantAnnotateStaticClass.java:29:26: compiler.err.cant.annotate.static.class +CantAnnotateStaticClass.java:30:9: compiler.err.cant.annotate.static.class +CantAnnotateStaticClass.java:31:35: compiler.err.cant.annotate.static.class +- compiler.note.unchecked.filename: CantAnnotateStaticClass.java +- compiler.note.unchecked.recompile +7 errors
--- a/test/tools/javac/annotations/typeAnnotations/newlocations/MultiCatch.java Thu Oct 03 19:28:07 2013 +0100 +++ b/test/tools/javac/annotations/typeAnnotations/newlocations/MultiCatch.java Fri Oct 11 19:05:18 2013 +0100 @@ -25,6 +25,7 @@ /* * @test + * @ignore 8008762 Type annotations failures * @bug 8006775 * @summary new type annotation location: multicatch * @author Werner Dietl
--- a/test/tools/javac/annotations/typeAnnotations/referenceinfos/MultiCatch.java Thu Oct 03 19:28:07 2013 +0100 +++ b/test/tools/javac/annotations/typeAnnotations/referenceinfos/MultiCatch.java Fri Oct 11 19:05:18 2013 +0100 @@ -25,6 +25,7 @@ /* * @test + * @ignore 8008762 Type annotation failures * @bug 8006732 8006775 * @summary Test population of reference info for multicatch exception parameters * @author Werner Dietl
--- a/test/tools/javac/api/TestJavacTask.java Thu Oct 03 19:28:07 2013 +0100 +++ b/test/tools/javac/api/TestJavacTask.java Fri Oct 11 19:05:18 2013 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -23,8 +23,8 @@ /* * @test - * @bug 4813736 - * @summary Provide a basic test of access to the Java Model from javac + * @bug 4813736 8015073 + * @summary Provide a basic test of access to the Java Model from javac, and error messages * @author Peter von der Ah\u00e9 * @run main TestJavacTask TestJavacTask.java */ @@ -40,21 +40,36 @@ import javax.tools.ToolProvider; public class TestJavacTask { - - static JavacTaskImpl getTask(JavaCompiler compiler, File... file) { + static final JavaCompiler compiler = ToolProvider.getSystemJavaCompiler(); + static JavacTaskImpl getTask(File... file) { StandardJavaFileManager fm = compiler.getStandardFileManager(null, null, null); Iterable<? extends JavaFileObject> files = fm.getJavaFileObjectsFromFiles(Arrays.asList(file)); return (JavacTaskImpl)compiler.getTask(null, fm, null, null, null, files); } - public static void main(String... args) throws IOException { - JavaCompiler tool = ToolProvider.getSystemJavaCompiler(); + static void basicTest(String... args) throws IOException { String srcdir = System.getProperty("test.src"); File file = new File(srcdir, args[0]); - JavacTaskImpl task = getTask(tool, file); + JavacTaskImpl task = getTask(file); for (TypeElement clazz : task.enter(task.parse())) System.out.println(clazz.getSimpleName()); } + static void checkKindError() { + final File testFile = new File("Test.java "); // <-note trailing space! + try { + getTask(testFile); + } catch (IllegalArgumentException iae) { + if (!iae.getMessage().contains("\"" + testFile.getName() + "\"")) { + System.err.println("Got message: " + iae.getMessage()); + throw new RuntimeException("Error: expected string not found"); + } + } + } + + public static void main(String... args) throws IOException { + basicTest(args); + checkKindError(); + } }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/defaultMethods/Assertions.java Fri Oct 11 19:05:18 2013 +0100 @@ -0,0 +1,102 @@ +/* + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package test; + +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/* + * @test + * @bug 8025141 + * @summary Interfaces must not contain non-public fields, ensure $assertionsDisabled + * is not generated into an interface + * @compile Assertions.java + * @run main/othervm -da test.Assertions + * @run main/othervm -ea:test.Assertions test.Assertions Inner + * @run main/othervm -ea:test.Outer test.Assertions Outer + * @run main/othervm -ea:test.Another test.Assertions Another.Inner + * @run main/othervm -ea:test... test.Assertions Inner Outer Another.Inner + */ + +public class Assertions { + interface Inner { + default void testInner() { + assert false; + } + } + + static class InnerImpl implements Inner {} + + static class OuterImpl implements Outer {} + + static class AnotherInnerImpl implements Another.Inner {} + + public static void main(String... args) { + Set<String> shouldThrowAssert = new HashSet<String>(Arrays.asList(args)); + try { + new InnerImpl().testInner(); + if (shouldThrowAssert.contains("Inner")) { + throw new IllegalStateException("AssertionError expected, but not thrown."); + } + } catch (AssertionError e) { + if (!shouldThrowAssert.contains("Inner")) { + throw new IllegalStateException("AssertionError not expected, but thrown."); + } + } + try { + new OuterImpl().testOuter(); + if (shouldThrowAssert.contains("Outer")) { + throw new IllegalStateException("AssertionError expected, but not thrown."); + } + } catch (AssertionError e) { + if (!shouldThrowAssert.contains("Outer")) { + throw new IllegalStateException("AssertionError not expected, but thrown."); + } + } + try { + new AnotherInnerImpl().testAnotherInner(); + if (shouldThrowAssert.contains("Another.Inner")) { + throw new IllegalStateException("AssertionError expected, but not thrown."); + } + } catch (AssertionError e) { + if (!shouldThrowAssert.contains("Another.Inner")) { + throw new IllegalStateException("AssertionError not expected, but thrown."); + } + } + } +} + +interface Outer { + default void testOuter() { + assert false; + } +} + +@interface Another { + interface Inner { + default void testAnotherInner() { + assert false; + } + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/defaultMethods/BadClassfile.java Fri Oct 11 19:05:18 2013 +0100 @@ -0,0 +1,89 @@ +/* + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 8025087 + * @summary Verify that pre-JDK8 classfiles with default and/or static methods + * are refused correctly. + * @build BadClassfile + * @run main BadClassfile + */ + +import com.sun.tools.classfile.*; +import com.sun.tools.javac.api.JavacTaskImpl; +import com.sun.tools.javac.code.Symbol; +import com.sun.tools.javac.jvm.ClassReader.BadClassFile; +import com.sun.tools.javac.jvm.Target; +import com.sun.tools.javac.util.Assert; +import com.sun.tools.javac.util.JCDiagnostic; +import java.io.File; +import java.util.Arrays; +import java.util.Objects; +import javax.tools.JavaCompiler; +import javax.tools.ToolProvider; + +public class BadClassfile { + public static void main(String... args) throws Exception { + test("BadClassfile$DefaultMethodTest", "compiler.misc.invalid.default.interface"); + test("BadClassfile$StaticMethodTest", "compiler.misc.invalid.static.interface"); + } + + private static void test(String classname, String expected) throws Exception { + File classfile = new File(System.getProperty("test.classes", "."), classname + ".class"); + ClassFile cf = ClassFile.read(classfile); + + cf = new ClassFile(cf.magic, Target.JDK1_7.minorVersion, + Target.JDK1_7.majorVersion, cf.constant_pool, cf.access_flags, + cf.this_class, cf.super_class, cf.interfaces, cf.fields, + cf.methods, cf.attributes); + + new ClassWriter().write(cf, classfile); + + JavaCompiler c = ToolProvider.getSystemJavaCompiler(); + JavacTaskImpl task = (JavacTaskImpl) c.getTask(null, null, null, Arrays.asList("-classpath", System.getProperty("test.classes", ".")), null, null); + + try { + Symbol clazz = com.sun.tools.javac.main.JavaCompiler.instance(task.getContext()).resolveIdent(classname); + + clazz.complete(); + } catch (BadClassFile f) { + JCDiagnostic embeddedDiag = (JCDiagnostic) f.diag.getArgs()[1]; + assertEquals(expected, embeddedDiag.getCode()); + assertEquals(Integer.toString(Target.JDK1_7.majorVersion), embeddedDiag.getArgs()[0]); + assertEquals(Integer.toString(Target.JDK1_7.minorVersion), embeddedDiag.getArgs()[1]); + } + } + + private static void assertEquals(Object expected, Object actual) { + Assert.check(Objects.equals(expected, actual), + "expected: " + expected + ", but was: " + actual); + } + + interface DefaultMethodTest { + default void test() { } + } + interface StaticMethodTest { + static void test() { } + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/defaultMethods/CannotChangeAssertionsStateAfterInitialized.java Fri Oct 11 19:05:18 2013 +0100 @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 8025141 + * @summary Ensure the assertion status cannot be changed once the class is initialized + * @compile CannotChangeAssertionsStateAfterInitialized.java + * @run main/othervm -da CannotChangeAssertionsStateAfterInitialized + */ + +public interface CannotChangeAssertionsStateAfterInitialized { + default void m() { + assert false; + } + + public static void main(String[] args) { + ClassLoader cl = CannotChangeAssertionsStateAfterInitialized.class.getClassLoader(); + cl.setClassAssertionStatus(CannotChangeAssertionsStateAfterInitialized.class.getName(), true); + new CannotChangeAssertionsStateAfterInitialized() {}.m(); + } + +}
--- a/test/tools/javac/diags/examples.not-yet.txt Thu Oct 03 19:28:07 2013 +0100 +++ b/test/tools/javac/diags/examples.not-yet.txt Fri Oct 11 19:05:18 2013 +0100 @@ -40,7 +40,6 @@ compiler.err.type.var.more.than.once.in.result # UNUSED compiler.err.unexpected.type compiler.err.unsupported.cross.fp.lit # Scanner: host system dependent -compiler.misc.bad.class.file.header # bad class file compiler.misc.bad.class.signature # bad class file compiler.misc.bad.const.pool.tag # bad class file compiler.misc.bad.const.pool.tag.at # bad class file
--- a/test/tools/javac/diags/examples/DuplicateAnnotation.java Thu Oct 03 19:28:07 2013 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,32 +0,0 @@ -/* - * Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -// key: compiler.err.duplicate.annotation -// key: compiler.warn.source.no.bootclasspath -// options: -source 7 - -@interface Anno { } - -@Anno -@Anno -class DuplicateAnnotation { }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/diags/examples/InterfaceOrArrayExpected.java Fri Oct 11 19:05:18 2013 +0100 @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +// key: compiler.err.intf.or.array.expected.here + +import java.util.List; + +class InterfaceExpected<T extends List & String> { }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/diags/examples/InvalidDefaultInterface/InvalidDefaultInterface.java Fri Oct 11 19:05:18 2013 +0100 @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +// key: compiler.misc.invalid.default.interface +// key: compiler.misc.bad.class.file.header +// key: compiler.err.cant.access +// options: -processor CreateBadClassFile + +/* The annotation processor will create an invalid classfile with version 51.0 + * and a non-abstract method in an interface. Loading the classfile will produce + * the diagnostic. + */ +class InvalidDefaultInterface { }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/diags/examples/InvalidDefaultInterface/processors/CreateBadClassFile.java Fri Oct 11 19:05:18 2013 +0100 @@ -0,0 +1,85 @@ +/* + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import com.sun.tools.classfile.*; +import com.sun.tools.classfile.ConstantPool.CONSTANT_Class_info; +import com.sun.tools.classfile.ConstantPool.CONSTANT_Utf8_info; +import com.sun.tools.classfile.ConstantPool.CPInfo; +import java.io.*; +import java.util.*; +import javax.annotation.processing.*; +import javax.lang.model.*; +import javax.lang.model.element.*; +import javax.tools.*; + +/* Create an invalid classfile with version 51.0 and a non-abstract method in an interface.*/ +@SupportedAnnotationTypes("*") +public class CreateBadClassFile extends AbstractProcessor { + public boolean process(Set<? extends TypeElement> elems, RoundEnvironment renv) { + if (++round == 1) { + ConstantPool cp = new ConstantPool(new CPInfo[] { + new CONSTANT_Utf8_info(""), //0 + new CONSTANT_Utf8_info("Test"), //1 + new CONSTANT_Class_info(null, 1), //2 + new CONSTANT_Utf8_info("java/lang/Object"), //3 + new CONSTANT_Class_info(null, 3), //4 + new CONSTANT_Utf8_info("test"), //5 + new CONSTANT_Utf8_info("()V"), //6 + }); + ClassFile cf = new ClassFile(0xCAFEBABE, + 0, + 51, + cp, + new AccessFlags(AccessFlags.ACC_ABSTRACT | + AccessFlags.ACC_INTERFACE | + AccessFlags.ACC_PUBLIC), + 2, + 4, + new int[0], + new Field[0], + new Method[] { + //creating non-abstract method in 51.0 classfile: + new Method(new AccessFlags(AccessFlags.ACC_PUBLIC), + 5, + new Descriptor(6), + new Attributes(cp, new Attribute[0])) + }, + new Attributes(cp, new Attribute[0])); + try { + JavaFileObject clazz = processingEnv.getFiler().createClassFile("Test"); + try (OutputStream out = clazz.openOutputStream()) { + new ClassWriter().write(cf, out); + } + } catch (IOException ex) { + ex.printStackTrace(); + } + } + return false; + } + + public SourceVersion getSupportedSourceVersion() { + return SourceVersion.latest(); + } + + int round = 0; +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/diags/examples/InvalidStaticInterface/InvalidStaticInterface.java Fri Oct 11 19:05:18 2013 +0100 @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +// key: compiler.misc.invalid.static.interface +// key: compiler.misc.bad.class.file.header +// key: compiler.err.cant.access +// options: -processor CreateBadClassFile + +/* The annotation processor will create an invalid classfile with version 51.0 + * and a static method in an interface. Loading the classfile will produce + * the diagnostic. + */ +class InvalidDefaultInterface { }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/diags/examples/InvalidStaticInterface/processors/CreateBadClassFile.java Fri Oct 11 19:05:18 2013 +0100 @@ -0,0 +1,86 @@ +/* + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import com.sun.tools.classfile.*; +import com.sun.tools.classfile.ConstantPool.CONSTANT_Class_info; +import com.sun.tools.classfile.ConstantPool.CONSTANT_Utf8_info; +import com.sun.tools.classfile.ConstantPool.CPInfo; +import java.io.*; +import java.util.*; +import javax.annotation.processing.*; +import javax.lang.model.*; +import javax.lang.model.element.*; +import javax.tools.*; + +/* Create an invalid classfile with version 51.0 and a static method in an interface.*/ +@SupportedAnnotationTypes("*") +public class CreateBadClassFile extends AbstractProcessor { + public boolean process(Set<? extends TypeElement> elems, RoundEnvironment renv) { + if (++round == 1) { + ConstantPool cp = new ConstantPool(new CPInfo[] { + new CONSTANT_Utf8_info(""), //0 + new CONSTANT_Utf8_info("Test"), //1 + new CONSTANT_Class_info(null, 1), //2 + new CONSTANT_Utf8_info("java/lang/Object"), //3 + new CONSTANT_Class_info(null, 3), //4 + new CONSTANT_Utf8_info("test"), //5 + new CONSTANT_Utf8_info("()V"), //6 + }); + ClassFile cf = new ClassFile(0xCAFEBABE, + 0, + 51, + cp, + new AccessFlags(AccessFlags.ACC_ABSTRACT | + AccessFlags.ACC_INTERFACE | + AccessFlags.ACC_PUBLIC), + 2, + 4, + new int[0], + new Field[0], + new Method[] { + //creating static method in 51.0 classfile: + new Method(new AccessFlags(AccessFlags.ACC_PUBLIC | + AccessFlags.ACC_STATIC), + 5, + new Descriptor(6), + new Attributes(cp, new Attribute[0])) + }, + new Attributes(cp, new Attribute[0])); + try { + JavaFileObject clazz = processingEnv.getFiler().createClassFile("Test"); + try (OutputStream out = clazz.openOutputStream()) { + new ClassWriter().write(cf, out); + } + } catch (IOException ex) { + ex.printStackTrace(); + } + } + return false; + } + + public SourceVersion getSupportedSourceVersion() { + return SourceVersion.latest(); + } + + int round = 0; +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/diags/examples/RepeatableAnnotationsNotSupported.java Fri Oct 11 19:05:18 2013 +0100 @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +// key: compiler.err.repeatable.annotations.not.supported.in.source +// key: compiler.warn.source.no.bootclasspath +// options: -source 7 + +@interface Anno { } + +@Anno +@Anno +class RepeatableAnnotationsNotSupported { }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/diags/examples/UnderscoreInLambdaExpression.java Fri Oct 11 19:05:18 2013 +0100 @@ -0,0 +1,27 @@ +/* + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +// key: compiler.err.underscore.as.identifier.in.lambda +public class UnderscoreInLambdaExpression { + java.util.function.Function<String,String> f = _ -> "x"; +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/enum/EnumAsIdentifier.java Fri Oct 11 19:05:18 2013 +0100 @@ -0,0 +1,16 @@ +/** + * @test /nodynamiccopyright/ + * @bug 8025537 + * @author sogoel + * @summary enum keyword used as an identifier + * @compile/ref=EnumAsIdentifier4.out -XDrawDiagnostics -source 1.4 EnumAsIdentifier.java + * @compile/fail/ref=EnumAsIdentifier5.out -XDrawDiagnostics -source 1.5 EnumAsIdentifier.java + * @compile/fail/ref=EnumAsIdentifier.out -XDrawDiagnostics EnumAsIdentifier.java + */ + +public class EnumAsIdentifier { + + int enum = 0; + +} +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/enum/EnumAsIdentifier.out Fri Oct 11 19:05:18 2013 +0100 @@ -0,0 +1,2 @@ +EnumAsIdentifier.java:13:9: compiler.err.enum.as.identifier +1 error
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/enum/EnumAsIdentifier4.out Fri Oct 11 19:05:18 2013 +0100 @@ -0,0 +1,6 @@ +- compiler.warn.source.no.bootclasspath: 1.4 +- compiler.warn.option.obsolete.source: 1.4 +- compiler.warn.option.obsolete.target: 1.4 +- compiler.warn.option.obsolete.suppression +EnumAsIdentifier.java:13:9: compiler.warn.enum.as.identifier +5 warnings
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/enum/EnumAsIdentifier5.out Fri Oct 11 19:05:18 2013 +0100 @@ -0,0 +1,6 @@ +- compiler.warn.source.no.bootclasspath: 1.5 +- compiler.warn.option.obsolete.source: 1.5 +- compiler.warn.option.obsolete.suppression +EnumAsIdentifier.java:13:9: compiler.err.enum.as.identifier +1 error +3 warnings
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/enum/EnumMembersOrder.java Fri Oct 11 19:05:18 2013 +0100 @@ -0,0 +1,20 @@ +/** + * @test /nodynamiccopyright/ + * @bug 8025537 5028491 + * @author sogoel + * @summary enum constants should precede other enum members + * @compile/fail/ref=EnumMembersOrder.out -XDrawDiagnostics EnumMembersOrder.java + */ + +enum Days { + + Days(String d) { day = d; } // constructor + + // enum constants + WEEKEND("SAT"), + WEEKDAY("MON"); + + private String day; + +} +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/enum/EnumMembersOrder.out Fri Oct 11 19:05:18 2013 +0100 @@ -0,0 +1,7 @@ +EnumMembersOrder.java:11:16: compiler.err.expected: ')' +EnumMembersOrder.java:11:17: compiler.err.expected3: ',', '}', ';' +EnumMembersOrder.java:11:19: compiler.err.expected: '}' +EnumMembersOrder.java:11:31: compiler.err.expected3: class, interface, enum +EnumMembersOrder.java:17:13: compiler.err.expected3: class, interface, enum +EnumMembersOrder.java:19:1: compiler.err.expected3: class, interface, enum +6 errors
--- a/test/tools/javac/generics/OverrideBridge.java Thu Oct 03 19:28:07 2013 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,166 +0,0 @@ -/* - * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -/* - * @test - * @bug 6337171 6996415 - * @ignore 6996758: Investigate better override bridges strategy - * @summary javac should create bridge methods when type variable bounds restricted - * @run main OverrideBridge - */ - -// fix, and test, has been disabled as a consequence of 6996415 - -import java.io.*; -import java.net.URI; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.HashMap; -import javax.tools.JavaCompiler; -import javax.tools.JavaFileObject; -import javax.tools.SimpleJavaFileObject; -import javax.tools.ToolProvider; - -import com.sun.source.util.JavacTask; -import com.sun.tools.classfile.ClassFile; -import com.sun.tools.classfile.ConstantPoolException; -import com.sun.tools.classfile.Descriptor.InvalidDescriptor; -import com.sun.tools.classfile.Method; - -public class OverrideBridge { - - enum Implementation { - IMPLICIT(""), - EXPLICIT("@Override public abstract X m(X x);"); - - String impl; - - Implementation(String impl) { - this.impl = impl; - } - } - - static class JavaSource extends SimpleJavaFileObject { - - final static String sourceStub = - "abstract class A<X> {\n" + - " public abstract X m(X x);\n" + - "}\n" + - "interface I<X> {\n" + - "X m(X x);\n" + - "}\n" + - "abstract class B<X extends B<X>> extends A<X> implements I<X> { #B }\n" + - "abstract class C<X extends C<X>> extends B<X> { #C }\n" + - "abstract class D<X extends D<X>> extends C<X> { #D }\n"; - - String source; - - public JavaSource(Implementation implB, Implementation implC, Implementation implD) { - super(URI.create("myfo:/Test.java"), JavaFileObject.Kind.SOURCE); - source = sourceStub.replace("#B", implB.impl).replace("#C", implC.impl).replace("#D", implD.impl); - } - - @Override - public CharSequence getCharContent(boolean ignoreEncodingErrors) { - return source; - } - } - - public static void main(String... args) throws Exception { - Map<ClassFile, List<Method>> refMembers = - compile(Implementation.EXPLICIT, Implementation.EXPLICIT, Implementation.EXPLICIT, "ref"); - int i = 0; - for (Implementation implB : Implementation.values()) { - for (Implementation implC : Implementation.values()) { - for (Implementation implD : Implementation.values()) { - Map<ClassFile, List<Method>> membersToCheck = compile(implB, implC, implD, "out_" + i++); - check(refMembers, membersToCheck); - } - } - } - } - - static String workDir = System.getProperty("user.dir"); - - static Map<ClassFile, List<Method>> compile(Implementation implB, Implementation implC, Implementation implD, String destPath) throws Exception { - File destDir = new File(workDir, destPath); destDir.mkdir(); - final JavaCompiler tool = ToolProvider.getSystemJavaCompiler(); - JavaSource source = new JavaSource(implB, implC, implD); - JavacTask ct = (JavacTask)tool.getTask(null, null, null, - Arrays.asList("-d", destPath), null, Arrays.asList(source)); - ct.generate(); - Map<ClassFile, List<Method>> members = new HashMap<>(); - addMembers(destDir, members); - return members; - } - - static void addMembers(File destDir, Map<ClassFile, List<Method>> members) { - String[] names = { "B.class", "C.class", "D.class" }; - try { - for (String name : names) { - File f = new File(destDir, name); - ClassFile cf = ClassFile.read(f); - members.put(cf, readMethod(cf, "m")); - } - } catch (Exception e) { - e.printStackTrace(); - throw new Error("error reading classes"); - } - } - - static List<Method> readMethod(ClassFile cf, String name) throws ConstantPoolException { - List<Method> buf = new ArrayList<>(); - for (Method m : cf.methods) { - if (m.getName(cf.constant_pool).equals(name)) { - buf.add(m); - } - } - return buf; - } - - static void check(Map<ClassFile, List<Method>> refMembers, Map<ClassFile, List<Method>> membersToCheck) throws ConstantPoolException, InvalidDescriptor { - for (Map.Entry<ClassFile, List<Method>> ref : refMembers.entrySet()) { - ClassFile cRef = ref.getKey(); - for (Method mRef : ref.getValue()) { - boolean ok = false; - for (Map.Entry<ClassFile, List<Method>> toCheck : membersToCheck.entrySet()) { - ClassFile cToCheck = toCheck.getKey(); - for (Method mToCheck : toCheck.getValue()) { - if (cRef.getName().equals(cToCheck.getName()) && - mRef.descriptor.getReturnType(cRef.constant_pool).equals( - mToCheck.descriptor.getReturnType(cToCheck.constant_pool)) && - mRef.descriptor.getParameterTypes(cRef.constant_pool).equals( - mToCheck.descriptor.getParameterTypes(cToCheck.constant_pool))) { - ok = true; - } - } - } - if (!ok) { - throw new AssertionError("Matching method descriptor for " + mRef.descriptor.getParameterTypes(cRef.constant_pool) + "not found"); - } - } - } - } -}
--- a/test/tools/javac/generics/typevars/6680106/T6680106.out Thu Oct 03 19:28:07 2013 +0100 +++ b/test/tools/javac/generics/typevars/6680106/T6680106.out Fri Oct 11 19:05:18 2013 +0100 @@ -1,13 +1,7 @@ -T6680106.java:11:25: compiler.err.type.found.req: T[], (compiler.misc.type.req.class) -T6680106.java:12:25: compiler.err.type.found.req: S[], (compiler.misc.type.req.class) -T6680106.java:12:40: compiler.err.type.found.req: T[], (compiler.misc.type.req.class) -T6680106.java:13:25: compiler.err.type.found.req: S[], (compiler.misc.type.req.class) -T6680106.java:13:40: compiler.err.type.found.req: U[], (compiler.misc.type.req.class) -T6680106.java:13:55: compiler.err.type.found.req: T[], (compiler.misc.type.req.class) -T6680106.java:14:30: compiler.err.type.found.req: T[], (compiler.misc.type.req.class) -T6680106.java:15:30: compiler.err.type.found.req: S[], (compiler.misc.type.req.class) -T6680106.java:15:50: compiler.err.type.found.req: T[], (compiler.misc.type.req.class) -T6680106.java:16:30: compiler.err.type.found.req: S[], (compiler.misc.type.req.class) -T6680106.java:16:50: compiler.err.type.found.req: U[], (compiler.misc.type.req.class) -T6680106.java:16:70: compiler.err.type.found.req: T[], (compiler.misc.type.req.class) -12 errors +T6680106.java:11:14: compiler.err.cyclic.inheritance: T +T6680106.java:12:14: compiler.err.cyclic.inheritance: T +T6680106.java:13:14: compiler.err.cyclic.inheritance: T +T6680106.java:14:14: compiler.err.cyclic.inheritance: T +T6680106.java:15:14: compiler.err.cyclic.inheritance: T +T6680106.java:16:14: compiler.err.cyclic.inheritance: T +6 errors
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/lambda/8012557/A.java Fri Oct 11 19:05:18 2013 +0100 @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +interface A { + default String u() { return "A"; } + default String name() { + SAM s = ()->u()+"A"; + return s.m(); + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/lambda/8012557/B.java Fri Oct 11 19:05:18 2013 +0100 @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +interface B { + default String u() { return "B"; } + default String name() { + SAM s = ()->u()+"B"; + return s.m(); + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/lambda/8012557/C.java Fri Oct 11 19:05:18 2013 +0100 @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +interface C { + default String u() { return "C"; } + default String name() { + SAM s = ()->u()+"C"; + return s.m(); + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/lambda/8012557/PrivateLambdas.java Fri Oct 11 19:05:18 2013 +0100 @@ -0,0 +1,88 @@ +/* + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 8012557 + * @summary Check that 8012557 is fixed, that interface lambda + * methods are private + * @author Robert Field + * @compile SAM.java + * @compile A.java + * @compile B.java + * @compile C.java + * @run main PrivateLambdas + * + * Unless the lambda methods are private, this will fail with: + * AbstractMethodError: + * Conflicting default methods: A.lambda$0 B.lambda$0 C.lambda$0 + */ + +import java.lang.reflect.Method; +import java.lang.reflect.Modifier; + +interface X extends A, B, C { + default String u() { return " "; } + default String name() { + return A.super.name() + B.super.name() + C.super.name(); + } +} + +public class PrivateLambdas implements X { + public static void main(String[] args) throws Exception { + + // Check that all the lambda methods are private instance synthetic + for (Class<?> k : new Class<?>[] { A.class, B.class, C.class }) { + Method[] methods = k.getDeclaredMethods(); + int lambdaCount = 0; + for(Method m : methods) { + if (m.getName().startsWith("lambda$")) { + ++lambdaCount; + int mod = m.getModifiers(); + if ((mod & Modifier.PRIVATE) == 0) { + throw new Exception("Expected " + m + " to be private"); + } + if (!m.isSynthetic()) { + throw new Exception("Expected " + m + " to be synthetic"); + } + if ((mod & Modifier.STATIC) != 0) { + throw new Exception("Expected " + m + " to be instance method"); + } + } + } + if (lambdaCount == 0) { + throw new Exception("Expected at least one lambda method"); + } + } + + /* + * Unless the lambda methods are private, this will fail with: + * AbstractMethodError: + * Conflicting default methods: A.lambda$0 B.lambda$0 C.lambda$0 + */ + X x = new PrivateLambdas(); + if (!x.name().equals(" A B C")) { + throw new Exception("Expected ' A B C' got: " + x.name()); + } + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/lambda/8012557/SAM.java Fri Oct 11 19:05:18 2013 +0100 @@ -0,0 +1,26 @@ +/* + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +interface SAM { + String m(); +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/lambda/8016320/IllegalBridgeModifier.java Fri Oct 11 19:05:18 2013 +0100 @@ -0,0 +1,55 @@ +/* + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 8016320 + * @summary Check that 8016320 is fixed, + * that bridges have valid modifier bits + * @author Robert Field + * @run main IllegalBridgeModifier + */ + +interface SAM { + int m(); +} + +interface SuperI { + public default int foo() { return 1234; } +} + +interface I extends SuperI { +} + +interface T extends I { + public default SAM boo() { return I.super::foo; } +} + +public class IllegalBridgeModifier { + public static void main(String argv[])throws Exception { + T t = new T(){}; + if (t.boo().m() != 1234) { + throw new Exception("Failed test"); + } + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/lambda/8024497/CrashUsingReturningThisRefLambdaFromDefaultMetTest.java Fri Oct 11 19:05:18 2013 +0100 @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 8024497 + * @summary crash returning this-referencing lambda from default method + * @compile CrashUsingReturningThisRefLambdaFromDefaultMetTest.java + */ + +interface SuperInterface {} + +interface CrashUsingReturningThisRefLambdaFromDefaultMetTest extends SuperInterface { + default Runnable getAction() { + return () -> { + SuperInterface.super.getClass(); + this.getClass(); + CrashUsingReturningThisRefLambdaFromDefaultMetTest.this.getClass(); + }; + } +}
--- a/test/tools/javac/lambda/methodReference/BridgeMethod.java Thu Oct 03 19:28:07 2013 +0100 +++ b/test/tools/javac/lambda/methodReference/BridgeMethod.java Fri Oct 11 19:05:18 2013 +0100 @@ -108,9 +108,10 @@ System.out.println("methods in SAM conversion of N:"); for(Method m : methods) { System.out.println(m.toGenericString()); - assertTrue(m.getName().equals("m")); - Class<?> returnType = m.getReturnType(); - assertTrue(types.remove(returnType.getName())); + if (m.getName().equals("m")) { + Class<?> returnType = m.getReturnType(); + assertTrue(types.remove(returnType.getName())); + } } assertTrue(types.size() == 1); //there's a bridge }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/processing/errors/EnsureAnnotationTypeMismatchException/Processor.java Fri Oct 11 19:05:18 2013 +0100 @@ -0,0 +1,102 @@ +/* + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.io.IOException; +import java.io.Writer; +import java.lang.annotation.*; +import java.util.Set; +import javax.annotation.processing.*; +import javax.lang.model.element.*; +import javax.lang.model.util.ElementFilter; +import javax.tools.*; +import com.sun.tools.javac.util.Assert; + +public class Processor extends JavacTestingAbstractProcessor { + + private boolean seenGenerated; + + @Override + public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) { + for (Element e : roundEnv.getElementsAnnotatedWith(Gen.class)) { + Gen gen = e.getAnnotation(Gen.class); + try { + JavaFileObject source = processingEnv.getFiler().createSourceFile(gen.fileName()); + + try (Writer out = source.openWriter()) { + out.write(gen.content()); + } + } catch (IOException ex) { + throw new IllegalStateException(ex); + } + } + + TypeElement generated = processingEnv.getElementUtils().getTypeElement("Generated"); + + if (generated != null) { + Check check = ElementFilter.methodsIn(generated.getEnclosedElements()).get(0).getAnnotation(Check.class); + + checkCorrectException(check::classValue, "java.lang.Class<java.lang.String>"); + checkCorrectException(check::intConstValue, "boolean"); + checkCorrectException(check::enumValue, "java.lang.String"); + checkCorrectException(check::incorrectAnnotationValue, "java.lang.Deprecated"); + checkCorrectException(check::incorrectArrayValue, "<any>"); + checkCorrectException(check::incorrectClassValue, "<any>"); + + seenGenerated = true; + } + + if (roundEnv.processingOver() && !seenGenerated) { + Assert.error("Did not see the generated class!"); + } + + return true; + } + + private static void checkCorrectException(Runnable runCheck, String expectedType) { + try { + runCheck.run(); + Assert.check(false); //Should not reach here + } catch (AnnotationTypeMismatchException ex) { + Assert.check(expectedType.equals(ex.foundType()), ex.foundType()); + } + } + +} + +@interface Gen { + String fileName(); + String content(); +} + +@interface Check { + Class<? extends Number> classValue(); + int intConstValue(); + E enumValue(); + int incorrectAnnotationValue(); + int incorrectArrayValue(); + Class<?> incorrectClassValue(); +} + +enum E { + A; +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/processing/errors/EnsureAnnotationTypeMismatchException/Source.java Fri Oct 11 19:05:18 2013 +0100 @@ -0,0 +1,25 @@ +/* + * @test /nodynamiccopyright/ + * @bug 6278240 + * @summary Ensure AnnotationTypeMismatchException is thrown when appropriate + * with reasonable foundType filled. + * @library /tools/javac/lib + * @build JavacTestingAbstractProcessor Processor + * @compile/fail/ref=Source.out -XDrawDiagnostics -processor Processor Source.java + */ + +@Gen(fileName="Generated", + content= +"class Generated {\n" + +" @Check(classValue=String.class,\n" + +" intConstValue=false,\n" + +" enumValue=\"a\",\n" + +" incorrectAnnotationValue=@Deprecated,\n" + +" incorrectArrayValue={1, \"a\"},\n" + +" incorrectClassValue=get())\n" + +" public static Class<?> get() {\n" + +" return null;\n" + +" }\n" + +"}\n") +class Source { +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/processing/errors/EnsureAnnotationTypeMismatchException/Source.out Fri Oct 11 19:05:18 2013 +0100 @@ -0,0 +1,7 @@ +Generated.java:2:29: compiler.err.prob.found.req: (compiler.misc.inconvertible.types: java.lang.Class<java.lang.String>, java.lang.Class<? extends java.lang.Number>) +Generated.java:3:26: compiler.err.prob.found.req: (compiler.misc.inconvertible.types: boolean, int) +Generated.java:4:22: compiler.err.prob.found.req: (compiler.misc.inconvertible.types: java.lang.String, E) +Generated.java:5:37: compiler.err.annotation.not.valid.for.type: int +Generated.java:6:32: compiler.err.annotation.value.not.allowable.type +Generated.java:7:35: compiler.err.annotation.value.must.be.class.literal +6 errors
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/processing/errors/TestBadProcessor.java Fri Oct 11 19:05:18 2013 +0100 @@ -0,0 +1,119 @@ +/* + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 8022163 + * @summary javac exits with 0 status and no messages on error to construct an ann-procesor + */ + +import java.io.*; + +public class TestBadProcessor { + public static void main(String... args) throws Exception { + new TestBadProcessor().run(); + } + + public static final String badAnnoProcSrc = + "import java.util.*;\n" + + "import javax.annotation.processing.*;\n" + + "import javax.lang.model.element.*;\n" + + + "public class AnnoProc extends AbstractProcessor {\n" + + " public AnnoProc() {\n" + + " throw new Error();\n" + + " }\n" + + + " public boolean process(Set<? extends TypeElement> elems, \n" + + " RoundEnvironment rEnv) {\n" + + " return false;\n" + + " }\n" + + "}\n"; + + public void run() throws Exception { + // setup + File srcDir = new File("src"); + File classesDir = new File("classes"); + classesDir.mkdirs(); + File srcFile = writeFile(srcDir, "AnnoProc.java", badAnnoProcSrc); + compile("-d", classesDir.getPath(), srcFile.getPath()); + writeFile(classesDir, "META-INF/services/javax.annotation.processing.Processor", "AnnoProc"); + + // run the primary compilation + int rc; + StringWriter sw = new StringWriter(); + try (PrintWriter pw = new PrintWriter(sw)) { + String[] args = { "-processorpath", classesDir.getPath(), srcFile.getPath() }; + rc = com.sun.tools.javac.Main.compile(args, pw); + } + + // verify that it failed as expected, with the expected message + String out = sw.toString(); + System.err.println(out); + String expect = "error: Bad service configuration file, " + + "or exception thrown while constructing Processor object: " + + "javax.annotation.processing.Processor: " + + "Provider AnnoProc could not be instantiated: java.lang.Error"; + if (!out.trim().equals(expect)) { + System.err.println("expected: " + expect); + error("output not as expected"); + } + + if (rc == 0) { + error("unexpected exit code: " + rc + "; expected: not zero"); + } + + // summary + if (errors > 0) + throw new Exception(errors + " errors found"); + } + + void compile(String... args) throws Exception { + int rc; + StringWriter sw = new StringWriter(); + try (PrintWriter pw = new PrintWriter(sw)) { + rc = com.sun.tools.javac.Main.compile(args, pw); + } + String out = sw.toString(); + if (!out.isEmpty()) + System.err.println(out); + if (rc != 0) + throw new Exception("compilation failed"); + } + + File writeFile(File dir, String path, String body) throws IOException { + File f = new File(dir, path); + f.getParentFile().mkdirs(); + try (FileWriter out = new FileWriter(f)) { + out.write(body); + } + return f; + } + + void error(String msg) { + System.err.println("Error: " + msg); + errors++; + } + + int errors; +}
--- a/test/tools/javac/processing/model/element/TestExecutableElement.java Thu Oct 03 19:28:07 2013 +0100 +++ b/test/tools/javac/processing/model/element/TestExecutableElement.java Fri Oct 11 19:05:18 2013 +0100 @@ -23,54 +23,57 @@ /* * @test - * @bug 8005046 8011052 - * @summary Test basic properties of javax.lang.element.Element + * @bug 8005046 8011052 8025087 + * @summary Test basic properties of javax.lang.element.ExecutableElement * @author Joseph D. Darcy * @library /tools/javac/lib * @build JavacTestingAbstractProcessor TestExecutableElement - * @compile -processor TestExecutableElement -proc:only TestExecutableElement.java + * @compile -processor TestExecutableElement -proc:only -AexpectedMethodCount=7 TestExecutableElement.java + * @compile/process -processor TestExecutableElement -proc:only -AexpectedMethodCount=3 ProviderOfDefault */ import java.lang.annotation.*; import java.util.Formatter; import java.util.Set; -import java.util.Objects; import java.util.regex.*; import javax.annotation.processing.*; -import javax.lang.model.SourceVersion; -import static javax.lang.model.SourceVersion.*; import javax.lang.model.element.*; -import javax.lang.model.util.*; import static javax.lang.model.util.ElementFilter.*; import static javax.tools.Diagnostic.Kind.*; -import static javax.tools.StandardLocation.*; /** * Test some basic workings of javax.lang.element.ExecutableElement */ +@SupportedOptions("expectedMethodCount") public class TestExecutableElement extends JavacTestingAbstractProcessor implements ProviderOfDefault { + private int seenMethods = 0; @IsDefault(false) public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) { - int errors = 0; if (!roundEnv.processingOver()) { - boolean hasRun = false; for (Element element : roundEnv.getRootElements()) { for (ExecutableElement method : methodsIn(element.getEnclosedElements())) { - hasRun = true; - errors += checkIsDefault(method); + checkIsDefault(method); + seenMethods++; } } + } else { + String expectedMethodCountStr = processingEnv.getOptions().get("expectedMethodCount"); + if (expectedMethodCountStr == null) { + messager.printMessage(ERROR, "No expected method count specified."); + } else { + int expectedMethodCount = Integer.parseInt(expectedMethodCountStr); - if (!hasRun) { - messager.printMessage(ERROR, "No test cases run; test fails."); + if (seenMethods != expectedMethodCount) { + messager.printMessage(ERROR, "Wrong number of seen methods: " + seenMethods); + } } } return true; } @IsDefault(false) - int checkIsDefault(ExecutableElement method) { + void checkIsDefault(ExecutableElement method) { System.out.println("Testing " + method); IsDefault expectedIsDefault = method.getAnnotation(IsDefault.class); @@ -116,9 +119,7 @@ expectedDefault, methodIsDefault).toString(), method); - return 1; } - return 0; } } @@ -142,4 +143,6 @@ @IsDefault(value=true, expectedTextRegex="\\s*@IsDefault\\(.*\\)\\s*default strictfp void quux\\(\\);\\s*$") default strictfp void quux() {}; + @IsDefault(false) + static void statik() {} }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/processing/model/element/TestTypeElement.java Fri Oct 11 19:05:18 2013 +0100 @@ -0,0 +1,63 @@ +/* + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 8025118 + * @summary Verify that TypeElement for interfaces does not have + * Modifier.DEFAULT in getModifiers() + * @library /tools/javac/lib + * @build JavacTestingAbstractProcessor TestTypeElement + * @compile -processor TestTypeElement -proc:only TestTypeElement.java + */ + +import java.util.Set; +import javax.annotation.processing.*; +import javax.lang.model.element.*; +import static javax.tools.Diagnostic.Kind.*; + +/** + * Verify that TypeElement for interfaces does not have Modifier.DEFAULT in getModifiers(). + */ +public class TestTypeElement extends JavacTestingAbstractProcessor { + public boolean process(Set<? extends TypeElement> annotations, + RoundEnvironment roundEnv) { + if (!roundEnv.processingOver()) { + for (Element element : roundEnv.getRootElements()) { + if (element.getKind().isClass() || element.getKind().isInterface()) { + if (element.getModifiers().contains(Modifier.DEFAULT)) + messager.printMessage(ERROR, "Modifier.DEFAULT not expected on classes/interfaces"); + } + } + } + return true; + } + +} + +/** + * Test interface to provide a default method. + */ +interface InterfaceWithDefaultMethod { + default void quux() {} +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/processing/model/type/InheritedAP.java Fri Oct 11 19:05:18 2013 +0100 @@ -0,0 +1,96 @@ +/* + * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 8024513 + * @library /tools/javac/lib + * @build InheritedAP + * @compile -cp . -processor InheritedAP -proc:only InheritedAP.java + * @summary NPE in annotation processing + */ +import java.util.*; +import javax.annotation.processing.*; +import javax.lang.model.element.*; +import javax.lang.model.type.*; +import javax.lang.model.util.*; +import java.lang.annotation.*; +import static javax.lang.model.type.TypeKind.*; +import static javax.lang.model.SourceVersion.*; +import static javax.lang.model.util.ElementFilter.*; + +@SupportedAnnotationTypes("testclass") +@SupportedSourceVersion(RELEASE_8) +public class InheritedAP extends AbstractProcessor { + static Types types; + public void init(ProcessingEnvironment penv) {super.init(penv);} + public static Types getTypes() { return types; } + + public boolean process(Set<? extends TypeElement> typeElementSet,RoundEnvironment renv) { + if ( renv.errorRaised()) { System.out.println("Error!"); return false; } + if ( typeElementSet.size() <=0 && typesIn(renv.getRootElements()).size() <= 0 ) { + return true; + } + types=processingEnv.getTypeUtils(); + for (TypeElement typeElem: typesIn(renv.getRootElements())) { + if (typeElem.getAnnotation(testclass.class) != null) { + new ElementScanner( new SimpleTypeMirrorVisitor()).scan(typeElem, null); + } + } + return true ; + } +} + +class SimpleTypeMirrorVisitor extends SimpleTypeVisitor6 <Void, Void> { + protected Void defaultAction(TypeMirror mirror, Void p ) { + try { + System.out.println( "InheritedAP.getTypes().directSupertypes( "+mirror.toString()+" );" ); + InheritedAP.getTypes().directSupertypes(mirror); + System.out.println("PASS"); + }catch(java.lang.IllegalArgumentException iae) {/*stuff*/ } + return p; + } +} + +class ElementScanner <T extends SimpleTypeVisitor6<Void, Void> > + extends ElementScanner6<Void, Void> { + SimpleTypeVisitor6<Void, Void> typeVisitor; + + public ElementScanner(T typeVisitor) { this.typeVisitor=typeVisitor;} + + @Override + public Void scan(Element e, Void p) { + if (e instanceof TypeElement ) { + TypeElement te = (TypeElement) e; + te.getSuperclass().accept(typeVisitor,p); + } + return p; + } + +} + + +@interface testclass { } + +@testclass +@interface iface { }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/tree/T8024415.java Fri Oct 11 19:05:18 2013 +0100 @@ -0,0 +1,113 @@ +/* + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 8024415 + * @summary Pretty printing of JCConditional does not follow the precedence and + * associativity rules of JCConditional + * @run testng T8024415 + */ + + +import static org.testng.Assert.assertEquals; + +import java.io.IOException; +import java.io.StringWriter; + +import org.testng.annotations.Test; + +import com.sun.tools.javac.file.JavacFileManager; +import com.sun.tools.javac.tree.JCTree; +import com.sun.tools.javac.tree.JCTree.JCExpression; +import com.sun.tools.javac.tree.Pretty; +import com.sun.tools.javac.tree.TreeMaker; +import com.sun.tools.javac.util.Context; +import com.sun.tools.javac.util.Names; + + +/* + * Test verifies that the precedence rules of conditional expressions + * (JCConditional) are correct. + */ +@Test +public class T8024415 { + + TreeMaker maker; + JCExpression x; + + + public T8024415() { + Context ctx = new Context(); + JavacFileManager.preRegister(ctx); + maker = TreeMaker.instance(ctx); + Names names = Names.instance(ctx); + x = maker.Ident(names.fromString("x")); + } + + + // JLS 15.25: The conditional operator is syntactically right-associative + // (it groups right-to-left). Thus, a?b:c?d:e?f:g means the same as + // a?b:(c?d:(e?f:g)). + public void testAssociativity() throws IOException { + + JCTree left = maker.Conditional(maker.Conditional(x, x, x), x, x); + JCTree right = maker.Conditional(x, x, maker.Conditional(x, x, x)); + + String prettyLeft = prettyPrint(left); + String prettyRight = prettyPrint(right); + + assertEquals(prettyLeft.replaceAll("\\s", ""), "(x?x:x)?x:x"); + assertEquals(prettyRight.replaceAll("\\s", ""), "x?x:x?x:x"); + + } + + + // The true-part of of a conditional expression is surrounded by ? and : + // and can thus always be parsed unambiguously without surrounding + // parentheses. + public void testPrecedence() throws IOException { + + JCTree left = maker.Conditional(maker.Assign(x, x), x, x); + JCTree middle = maker.Conditional(x, maker.Assign(x, x), x); + JCTree right = maker.Conditional(x, x, maker.Assign(x, x)); + + String prettyLeft = prettyPrint(left); + String prettyMiddle = prettyPrint(middle); + String prettyRight = prettyPrint(right); + + assertEquals(prettyLeft.replaceAll("\\s", ""), "(x=x)?x:x"); + assertEquals(prettyMiddle.replaceAll("\\s", ""), "x?x=x:x"); + assertEquals(prettyRight.replaceAll("\\s", ""), "x?x:(x=x)"); + + } + + + // Helper method + private static String prettyPrint(JCTree tree) throws IOException { + StringWriter sw = new StringWriter(); + new Pretty(sw, true).printExpr(tree); + return sw.toString(); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javap/BoundsTypeVariableTest.java Fri Oct 11 19:05:18 2013 +0100 @@ -0,0 +1,95 @@ +/* + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/** + * @test + * @bug 8003537 + * @summary javap should not use / in Bounds Type Variables + */ + +import java.io.File; +import java.io.IOException; +import java.io.PrintWriter; +import java.io.StringWriter; +import java.nio.charset.Charset; +import java.nio.file.Files; +import java.util.ArrayList; +import java.util.List; +import java.util.regex.Pattern; +import static java.nio.file.StandardOpenOption.*; + +public class BoundsTypeVariableTest { + public static void main(String... args) throws Exception { + new BoundsTypeVariableTest().run(); + } + + void run() throws Exception { + File srcDir = new File("src"); + srcDir.mkdirs(); + File classesDir = new File("classes"); + classesDir.mkdirs(); + final String expect = "public abstract <U extends java.lang.Object> U doit();"; + List<String> contents = new ArrayList<>(); + contents.add("abstract class X {"); + contents.add(expect); + contents.add("}"); + + File f = writeFile(new File(srcDir, "X.java"), contents); + javac("-d", classesDir.getPath(), f.getPath()); + String out = javap("-p", "-v", new File(classesDir, "X.class").getPath()); + if (!out.contains(expect)) { + throw new Exception("expected pattern not found: " + expect); + } + } + + File writeFile(File f, List<String> body) throws IOException { + Files.write(f.toPath(), body, Charset.defaultCharset(), + CREATE, TRUNCATE_EXISTING); + return f; + } + + void javac(String... args) throws Exception { + StringWriter sw = new StringWriter(); + PrintWriter pw = new PrintWriter(sw); + int rc = com.sun.tools.javac.Main.compile(args, pw); + pw.flush(); + String out = sw.toString(); + if (!out.isEmpty()) + System.err.println(out); + if (rc != 0) + throw new Exception("compilation failed"); + } + + String javap(String... args) throws Exception { + StringWriter sw = new StringWriter(); + PrintWriter pw = new PrintWriter(sw); + int rc = com.sun.tools.javap.Main.run(args, pw); + pw.flush(); + String out = sw.toString(); + if (!out.isEmpty()) + System.err.println(out); + if (rc != 0) + throw new Exception("javap failed"); + return out; + } +}