# HG changeset patch # User lana # Date 1383263203 25200 # Node ID 6b4d6205366c1170ebefea95b1b9ae1d69add036 # Parent fea486d30d41034c7e998cb0170141170487503b# Parent 62a67e0875fffafd09b8d9e24c6c421391ef14cd Merge diff -r fea486d30d41 -r 6b4d6205366c src/share/classes/com/sun/javadoc/Tag.java --- a/src/share/classes/com/sun/javadoc/Tag.java Thu Oct 31 12:36:36 2013 -0700 +++ b/src/share/classes/com/sun/javadoc/Tag.java Thu Oct 31 16:46:43 2013 -0700 @@ -72,7 +72,7 @@ * kind() == name(); * the following table lists those cases where there is more * than one tag of a given kind: - *

+ * * * * diff -r fea486d30d41 -r 6b4d6205366c src/share/classes/com/sun/tools/doclets/formats/html/AbstractExecutableMemberWriter.java --- a/src/share/classes/com/sun/tools/doclets/formats/html/AbstractExecutableMemberWriter.java Thu Oct 31 12:36:36 2013 -0700 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/AbstractExecutableMemberWriter.java Thu Oct 31 16:46:43 2013 -0700 @@ -101,10 +101,10 @@ Content tdSummary) { ExecutableMemberDoc emd = (ExecutableMemberDoc)member; String name = emd.name(); - Content strong = HtmlTree.SPAN(HtmlStyle.strong, + Content memberLink = HtmlTree.SPAN(HtmlStyle.memberNameLink, writer.getDocLink(context, cd, (MemberDoc) emd, name, false)); - Content code = HtmlTree.CODE(strong); + Content code = HtmlTree.CODE(memberLink); addParameters(emd, false, code, name.length() - 1); tdSummary.addContent(code); } diff -r fea486d30d41 -r 6b4d6205366c src/share/classes/com/sun/tools/doclets/formats/html/AbstractIndexWriter.java --- a/src/share/classes/com/sun/tools/doclets/formats/html/AbstractIndexWriter.java Thu Oct 31 12:36:36 2013 -0700 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/AbstractIndexWriter.java Thu Oct 31 16:46:43 2013 -0700 @@ -176,7 +176,7 @@ String name = (member instanceof ExecutableMemberDoc)? member.name() + ((ExecutableMemberDoc)member).flatSignature() : member.name(); - Content span = HtmlTree.SPAN(HtmlStyle.strong, + Content span = HtmlTree.SPAN(HtmlStyle.memberNameLink, getDocLink(LinkInfoImpl.Kind.INDEX, member, name)); Content dt = HtmlTree.DT(span); dt.addContent(" - "); @@ -198,7 +198,7 @@ */ protected void addComment(ProgramElementDoc element, Content contentTree) { Tag[] tags; - Content span = HtmlTree.SPAN(HtmlStyle.strong, deprecatedPhrase); + Content span = HtmlTree.SPAN(HtmlStyle.deprecatedLabel, deprecatedPhrase); HtmlTree div = new HtmlTree(HtmlTag.DIV); div.addStyle(HtmlStyle.block); if (Util.isDeprecated(element)) { diff -r fea486d30d41 -r 6b4d6205366c src/share/classes/com/sun/tools/doclets/formats/html/AbstractMemberWriter.java --- a/src/share/classes/com/sun/tools/doclets/formats/html/AbstractMemberWriter.java Thu Oct 31 12:36:36 2013 -0700 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/AbstractMemberWriter.java Thu Oct 31 16:46:43 2013 -0700 @@ -480,7 +480,7 @@ if (cd != null && !(pgmdoc instanceof ConstructorDoc) && !(pgmdoc instanceof ClassDoc)) { HtmlTree name = new HtmlTree(HtmlTag.SPAN); - name.addStyle(HtmlStyle.strong); + name.addStyle(HtmlStyle.typeNameLabel); name.addContent(cd.name() + "."); tdLast.addContent(name); } diff -r fea486d30d41 -r 6b4d6205366c src/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeFieldWriterImpl.java --- a/src/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeFieldWriterImpl.java Thu Oct 31 12:36:36 2013 -0700 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeFieldWriterImpl.java Thu Oct 31 16:46:43 2013 -0700 @@ -237,9 +237,9 @@ */ protected void addSummaryLink(LinkInfoImpl.Kind context, ClassDoc cd, ProgramElementDoc member, Content tdSummary) { - Content strong = HtmlTree.SPAN(HtmlStyle.strong, + Content memberLink = HtmlTree.SPAN(HtmlStyle.memberNameLink, writer.getDocLink(context, (MemberDoc) member, member.name(), false)); - Content code = HtmlTree.CODE(strong); + Content code = HtmlTree.CODE(memberLink); tdSummary.addContent(code); } diff -r fea486d30d41 -r 6b4d6205366c src/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeRequiredMemberWriterImpl.java --- a/src/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeRequiredMemberWriterImpl.java Thu Oct 31 12:36:36 2013 -0700 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeRequiredMemberWriterImpl.java Thu Oct 31 16:46:43 2013 -0700 @@ -239,9 +239,9 @@ */ protected void addSummaryLink(LinkInfoImpl.Kind context, ClassDoc cd, ProgramElementDoc member, Content tdSummary) { - Content strong = HtmlTree.SPAN(HtmlStyle.strong, + Content memberLink = HtmlTree.SPAN(HtmlStyle.memberNameLink, writer.getDocLink(context, (MemberDoc) member, member.name(), false)); - Content code = HtmlTree.CODE(strong); + Content code = HtmlTree.CODE(memberLink); tdSummary.addContent(code); } diff -r fea486d30d41 -r 6b4d6205366c src/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeWriterImpl.java --- a/src/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeWriterImpl.java Thu Oct 31 12:36:36 2013 -0700 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeWriterImpl.java Thu Oct 31 16:46:43 2013 -0700 @@ -227,7 +227,7 @@ addSrcLink(annotationType, annotationName, pre); pre.addContent(parameterLinks); } else { - Content span = HtmlTree.SPAN(HtmlStyle.strong, annotationName); + Content span = HtmlTree.SPAN(HtmlStyle.memberNameLabel, annotationName); span.addContent(parameterLinks); pre.addContent(span); } @@ -262,8 +262,8 @@ annotationInfoTree.addContent(hr); Tag[] deprs = annotationType.tags("deprecated"); if (Util.isDeprecated(annotationType)) { - Content strong = HtmlTree.SPAN(HtmlStyle.strong, deprecatedPhrase); - Content div = HtmlTree.DIV(HtmlStyle.block, strong); + Content deprLabel = HtmlTree.SPAN(HtmlStyle.deprecatedLabel, deprecatedPhrase); + Content div = HtmlTree.DIV(HtmlStyle.block, deprLabel); if (deprs.length > 0) { Tag[] commentTags = deprs[0].inlineTags(); if (commentTags.length > 0) { diff -r fea486d30d41 -r 6b4d6205366c src/share/classes/com/sun/tools/doclets/formats/html/ClassWriterImpl.java --- a/src/share/classes/com/sun/tools/doclets/formats/html/ClassWriterImpl.java Thu Oct 31 12:36:36 2013 -0700 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/ClassWriterImpl.java Thu Oct 31 16:46:43 2013 -0700 @@ -254,7 +254,7 @@ addSrcLink(classDoc, className, pre); pre.addContent(parameterLinks); } else { - Content span = HtmlTree.SPAN(HtmlStyle.strong, className); + Content span = HtmlTree.SPAN(HtmlStyle.typeNameLabel, className); span.addContent(parameterLinks); pre.addContent(span); } @@ -547,8 +547,8 @@ classInfoTree.addContent(hr); Tag[] deprs = classDoc.tags("deprecated"); if (Util.isDeprecated(classDoc)) { - Content strong = HtmlTree.SPAN(HtmlStyle.strong, deprecatedPhrase); - Content div = HtmlTree.DIV(HtmlStyle.block, strong); + Content deprLabel = HtmlTree.SPAN(HtmlStyle.deprecatedLabel, deprecatedPhrase); + Content div = HtmlTree.DIV(HtmlStyle.block, deprLabel); if (deprs.length > 0) { Tag[] commentTags = deprs[0].inlineTags(); if (commentTags.length > 0) { diff -r fea486d30d41 -r 6b4d6205366c src/share/classes/com/sun/tools/doclets/formats/html/ConfigurationImpl.java --- a/src/share/classes/com/sun/tools/doclets/formats/html/ConfigurationImpl.java Thu Oct 31 12:36:36 2013 -0700 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/ConfigurationImpl.java Thu Oct 31 16:46:43 2013 -0700 @@ -284,7 +284,7 @@ setTopFile(root); if (root instanceof RootDocImpl) { - ((RootDocImpl) root).initDocLint(doclintOpts); + ((RootDocImpl) root).initDocLint(doclintOpts, tagletManager.getCustomTagNames()); } } diff -r fea486d30d41 -r 6b4d6205366c src/share/classes/com/sun/tools/doclets/formats/html/EnumConstantWriterImpl.java --- a/src/share/classes/com/sun/tools/doclets/formats/html/EnumConstantWriterImpl.java Thu Oct 31 12:36:36 2013 -0700 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/EnumConstantWriterImpl.java Thu Oct 31 16:46:43 2013 -0700 @@ -224,9 +224,9 @@ */ protected void addSummaryLink(LinkInfoImpl.Kind context, ClassDoc cd, ProgramElementDoc member, Content tdSummary) { - Content strong = HtmlTree.SPAN(HtmlStyle.strong, + Content memberLink = HtmlTree.SPAN(HtmlStyle.memberNameLink, writer.getDocLink(context, (MemberDoc) member, member.name(), false)); - Content code = HtmlTree.CODE(strong); + Content code = HtmlTree.CODE(memberLink); tdSummary.addContent(code); } diff -r fea486d30d41 -r 6b4d6205366c src/share/classes/com/sun/tools/doclets/formats/html/FieldWriterImpl.java --- a/src/share/classes/com/sun/tools/doclets/formats/html/FieldWriterImpl.java Thu Oct 31 12:36:36 2013 -0700 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/FieldWriterImpl.java Thu Oct 31 16:46:43 2013 -0700 @@ -140,11 +140,11 @@ holder.typeName() : holder.qualifiedTypeName(), false); Content codeLink = HtmlTree.CODE(link); - Content strong = HtmlTree.SPAN(HtmlStyle.strong, holder.isClass()? + Content descfrmLabel = HtmlTree.SPAN(HtmlStyle.descfrmTypeLabel, holder.isClass()? writer.descfrmClassLabel : writer.descfrmInterfaceLabel); - strong.addContent(writer.getSpace()); - strong.addContent(codeLink); - fieldDocTree.addContent(HtmlTree.DIV(HtmlStyle.block, strong)); + descfrmLabel.addContent(writer.getSpace()); + descfrmLabel.addContent(codeLink); + fieldDocTree.addContent(HtmlTree.DIV(HtmlStyle.block, descfrmLabel)); writer.addInlineComment(field, fieldDocTree); } } @@ -258,9 +258,9 @@ */ protected void addSummaryLink(LinkInfoImpl.Kind context, ClassDoc cd, ProgramElementDoc member, Content tdSummary) { - Content strong = HtmlTree.SPAN(HtmlStyle.strong, + Content memberLink = HtmlTree.SPAN(HtmlStyle.memberNameLink, writer.getDocLink(context, cd , (MemberDoc) member, member.name(), false)); - Content code = HtmlTree.CODE(strong); + Content code = HtmlTree.CODE(memberLink); tdSummary.addContent(code); } diff -r fea486d30d41 -r 6b4d6205366c src/share/classes/com/sun/tools/doclets/formats/html/HelpWriter.java --- a/src/share/classes/com/sun/tools/doclets/formats/html/HelpWriter.java Thu Oct 31 12:36:36 2013 -0700 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/HelpWriter.java Thu Oct 31 16:46:43 2013 -0700 @@ -316,7 +316,7 @@ liConst.addContent(constPara); ul.addContent(liConst); Content divContent = HtmlTree.DIV(HtmlStyle.contentContainer, ul); - Content line30 = HtmlTree.SPAN(HtmlStyle.italic, getResource("doclet.Help_line_30")); + Content line30 = HtmlTree.SPAN(HtmlStyle.emphasizedPhrase, getResource("doclet.Help_line_30")); divContent.addContent(line30); contentTree.addContent(divContent); } diff -r fea486d30d41 -r 6b4d6205366c src/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java --- a/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java Thu Oct 31 12:36:36 2013 -0700 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java Thu Oct 31 16:46:43 2013 -0700 @@ -391,8 +391,7 @@ tbody.addContent(tr); } table.addContent(tbody); - Content li = HtmlTree.LI(HtmlStyle.blockList, table); - summaryContentTree.addContent(li); + summaryContentTree.addContent(table); } } @@ -1051,7 +1050,7 @@ public Content italicsClassName(ClassDoc cd, boolean qual) { Content name = new StringContent((qual)? cd.qualifiedName(): cd.name()); - return (cd.isInterface())? HtmlTree.SPAN(HtmlStyle.italic, name): name; + return (cd.isInterface())? HtmlTree.SPAN(HtmlStyle.interfaceName, name): name; } /** @@ -1567,7 +1566,7 @@ Content div; Content result = commentTagsToContent(null, doc, tags, first); if (depr) { - Content italic = HtmlTree.SPAN(HtmlStyle.italic, result); + Content italic = HtmlTree.SPAN(HtmlStyle.deprecationComment, result); div = HtmlTree.DIV(HtmlStyle.block, italic); htmltree.addContent(div); } diff -r fea486d30d41 -r 6b4d6205366c src/share/classes/com/sun/tools/doclets/formats/html/MethodWriterImpl.java --- a/src/share/classes/com/sun/tools/doclets/formats/html/MethodWriterImpl.java Thu Oct 31 12:36:36 2013 -0700 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/MethodWriterImpl.java Thu Oct 31 16:46:43 2013 -0700 @@ -160,11 +160,11 @@ holder.typeName() : holder.qualifiedTypeName(), false); Content codelLink = HtmlTree.CODE(link); - Content strong = HtmlTree.SPAN(HtmlStyle.strong, holder.asClassDoc().isClass()? + Content descfrmLabel = HtmlTree.SPAN(HtmlStyle.descfrmTypeLabel, holder.asClassDoc().isClass()? writer.descfrmClassLabel : writer.descfrmInterfaceLabel); - strong.addContent(writer.getSpace()); - strong.addContent(codelLink); - methodDocTree.addContent(HtmlTree.DIV(HtmlStyle.block, strong)); + descfrmLabel.addContent(writer.getSpace()); + descfrmLabel.addContent(codelLink); + methodDocTree.addContent(HtmlTree.DIV(HtmlStyle.block, descfrmLabel)); writer.addInlineComment(method, methodDocTree); } } @@ -310,7 +310,7 @@ label = writer.specifiedByLabel; context = LinkInfoImpl.Kind.METHOD_SPECIFIED_BY; } - Content dt = HtmlTree.DT(HtmlTree.SPAN(HtmlStyle.strong, label)); + Content dt = HtmlTree.DT(HtmlTree.SPAN(HtmlStyle.overrideSpecifyLabel, label)); dl.addContent(dt); Content overriddenTypeLink = writer.getLink(new LinkInfoImpl(writer.configuration, context, overriddenType)); @@ -365,7 +365,7 @@ Content intfaclink = writer.getLink(new LinkInfoImpl( writer.configuration, LinkInfoImpl.Kind.METHOD_SPECIFIED_BY, intfac)); Content codeIntfacLink = HtmlTree.CODE(intfaclink); - Content dt = HtmlTree.DT(HtmlTree.SPAN(HtmlStyle.strong, writer.specifiedByLabel)); + Content dt = HtmlTree.DT(HtmlTree.SPAN(HtmlStyle.overrideSpecifyLabel, writer.specifiedByLabel)); dl.addContent(dt); Content methlink = writer.getDocLink( LinkInfoImpl.Kind.MEMBER, implementedMeth, diff -r fea486d30d41 -r 6b4d6205366c src/share/classes/com/sun/tools/doclets/formats/html/NestedClassWriterImpl.java --- a/src/share/classes/com/sun/tools/doclets/formats/html/NestedClassWriterImpl.java Thu Oct 31 12:36:36 2013 -0700 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/NestedClassWriterImpl.java Thu Oct 31 16:46:43 2013 -0700 @@ -166,9 +166,9 @@ */ protected void addSummaryLink(LinkInfoImpl.Kind context, ClassDoc cd, ProgramElementDoc member, Content tdSummary) { - Content strong = HtmlTree.SPAN(HtmlStyle.strong, + Content memberLink = HtmlTree.SPAN(HtmlStyle.memberNameLink, writer.getLink(new LinkInfoImpl(configuration, context, (ClassDoc)member))); - Content code = HtmlTree.CODE(strong); + Content code = HtmlTree.CODE(memberLink); tdSummary.addContent(code); } diff -r fea486d30d41 -r 6b4d6205366c src/share/classes/com/sun/tools/doclets/formats/html/PackageFrameWriter.java --- a/src/share/classes/com/sun/tools/doclets/formats/html/PackageFrameWriter.java Thu Oct 31 12:36:36 2013 -0700 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/PackageFrameWriter.java Thu Oct 31 16:46:43 2013 -0700 @@ -183,7 +183,7 @@ printedHeader = true; } Content arr_i_name = new StringContent(arr[i].name()); - if (arr[i].isInterface()) arr_i_name = HtmlTree.SPAN(HtmlStyle.italic, arr_i_name); + if (arr[i].isInterface()) arr_i_name = HtmlTree.SPAN(HtmlStyle.interfaceName, arr_i_name); Content link = getLink(new LinkInfoImpl(configuration, LinkInfoImpl.Kind.PACKAGE_FRAME, arr[i]).label(arr_i_name).target("classFrame")); Content li = HtmlTree.LI(link); diff -r fea486d30d41 -r 6b4d6205366c src/share/classes/com/sun/tools/doclets/formats/html/PackageTreeWriter.java --- a/src/share/classes/com/sun/tools/doclets/formats/html/PackageTreeWriter.java Thu Oct 31 12:36:36 2013 -0700 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/PackageTreeWriter.java Thu Oct 31 16:46:43 2013 -0700 @@ -155,7 +155,7 @@ * @param div the content tree to which the link will be added */ protected void addLinkToMainTree(Content div) { - Content span = HtmlTree.SPAN(HtmlStyle.strong, + Content span = HtmlTree.SPAN(HtmlStyle.packageHierarchyLabel, getResource("doclet.Package_Hierarchies")); div.addContent(span); HtmlTree ul = new HtmlTree (HtmlTag.UL); diff -r fea486d30d41 -r 6b4d6205366c src/share/classes/com/sun/tools/doclets/formats/html/PackageWriterImpl.java --- a/src/share/classes/com/sun/tools/doclets/formats/html/PackageWriterImpl.java Thu Oct 31 12:36:36 2013 -0700 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/PackageWriterImpl.java Thu Oct 31 16:46:43 2013 -0700 @@ -141,7 +141,7 @@ if (Util.isDeprecated(packageDoc)) { HtmlTree deprDiv = new HtmlTree(HtmlTag.DIV); deprDiv.addStyle(HtmlStyle.deprecatedContent); - Content deprPhrase = HtmlTree.SPAN(HtmlStyle.strong, deprecatedPhrase); + Content deprPhrase = HtmlTree.SPAN(HtmlStyle.deprecatedLabel, deprecatedPhrase); deprDiv.addContent(deprPhrase); if (deprs.length > 0) { Tag[] commentTags = deprs[0].inlineTags(); diff -r fea486d30d41 -r 6b4d6205366c src/share/classes/com/sun/tools/doclets/formats/html/ProfilePackageFrameWriter.java --- a/src/share/classes/com/sun/tools/doclets/formats/html/ProfilePackageFrameWriter.java Thu Oct 31 12:36:36 2013 -0700 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/ProfilePackageFrameWriter.java Thu Oct 31 16:46:43 2013 -0700 @@ -174,7 +174,7 @@ printedHeader = true; } Content arr_i_name = new StringContent(arr[i].name()); - if (arr[i].isInterface()) arr_i_name = HtmlTree.SPAN(HtmlStyle.italic, arr_i_name); + if (arr[i].isInterface()) arr_i_name = HtmlTree.SPAN(HtmlStyle.interfaceName, arr_i_name); Content link = getLink(new LinkInfoImpl(configuration, LinkInfoImpl.Kind.PACKAGE_FRAME, arr[i]).label(arr_i_name).target("classFrame")); Content li = HtmlTree.LI(link); diff -r fea486d30d41 -r 6b4d6205366c src/share/classes/com/sun/tools/doclets/formats/html/ProfilePackageWriterImpl.java --- a/src/share/classes/com/sun/tools/doclets/formats/html/ProfilePackageWriterImpl.java Thu Oct 31 12:36:36 2013 -0700 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/ProfilePackageWriterImpl.java Thu Oct 31 16:46:43 2013 -0700 @@ -158,7 +158,7 @@ if (Util.isDeprecated(packageDoc)) { HtmlTree deprDiv = new HtmlTree(HtmlTag.DIV); deprDiv.addStyle(HtmlStyle.deprecatedContent); - Content deprPhrase = HtmlTree.SPAN(HtmlStyle.strong, deprecatedPhrase); + Content deprPhrase = HtmlTree.SPAN(HtmlStyle.deprecatedLabel, deprecatedPhrase); deprDiv.addContent(deprPhrase); if (deprs.length > 0) { Tag[] commentTags = deprs[0].inlineTags(); @@ -175,8 +175,11 @@ */ public void addClassesSummary(ClassDoc[] classes, String label, String tableSummary, String[] tableHeader, Content packageSummaryContentTree) { + HtmlTree li = new HtmlTree(HtmlTag.LI); + li.addStyle(HtmlStyle.blockList); addClassesSummary(classes, label, tableSummary, tableHeader, - packageSummaryContentTree, profileValue); + li, profileValue); + packageSummaryContentTree.addContent(li); } /** diff -r fea486d30d41 -r 6b4d6205366c src/share/classes/com/sun/tools/doclets/formats/html/ProfileWriterImpl.java --- a/src/share/classes/com/sun/tools/doclets/formats/html/ProfileWriterImpl.java Thu Oct 31 12:36:36 2013 -0700 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/ProfileWriterImpl.java Thu Oct 31 16:46:43 2013 -0700 @@ -187,7 +187,7 @@ deprs = pkg.tags("deprecated"); HtmlTree deprDiv = new HtmlTree(HtmlTag.DIV); deprDiv.addStyle(HtmlStyle.deprecatedContent); - Content deprPhrase = HtmlTree.SPAN(HtmlStyle.strong, deprecatedPhrase); + Content deprPhrase = HtmlTree.SPAN(HtmlStyle.deprecatedLabel, deprecatedPhrase); deprDiv.addContent(deprPhrase); if (deprs.length > 0) { Tag[] commentTags = deprs[0].inlineTags(); diff -r fea486d30d41 -r 6b4d6205366c src/share/classes/com/sun/tools/doclets/formats/html/PropertyWriterImpl.java --- a/src/share/classes/com/sun/tools/doclets/formats/html/PropertyWriterImpl.java Thu Oct 31 12:36:36 2013 -0700 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/PropertyWriterImpl.java Thu Oct 31 16:46:43 2013 -0700 @@ -136,11 +136,11 @@ holder.typeName() : holder.qualifiedTypeName(), false); Content codeLink = HtmlTree.CODE(link); - Content strong = HtmlTree.SPAN(HtmlStyle.strong, holder.isClass()? + Content descfrmLabel = HtmlTree.SPAN(HtmlStyle.descfrmTypeLabel, holder.isClass()? writer.descfrmClassLabel : writer.descfrmInterfaceLabel); - strong.addContent(writer.getSpace()); - strong.addContent(codeLink); - propertyDocTree.addContent(HtmlTree.DIV(HtmlStyle.block, strong)); + descfrmLabel.addContent(writer.getSpace()); + descfrmLabel.addContent(codeLink); + propertyDocTree.addContent(HtmlTree.DIV(HtmlStyle.block, descfrmLabel)); writer.addInlineComment(property, propertyDocTree); } } @@ -255,14 +255,14 @@ */ protected void addSummaryLink(LinkInfoImpl.Kind context, ClassDoc cd, ProgramElementDoc member, Content tdSummary) { - Content strong = HtmlTree.SPAN(HtmlStyle.strong, + Content memberLink = HtmlTree.SPAN(HtmlStyle.memberNameLink, writer.getDocLink(context, cd, (MemberDoc) member, member.name().substring(0, member.name().lastIndexOf("Property")), false, true)); - Content code = HtmlTree.CODE(strong); + Content code = HtmlTree.CODE(memberLink); tdSummary.addContent(code); } diff -r fea486d30d41 -r 6b4d6205366c src/share/classes/com/sun/tools/doclets/formats/html/SubWriterHolderWriter.java --- a/src/share/classes/com/sun/tools/doclets/formats/html/SubWriterHolderWriter.java Thu Oct 31 12:36:36 2013 -0700 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/SubWriterHolderWriter.java Thu Oct 31 16:46:43 2013 -0700 @@ -175,8 +175,8 @@ Tag[] deprs = member.tags("deprecated"); Content div; if (Util.isDeprecated((ProgramElementDoc) member)) { - Content strong = HtmlTree.SPAN(HtmlStyle.strong, deprecatedPhrase); - div = HtmlTree.DIV(HtmlStyle.block, strong); + Content deprLabel = HtmlTree.SPAN(HtmlStyle.deprecatedLabel, deprecatedPhrase); + div = HtmlTree.DIV(HtmlStyle.block, deprLabel); div.addContent(getSpace()); if (deprs.length > 0) { addInlineDeprecatedComment(member, deprs[0], div); @@ -186,8 +186,8 @@ } else { ClassDoc cd = ((ProgramElementDoc)member).containingClass(); if (cd != null && Util.isDeprecated(cd)) { - Content strong = HtmlTree.SPAN(HtmlStyle.strong, deprecatedPhrase); - div = HtmlTree.DIV(HtmlStyle.block, strong); + Content deprLabel = HtmlTree.SPAN(HtmlStyle.deprecatedLabel, deprecatedPhrase); + div = HtmlTree.DIV(HtmlStyle.block, deprLabel); div.addContent(getSpace()); tdSummary.addContent(div); } diff -r fea486d30d41 -r 6b4d6205366c src/share/classes/com/sun/tools/doclets/formats/html/TagletWriterImpl.java --- a/src/share/classes/com/sun/tools/doclets/formats/html/TagletWriterImpl.java Thu Oct 31 12:36:36 2013 -0700 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/TagletWriterImpl.java Thu Oct 31 16:46:43 2013 -0700 @@ -97,7 +97,7 @@ Tag[] deprs = doc.tags("deprecated"); if (doc instanceof ClassDoc) { if (Util.isDeprecated((ProgramElementDoc) doc)) { - result.addContent(HtmlTree.SPAN(HtmlStyle.strong, + result.addContent(HtmlTree.SPAN(HtmlStyle.deprecatedLabel, new StringContent(configuration.getText("doclet.Deprecated")))); result.addContent(RawHtml.nbsp); if (deprs.length > 0) { @@ -112,18 +112,18 @@ } else { MemberDoc member = (MemberDoc) doc; if (Util.isDeprecated((ProgramElementDoc) doc)) { - result.addContent(HtmlTree.SPAN(HtmlStyle.strong, + result.addContent(HtmlTree.SPAN(HtmlStyle.deprecatedLabel, new StringContent(configuration.getText("doclet.Deprecated")))); result.addContent(RawHtml.nbsp); if (deprs.length > 0) { Content body = commentTagsToOutput(null, doc, deprs[0].inlineTags(), false); if (!body.isEmpty()) - result.addContent(HtmlTree.SPAN(HtmlStyle.italic, body)); + result.addContent(HtmlTree.SPAN(HtmlStyle.deprecationComment, body)); } } else { if (Util.isDeprecated(member.containingClass())) { - result.addContent(HtmlTree.SPAN(HtmlStyle.strong, + result.addContent(HtmlTree.SPAN(HtmlStyle.deprecatedLabel, new StringContent(configuration.getText("doclet.Deprecated")))); result.addContent(RawHtml.nbsp); } @@ -151,7 +151,7 @@ * {@inheritDoc} */ public Content getParamHeader(String header) { - HtmlTree result = HtmlTree.DT(HtmlTree.SPAN(HtmlStyle.strong, + HtmlTree result = HtmlTree.DT(HtmlTree.SPAN(HtmlStyle.paramLabel, new StringContent(header))); return result; } @@ -186,7 +186,7 @@ */ public Content returnTagOutput(Tag returnTag) { ContentBuilder result = new ContentBuilder(); - result.addContent(HtmlTree.DT(HtmlTree.SPAN(HtmlStyle.strong, + result.addContent(HtmlTree.DT(HtmlTree.SPAN(HtmlStyle.returnLabel, new StringContent(configuration.getText("doclet.Returns"))))); result.addContent(HtmlTree.DD(htmlWriter.commentTagsToContent( returnTag, null, returnTag.inlineTags(), false))); @@ -231,7 +231,7 @@ return body; ContentBuilder result = new ContentBuilder(); - result.addContent(HtmlTree.DT(HtmlTree.SPAN(HtmlStyle.strong, + result.addContent(HtmlTree.DT(HtmlTree.SPAN(HtmlStyle.seeLabel, new StringContent(configuration.getText("doclet.See_Also"))))); result.addContent(HtmlTree.DD(body)); return result; @@ -250,7 +250,7 @@ */ public Content simpleTagOutput(Tag[] simpleTags, String header) { ContentBuilder result = new ContentBuilder(); - result.addContent(HtmlTree.DT(HtmlTree.SPAN(HtmlStyle.strong, new RawHtml(header)))); + result.addContent(HtmlTree.DT(HtmlTree.SPAN(HtmlStyle.simpleTagLabel, new RawHtml(header)))); ContentBuilder body = new ContentBuilder(); for (int i = 0; i < simpleTags.length; i++) { if (i > 0) { @@ -268,7 +268,7 @@ */ public Content simpleTagOutput(Tag simpleTag, String header) { ContentBuilder result = new ContentBuilder(); - result.addContent(HtmlTree.DT(HtmlTree.SPAN(HtmlStyle.strong, new RawHtml(header)))); + result.addContent(HtmlTree.DT(HtmlTree.SPAN(HtmlStyle.simpleTagLabel, new RawHtml(header)))); Content body = htmlWriter.commentTagsToContent( simpleTag, null, simpleTag.inlineTags(), false); result.addContent(HtmlTree.DD(body)); @@ -279,7 +279,7 @@ * {@inheritDoc} */ public Content getThrowsHeader() { - HtmlTree result = HtmlTree.DT(HtmlTree.SPAN(HtmlStyle.strong, + HtmlTree result = HtmlTree.DT(HtmlTree.SPAN(HtmlStyle.throwsLabel, new StringContent(configuration.getText("doclet.Throws")))); return result; } diff -r fea486d30d41 -r 6b4d6205366c src/share/classes/com/sun/tools/doclets/formats/html/TreeWriter.java --- a/src/share/classes/com/sun/tools/doclets/formats/html/TreeWriter.java Thu Oct 31 12:36:36 2013 -0700 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/TreeWriter.java Thu Oct 31 16:46:43 2013 -0700 @@ -131,7 +131,7 @@ return; } if (!classesonly) { - Content span = HtmlTree.SPAN(HtmlStyle.strong, + Content span = HtmlTree.SPAN(HtmlStyle.packageHierarchyLabel, getResource("doclet.Package_Hierarchies")); contentTree.addContent(span); HtmlTree ul = new HtmlTree(HtmlTag.UL); diff -r fea486d30d41 -r 6b4d6205366c src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlDocWriter.java --- a/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlDocWriter.java Thu Oct 31 12:36:36 2013 -0700 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlDocWriter.java Thu Oct 31 16:46:43 2013 -0700 @@ -236,7 +236,7 @@ String stylename, String title, String target) { Content body = label; if (strong) { - body = HtmlTree.SPAN(HtmlStyle.strong, body); + body = HtmlTree.SPAN(HtmlStyle.typeNameLink, body); } if (stylename != null && stylename.length() != 0) { HtmlTree t = new HtmlTree(HtmlTag.FONT, body); diff -r fea486d30d41 -r 6b4d6205366c src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlStyle.java --- a/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlStyle.java Thu Oct 31 12:36:36 2013 -0700 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlStyle.java Thu Oct 31 16:46:43 2013 -0700 @@ -52,37 +52,51 @@ constantValuesContainer, contentContainer, deprecatedContent, + deprecatedLabel, deprecatedSummary, + deprecationComment, description, + descfrmTypeLabel, details, docSummary, + emphasizedPhrase, header, horizontal, footer, indexContainer, indexHeader, inheritance, - italic, + interfaceName, legalCopy, + memberNameLabel, + memberNameLink, memberSummary, nameValue, navBarCell1Rev, navList, + overrideSpecifyLabel, overviewSummary, + packageHierarchyLabel, + paramLabel, + returnLabel, rowColor, + seeLabel, serializedFormContainer, + simpleTagLabel, skipNav, sourceContainer, sourceLineNo, - strong, subNav, subNavList, subTitle, summary, tabEnd, tableTab, + throwsLabel, title, topNav, + typeNameLabel, + typeNameLink, typeSummary, useSummary; } diff -r fea486d30d41 -r 6b4d6205366c src/share/classes/com/sun/tools/doclets/internal/toolkit/resources/stylesheet.css --- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/resources/stylesheet.css Thu Oct 31 12:36:36 2013 -0700 +++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/resources/stylesheet.css Thu Oct 31 16:46:43 2013 -0700 @@ -514,9 +514,11 @@ display:block; margin:3px 0 0 0; } -.strong { +.deprecatedLabel, .descfrmTypeLabel, .memberNameLabel, .memberNameLink, +.overrideSpecifyLabel, .packageHierarchyLabel, .paramLabel, .returnLabel, +.seeLabel, .simpleTagLabel, .throwsLabel, .typeNameLabel, .typeNameLink { font-weight:bold; } -.italic { +.deprecationComment, .emphasizedPhrase, .interfaceName { font-style:italic; } diff -r fea486d30d41 -r 6b4d6205366c src/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/TagletManager.java --- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/TagletManager.java Thu Oct 31 12:36:36 2013 -0700 +++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/TagletManager.java Thu Oct 31 16:46:43 2013 -0700 @@ -205,6 +205,10 @@ } } + public Set getCustomTagNames() { + return customTags.keySet(); + } + /** * Add a new Taglet. Print a message to indicate whether or not * the Taglet was registered properly. diff -r fea486d30d41 -r 6b4d6205366c src/share/classes/com/sun/tools/doclint/Checker.java --- a/src/share/classes/com/sun/tools/doclint/Checker.java Thu Oct 31 12:36:36 2013 -0700 +++ b/src/share/classes/com/sun/tools/doclint/Checker.java Thu Oct 31 16:46:43 2013 -0700 @@ -71,6 +71,8 @@ import com.sun.source.doctree.StartElementTree; import com.sun.source.doctree.TextTree; import com.sun.source.doctree.ThrowsTree; +import com.sun.source.doctree.UnknownBlockTagTree; +import com.sun.source.doctree.UnknownInlineTagTree; import com.sun.source.doctree.ValueTree; import com.sun.source.doctree.VersionTree; import com.sun.source.util.DocTreePath; @@ -842,6 +844,23 @@ } @Override + public Void visitUnknownBlockTag(UnknownBlockTagTree tree, Void ignore) { + checkUnknownTag(tree, tree.getTagName()); + return super.visitUnknownBlockTag(tree, ignore); + } + + @Override + public Void visitUnknownInlineTag(UnknownInlineTagTree tree, Void ignore) { + checkUnknownTag(tree, tree.getTagName()); + return super.visitUnknownInlineTag(tree, ignore); + } + + private void checkUnknownTag(DocTree tree, String tagName) { + if (env.customTags != null && !env.customTags.contains(tagName)) + env.messages.error(SYNTAX, tree, "dc.tag.unknown", tagName); + } + + @Override public Void visitValue(ValueTree tree, Void ignore) { ReferenceTree ref = tree.getReference(); if (ref == null || ref.getSignature().isEmpty()) { diff -r fea486d30d41 -r 6b4d6205366c src/share/classes/com/sun/tools/doclint/DocLint.java --- a/src/share/classes/com/sun/tools/doclint/DocLint.java Thu Oct 31 12:36:36 2013 -0700 +++ b/src/share/classes/com/sun/tools/doclint/DocLint.java Thu Oct 31 16:46:43 2013 -0700 @@ -78,6 +78,8 @@ public static final String XMSGS_CUSTOM_PREFIX = "-Xmsgs:"; private static final String STATS = "-stats"; public static final String XIMPLICIT_HEADERS = "-XimplicitHeaders:"; + public static final String XCUSTOM_TAGS_PREFIX = "-XcustomTags:"; + public static final String TAGS_SEPARATOR = ","; // public static void main(String... args) { @@ -199,6 +201,8 @@ env.messages.setOptions(null); } else if (arg.startsWith(XMSGS_CUSTOM_PREFIX)) { env.messages.setOptions(arg.substring(arg.indexOf(":") + 1)); + } else if (arg.startsWith(XCUSTOM_TAGS_PREFIX)) { + env.setCustomTags(arg.substring(arg.indexOf(":") + 1)); } else if (arg.equals("-h") || arg.equals("-help") || arg.equals("--help") || arg.equals("-?") || arg.equals("-usage")) { needHelp = true; @@ -262,6 +266,8 @@ } else if (arg.matches(XIMPLICIT_HEADERS + "[1-6]")) { char ch = arg.charAt(arg.length() - 1); env.setImplicitHeaders(Character.digit(ch, 10)); + } else if (arg.startsWith(XCUSTOM_TAGS_PREFIX)) { + env.setCustomTags(arg.substring(arg.indexOf(":") + 1)); } else throw new IllegalArgumentException(arg); } diff -r fea486d30d41 -r 6b4d6205366c src/share/classes/com/sun/tools/doclint/Env.java --- a/src/share/classes/com/sun/tools/doclint/Env.java Thu Oct 31 12:36:36 2013 -0700 +++ b/src/share/classes/com/sun/tools/doclint/Env.java Thu Oct 31 16:46:43 2013 -0700 @@ -27,6 +27,7 @@ import java.util.Set; +import java.util.LinkedHashSet; import javax.lang.model.element.Element; import javax.lang.model.element.ElementKind; @@ -86,6 +87,8 @@ int implicitHeaderLevel = 0; + Set customTags; + // Utility classes DocTrees trees; Elements elements; @@ -135,6 +138,14 @@ implicitHeaderLevel = n; } + void setCustomTags(String cTags) { + customTags = new LinkedHashSet(); + for (String s : cTags.split(DocLint.TAGS_SEPARATOR)) { + if (!s.isEmpty()) + customTags.add(s); + } + } + /** Set the current declaration and its doc comment. */ void setCurrent(TreePath path, DocCommentTree comment) { currPath = path; diff -r fea486d30d41 -r 6b4d6205366c src/share/classes/com/sun/tools/javac/code/AnnoConstruct.java --- a/src/share/classes/com/sun/tools/javac/code/AnnoConstruct.java Thu Oct 31 12:36:36 2013 -0700 +++ b/src/share/classes/com/sun/tools/javac/code/AnnoConstruct.java Thu Oct 31 16:46:43 2013 -0700 @@ -25,6 +25,7 @@ package com.sun.tools.javac.code; import java.lang.annotation.Annotation; +import java.lang.annotation.Inherited; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; @@ -112,20 +113,17 @@ } // Deal with inherited annotations - if (direct == null && container == null) + if (direct == null && container == null && + annoType.isAnnotationPresent(Inherited.class)) return getInheritedAnnotations(annoType); - // Pack them in an array - Attribute[] contained0 = null; - if (container != null) - contained0 = unpackAttributes(container); - ListBuffer 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()]); + Attribute.Compound[] contained = unpackContained(container); + + // In case of an empty legacy container we might need to look for + // inherited annos as well + if (direct == null && contained.length == 0 && + annoType.isAnnotationPresent(Inherited.class)) + return getInheritedAnnotations(annoType); int size = (direct == null ? 0 : 1) + contained.length; @SuppressWarnings("unchecked") // annoType is the Class for A @@ -157,6 +155,19 @@ return arr; } + private Attribute.Compound[] unpackContained(Attribute.Compound container) { + // Pack them in an array + Attribute[] contained0 = null; + if (container != null) + contained0 = unpackAttributes(container); + ListBuffer compounds = new ListBuffer<>(); + if (contained0 != null) { + for (Attribute a : contained0) + if (a instanceof Attribute.Compound) + compounds = compounds.append((Attribute.Compound)a); + } + return compounds.toArray(new Attribute.Compound[compounds.size()]); + } // This method is part of the javax.lang.model API, do not use this in javac code. public A getAnnotation(Class annoType) { diff -r fea486d30d41 -r 6b4d6205366c src/share/classes/com/sun/tools/javac/code/Flags.java --- a/src/share/classes/com/sun/tools/javac/code/Flags.java Thu Oct 31 12:36:36 2013 -0700 +++ b/src/share/classes/com/sun/tools/javac/code/Flags.java Thu Oct 31 16:46:43 2013 -0700 @@ -270,6 +270,11 @@ */ public static final long POTENTIALLY_AMBIGUOUS = 1L<<48; + /** + * Flag that marks a synthetic method body for a lambda expression + */ + public static final long LAMBDA_METHOD = 1L<<49; + /** Modifier masks. */ public static final int @@ -378,7 +383,8 @@ NOT_IN_PROFILE(Flags.NOT_IN_PROFILE), BAD_OVERRIDE(Flags.BAD_OVERRIDE), SIGNATURE_POLYMORPHIC(Flags.SIGNATURE_POLYMORPHIC), - THROWS(Flags.THROWS); + THROWS(Flags.THROWS), + LAMBDA_METHOD(Flags.LAMBDA_METHOD); Flag(long flag) { this.value = flag; diff -r fea486d30d41 -r 6b4d6205366c src/share/classes/com/sun/tools/javac/code/Symbol.java --- a/src/share/classes/com/sun/tools/javac/code/Symbol.java Thu Oct 31 12:36:36 2013 -0700 +++ b/src/share/classes/com/sun/tools/javac/code/Symbol.java Thu Oct 31 16:46:43 2013 -0700 @@ -100,7 +100,7 @@ /** The attributes of this symbol are contained in this * SymbolMetadata. The SymbolMetadata instance is NOT immutable. */ - protected SymbolMetadata annotations; + protected SymbolMetadata metadata; /** An accessor method for the attributes of this symbol. @@ -108,9 +108,9 @@ * method to make sure that the class symbol is loaded. */ public List getRawAttributes() { - return (annotations == null) + return (metadata == null) ? List.nil() - : annotations.getDeclarationAttributes(); + : metadata.getDeclarationAttributes(); } /** An accessor method for the type attributes of this symbol. @@ -118,9 +118,9 @@ * method to make sure that the class symbol is loaded. */ public List getRawTypeAttributes() { - return (annotations == null) + return (metadata == null) ? List.nil() - : annotations.getTypeAttributes(); + : metadata.getTypeAttributes(); } /** Fetch a particular annotation from a symbol. */ @@ -132,106 +132,106 @@ } public boolean annotationsPendingCompletion() { - return annotations == null ? false : annotations.pendingCompletion(); + return metadata == null ? false : metadata.pendingCompletion(); } public void appendAttributes(List l) { if (l.nonEmpty()) { - initedAnnos().append(l); + initedMetadata().append(l); } } public void appendClassInitTypeAttributes(List l) { if (l.nonEmpty()) { - initedAnnos().appendClassInitTypeAttributes(l); + initedMetadata().appendClassInitTypeAttributes(l); } } public void appendInitTypeAttributes(List l) { if (l.nonEmpty()) { - initedAnnos().appendInitTypeAttributes(l); + initedMetadata().appendInitTypeAttributes(l); } } public void appendTypeAttributesWithCompletion(final Annotate.AnnotateRepeatedContext ctx) { - initedAnnos().appendTypeAttributesWithCompletion(ctx); + initedMetadata().appendTypeAttributesWithCompletion(ctx); } public void appendUniqueTypeAttributes(List l) { if (l.nonEmpty()) { - initedAnnos().appendUniqueTypes(l); + initedMetadata().appendUniqueTypes(l); } } public List getClassInitTypeAttributes() { - return (annotations == null) + return (metadata == null) ? List.nil() - : annotations.getClassInitTypeAttributes(); + : metadata.getClassInitTypeAttributes(); } public List getInitTypeAttributes() { - return (annotations == null) + return (metadata == null) ? List.nil() - : annotations.getInitTypeAttributes(); + : metadata.getInitTypeAttributes(); } public List getDeclarationAttributes() { - return (annotations == null) + return (metadata == null) ? List.nil() - : annotations.getDeclarationAttributes(); + : metadata.getDeclarationAttributes(); } public boolean hasAnnotations() { - return (annotations != null && !annotations.isEmpty()); + return (metadata != null && !metadata.isEmpty()); } public boolean hasTypeAnnotations() { - return (annotations != null && !annotations.isTypesEmpty()); + return (metadata != null && !metadata.isTypesEmpty()); } public void prependAttributes(List l) { if (l.nonEmpty()) { - initedAnnos().prepend(l); + initedMetadata().prepend(l); } } public void resetAnnotations() { - initedAnnos().reset(); + initedMetadata().reset(); } public void setAttributes(Symbol other) { - if (annotations != null || other.annotations != null) { - initedAnnos().setAttributes(other.annotations); + if (metadata != null || other.metadata != null) { + initedMetadata().setAttributes(other.metadata); } } public void setDeclarationAttributes(List a) { - if (annotations != null || a.nonEmpty()) { - initedAnnos().setDeclarationAttributes(a); + if (metadata != null || a.nonEmpty()) { + initedMetadata().setDeclarationAttributes(a); } } public void setDeclarationAttributesWithCompletion(final Annotate.AnnotateRepeatedContext ctx) { - initedAnnos().setDeclarationAttributesWithCompletion(ctx); + initedMetadata().setDeclarationAttributesWithCompletion(ctx); } public void setTypeAttributes(List a) { - if (annotations != null || a.nonEmpty()) { - if (annotations == null) - annotations = new SymbolMetadata(this); - annotations.setTypeAttributes(a); + if (metadata != null || a.nonEmpty()) { + if (metadata == null) + metadata = new SymbolMetadata(this); + metadata.setTypeAttributes(a); } } - private SymbolMetadata initedAnnos() { - if (annotations == null) - annotations = new SymbolMetadata(this); - return annotations; + private SymbolMetadata initedMetadata() { + if (metadata == null) + metadata = new SymbolMetadata(this); + return metadata; } /** This method is intended for debugging only. */ - public SymbolMetadata getAnnotations() { - return annotations; + public SymbolMetadata getMetadata() { + return metadata; } // @@ -862,10 +862,10 @@ } private void mergeAttributes() { - if (annotations == null && - package_info.annotations != null) { - annotations = new SymbolMetadata(this); - annotations.setAttributes(package_info.annotations); + if (metadata == null && + package_info.metadata != null) { + metadata = new SymbolMetadata(this); + metadata.setAttributes(package_info.metadata); } } diff -r fea486d30d41 -r 6b4d6205366c src/share/classes/com/sun/tools/javac/code/TypeAnnotations.java --- a/src/share/classes/com/sun/tools/javac/code/TypeAnnotations.java Thu Oct 31 12:36:36 2013 -0700 +++ b/src/share/classes/com/sun/tools/javac/code/TypeAnnotations.java Thu Oct 31 16:46:43 2013 -0700 @@ -323,7 +323,16 @@ if (type == null) { // When type is null, put the type annotations to the symbol. // This is used for constructor return annotations, for which - // no appropriate type exists. + // we use the type of the enclosing class. + type = sym.getEnclosingElement().asType(); + + // Declaration annotations are always allowed on constructor returns. + // Therefore, use typeAnnotations instead of onlyTypeAnnos. + type = typeWithAnnotations(typetree, type, typeAnnotations, typeAnnotations); + // Note that we don't use the result, the call to + // typeWithAnnotations side-effects the type annotation positions. + // This is important for constructors of nested classes. + sym.appendUniqueTypeAttributes(typeAnnotations); return; } @@ -361,9 +370,9 @@ sym.appendUniqueTypeAttributes(typeAnnotations); if (sym.getKind() == ElementKind.PARAMETER || - sym.getKind() == ElementKind.LOCAL_VARIABLE || - sym.getKind() == ElementKind.RESOURCE_VARIABLE || - sym.getKind() == ElementKind.EXCEPTION_PARAMETER) { + sym.getKind() == ElementKind.LOCAL_VARIABLE || + sym.getKind() == ElementKind.RESOURCE_VARIABLE || + sym.getKind() == ElementKind.EXCEPTION_PARAMETER) { // Make sure all type annotations from the symbol are also // on the owner. sym.owner.appendUniqueTypeAttributes(sym.getRawTypeAttributes()); @@ -404,11 +413,11 @@ depth = depth.append(TypePathEntry.ARRAY); while (arType.elemtype.hasTag(TypeTag.ARRAY)) { if (arType.elemtype.isAnnotated()) { - Type.AnnotatedType aelemtype = (Type.AnnotatedType) arType.elemtype; + Type aelemtype = arType.elemtype; arType = (Type.ArrayType) aelemtype.unannotatedType(); ArrayType prevToMod = tomodify; tomodify = new Type.ArrayType(null, arType.tsym); - prevToMod.elemtype = (Type.AnnotatedType) tomodify.annotatedType(arType.elemtype.getAnnotationMirrors()); + prevToMod.elemtype = tomodify.annotatedType(arType.elemtype.getAnnotationMirrors()); } else { arType = (Type.ArrayType) arType.elemtype; tomodify.elemtype = new Type.ArrayType(null, arType.tsym); @@ -1212,6 +1221,22 @@ super.visitTypeParameter(tree); } + private void copyNewClassAnnotationsToOwner(JCNewClass tree) { + Symbol sym = tree.def.sym; + TypeAnnotationPosition pos = new TypeAnnotationPosition(); + ListBuffer newattrs = + new ListBuffer(); + + for (Attribute.TypeCompound old : sym.getRawTypeAttributes()) { + newattrs.append(new Attribute.TypeCompound(old.type, old.values, + pos)); + } + + pos.type = TargetType.NEW; + pos.pos = tree.pos; + sym.owner.appendUniqueTypeAttributes(newattrs.toList()); + } + @Override public void visitNewClass(JCNewClass tree) { if (tree.def != null && @@ -1230,7 +1255,7 @@ } Type before = classdecl.sym.type; separateAnnotationsKinds(classdecl, tree.clazz.type, classdecl.sym, pos); - + copyNewClassAnnotationsToOwner(tree); // classdecl.sym.type now contains an annotated type, which // is not what we want there. // TODO: should we put this type somewhere in the superclass/interface? diff -r fea486d30d41 -r 6b4d6205366c src/share/classes/com/sun/tools/javac/comp/Attr.java --- a/src/share/classes/com/sun/tools/javac/comp/Attr.java Thu Oct 31 12:36:36 2013 -0700 +++ b/src/share/classes/com/sun/tools/javac/comp/Attr.java Thu Oct 31 16:46:43 2013 -0700 @@ -250,6 +250,14 @@ Type owntype = found; if (!owntype.hasTag(ERROR) && !resultInfo.pt.hasTag(METHOD) && !resultInfo.pt.hasTag(FORALL)) { if (allowPoly && inferenceContext.free(found)) { + if ((ownkind & ~resultInfo.pkind) == 0) { + owntype = resultInfo.check(tree, inferenceContext.asFree(owntype)); + } else { + log.error(tree.pos(), "unexpected.type", + kindNames(resultInfo.pkind), + kindName(ownkind)); + owntype = types.createErrorType(owntype); + } inferenceContext.addFreeTypeListener(List.of(found, resultInfo.pt), new FreeTypeListener() { @Override public void typesInferred(InferenceContext inferenceContext) { @@ -314,9 +322,6 @@ case CLASSDEF: //class def is always an owner return ((JCClassDecl)env.tree).sym; - case LAMBDA: - //a lambda is an owner - return a fresh synthetic method symbol - return new MethodSymbol(0, names.empty, null, syms.methodClass); case BLOCK: //static/instance init blocks are owner Symbol blockSym = env.info.scope.owner; @@ -514,6 +519,15 @@ protected ResultInfo dup(CheckContext newContext) { return new ResultInfo(pkind, pt, newContext); } + + @Override + public String toString() { + if (pt != null) { + return pt.toString(); + } else { + return ""; + } + } } class RecoveryInfo extends ResultInfo { @@ -4065,8 +4079,6 @@ * Apply the annotations to the particular type. */ public void annotateType(final JCTree tree, final List annotations) { - // Callers ensure this. - // Assert.check(annotations != null && annotations.nonEmpty()); annotate.typeAnnotation(new Annotate.Worker() { @Override public String toString() { @@ -4084,8 +4096,9 @@ } private static List fromAnnotations(List annotations) { - if (annotations.isEmpty()) + if (annotations.isEmpty()) { return List.nil(); + } ListBuffer buf = new ListBuffer<>(); for (JCAnnotation anno : annotations) { @@ -4097,6 +4110,10 @@ // Any better solutions? buf.append((Attribute.TypeCompound) anno.attribute); } + // Eventually we will want to throw an exception here, but + // we can't do that just yet, because it gets triggered + // when attempting to attach an annotation that isn't + // defined. } return buf.toList(); } diff -r fea486d30d41 -r 6b4d6205366c src/share/classes/com/sun/tools/javac/comp/Check.java --- a/src/share/classes/com/sun/tools/javac/comp/Check.java Thu Oct 31 12:36:36 2013 -0700 +++ b/src/share/classes/com/sun/tools/javac/comp/Check.java Thu Oct 31 16:46:43 2013 -0700 @@ -528,7 +528,7 @@ inferenceContext.addFreeTypeListener(List.of(req), new FreeTypeListener() { @Override public void typesInferred(InferenceContext inferenceContext) { - checkType(pos, found, inferenceContext.asInstType(req), checkContext); + checkType(pos, inferenceContext.asInstType(found), inferenceContext.asInstType(req), checkContext); } }); } @@ -3011,7 +3011,6 @@ boolean annotationApplicable(JCAnnotation a, Symbol s) { Attribute.Array arr = getAttributeTargetAttribute(a.annotationType.type.tsym); Name[] targets; - if (arr == null) { targets = defaultTargetMetaInfo(a, s); } else { @@ -3028,7 +3027,7 @@ } for (Name target : targets) { if (target == names.TYPE) - { if (s.kind == TYP) return true; } + { if (s.kind == TYP && !s.isAnonymous()) return true; } else if (target == names.FIELD) { if (s.kind == VAR && s.owner.kind != MTH) return true; } else if (target == names.METHOD) diff -r fea486d30d41 -r 6b4d6205366c src/share/classes/com/sun/tools/javac/comp/Flow.java --- a/src/share/classes/com/sun/tools/javac/comp/Flow.java Thu Oct 31 12:36:36 2013 -0700 +++ b/src/share/classes/com/sun/tools/javac/comp/Flow.java Thu Oct 31 16:46:43 2013 -0700 @@ -1718,9 +1718,9 @@ if (tree.body == null) { return; } - /* MemberEnter can generate synthetic methods, ignore them + /* Ignore synthetic methods, except for translated lambda methods. */ - if ((tree.sym.flags() & SYNTHETIC) != 0) { + if ((tree.sym.flags() & (SYNTHETIC | LAMBDA_METHOD)) == SYNTHETIC) { return; } @@ -1795,7 +1795,7 @@ protected void initParam(JCVariableDecl def) { inits.incl(def.sym.adr); uninits.excl(def.sym.adr); - } + } public void visitVarDef(JCVariableDecl tree) { boolean track = trackable(tree.sym); diff -r fea486d30d41 -r 6b4d6205366c src/share/classes/com/sun/tools/javac/comp/Infer.java --- a/src/share/classes/com/sun/tools/javac/comp/Infer.java Thu Oct 31 12:36:36 2013 -0700 +++ b/src/share/classes/com/sun/tools/javac/comp/Infer.java Thu Oct 31 16:46:43 2013 -0700 @@ -1768,9 +1768,11 @@ public Type apply(Type t) { if (t.hasTag(TYPEVAR)) { TypeVar tv = (TypeVar)t; - return tv.isCaptured() ? - new CapturedUndetVar((CapturedType)tv, types) : - new UndetVar(tv, types); + if (tv.isCaptured()) { + return new CapturedUndetVar((CapturedType)tv, types); + } else { + return new UndetVar(tv, types); + } } else { return t.map(this); } diff -r fea486d30d41 -r 6b4d6205366c src/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java --- a/src/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java Thu Oct 31 12:36:36 2013 -0700 +++ b/src/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java Thu Oct 31 16:46:43 2013 -0700 @@ -48,6 +48,7 @@ import com.sun.tools.javac.util.JCDiagnostic.DiagnosticPosition; import com.sun.source.tree.MemberReferenceTree.ReferenceMode; +import java.util.EnumMap; import java.util.HashMap; import java.util.LinkedHashMap; import java.util.Map; @@ -68,6 +69,7 @@ */ public class LambdaToMethod extends TreeTranslator { + private Attr attr; private JCDiagnostic.Factory diags; private Log log; private Lower lower; @@ -103,6 +105,35 @@ /** Flag for alternate metafactories indicating the lambda object requires multiple bridges */ public static final int FLAG_BRIDGES = 1 << 2; + // + protected static final Context.Key unlambdaKey = + new Context.Key(); + + public static LambdaToMethod instance(Context context) { + LambdaToMethod instance = context.get(unlambdaKey); + if (instance == null) { + instance = new LambdaToMethod(context); + } + return instance; + } + private LambdaToMethod(Context context) { + context.put(unlambdaKey, this); + diags = JCDiagnostic.Factory.instance(context); + log = Log.instance(context); + lower = Lower.instance(context); + names = Names.instance(context); + syms = Symtab.instance(context); + rs = Resolve.instance(context); + make = TreeMaker.instance(context); + types = Types.instance(context); + transTypes = TransTypes.instance(context); + analyzer = new LambdaAnalyzerPreprocessor(); + Options options = Options.instance(context); + dumpLambdaToMethodStats = options.isSet("dumpLambdaToMethodStats"); + attr = Attr.instance(context); + } + // + private class KlassInfo { /** @@ -125,12 +156,15 @@ */ private final VarSymbol deserParamSym; - private KlassInfo(Symbol kSym) { + private final JCClassDecl clazz; + + private KlassInfo(JCClassDecl clazz) { + this.clazz = clazz; appendedMethodList = new ListBuffer<>(); deserializeCases = new HashMap>(); MethodType type = new MethodType(List.of(syms.serializedLambdaType), syms.objectType, List.nil(), syms.methodClass); - deserMethodSym = makePrivateSyntheticMethod(STATIC, names.deserializeLambda, type, kSym); + deserMethodSym = makePrivateSyntheticMethod(STATIC, names.deserializeLambda, type, clazz.sym); deserParamSym = new VarSymbol(FINAL, names.fromString("lambda"), syms.serializedLambdaType, deserMethodSym); } @@ -140,37 +174,6 @@ } } - // - private static final Context.Key unlambdaKey = - new Context.Key(); - - public static LambdaToMethod instance(Context context) { - LambdaToMethod instance = context.get(unlambdaKey); - if (instance == null) { - instance = new LambdaToMethod(context); - } - return instance; - } - - private Attr attr; - - private LambdaToMethod(Context context) { - diags = JCDiagnostic.Factory.instance(context); - log = Log.instance(context); - lower = Lower.instance(context); - names = Names.instance(context); - syms = Symtab.instance(context); - rs = Resolve.instance(context); - make = TreeMaker.instance(context); - types = Types.instance(context); - transTypes = TransTypes.instance(context); - analyzer = new LambdaAnalyzerPreprocessor(); - Options options = Options.instance(context); - dumpLambdaToMethodStats = options.isSet("dumpLambdaToMethodStats"); - attr = Attr.instance(context); - } - // - // @Override public T translate(T tree) { @@ -221,10 +224,16 @@ } KlassInfo prevKlassInfo = kInfo; try { - kInfo = new KlassInfo(tree.sym); + kInfo = new KlassInfo(tree); super.visitClassDef(tree); if (!kInfo.deserializeCases.isEmpty()) { - kInfo.addMethod(makeDeserializeMethod(tree.sym)); + int prevPos = make.pos; + try { + make.at(tree); + kInfo.addMethod(makeDeserializeMethod(tree.sym)); + } finally { + make.at(prevPos); + } } //add all translated instance methods here List newMethods = kInfo.appendedMethodList.toList(); @@ -400,26 +409,21 @@ if (context == null || !analyzer.lambdaIdentSymbolFilter(tree.sym)) { super.visitIdent(tree); } else { - LambdaTranslationContext lambdaContext = (LambdaTranslationContext) context; - if (lambdaContext.getSymbolMap(PARAM).containsKey(tree.sym)) { - Symbol translatedSym = lambdaContext.getSymbolMap(PARAM).get(tree.sym); - result = make.Ident(translatedSym).setType(tree.type); - translatedSym.setTypeAttributes(tree.sym.getRawTypeAttributes()); - } else if (lambdaContext.getSymbolMap(LOCAL_VAR).containsKey(tree.sym)) { - Symbol translatedSym = lambdaContext.getSymbolMap(LOCAL_VAR).get(tree.sym); - result = make.Ident(translatedSym).setType(tree.type); - translatedSym.setTypeAttributes(tree.sym.getRawTypeAttributes()); - } else if (lambdaContext.getSymbolMap(TYPE_VAR).containsKey(tree.sym)) { - Symbol translatedSym = lambdaContext.getSymbolMap(TYPE_VAR).get(tree.sym); - result = make.Ident(translatedSym).setType(translatedSym.type); - translatedSym.setTypeAttributes(tree.sym.getRawTypeAttributes()); - } else if (lambdaContext.getSymbolMap(CAPTURED_VAR).containsKey(tree.sym)) { - Symbol translatedSym = lambdaContext.getSymbolMap(CAPTURED_VAR).get(tree.sym); - result = make.Ident(translatedSym).setType(tree.type); - } else { - //access to untranslated symbols (i.e. compile-time constants, - //members defined inside the lambda body, etc.) ) - super.visitIdent(tree); + int prevPos = make.pos; + try { + make.at(tree); + + LambdaTranslationContext lambdaContext = (LambdaTranslationContext) context; + JCTree ltree = lambdaContext.translate(tree); + if (ltree != null) { + result = ltree; + } else { + //access to untranslated symbols (i.e. compile-time constants, + //members defined inside the lambda body, etc.) ) + super.visitIdent(tree); + } + } finally { + make.at(prevPos); } } } @@ -429,11 +433,21 @@ LambdaTranslationContext lambdaContext = (LambdaTranslationContext)context; if (context != null && lambdaContext.getSymbolMap(LOCAL_VAR).containsKey(tree.sym)) { JCExpression init = translate(tree.init); - result = make.VarDef((VarSymbol)lambdaContext.getSymbolMap(LOCAL_VAR).get(tree.sym), init); + int prevPos = make.pos; + try { + result = make.at(tree).VarDef((VarSymbol)lambdaContext.getSymbolMap(LOCAL_VAR).get(tree.sym), init); + } finally { + make.at(prevPos); + } } else if (context != null && lambdaContext.getSymbolMap(TYPE_VAR).containsKey(tree.sym)) { JCExpression init = translate(tree.init); VarSymbol xsym = (VarSymbol)lambdaContext.getSymbolMap(TYPE_VAR).get(tree.sym); - result = make.VarDef(xsym, init); + int prevPos = make.pos; + try { + result = make.at(tree).VarDef(xsym, init); + } finally { + make.at(prevPos); + } // Replace the entered symbol for this variable Scope sc = tree.sym.owner.members(); if (sc != null) { @@ -460,23 +474,28 @@ boolean isLambda_void = expr.type.hasTag(VOID); boolean isTarget_void = restype.hasTag(VOID); boolean isTarget_Void = types.isSameType(restype, types.boxedClass(syms.voidType).type); - if (isTarget_void) { - //target is void: - // BODY; - JCStatement stat = make.Exec(expr); - return make.Block(0, List.of(stat)); - } else if (isLambda_void && isTarget_Void) { - //void to Void conversion: - // BODY; return null; - ListBuffer stats = new ListBuffer<>(); - stats.append(make.Exec(expr)); - stats.append(make.Return(make.Literal(BOT, null).setType(syms.botType))); - return make.Block(0, stats.toList()); - } else { - //non-void to non-void conversion: - // return (TYPE)BODY; - JCExpression retExpr = transTypes.coerce(attrEnv, expr, restype); - return make.at(retExpr).Block(0, List.of(make.Return(retExpr))); + int prevPos = make.pos; + try { + if (isTarget_void) { + //target is void: + // BODY; + JCStatement stat = make.at(expr).Exec(expr); + return make.Block(0, List.of(stat)); + } else if (isLambda_void && isTarget_Void) { + //void to Void conversion: + // BODY; return null; + ListBuffer stats = new ListBuffer<>(); + stats.append(make.at(expr).Exec(expr)); + stats.append(make.Return(make.Literal(BOT, null).setType(syms.botType))); + return make.Block(0, stats.toList()); + } else { + //non-void to non-void conversion: + // return (TYPE)BODY; + JCExpression retExpr = transTypes.coerce(attrEnv, expr, restype); + return make.at(retExpr).Block(0, List.of(make.Return(retExpr))); + } + } finally { + make.at(prevPos); } } @@ -587,10 +606,10 @@ DiagnosticPosition pos, List staticArgs, MethodType indyType) { String functionalInterfaceClass = classSig(targetType); String functionalInterfaceMethodName = samSym.getSimpleName().toString(); - String functionalInterfaceMethodSignature = methodSig(types.erasure(samSym.type)); + String functionalInterfaceMethodSignature = typeSig(types.erasure(samSym.type)); String implClass = classSig(types.erasure(refSym.owner.type)); String implMethodName = refSym.getQualifiedName().toString(); - String implMethodSignature = methodSig(types.erasure(refSym.type)); + String implMethodSignature = typeSig(types.erasure(refSym.type)); JCExpression kindTest = eqTest(syms.intType, deserGetter("getImplMethodKind", syms.intType), make.Literal(implMethodKind)); ListBuffer serArgs = new ListBuffer<>(); @@ -978,8 +997,14 @@ } } if (context.isSerializable()) { - addDeserializationCase(refKind, refSym, tree.type, samSym, - tree, staticArgs, indyType); + int prevPos = make.pos; + try { + make.at(kInfo.clazz); + addDeserializationCase(refKind, refSym, tree.type, samSym, + tree, staticArgs, indyType); + } finally { + make.at(prevPos); + } } } @@ -1098,8 +1123,21 @@ * keep the count of lambda expression defined in given context (used to * generate unambiguous names for serializable lambdas) */ - private Map serializableLambdaCounts = - new HashMap(); + private class SyntheticMethodNameCounter { + private Map map = new HashMap<>(); + int getIndex(StringBuilder buf) { + String temp = buf.toString(); + Integer count = map.get(temp); + if (count == null) { + count = 0; + } + ++count; + map.put(temp, count); + return count; + } + } + private SyntheticMethodNameCounter syntheticMethodNameCounts = + new SyntheticMethodNameCounter(); private Map localClassDefs; @@ -1133,13 +1171,13 @@ @Override public void visitClassDef(JCClassDecl tree) { List prevStack = frameStack; - Map prevSerializableLambdaCount = - serializableLambdaCounts; + SyntheticMethodNameCounter prevSyntheticMethodNameCounts = + syntheticMethodNameCounts; Map prevClinits = clinits; DiagnosticSource prevSource = log.currentSource(); try { log.useSource(tree.sym.sourcefile); - serializableLambdaCounts = new HashMap(); + syntheticMethodNameCounts = new SyntheticMethodNameCounter(); prevClinits = new HashMap(); if (tree.sym.owner.kind == MTH) { localClassDefs.put(tree.sym, tree); @@ -1165,7 +1203,7 @@ finally { log.useSource(prevSource.getFile()); frameStack = prevStack; - serializableLambdaCounts = prevSerializableLambdaCount; + syntheticMethodNameCounts = prevSyntheticMethodNameCounts; clinits = prevClinits; } } @@ -1315,7 +1353,9 @@ ListBuffer paramBuff = new ListBuffer(); int i = 0; for (List l = ptypes; l.nonEmpty(); l = l.tail) { - paramBuff.append(make.Param(make.paramName(i++), l.head, owner)); + JCVariableDecl param = make.Param(make.paramName(i++), l.head, owner); + param.sym.pos = tree.pos; + paramBuff.append(param); } List params = paramBuff.toList(); @@ -1388,50 +1428,6 @@ } } - private Name lambdaName() { - return names.lambda.append(names.fromString("" + lambdaCount++)); - } - - /** - * For a serializable lambda, generate a name which maximizes name - * stability across deserialization. - * @param owner - * @return Name to use for the synthetic lambda method name - */ - private Name serializedLambdaName(Symbol owner) { - StringBuilder buf = new StringBuilder(); - buf.append(names.lambda); - // Append the name of the method enclosing the lambda. - String methodName = owner.name.toString(); - if (methodName.equals("")) - methodName = "static"; - else if (methodName.equals("")) - methodName = "new"; - buf.append(methodName); - buf.append('$'); - // Append a hash of the enclosing method signature to differentiate - // overloaded enclosing methods. For lambdas enclosed in lambdas, - // the generated lambda method will not have type yet, but the - // enclosing method's name will have been generated with this same - // method, so it will be unique and never be overloaded. - Assert.check(owner.type != null || directlyEnclosingLambda() != null); - if (owner.type != null) { - int methTypeHash = methodSig(owner.type).hashCode(); - buf.append(Integer.toHexString(methTypeHash)); - } - buf.append('$'); - // The above appended name components may not be unique, append a - // count based on the above name components. - String temp = buf.toString(); - Integer count = serializableLambdaCounts.get(temp); - if (count == null) { - count = 0; - } - buf.append(count++); - serializableLambdaCounts.put(temp, count); - return names.fromString(buf.toString()); - } - /** * Return a valid owner given the current declaration stack * (required to skip synthetic lambda symbols) @@ -1648,19 +1644,19 @@ private abstract class TranslationContext { /** the underlying (untranslated) tree */ - T tree; + final T tree; /** points to the adjusted enclosing scope in which this lambda/mref expression occurs */ - Symbol owner; + final Symbol owner; /** the depth of this lambda expression in the frame stack */ - int depth; + final int depth; /** the enclosing translation context (set for nested lambdas/mref) */ - TranslationContext prev; + final TranslationContext prev; /** list of methods to be bridged by the meta-factory */ - List bridges; + final List bridges; TranslationContext(T tree) { this.tree = tree; @@ -1688,6 +1684,31 @@ } return false; } + + /** + * @return Name of the enclosing method to be folded into synthetic + * method name + */ + String enclosingMethodName() { + return syntheticMethodNameComponent(owner.name); + } + + /** + * @return Method name in a form that can be folded into a + * component of a synthetic method name + */ + String syntheticMethodNameComponent(Name name) { + if (name == null) { + return "null"; + } + String methodName = name.toString(); + if (methodName.equals("")) { + methodName = "static"; + } else if (methodName.equals("")) { + methodName = "new"; + } + return methodName; + } } /** @@ -1699,22 +1720,12 @@ private class LambdaTranslationContext extends TranslationContext { /** variable in the enclosing context to which this lambda is assigned */ - Symbol self; - - /** map from original to translated lambda parameters */ - Map lambdaParams = new LinkedHashMap(); - - /** map from original to translated lambda locals */ - Map lambdaLocals = new LinkedHashMap(); + final Symbol self; - /** map from variables in enclosing scope to translated synthetic parameters */ - Map capturedLocals = new LinkedHashMap(); + /** variable in the enclosing context to which this lambda is assigned */ + final Symbol assignedTo; - /** map from class symbols to translated synthetic parameters (for captured member access) */ - Map capturedThis = new LinkedHashMap(); - - /** map from original to translated lambda locals */ - Map typeVars = new LinkedHashMap(); + Map> translatedSymbols; /** the synthetic symbol for the method hoisting the translated lambda */ Symbol translatedSym; @@ -1724,14 +1735,110 @@ LambdaTranslationContext(JCLambda tree) { super(tree); Frame frame = frameStack.head; - if (frame.tree.hasTag(VARDEF)) { - self = ((JCVariableDecl)frame.tree).sym; - } - Name name = isSerializable() ? serializedLambdaName(owner) : lambdaName(); - this.translatedSym = makePrivateSyntheticMethod(0, name, null, owner.enclClass()); + switch (frame.tree.getTag()) { + case VARDEF: + assignedTo = self = ((JCVariableDecl) frame.tree).sym; + break; + case ASSIGN: + self = null; + assignedTo = TreeInfo.symbol(((JCAssign) frame.tree).getVariable()); + break; + default: + assignedTo = self = null; + break; + } + + // This symbol will be filled-in in complete + this.translatedSym = makePrivateSyntheticMethod(0, null, null, owner.enclClass()); + if (dumpLambdaToMethodStats) { log.note(tree, "lambda.stat", needsAltMetafactory(), translatedSym); } + translatedSymbols = new EnumMap<>(LambdaSymbolKind.class); + + translatedSymbols.put(PARAM, new LinkedHashMap()); + translatedSymbols.put(LOCAL_VAR, new LinkedHashMap()); + translatedSymbols.put(CAPTURED_VAR, new LinkedHashMap()); + translatedSymbols.put(CAPTURED_THIS, new LinkedHashMap()); + translatedSymbols.put(TYPE_VAR, new LinkedHashMap()); + } + + /** + * For a serializable lambda, generate a disambiguating string + * which maximizes stability across deserialization. + * + * @return String to differentiate synthetic lambda method names + */ + private String serializedLambdaDisambiguation() { + StringBuilder buf = new StringBuilder(); + // Append the enclosing method signature to differentiate + // overloaded enclosing methods. For lambdas enclosed in + // lambdas, the generated lambda method will not have type yet, + // but the enclosing method's name will have been generated + // with this same method, so it will be unique and never be + // overloaded. + Assert.check( + owner.type != null || + directlyEnclosingLambda() != null); + if (owner.type != null) { + buf.append(typeSig(owner.type)); + buf.append(":"); + } + + // Add target type info + buf.append(types.findDescriptorSymbol(tree.type.tsym).owner.flatName()); + buf.append(" "); + + // Add variable assigned to + if (assignedTo != null) { + buf.append(assignedTo.flatName()); + buf.append("="); + } + //add captured locals info: type, name, order + for (Symbol fv : getSymbolMap(CAPTURED_VAR).keySet()) { + if (fv != self) { + buf.append(typeSig(fv.type)); + buf.append(" "); + buf.append(fv.flatName()); + buf.append(","); + } + } + + return buf.toString(); + } + + /** + * For a non-serializable lambda, generate a simple method. + * + * @return Name to use for the synthetic lambda method name + */ + private Name lambdaName() { + return names.lambda.append(names.fromString(enclosingMethodName() + "$" + lambdaCount++)); + } + + /** + * For a serializable lambda, generate a method name which maximizes + * name stability across deserialization. + * + * @return Name to use for the synthetic lambda method name + */ + private Name serializedLambdaName() { + StringBuilder buf = new StringBuilder(); + buf.append(names.lambda); + // Append the name of the method enclosing the lambda. + buf.append(enclosingMethodName()); + buf.append('$'); + // Append a hash of the disambiguating string : enclosing method + // signature, etc. + String disam = serializedLambdaDisambiguation(); + buf.append(Integer.toHexString(disam.hashCode())); + buf.append('$'); + // The above appended name components may not be unique, append + // a count based on the above name components. + buf.append(syntheticMethodNameCounts.getIndex(buf)); + String result = buf.toString(); + //System.err.printf("serializedLambdaName: %s -- %s\n", result, disam); + return names.fromString(result); } /** @@ -1755,7 +1862,7 @@ ((VarSymbol)ret).pos = ((VarSymbol)sym).pos; break; case CAPTURED_VAR: - ret = new VarSymbol(SYNTHETIC | FINAL, name, types.erasure(sym.type), translatedSym) { + ret = new VarSymbol(SYNTHETIC | FINAL | PARAMETER, name, types.erasure(sym.type), translatedSym) { @Override public Symbol baseSymbol() { //keep mapping with original captured symbol @@ -1763,8 +1870,17 @@ } }; break; + case LOCAL_VAR: + ret = new VarSymbol(FINAL, name, types.erasure(sym.type), translatedSym); + ((VarSymbol) ret).pos = ((VarSymbol) sym).pos; + break; + case PARAM: + ret = new VarSymbol(FINAL | PARAMETER, name, types.erasure(sym.type), translatedSym); + ((VarSymbol) ret).pos = ((VarSymbol) sym).pos; + break; default: ret = makeSyntheticVar(FINAL, name, types.erasure(sym.type), translatedSym); + ((VarSymbol) ret).pos = ((VarSymbol) sym).pos; } if (ret != sym) { ret.setDeclarationAttributes(sym.getRawAttributes()); @@ -1774,27 +1890,22 @@ } void addSymbol(Symbol sym, LambdaSymbolKind skind) { - Map transMap = null; + Map transMap = getSymbolMap(skind); Name preferredName; switch (skind) { case CAPTURED_THIS: - transMap = capturedThis; - preferredName = names.fromString("encl$" + capturedThis.size()); + preferredName = names.fromString("encl$" + transMap.size()); break; case CAPTURED_VAR: - transMap = capturedLocals; - preferredName = names.fromString("cap$" + capturedLocals.size()); + preferredName = names.fromString("cap$" + transMap.size()); break; case LOCAL_VAR: - transMap = lambdaLocals; preferredName = sym.name; break; case PARAM: - transMap = lambdaParams; preferredName = sym.name; break; case TYPE_VAR: - transMap = typeVars; preferredName = sym.name; break; default: throw new AssertionError(); @@ -1804,29 +1915,22 @@ } } - Map getSymbolMap(LambdaSymbolKind... skinds) { - LinkedHashMap translationMap = new LinkedHashMap(); - for (LambdaSymbolKind skind : skinds) { - switch (skind) { - case CAPTURED_THIS: - translationMap.putAll(capturedThis); - break; - case CAPTURED_VAR: - translationMap.putAll(capturedLocals); - break; - case LOCAL_VAR: - translationMap.putAll(lambdaLocals); - break; - case PARAM: - translationMap.putAll(lambdaParams); - break; - case TYPE_VAR: - translationMap.putAll(typeVars); - break; - default: throw new AssertionError(); + Map getSymbolMap(LambdaSymbolKind skind) { + Map m = translatedSymbols.get(skind); + Assert.checkNonNull(m); + return m; + } + + JCTree translate(JCIdent lambdaIdent) { + for (Map m : translatedSymbols.values()) { + if (m.containsKey(lambdaIdent.sym)) { + Symbol tSym = m.get(lambdaIdent.sym); + JCTree t = make.Ident(tSym).setType(lambdaIdent.type); + tSym.setTypeAttributes(lambdaIdent.sym.getRawTypeAttributes()); + return t; } } - return translationMap; + return null; } /** @@ -1845,7 +1949,7 @@ // If instance access isn't needed, make it static. // Interface instance methods must be default methods. // Lambda methods are private synthetic. - translatedSym.flags_field = SYNTHETIC | + translatedSym.flags_field = SYNTHETIC | LAMBDA_METHOD | PRIVATE | (thisReferenced? (inInterface? DEFAULT : 0) : STATIC); @@ -1857,11 +1961,18 @@ // // 1) reference to enclosing contexts captured by the lambda expression // 2) enclosing locals captured by the lambda expression - for (Symbol thisSym : getSymbolMap(CAPTURED_VAR, PARAM).values()) { + for (Symbol thisSym : getSymbolMap(CAPTURED_VAR).values()) { + params.append(make.VarDef((VarSymbol) thisSym, null)); + } + for (Symbol thisSym : getSymbolMap(PARAM).values()) { params.append(make.VarDef((VarSymbol) thisSym, null)); } + syntheticParams = params.toList(); - syntheticParams = params.toList(); + // Compute and set the lambda name + translatedSym.name = isSerializable() + ? serializedLambdaName() + : lambdaName(); //prepend synthetic args to translated lambda method signature translatedSym.type = types.createMethodTypeWithParameters( @@ -1890,7 +2001,7 @@ this.isSuper = tree.hasKind(ReferenceKind.SUPER); this.bridgeSym = needsBridge() ? makePrivateSyntheticMethod(isSuper ? 0 : STATIC, - lambdaName().append(names.fromString("$bridge")), null, + referenceBridgeName(), null, owner.enclClass()) : null; if (dumpLambdaToMethodStats) { @@ -1904,7 +2015,9 @@ * Get the opcode associated with this method reference */ int referenceKind() { - return LambdaToMethod.this.referenceKind(needsBridge() ? bridgeSym : tree.sym); + return LambdaToMethod.this.referenceKind(needsBridge() + ? bridgeSym + : tree.sym); } boolean needsVarArgsConversion() { @@ -1912,19 +2025,68 @@ } /** + * Generate a disambiguating string to increase stability (important + * if serialized) + * + * @return String to differentiate synthetic lambda method names + */ + private String referenceBridgeDisambiguation() { + StringBuilder buf = new StringBuilder(); + // Append the enclosing method signature to differentiate + // overloaded enclosing methods. + if (owner.type != null) { + buf.append(typeSig(owner.type)); + buf.append(":"); + } + + // Append qualifier type + buf.append(classSig(tree.sym.owner.type)); + + // Note static/instance + buf.append(tree.sym.isStatic()? " S " : " I "); + + // Append referenced signature + buf.append(typeSig(tree.sym.erasure(types))); + + return buf.toString(); + } + + /** + * Construct a unique stable name for the method reference bridge + * + * @return Name to use for the synthetic method name + */ + private Name referenceBridgeName() { + StringBuilder buf = new StringBuilder(); + // Append lambda ID, this is semantically significant + buf.append(names.lambda); + // Note that it is a method reference bridge + buf.append("MR$"); + // Append the enclosing method name + buf.append(enclosingMethodName()); + buf.append('$'); + // Append the referenced method name + buf.append(syntheticMethodNameComponent(tree.sym.name)); + buf.append('$'); + // Append a hash of the disambiguating string : enclosing method + // signature, etc. + String disam = referenceBridgeDisambiguation(); + buf.append(Integer.toHexString(disam.hashCode())); + buf.append('$'); + // The above appended name components may not be unique, append + // a count based on the above name components. + buf.append(syntheticMethodNameCounts.getIndex(buf)); + String result = buf.toString(); + return names.fromString(result); + } + + /** * @return Is this an array operation like clone() */ boolean isArrayOp() { return tree.sym.owner == syms.arrayClass; } - boolean isPrivateConstructor() { - //hack needed to workaround 292 bug (8005122) - //when 292 issue is fixed we should simply remove this - return tree.sym.name == names.init && - (tree.sym.flags() & PRIVATE) != 0; - } - boolean receiverAccessible() { //hack needed to workaround 292 bug (7087658) //when 292 issue is fixed we should remove this and change the backend @@ -1933,12 +2095,24 @@ } /** + * The VM does not support access across nested classes (8010319). + * Were that ever to change, this should be removed. + */ + boolean isPrivateInOtherClass() { + return (tree.sym.flags() & PRIVATE) != 0 && + !types.isSameType( + types.erasure(tree.sym.enclClass().asType()), + types.erasure(owner.enclClass().asType())); + } + + /** * Does this reference needs a bridge (i.e. var args need to be * expanded or "super" is used) */ final boolean needsBridge() { return isSuper || needsVarArgsConversion() || isArrayOp() || - isPrivateConstructor() || !receiverAccessible(); + isPrivateInOtherClass() || + !receiverAccessible(); } Type generatedRefSig() { @@ -1952,12 +2126,16 @@ } // + /* + * These keys provide mappings for various translated lambda symbols + * and the prevailing order must be maintained. + */ enum LambdaSymbolKind { - CAPTURED_VAR, - CAPTURED_THIS, - LOCAL_VAR, - PARAM, - TYPE_VAR; + PARAM, // original to translated lambda parameters + LOCAL_VAR, // original to translated lambda locals + CAPTURED_VAR, // variables in enclosing scope to translated synthetic parameters + CAPTURED_THIS, // class symbols to translated synthetic parameters (for captured member access) + TYPE_VAR; // original to translated lambda type variables } /** @@ -1966,7 +2144,7 @@ * **************************************************************** */ - private String methodSig(Type type) { + private String typeSig(Type type) { L2MSignatureGenerator sg = new L2MSignatureGenerator(); sg.assembleSig(type); return sg.toString(); diff -r fea486d30d41 -r 6b4d6205366c src/share/classes/com/sun/tools/javac/comp/MemberEnter.java --- a/src/share/classes/com/sun/tools/javac/comp/MemberEnter.java Thu Oct 31 12:36:36 2013 -0700 +++ b/src/share/classes/com/sun/tools/javac/comp/MemberEnter.java Thu Oct 31 16:46:43 2013 -0700 @@ -573,45 +573,51 @@ Env localEnv = methodEnv(tree, env); - DiagnosticPosition prevLintPos = deferredLintHandler.setPos(tree.pos()); + annotate.enterStart(); try { - // Compute the method type - m.type = signature(m, tree.typarams, tree.params, - tree.restype, tree.recvparam, - tree.thrown, - localEnv); - } finally { - deferredLintHandler.setPos(prevLintPos); - } + DiagnosticPosition prevLintPos = deferredLintHandler.setPos(tree.pos()); + try { + // Compute the method type + m.type = signature(m, tree.typarams, tree.params, + tree.restype, tree.recvparam, + tree.thrown, + localEnv); + } finally { + deferredLintHandler.setPos(prevLintPos); + } - if (types.isSignaturePolymorphic(m)) { - m.flags_field |= SIGNATURE_POLYMORPHIC; - } + if (types.isSignaturePolymorphic(m)) { + m.flags_field |= SIGNATURE_POLYMORPHIC; + } - // Set m.params - ListBuffer params = new ListBuffer(); - JCVariableDecl lastParam = null; - for (List l = tree.params; l.nonEmpty(); l = l.tail) { - JCVariableDecl param = lastParam = l.head; - params.append(Assert.checkNonNull(param.sym)); - } - m.params = params.toList(); + // Set m.params + ListBuffer params = new ListBuffer(); + JCVariableDecl lastParam = null; + for (List l = tree.params; l.nonEmpty(); l = l.tail) { + JCVariableDecl param = lastParam = l.head; + params.append(Assert.checkNonNull(param.sym)); + } + m.params = params.toList(); + + // mark the method varargs, if necessary + if (lastParam != null && (lastParam.mods.flags & Flags.VARARGS) != 0) + m.flags_field |= Flags.VARARGS; - // mark the method varargs, if necessary - if (lastParam != null && (lastParam.mods.flags & Flags.VARARGS) != 0) - m.flags_field |= Flags.VARARGS; + localEnv.info.scope.leave(); + if (chk.checkUnique(tree.pos(), m, enclScope)) { + enclScope.enter(m); + } - localEnv.info.scope.leave(); - if (chk.checkUnique(tree.pos(), m, enclScope)) { - enclScope.enter(m); + annotateLater(tree.mods.annotations, localEnv, m, tree.pos()); + // Visit the signature of the method. Note that + // TypeAnnotate doesn't descend into the body. + typeAnnotate(tree, localEnv, m, tree.pos()); + + if (tree.defaultValue != null) + annotateDefaultValueLater(tree.defaultValue, localEnv, m); + } finally { + annotate.enterDone(); } - annotateLater(tree.mods.annotations, localEnv, m, tree.pos()); - // Visit the signature of the method. Note that - // TypeAnnotate doesn't descend into the body. - typeAnnotate(tree, localEnv, m, tree.pos()); - - if (tree.defaultValue != null) - annotateDefaultValueLater(tree.defaultValue, localEnv, m); } /** Create a fresh environment for method bodies. @@ -639,61 +645,68 @@ localEnv.info.staticLevel++; } DiagnosticPosition prevLintPos = deferredLintHandler.setPos(tree.pos()); + annotate.enterStart(); try { - if (TreeInfo.isEnumInit(tree)) { - attr.attribIdentAsEnumType(localEnv, (JCIdent)tree.vartype); - } else { - attr.attribType(tree.vartype, localEnv); - if (tree.nameexpr != null) { - attr.attribExpr(tree.nameexpr, localEnv); - MethodSymbol m = localEnv.enclMethod.sym; - if (m.isConstructor()) { - Type outertype = m.owner.owner.type; - if (outertype.hasTag(TypeTag.CLASS)) { - checkType(tree.vartype, outertype, "incorrect.constructor.receiver.type"); - checkType(tree.nameexpr, outertype, "incorrect.constructor.receiver.name"); + try { + if (TreeInfo.isEnumInit(tree)) { + attr.attribIdentAsEnumType(localEnv, (JCIdent)tree.vartype); + } else { + attr.attribType(tree.vartype, localEnv); + if (tree.nameexpr != null) { + attr.attribExpr(tree.nameexpr, localEnv); + MethodSymbol m = localEnv.enclMethod.sym; + if (m.isConstructor()) { + Type outertype = m.owner.owner.type; + if (outertype.hasTag(TypeTag.CLASS)) { + checkType(tree.vartype, outertype, "incorrect.constructor.receiver.type"); + checkType(tree.nameexpr, outertype, "incorrect.constructor.receiver.name"); + } else { + log.error(tree, "receiver.parameter.not.applicable.constructor.toplevel.class"); + } } else { - log.error(tree, "receiver.parameter.not.applicable.constructor.toplevel.class"); + checkType(tree.vartype, m.owner.type, "incorrect.receiver.type"); + checkType(tree.nameexpr, m.owner.type, "incorrect.receiver.name"); } - } else { - checkType(tree.vartype, m.owner.type, "incorrect.receiver.type"); - checkType(tree.nameexpr, m.owner.type, "incorrect.receiver.name"); } } + } finally { + deferredLintHandler.setPos(prevLintPos); + } + + if ((tree.mods.flags & VARARGS) != 0) { + //if we are entering a varargs parameter, we need to + //replace its type (a plain array type) with the more + //precise VarargsType --- we need to do it this way + //because varargs is represented in the tree as a + //modifier on the parameter declaration, and not as a + //distinct type of array node. + ArrayType atype = (ArrayType)tree.vartype.type.unannotatedType(); + tree.vartype.type = atype.makeVarargs(); + } + Scope enclScope = enter.enterScope(env); + VarSymbol v = + new VarSymbol(0, tree.name, tree.vartype.type, enclScope.owner); + v.flags_field = chk.checkFlags(tree.pos(), tree.mods.flags, v, tree); + tree.sym = v; + if (tree.init != null) { + v.flags_field |= HASINIT; + if ((v.flags_field & FINAL) != 0 && + needsLazyConstValue(tree.init)) { + Env initEnv = getInitEnv(tree, env); + initEnv.info.enclVar = v; + v.setLazyConstValue(initEnv(tree, initEnv), attr, tree); + } } + if (chk.checkUnique(tree.pos(), v, enclScope)) { + chk.checkTransparentVar(tree.pos(), v, enclScope); + enclScope.enter(v); + } + annotateLater(tree.mods.annotations, localEnv, v, tree.pos()); + typeAnnotate(tree.vartype, env, v, tree.pos()); + v.pos = tree.pos; } finally { - deferredLintHandler.setPos(prevLintPos); - } - - if ((tree.mods.flags & VARARGS) != 0) { - //if we are entering a varargs parameter, we need to replace its type - //(a plain array type) with the more precise VarargsType --- we need - //to do it this way because varargs is represented in the tree as a modifier - //on the parameter declaration, and not as a distinct type of array node. - ArrayType atype = (ArrayType)tree.vartype.type.unannotatedType(); - tree.vartype.type = atype.makeVarargs(); + annotate.enterDone(); } - Scope enclScope = enter.enterScope(env); - VarSymbol v = - new VarSymbol(0, tree.name, tree.vartype.type, enclScope.owner); - v.flags_field = chk.checkFlags(tree.pos(), tree.mods.flags, v, tree); - tree.sym = v; - if (tree.init != null) { - v.flags_field |= HASINIT; - if ((v.flags_field & FINAL) != 0 && - needsLazyConstValue(tree.init)) { - Env initEnv = getInitEnv(tree, env); - initEnv.info.enclVar = v; - v.setLazyConstValue(initEnv(tree, initEnv), attr, tree); - } - } - if (chk.checkUnique(tree.pos(), v, enclScope)) { - chk.checkTransparentVar(tree.pos(), v, enclScope); - enclScope.enter(v); - } - annotateLater(tree.mods.annotations, localEnv, v, tree.pos()); - typeAnnotate(tree.vartype, env, v, tree.pos()); - v.pos = tree.pos; } // where void checkType(JCTree tree, Type type, String diag) { diff -r fea486d30d41 -r 6b4d6205366c src/share/classes/com/sun/tools/javac/jvm/Gen.java --- a/src/share/classes/com/sun/tools/javac/jvm/Gen.java Thu Oct 31 12:36:36 2013 -0700 +++ b/src/share/classes/com/sun/tools/javac/jvm/Gen.java Thu Oct 31 16:46:43 2013 -0700 @@ -1652,9 +1652,10 @@ startpc, end, code.curCP(), catchType); if (subCatch.type.isAnnotated()) { - // All compounds share the same position, simply update the - // first one. - subCatch.type.getAnnotationMirrors().head.position.type_index = catchType; + for (Attribute.TypeCompound tc : + subCatch.type.getAnnotationMirrors()) { + tc.position.type_index = catchType; + } } } gaps = gaps.tail; @@ -1668,9 +1669,10 @@ startpc, endpc, code.curCP(), catchType); if (subCatch.type.isAnnotated()) { - // All compounds share the same position, simply update the - // first one. - subCatch.type.getAnnotationMirrors().head.position.type_index = catchType; + for (Attribute.TypeCompound tc : + subCatch.type.getAnnotationMirrors()) { + tc.position.type_index = catchType; + } } } } @@ -2892,7 +2894,8 @@ @Override public void visitMethodDef(JCMethodDecl tree) { - if ((tree.sym.flags() & (SYNTHETIC | GENERATEDCONSTR)) != 0) { + if ((tree.sym.flags() & (SYNTHETIC | GENERATEDCONSTR)) != 0 + && (tree.sym.flags() & LAMBDA_METHOD) == 0) { return; } if (tree.name.equals(names.clinit)) { @@ -2906,6 +2909,7 @@ return; } currentMethod = tree.sym; + super.visitMethodDef(tree); } diff -r fea486d30d41 -r 6b4d6205366c src/share/classes/com/sun/tools/javac/main/JavaCompiler.java --- a/src/share/classes/com/sun/tools/javac/main/JavaCompiler.java Thu Oct 31 12:36:36 2013 -0700 +++ b/src/share/classes/com/sun/tools/javac/main/JavaCompiler.java Thu Oct 31 16:46:43 2013 -0700 @@ -271,10 +271,6 @@ */ protected TransTypes transTypes; - /** The lambda translator. - */ - protected LambdaToMethod lambdaToMethod; - /** The syntactic sugar desweetener. */ protected Lower lower; @@ -388,8 +384,6 @@ options = Options.instance(context); - lambdaToMethod = LambdaToMethod.instance(context); - verbose = options.isSet(VERBOSE); sourceOutput = options.isSet(PRINTSOURCE); // used to be -s stubOutput = options.isSet("-stubs"); @@ -1393,6 +1387,7 @@ */ class ScanNested extends TreeScanner { Set> dependencies = new LinkedHashSet>(); + protected boolean hasLambdas; @Override public void visitClassDef(JCClassDecl node) { Type st = types.supertype(node.sym.type); @@ -1402,7 +1397,18 @@ Env stEnv = enter.getEnv(c); if (stEnv != null && env != stEnv) { if (dependencies.add(stEnv)) { - scan(stEnv.tree); + boolean prevHasLambdas = hasLambdas; + try { + scan(stEnv.tree); + } finally { + /* + * ignore any updates to hasLambdas made during + * the nested scan, this ensures an initalized + * LambdaToMethod is available only to those + * classes that contain lambdas + */ + hasLambdas = prevHasLambdas; + } } envForSuperTypeFound = true; } @@ -1410,6 +1416,16 @@ } super.visitClassDef(node); } + @Override + public void visitLambda(JCLambda tree) { + hasLambdas = true; + super.visitLambda(tree); + } + @Override + public void visitReference(JCMemberReference tree) { + hasLambdas = true; + super.visitReference(tree); + } } ScanNested scanner = new ScanNested(); scanner.scan(env.tree); @@ -1468,11 +1484,11 @@ env.tree = transTypes.translateTopLevelClass(env.tree, localMake); compileStates.put(env, CompileState.TRANSTYPES); - if (source.allowLambda()) { + if (source.allowLambda() && scanner.hasLambdas) { if (shouldStop(CompileState.UNLAMBDA)) return; - env.tree = lambdaToMethod.translateTopLevelClass(env, env.tree, localMake); + env.tree = LambdaToMethod.instance(context).translateTopLevelClass(env, env.tree, localMake); compileStates.put(env, CompileState.UNLAMBDA); } diff -r fea486d30d41 -r 6b4d6205366c src/share/classes/com/sun/tools/javac/util/JavacMessages.java --- a/src/share/classes/com/sun/tools/javac/util/JavacMessages.java Thu Oct 31 12:36:36 2013 -0700 +++ b/src/share/classes/com/sun/tools/javac/util/JavacMessages.java Thu Oct 31 16:46:43 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2011, 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 @@ -184,19 +184,19 @@ String key, Object... args) { String msg = null; - for (List l = bundles; l.nonEmpty() && msg == null; l = l.tail) { - ResourceBundle rb = l.head; - try { - msg = rb.getString(key); - } - catch (MissingResourceException e) { - // ignore, try other bundles in list - } - } - if (msg == null) { - msg = "compiler message file broken: key=" + key + - " arguments={0}, {1}, {2}, {3}, {4}, {5}, {6}, {7}"; - } - return MessageFormat.format(msg, args); + for (List l = bundles; l.nonEmpty() && msg == null; l = l.tail) { + ResourceBundle rb = l.head; + try { + msg = rb.getString(key); + } + catch (MissingResourceException e) { + // ignore, try other bundles in list + } + } + if (msg == null) { + msg = "compiler message file broken: key=" + key + + " arguments={0}, {1}, {2}, {3}, {4}, {5}, {6}, {7}"; + } + return MessageFormat.format(msg, args); } } diff -r fea486d30d41 -r 6b4d6205366c src/share/classes/com/sun/tools/javadoc/DocEnv.java --- a/src/share/classes/com/sun/tools/javadoc/DocEnv.java Thu Oct 31 12:36:36 2013 -0700 +++ b/src/share/classes/com/sun/tools/javadoc/DocEnv.java Thu Oct 31 16:46:43 2013 -0700 @@ -800,7 +800,7 @@ return result; } - void initDoclint(Collection opts) { + void initDoclint(Collection opts, Collection customTagNames) { ArrayList doclintOpts = new ArrayList(); for (String opt: opts) { @@ -814,6 +814,15 @@ return; } + String sep = ""; + StringBuilder customTags = new StringBuilder(); + for (String customTag : customTagNames) { + customTags.append(sep); + customTags.append(customTag); + sep = DocLint.TAGS_SEPARATOR; + } + doclintOpts.add(DocLint.XCUSTOM_TAGS_PREFIX + customTags.toString()); + JavacTask t = BasicJavacTask.instance(context); doclint = new DocLint(); // standard doclet normally generates H1, H2 diff -r fea486d30d41 -r 6b4d6205366c src/share/classes/com/sun/tools/javadoc/RootDocImpl.java --- a/src/share/classes/com/sun/tools/javadoc/RootDocImpl.java Thu Oct 31 12:36:36 2013 -0700 +++ b/src/share/classes/com/sun/tools/javadoc/RootDocImpl.java Thu Oct 31 16:46:43 2013 -0700 @@ -377,8 +377,8 @@ return env.fileManager; } - public void initDocLint(Collection opts) { - env.initDoclint(opts); + public void initDocLint(Collection opts, Collection customTagNames) { + env.initDoclint(opts, customTagNames); } public boolean showTagMessages() { diff -r fea486d30d41 -r 6b4d6205366c src/share/classes/com/sun/tools/jdeps/Analyzer.java --- a/src/share/classes/com/sun/tools/jdeps/Analyzer.java Thu Oct 31 12:36:36 2013 -0700 +++ b/src/share/classes/com/sun/tools/jdeps/Analyzer.java Thu Oct 31 16:46:43 2013 -0700 @@ -26,9 +26,11 @@ import com.sun.tools.classfile.Dependency.Location; import com.sun.tools.jdeps.PlatformClassPath.JDKArchive; +import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.Objects; import java.util.Set; import java.util.SortedMap; import java.util.SortedSet; @@ -52,7 +54,7 @@ private final Type type; private final Map results = new HashMap<>(); - private final Map map = new HashMap<>(); + private final Map map = new HashMap<>(); private final Archive NOT_FOUND = new Archive(JdepsTask.getMessage("artifact.not.found")); @@ -69,6 +71,17 @@ * Performs the dependency analysis on the given archives. */ public void run(List archives) { + // build a map from Location to Archive + for (Archive archive: archives) { + for (Location l: archive.getClasses()) { + if (!map.containsKey(l)) { + map.put(l, archive); + } else { + // duplicated class warning? + } + } + } + // traverse and analyze all dependencies for (Archive archive : archives) { ArchiveDeps deps; if (type == Type.CLASS || type == Type.VERBOSE) { @@ -76,33 +89,9 @@ } else { deps = new PackageVisitor(archive); } - archive.visit(deps); + archive.visitDependences(deps); results.put(archive, deps); } - - // set the required dependencies - for (ArchiveDeps result: results.values()) { - for (Set set : result.deps.values()) { - for (String target : set) { - Archive source = getArchive(target); - if (result.archive != source) { - String profile = ""; - if (source instanceof JDKArchive) { - profile = result.profile != null ? result.profile.toString() : ""; - if (result.getTargetProfile(target) == null) { - profile += ", JDK internal API"; - // override the value if it accesses any JDK internal - result.requireArchives.put(source, profile); - continue; - } - } - if (!result.requireArchives.containsKey(source)) { - result.requireArchives.put(source, profile); - } - } - } - } - } } public boolean hasDependences(Archive archive) { @@ -117,94 +106,143 @@ * Visits the source archive to its destination archive of * a recorded dependency. */ - void visitArchiveDependence(Archive origin, Archive target, String profile); + void visitArchiveDependence(Archive origin, Archive target, Profile profile); /** * Visits a recorded dependency from origin to target which can be * a fully-qualified classname, a package name, a profile or * archive name depending on the Analyzer's type. */ - void visitDependence(String origin, Archive source, String target, Archive archive, String profile); + void visitDependence(String origin, Archive source, String target, Archive archive, Profile profile); } public void visitArchiveDependences(Archive source, Visitor v) { ArchiveDeps r = results.get(source); - for (Map.Entry e : r.requireArchives.entrySet()) { - v.visitArchiveDependence(r.archive, e.getKey(), e.getValue()); + for (ArchiveDeps.Dep d: r.requireArchives()) { + v.visitArchiveDependence(r.archive, d.archive, d.profile); } } public void visitDependences(Archive source, Visitor v) { ArchiveDeps r = results.get(source); - for (String origin : r.deps.keySet()) { - for (String target : r.deps.get(origin)) { - Archive archive = getArchive(target); - assert source == getArchive(origin); - Profile profile = r.getTargetProfile(target); - + for (Map.Entry> e: r.deps.entrySet()) { + String origin = e.getKey(); + for (ArchiveDeps.Dep d: e.getValue()) { // filter intra-dependency unless in verbose mode - if (type == Type.VERBOSE || archive != source) { - v.visitDependence(origin, source, target, archive, - profile != null ? profile.toString() : ""); + if (type == Type.VERBOSE || d.archive != source) { + v.visitDependence(origin, source, d.target, d.archive, d.profile); } } } } - public Archive getArchive(String name) { - return map.containsKey(name) ? map.get(name) : NOT_FOUND; - } - + /** + * ArchiveDeps contains the dependencies for an Archive that + * can have one or more classes. + */ private abstract class ArchiveDeps implements Archive.Visitor { final Archive archive; - final Map requireArchives; - final SortedMap> deps; - Profile profile = null; + final SortedMap> deps; ArchiveDeps(Archive archive) { this.archive = archive; - this.requireArchives = new HashMap<>(); this.deps = new TreeMap<>(); } - void add(String loc) { - Archive a = map.get(loc); - if (a == null) { - map.put(loc, archive); - } else if (a != archive) { - // duplicated class warning? - } - } - - void add(String origin, String target) { - SortedSet set = deps.get(origin); + void add(String origin, String target, Archive targetArchive, String pkgName) { + SortedSet set = deps.get(origin); if (set == null) { deps.put(origin, set = new TreeSet<>()); } - if (!set.contains(target)) { - set.add(target); - // find the corresponding profile - Profile p = getTargetProfile(target); - if (profile == null || (p != null && profile.profile < p.profile)) { - profile = p; + Profile p = targetArchive instanceof JDKArchive + ? Profile.getProfile(pkgName) : null; + set.add(new Dep(target, targetArchive, p)); + } + + /** + * Returns the list of Archive dependences. The returned + * list contains one {@code Dep} instance per one archive + * and with the minimum profile this archive depends on. + */ + List requireArchives() { + Map map = new HashMap<>(); + for (Set set: deps.values()) { + for (Dep d: set) { + if (this.archive != d.archive) { + Profile p = map.get(d.archive); + if (p == null || (d.profile != null && p.profile < d.profile.profile)) { + map.put(d.archive, d.profile); + } + } } } + List list = new ArrayList<>(); + for (Map.Entry e: map.entrySet()) { + list.add(new Dep("", e.getKey(), e.getValue())); + } + return list; + } + + /** + * Dep represents a dependence where the target can be + * a classname or packagename and the archive and profile + * the target belongs to. + */ + class Dep implements Comparable { + final String target; + final Archive archive; + final Profile profile; + Dep(String target, Archive archive, Profile p) { + this.target = target; + this.archive = archive; + this.profile = p; + } + + @Override + public boolean equals(Object o) { + if (o instanceof Dep) { + Dep d = (Dep)o; + return this.archive == d.archive && this.target.equals(d.target); + } + return false; + } + + @Override + public int hashCode() { + int hash = 3; + hash = 17 * hash + Objects.hashCode(this.archive); + hash = 17 * hash + Objects.hashCode(this.target); + return hash; + } + + @Override + public int compareTo(Dep o) { + if (this.target.equals(o.target)) { + if (this.archive == o.archive) { + return 0; + } else { + return this.archive.getFileName().compareTo(o.archive.getFileName()); + } + } + return this.target.compareTo(o.target); + } } public abstract void visit(Location o, Location t); - public abstract Profile getTargetProfile(String target); } private class ClassVisitor extends ArchiveDeps { ClassVisitor(Archive archive) { super(archive); } - public void visit(Location l) { - add(l.getClassName()); - } + @Override public void visit(Location o, Location t) { - add(o.getClassName(), t.getClassName()); - } - public Profile getTargetProfile(String target) { - int i = target.lastIndexOf('.'); - return (i > 0) ? Profile.getProfile(target.substring(0, i)) : null; + Archive targetArchive = + this.archive.getClasses().contains(t) ? this.archive : map.get(t); + if (targetArchive == null) { + map.put(t, targetArchive = NOT_FOUND); + } + + String origin = o.getClassName(); + String target = t.getClassName(); + add(origin, target, targetArchive, t.getPackageName()); } } @@ -212,18 +250,21 @@ PackageVisitor(Archive archive) { super(archive); } + @Override public void visit(Location o, Location t) { - add(packageOf(o), packageOf(t)); - } - public void visit(Location l) { - add(packageOf(l)); + Archive targetArchive = + this.archive.getClasses().contains(t) ? this.archive : map.get(t); + if (targetArchive == null) { + map.put(t, targetArchive = NOT_FOUND); + } + + String origin = packageOf(o); + String target = packageOf(t); + add(origin, target, targetArchive, t.getPackageName()); } - private String packageOf(Location loc) { - String pkg = loc.getPackageName(); + public String packageOf(Location o) { + String pkg = o.getPackageName(); return pkg.isEmpty() ? "" : pkg; } - public Profile getTargetProfile(String target) { - return Profile.getProfile(target); - } } } diff -r fea486d30d41 -r 6b4d6205366c src/share/classes/com/sun/tools/jdeps/Archive.java --- a/src/share/classes/com/sun/tools/jdeps/Archive.java Thu Oct 31 12:36:36 2013 -0700 +++ b/src/share/classes/com/sun/tools/jdeps/Archive.java Thu Oct 31 16:46:43 2013 -0700 @@ -67,6 +67,7 @@ deps.put(origin, set); } } + public void addClass(Location origin, Location target) { Set set = deps.get(origin); if (set == null) { @@ -76,21 +77,27 @@ set.add(target); } - public void visit(Visitor v) { + public Set getClasses() { + return deps.keySet(); + } + + public void visitDependences(Visitor v) { for (Map.Entry> e: deps.entrySet()) { - v.visit(e.getKey()); for (Location target : e.getValue()) { v.visit(e.getKey(), target); } } } + public String getPathName() { + return path != null ? path.toString() : filename; + } + public String toString() { - return path != null ? path.toString() : filename; + return filename; } interface Visitor { - void visit(Location loc); void visit(Location origin, Location target); } } diff -r fea486d30d41 -r 6b4d6205366c src/share/classes/com/sun/tools/jdeps/JdepsTask.java --- a/src/share/classes/com/sun/tools/jdeps/JdepsTask.java Thu Oct 31 12:36:36 2013 -0700 +++ b/src/share/classes/com/sun/tools/jdeps/JdepsTask.java Thu Oct 31 16:46:43 2013 -0700 @@ -190,6 +190,11 @@ task.options.fullVersion = true; } }, + new HiddenOption(false, "-showlabel") { + void process(JdepsTask task, String opt, String arg) { + task.options.showLabel = true; + } + }, new HiddenOption(true, "-depth") { void process(JdepsTask task, String opt, String arg) throws BadArgs { try { @@ -279,12 +284,21 @@ private void generateDotFiles(Path dir, Analyzer analyzer) throws IOException { Path summary = dir.resolve("summary.dot"); - try (PrintWriter sw = new PrintWriter(Files.newOutputStream(summary)); - DotFileFormatter formatter = new DotFileFormatter(sw, "summary")) { - for (Archive archive : sourceLocations) { - analyzer.visitArchiveDependences(archive, formatter); + boolean verbose = options.verbose == Analyzer.Type.VERBOSE; + DotGraph graph = verbose ? new DotSummaryForPackage() + : new DotSummaryForArchive(); + for (Archive archive : sourceLocations) { + analyzer.visitArchiveDependences(archive, graph); + if (verbose || options.showLabel) { + // traverse detailed dependences to generate package-level + // summary or build labels for edges + analyzer.visitDependences(archive, graph); } } + try (PrintWriter sw = new PrintWriter(Files.newOutputStream(summary))) { + graph.writeTo(sw); + } + // output individual .dot file for each archive if (options.verbose != Analyzer.Type.SUMMARY) { for (Archive archive : sourceLocations) { if (analyzer.hasDependences(archive)) { @@ -365,17 +379,16 @@ } } } + sourceLocations.addAll(archives); List classpaths = new ArrayList<>(); // for class file lookup + classpaths.addAll(getClassPathArchives(options.classpath)); if (options.includePattern != null) { - archives.addAll(getClassPathArchives(options.classpath)); - } else { - classpaths.addAll(getClassPathArchives(options.classpath)); + archives.addAll(classpaths); } classpaths.addAll(PlatformClassPath.getArchives()); - // add all archives to the source locations for reporting - sourceLocations.addAll(archives); + // add all classpath archives to the source locations for reporting sourceLocations.addAll(classpaths); // Work queue of names of classfiles to be searched. @@ -557,6 +570,7 @@ boolean showSummary; boolean wildcard; boolean apiOnly; + boolean showLabel; String dotOutputDir; String classpath = ""; int depth = 1; @@ -627,16 +641,34 @@ return result; } + /** + * If the given archive is JDK archive and non-null Profile, + * this method returns the profile name only if -profile option is specified; + * a null profile indicates it accesses a private JDK API and this method + * will return "JDK internal API". + * + * For non-JDK archives, this method returns the file name of the archive. + */ + private String getProfileArchiveInfo(Archive source, Profile profile) { + if (options.showProfile && profile != null) + return profile.toString(); + + if (source instanceof JDKArchive) { + return profile == null ? "JDK internal API (" + source.getFileName() + ")" : ""; + } + return source.getFileName(); + } /** - * Returns the file name of the archive for non-JRE class or - * internal JRE classes. It returns empty string for SE API. + * Returns the profile name or "JDK internal API" for JDK archive; + * otherwise empty string. */ - private static String getArchiveName(Archive source, String profile) { - String name = source.getFileName(); - if (source instanceof JDKArchive) - return profile.isEmpty() ? "JDK internal API (" + name + ")" : ""; - return name; + private String profileName(Archive archive, Profile profile) { + if (archive instanceof JDKArchive) { + return Objects.toString(profile, "JDK internal API"); + } else { + return ""; + } } class RawOutputFormatter implements Analyzer.Visitor { @@ -648,21 +680,18 @@ private String pkg = ""; @Override public void visitDependence(String origin, Archive source, - String target, Archive archive, String profile) { + String target, Archive archive, Profile profile) { if (!origin.equals(pkg)) { pkg = origin; writer.format(" %s (%s)%n", origin, source.getFileName()); } - String name = (options.showProfile && !profile.isEmpty()) - ? profile - : getArchiveName(archive, profile); - writer.format(" -> %-50s %s%n", target, name); + writer.format(" -> %-50s %s%n", target, getProfileArchiveInfo(archive, profile)); } @Override - public void visitArchiveDependence(Archive origin, Archive target, String profile) { - writer.format("%s -> %s", origin, target); - if (options.showProfile && !profile.isEmpty()) { + public void visitArchiveDependence(Archive origin, Archive target, Profile profile) { + writer.format("%s -> %s", origin.getPathName(), target.getPathName()); + if (options.showProfile && profile != null) { writer.format(" (%s)%n", profile); } else { writer.format("%n"); @@ -670,19 +699,14 @@ } } - class DotFileFormatter implements Analyzer.Visitor, AutoCloseable { + class DotFileFormatter extends DotGraph implements AutoCloseable { private final PrintWriter writer; private final String name; - DotFileFormatter(PrintWriter writer, String name) { - this.writer = writer; - this.name = name; - writer.format("digraph \"%s\" {%n", name); - } DotFileFormatter(PrintWriter writer, Archive archive) { this.writer = writer; this.name = archive.getFileName(); writer.format("digraph \"%s\" {%n", name); - writer.format(" // Path: %s%n", archive.toString()); + writer.format(" // Path: %s%n", archive.getPathName()); } @Override @@ -690,39 +714,169 @@ writer.println("}"); } - private final Set edges = new HashSet<>(); - private String node = ""; @Override public void visitDependence(String origin, Archive source, - String target, Archive archive, String profile) { - if (!node.equals(origin)) { - edges.clear(); - node = origin; - } + String target, Archive archive, Profile profile) { // if -P option is specified, package name -> profile will // be shown and filter out multiple same edges. - if (!edges.contains(target)) { - StringBuilder sb = new StringBuilder(); - String name = options.showProfile && !profile.isEmpty() - ? profile - : getArchiveName(archive, profile); - writer.format(" %-50s -> %s;%n", - String.format("\"%s\"", origin), - name.isEmpty() ? String.format("\"%s\"", target) - : String.format("\"%s (%s)\"", target, name)); - edges.add(target); + String name = getProfileArchiveInfo(archive, profile); + writeEdge(writer, new Edge(origin, target, getProfileArchiveInfo(archive, profile))); + } + @Override + public void visitArchiveDependence(Archive origin, Archive target, Profile profile) { + throw new UnsupportedOperationException(); + } + } + + class DotSummaryForArchive extends DotGraph { + @Override + public void visitDependence(String origin, Archive source, + String target, Archive archive, Profile profile) { + Edge e = findEdge(source, archive); + assert e != null; + // add the dependency to the label if enabled and not compact1 + if (profile == Profile.COMPACT1) { + return; + } + e.addLabel(origin, target, profileName(archive, profile)); + } + @Override + public void visitArchiveDependence(Archive origin, Archive target, Profile profile) { + // add an edge with the archive's name with no tag + // so that there is only one node for each JDK archive + // while there may be edges to different profiles + Edge e = addEdge(origin, target, ""); + if (target instanceof JDKArchive) { + // add a label to print the profile + if (profile == null) { + e.addLabel("JDK internal API"); + } else if (options.showProfile && !options.showLabel) { + e.addLabel(profile.toString()); + } } } + } + // DotSummaryForPackage generates the summary.dot file for verbose mode + // (-v or -verbose option) that includes all class dependencies. + // The summary.dot file shows package-level dependencies. + class DotSummaryForPackage extends DotGraph { + private String packageOf(String cn) { + int i = cn.lastIndexOf('.'); + return i > 0 ? cn.substring(0, i) : ""; + } + @Override + public void visitDependence(String origin, Archive source, + String target, Archive archive, Profile profile) { + // add a package dependency edge + String from = packageOf(origin); + String to = packageOf(target); + Edge e = addEdge(from, to, getProfileArchiveInfo(archive, profile)); + + // add the dependency to the label if enabled and not compact1 + if (!options.showLabel || profile == Profile.COMPACT1) { + return; + } + + // trim the package name of origin to shorten the label + int i = origin.lastIndexOf('.'); + String n1 = i < 0 ? origin : origin.substring(i+1); + e.addLabel(n1, target, profileName(archive, profile)); + } @Override - public void visitArchiveDependence(Archive origin, Archive target, String profile) { - String name = options.showProfile && !profile.isEmpty() - ? profile : ""; - writer.format(" %-30s -> \"%s\";%n", - String.format("\"%s\"", origin.getFileName()), - name.isEmpty() - ? target.getFileName() - : String.format("%s (%s)", target.getFileName(), name)); + public void visitArchiveDependence(Archive origin, Archive target, Profile profile) { + // nop + } + } + abstract class DotGraph implements Analyzer.Visitor { + private final Set edges = new LinkedHashSet<>(); + private Edge curEdge; + public void writeTo(PrintWriter writer) { + writer.format("digraph \"summary\" {%n"); + for (Edge e: edges) { + writeEdge(writer, e); + } + writer.println("}"); + } + + void writeEdge(PrintWriter writer, Edge e) { + writer.format(" %-50s -> \"%s\"%s;%n", + String.format("\"%s\"", e.from.toString()), + e.tag.isEmpty() ? e.to + : String.format("%s (%s)", e.to, e.tag), + getLabel(e)); + } + + Edge addEdge(T origin, T target, String tag) { + Edge e = new Edge(origin, target, tag); + if (e.equals(curEdge)) { + return curEdge; + } + + if (edges.contains(e)) { + for (Edge e1 : edges) { + if (e.equals(e1)) { + curEdge = e1; + } + } + } else { + edges.add(e); + curEdge = e; + } + return curEdge; + } + + Edge findEdge(T origin, T target) { + for (Edge e : edges) { + if (e.from.equals(origin) && e.to.equals(target)) { + return e; + } + } + return null; + } + + String getLabel(Edge e) { + String label = e.label.toString(); + return label.isEmpty() ? "" : String.format("[label=\"%s\",fontsize=9]", label); + } + + class Edge { + final T from; + final T to; + final String tag; // optional tag + final StringBuilder label = new StringBuilder(); + Edge(T from, T to, String tag) { + this.from = from; + this.to = to; + this.tag = tag; + } + void addLabel(String s) { + label.append(s).append("\\n"); + } + void addLabel(String origin, String target, String profile) { + label.append(origin).append(" -> ").append(target); + if (!profile.isEmpty()) { + label.append(" (" + profile + ")"); + } + label.append("\\n"); + } + @Override @SuppressWarnings("unchecked") + public boolean equals(Object o) { + if (o instanceof DotGraph.Edge) { + DotGraph.Edge e = (DotGraph.Edge)o; + return this.from.equals(e.from) && + this.to.equals(e.to) && + this.tag.equals(e.tag); + } + return false; + } + @Override + public int hashCode() { + int hash = 7; + hash = 67 * hash + Objects.hashCode(this.from) + + Objects.hashCode(this.to) + Objects.hashCode(this.tag); + return hash; + } } } } diff -r fea486d30d41 -r 6b4d6205366c src/share/classes/com/sun/tools/jdeps/Profile.java --- a/src/share/classes/com/sun/tools/jdeps/Profile.java Thu Oct 31 12:36:36 2013 -0700 +++ b/src/share/classes/com/sun/tools/jdeps/Profile.java Thu Oct 31 16:46:43 2013 -0700 @@ -81,8 +81,12 @@ } static class PackageToProfile { + static String[] JAVAX_CRYPTO_PKGS = new String[] { + "javax.crypto", + "javax.crypto.interfaces", + "javax.crypto.spec" + }; static Map map = initProfiles(); - private static Map initProfiles() { try { String profilesProps = System.getProperty("jdeps.profiles"); @@ -103,6 +107,9 @@ findProfile(cf); } } + // special case for javax.crypto.* classes that are not + // included in ct.sym since they are in jce.jar + Collections.addAll(Profile.COMPACT1.packages, JAVAX_CRYPTO_PKGS); } } } catch (IOException | ConstantPoolException e) { diff -r fea486d30d41 -r 6b4d6205366c src/share/classes/javax/annotation/processing/Processor.java --- a/src/share/classes/javax/annotation/processing/Processor.java Thu Oct 31 12:36:36 2013 -0700 +++ b/src/share/classes/javax/annotation/processing/Processor.java Thu Oct 31 16:46:43 2013 -0700 @@ -209,11 +209,11 @@ *
*
SupportedOptionString: *
Identifiers - *

+ * *

Identifiers: *
Identifier *
Identifier {@code .} Identifiers - *

+ * *

Identifier: *
Syntactic identifier, including keywords and literals *
@@ -250,7 +250,7 @@ *
SupportedAnnotationTypeString: *
TypeName DotStaropt *
* - *

+ * *

DotStar: *
. * * diff -r fea486d30d41 -r 6b4d6205366c src/share/classes/jdk/Exported.java --- a/src/share/classes/jdk/Exported.java Thu Oct 31 12:36:36 2013 -0700 +++ b/src/share/classes/jdk/Exported.java Thu Oct 31 16:46:43 2013 -0700 @@ -38,7 +38,30 @@ * 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. + * programmatically distinguished. + * + *

If in one release a type or package is + * @Exported(true), in a subsequent major release such a + * type or package can transition to @Exported(false). + * + *

If a type or package is @Exported(false) in a + * release, it may be removed in a subsequent major release. + * + *

If a top-level type has an @Exported annotation, + * any nested member types with the top-level type should have an + * @Exported annotation with the same value. + * + * (In exceptional cases, if a nested type is going to be removed + * before its enclosing type, the nested type's could be + * @Exported(false) while its enclosing type was + * @Exported(true).) + * + * Likewise, if a package has an @Exported annotation, + * top-level types within that package should also have an + * @Exported annotation. + * + * Sometimes a top-level type may have a different + * @Exported value than its package. * * @since 1.8 */ diff -r fea486d30d41 -r 6b4d6205366c test/com/sun/javadoc/AuthorDD/AuthorDD.java --- a/test/com/sun/javadoc/AuthorDD/AuthorDD.java Thu Oct 31 12:36:36 2013 -0700 +++ b/test/com/sun/javadoc/AuthorDD/AuthorDD.java Thu Oct 31 16:46:43 2013 -0700 @@ -23,7 +23,7 @@ /* * @test - * @bug 4651598 + * @bug 4651598 8026567 * @summary Javadoc wrongly inserts

tags when using multiple @author tags * @author dkramer * @run main AuthorDD @@ -86,12 +86,12 @@ // Test single @since tag: - { "
Since:
"+NL+"
JDK 1.0
", + { "
Since:
"+NL+"
JDK 1.0
", BUGID + FS + "p1" + FS + "C1.html" }, // Test multiple @author tags: - { "
Author:
"+NL+"
Doug Kramer, Jamie, Neal
", + { "
Author:
"+NL+"
Doug Kramer, Jamie, Neal
", BUGID + FS + "p1" + FS + "C1.html" }, }; diff -r fea486d30d41 -r 6b4d6205366c test/com/sun/javadoc/testAnnotationTypes/TestAnnotationTypes.java --- a/test/com/sun/javadoc/testAnnotationTypes/TestAnnotationTypes.java Thu Oct 31 12:36:36 2013 -0700 +++ b/test/com/sun/javadoc/testAnnotationTypes/TestAnnotationTypes.java Thu Oct 31 16:46:43 2013 -0700 @@ -23,7 +23,7 @@ /* * @test - * @bug 4973609 8015249 8025633 + * @bug 4973609 8015249 8025633 8026567 * @summary Make sure that annotation types with 0 members does not have * extra HR tags. * @author jamieh @@ -55,7 +55,7 @@ {BUG_ID + FS + "pkg" + FS + "AnnotationTypeField.html", "

Field Summary

"}, {BUG_ID + FS + "pkg" + FS + "AnnotationTypeField.html", - "
"}, {BUG_ID + FS + "pkg" + FS + "AnnotationTypeField.html", diff -r fea486d30d41 -r 6b4d6205366c test/com/sun/javadoc/testClassCrossReferences/TestClassCrossReferences.java --- a/test/com/sun/javadoc/testClassCrossReferences/TestClassCrossReferences.java Thu Oct 31 12:36:36 2013 -0700 +++ b/test/com/sun/javadoc/testClassCrossReferences/TestClassCrossReferences.java Thu Oct 31 16:46:43 2013 -0700 @@ -23,7 +23,7 @@ /* * @test - * @bug 4652655 4857717 8025633 + * @bug 4652655 4857717 8025633 8026567 * @summary This test verifies that class cross references work properly. * @author jamieh * @library ../lib/ @@ -48,7 +48,7 @@ "Link to external member gcd"}, {BUG_ID + FS + "C.html", - "
" + NL + "
Overrides:
" + NL + + "
" + NL + "
Overrides:
" + NL + "
toString in class java.lang.Object
" + NL + "
"} }; diff -r fea486d30d41 -r 6b4d6205366c test/com/sun/javadoc/testClassTree/TestClassTree.java --- a/test/com/sun/javadoc/testClassTree/TestClassTree.java Thu Oct 31 12:36:36 2013 -0700 +++ b/test/com/sun/javadoc/testClassTree/TestClassTree.java Thu Oct 31 16:46:43 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 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 4632553 4973607 + * @bug 4632553 4973607 8026567 * @summary No need to include type name (class, interface, etc.) before * every single type in class tree. * Make sure class tree includes heirarchy for enums and annotation @@ -49,12 +49,12 @@ private static final String[][] TEST = { {BUG_ID + FS + "pkg" + FS + "package-tree.html", "" + NL + "" + NL + "" }, }; private static final String[][] NEGATED_TEST = { {BUG_ID + FS + "pkg" + FS + "package-tree.html", "
  • class pkg.ParentClass
  • "} + "title=\"class in pkg\">ParentClass"} }; /** diff -r fea486d30d41 -r 6b4d6205366c test/com/sun/javadoc/testConstructorIndent/TestConstructorIndent.java --- a/test/com/sun/javadoc/testConstructorIndent/TestConstructorIndent.java Thu Oct 31 12:36:36 2013 -0700 +++ b/test/com/sun/javadoc/testConstructorIndent/TestConstructorIndent.java Thu Oct 31 16:46:43 2013 -0700 @@ -23,7 +23,7 @@ /* * @test - * @bug 4904037 + * @bug 4904037 8026567 * @summary The constructor comments should be surrounded by *
    . Check for this in the output. * @author jamieh @@ -47,7 +47,7 @@ private static final String[][] TEST = { {BUG_ID + FS + "C.html", "
    " + "This is just a simple constructor.
    " + NL + - "
    " + NL + "
    Parameters:
    " + NL + + "
    " + NL + "
    Parameters:
    " + NL + "
    i - a param.
    " + NL +"
    " } }; diff -r fea486d30d41 -r 6b4d6205366c test/com/sun/javadoc/testCustomTag/TagTestClass.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/com/sun/javadoc/testCustomTag/TagTestClass.java Thu Oct 31 16:46:43 2013 -0700 @@ -0,0 +1,31 @@ +/* + * 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. + */ + +/** + * @customTag A custom tag. + * @unknownTag An unknown tag + */ +public class TagTestClass { + + public void method(){} +} diff -r fea486d30d41 -r 6b4d6205366c test/com/sun/javadoc/testCustomTag/TestCustomTag.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/com/sun/javadoc/testCustomTag/TestCustomTag.java Thu Oct 31 16:46:43 2013 -0700 @@ -0,0 +1,109 @@ +/* + * 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 8006248 + * @summary Test custom tag. Verify that an unknown tag generates appropriate warnings. + * @author Bhavesh Patel + * @library ../lib/ + * @build JavadocTester taglets.CustomTag TestCustomTag + * @run main TestCustomTag + */ + +public class TestCustomTag extends JavadocTester { + + //Test information. + private static final String BUG_ID = "8006248"; + + //Javadoc arguments. + private static final String[] ARGS = new String[] { + "-Xdoclint:none", "-d", BUG_ID, "-tagletpath", SRC_DIR, + "-taglet", "taglets.CustomTag", "-sourcepath", + SRC_DIR, SRC_DIR + FS + "TagTestClass.java" + }; + + private static final String[] ARGS1 = new String[] { + "-d", BUG_ID + "-1", "-tagletpath", SRC_DIR, "-taglet", "taglets.CustomTag", + "-sourcepath", SRC_DIR, SRC_DIR + FS + "TagTestClass.java" + }; + private static final String[] ARGS2 = new String[] { + "-Xdoclint:none", "-d", BUG_ID + "-2", "-sourcepath", + SRC_DIR, SRC_DIR + FS + "TagTestClass.java" + }; + + private static final String[] ARGS3 = new String[] { + "-d", BUG_ID + "-3", "-sourcepath", SRC_DIR, SRC_DIR + FS + "TagTestClass.java" + }; + + //Input for string search tests. + private static final String[][] TEST = new String[][] { + {WARNING_OUTPUT, "warning - @unknownTag is an unknown tag." + } + }; + + private static final String[][] TEST1 = new String[][] { + {ERROR_OUTPUT, "error: unknown tag: unknownTag" + } + }; + private static final String[][] TEST2 = new String[][] { + {WARNING_OUTPUT, "warning - @customTag is an unknown tag." + }, + {WARNING_OUTPUT, "warning - @unknownTag is an unknown tag." + } + }; + + private static final String[][] TEST3 = new String[][] { + {ERROR_OUTPUT, "error: unknown tag: customTag" + }, + {ERROR_OUTPUT, "error: unknown tag: unknownTag" + } + }; + + /** + * The entry point of the test. + * @param args the array of command line arguments. + */ + public static void main(String[] args) { + TestCustomTag tester = new TestCustomTag(); + run(tester, ARGS, TEST, NO_TEST); + run(tester, ARGS1, TEST1, NO_TEST); + run(tester, ARGS2, TEST2, NO_TEST); + run(tester, ARGS3, TEST3, NO_TEST); + tester.printSummary(); + } + + /** + * {@inheritDoc} + */ + public String getBugId() { + return BUG_ID; + } + + /** + * {@inheritDoc} + */ + public String getBugName() { + return getClass().getName(); + } +} diff -r fea486d30d41 -r 6b4d6205366c test/com/sun/javadoc/testCustomTag/taglets/CustomTag.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/com/sun/javadoc/testCustomTag/taglets/CustomTag.java Thu Oct 31 16:46:43 2013 -0700 @@ -0,0 +1,59 @@ +/* + * 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 taglets; + +import com.sun.tools.doclets.internal.toolkit.*; +import com.sun.tools.doclets.internal.toolkit.taglets.*; +import com.sun.tools.doclets.internal.toolkit.util.*; + +import com.sun.javadoc.*; +import java.util.*; + +public class CustomTag extends BaseTaglet { + + public CustomTag() { + name = "customTag"; + } + + public static void register(Map tagletMap) { + CustomTag tag = new CustomTag(); + Taglet t = (Taglet) tagletMap.get(tag.getName()); + if (t != null) { + tagletMap.remove(tag.getName()); + } + tagletMap.put(tag.getName(), tag); + } + + /** + * {@inheritDoc} + */ + public Content getTagletOutput(Tag tag, TagletWriter writer) { + ArrayList inlineTags = new ArrayList(); + inlineTags.add(new TextTag(tag.holder(), "
    Custom Tag:
    ")); + inlineTags.addAll(Arrays.asList(tag.inlineTags())); + inlineTags.add(new TextTag(tag.holder(), "
    ")); + return writer.commentTagsToOutput(tag, + (Tag[]) inlineTags.toArray(new Tag[] {})); + } +} diff -r fea486d30d41 -r 6b4d6205366c test/com/sun/javadoc/testDeprecatedDocs/TestDeprecatedDocs.java --- a/test/com/sun/javadoc/testDeprecatedDocs/TestDeprecatedDocs.java Thu Oct 31 12:36:36 2013 -0700 +++ b/test/com/sun/javadoc/testDeprecatedDocs/TestDeprecatedDocs.java Thu Oct 31 16:46:43 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2011, 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 4927552 + * @bug 4927552 8026567 * @summary * @author jamieh * @library ../lib/ @@ -76,20 +76,20 @@ {TARGET_FILE, "pkg.DeprecatedClassByAnnotation.field"}, {TARGET_FILE2, "
    @Deprecated" + NL +
    -                 "public class DeprecatedClassByAnnotation" + NL +
    +                 "public class DeprecatedClassByAnnotation" + NL +
                      "extends java.lang.Object
    "}, {TARGET_FILE2, "
    @Deprecated" + NL +
                      "public int field
    " + NL + - "
    Deprecated. 
    "}, + "
    Deprecated. 
    "}, {TARGET_FILE2, "
    @Deprecated" + NL +
                      "public DeprecatedClassByAnnotation()
    " + NL + - "
    Deprecated. 
    "}, + "
    Deprecated. 
    "}, {TARGET_FILE2, "
    @Deprecated" + NL +
                      "public void method()
    " + NL + - "
    Deprecated. 
    "}, + "
    Deprecated. 
    "}, }; private static final String[][] NEGATED_TEST = NO_TEST; diff -r fea486d30d41 -r 6b4d6205366c test/com/sun/javadoc/testExternalOverridenMethod/TestExternalOverridenMethod.java --- a/test/com/sun/javadoc/testExternalOverridenMethod/TestExternalOverridenMethod.java Thu Oct 31 12:36:36 2013 -0700 +++ b/test/com/sun/javadoc/testExternalOverridenMethod/TestExternalOverridenMethod.java Thu Oct 31 16:46:43 2013 -0700 @@ -23,7 +23,7 @@ /* * @test - * @bug 4857717 8025633 + * @bug 4857717 8025633 8026567 * @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. @@ -38,13 +38,13 @@ private static final String BUG_ID = "4857717"; private static final String[][] TEST = { {BUG_ID + FS + "pkg" + FS + "XReader.html", - "
    Overrides:
    " + NL + + "
    Overrides:
    " + NL + "
    read in class " + "FilterReader
    "}, {BUG_ID + FS + "pkg" + FS + "XReader.html", - "
    Specified by:
    " + NL + + "
    Specified by:
    " + NL + "
    readInt in interface " + "C4<E extends C4<E>>" + "public abstract class C4<E extends C4<E>>" }, }; private static final String[][] NEGATED_TEST = diff -r fea486d30d41 -r 6b4d6205366c test/com/sun/javadoc/testHtmlDefinitionListTag/TestHtmlDefinitionListTag.java --- a/test/com/sun/javadoc/testHtmlDefinitionListTag/TestHtmlDefinitionListTag.java Thu Oct 31 12:36:36 2013 -0700 +++ b/test/com/sun/javadoc/testHtmlDefinitionListTag/TestHtmlDefinitionListTag.java Thu Oct 31 16:46:43 2013 -0700 @@ -25,7 +25,7 @@ /* * @test - * @bug 6786690 6820360 8025633 + * @bug 6786690 6820360 8025633 8026567 * @summary This test verifies the nesting of definition list tags. * @author Bhavesh Patel * @library ../lib/ @@ -43,7 +43,7 @@ // for default value. private static final String[][] TEST_ALL = { {BUG_ID + FS + "pkg1" + FS + "C1.html", "
    public class " +
    -                 "C1" + NL +
    +                 "C1" + NL +
                      "extends java.lang.Object" + NL + "implements java.io.Serializable
    "}, {BUG_ID + FS + "pkg1" + FS + "C4.html", "
    " + NL + "
    Default:
    " + NL + "
    true
    " + NL + @@ -54,64 +54,64 @@ // enclosing comments, tags and deprecated information. private static final String[][] TEST_CMNT_DEPR = { {BUG_ID + FS + "pkg1" + FS + "package-summary.html", "
    " + NL + - "
    Since:
    " + NL + + "
    Since:
    " + NL + "
    JDK1.0
    " + NL + "
    "}, - {BUG_ID + FS + "pkg1" + FS + "C1.html", "
    " + NL + "
    Since:
    " + NL + - "
    JDK1.0
    " + NL + "
    See Also:
    " + NL + + {BUG_ID + FS + "pkg1" + FS + "C1.html", "
    " + NL + "
    Since:
    " + NL + + "
    JDK1.0
    " + NL + "
    See Also:
    " + NL + "
    " + "C2, " + NL + "" + "Serialized Form
    " + NL + "
    "}, - {BUG_ID + FS + "pkg1" + FS + "C1.html", "
    " + NL + "
    Since:
    " + NL + + {BUG_ID + FS + "pkg1" + FS + "C1.html", "
    " + NL + "
    Since:
    " + NL + "
    1.4
    " + NL + - "
    See Also:
    " + NL + "
    " + + "
    See Also:
    " + NL + "
    " + "" + "setUndecorated(boolean)
    " + NL + "
    "}, - {BUG_ID + FS + "pkg1" + FS + "C1.html", "
    "+ NL + "
    Parameters:
    " + NL + "
    title" + + {BUG_ID + FS + "pkg1" + FS + "C1.html", "
    "+ NL + "
    Parameters:
    " + NL + "
    title" + " - the title
    " + NL + "
    test - boolean value" + - "
    " + NL + "
    Throws:
    " + NL + + "
    " + NL + "
    Throws:
    " + NL + "
    java.lang.IllegalArgumentException - if the " + "owner's" + NL + " GraphicsConfiguration is not from a screen " + "device
    " + NL + "
    HeadlessException
    " + NL + "
    "}, - {BUG_ID + FS + "pkg1" + FS + "C1.html", "
    " + NL + "
    Parameters:
    " + NL + "
    undecorated" + + {BUG_ID + FS + "pkg1" + FS + "C1.html", "
    " + NL + "
    Parameters:
    " + NL + "
    undecorated" + " - true if no decorations are" + NL + " to be enabled;" + NL + " false " + - "if decorations are to be enabled.
    " + NL + "
    Since:" + + "if decorations are to be enabled.
    " + NL + "
    Since:" + "
    " + NL + "
    1.4
    " + NL + - "
    See Also:
    " + NL + "
    " + + "
    See Also:
    " + NL + "
    " + "readObject()" + "
    " + NL + "
    "}, - {BUG_ID + FS + "pkg1" + FS + "C1.html", "
    " + NL + "
    Throws:
    " + NL + - "
    java.io.IOException
    " + NL + "
    See Also:" + + {BUG_ID + FS + "pkg1" + FS + "C1.html", "
    " + NL + "
    Throws:
    " + NL + + "
    java.io.IOException
    " + NL + "
    See Also:" + "
    " + NL + "
    " + "setUndecorated(boolean)
    " + NL + "
    "}, - {BUG_ID + FS + "pkg1" + FS + "C2.html", "
    " + NL + "
    Parameters:" + - "
    " + NL + "
    set - boolean
    " + NL + "
    " + + {BUG_ID + FS + "pkg1" + FS + "C2.html", "
    " + NL + "
    Parameters:" + + "
    " + NL + "
    set - boolean
    " + NL + "
    " + "Since:
    " + NL + "
    1.4
    " + NL + "
    "}, - {BUG_ID + FS + "serialized-form.html", "
    " + NL + "
    Throws:" + + {BUG_ID + FS + "serialized-form.html", "
    " + NL + "
    Throws:" + "
    " + NL + "
    " + - "java.io.IOException
    " + NL + "
    See Also:" + + "java.io.IOException
    " + NL + "
    See Also:" + "
    " + NL + "
    " + "C1.setUndecorated(boolean)
    " + NL + "
    "}, - {BUG_ID + FS + "serialized-form.html", "Deprecated." + - " As of JDK version 1.5, replaced by" + NL + + {BUG_ID + FS + "serialized-form.html", "Deprecated." + + " As of JDK version 1.5, replaced by" + NL + " " + "setUndecorated(boolean)." + NL + "
    This field indicates whether the C1 is " + - "undecorated.
    " + NL + " " + NL + "
    " + NL + "
    Since:
    " + NL + - "
    1.4
    " + NL + "
    See Also:" + + "undecorated." + NL + " " + NL + "
    " + NL + "
    Since:
    " + NL + + "
    1.4
    " + NL + "
    See Also:" + "
    " + NL + "
    " + "C1.setUndecorated(boolean)
    " + NL + "
    "}, - {BUG_ID + FS + "serialized-form.html", "Deprecated." + - " As of JDK version 1.5, replaced by" + NL + + {BUG_ID + FS + "serialized-form.html", "Deprecated." + + " As of JDK version 1.5, replaced by" + NL + " " + "setUndecorated(boolean)." + NL + "
    Reads the object stream.
    " + NL + - "
    " + NL + "
    Throws:" + + "
    " + NL + "
    Throws:" + "
    " + NL + "
    " + "IOException
    " + NL + "
    java.io.IOException
    " + NL + "
    "}, - {BUG_ID + FS + "serialized-form.html", "Deprecated." + + {BUG_ID + FS + "serialized-form.html", "Deprecated." + " " + NL + "
    The name for this class.
    "}}; @@ -122,55 +122,55 @@ // and deprecated information. private static final String[][] TEST_NODEPR = { {BUG_ID + FS + "pkg1" + FS + "package-summary.html", "
    " + NL + - "
    Since:
    " + NL + + "
    Since:
    " + NL + "
    JDK1.0
    " + NL + "
    "}, - {BUG_ID + FS + "pkg1" + FS + "C1.html", "
    " + NL + "
    Since:" + - "
    " + NL + "
    JDK1.0
    " + NL + "
    See Also:" + + {BUG_ID + FS + "pkg1" + FS + "C1.html", "
    " + NL + "
    Since:" + + "
    " + NL + "
    JDK1.0
    " + NL + "
    See Also:" + "
    " + NL + "
    " + "C2, " + NL + "" + "Serialized Form
    " + NL + "
    "}, - {BUG_ID + FS + "pkg1" + FS + "C1.html", "
    " + NL + "
    Parameters:" + + {BUG_ID + FS + "pkg1" + FS + "C1.html", "
    " + NL + "
    Parameters:" + "
    " + NL + "
    title - the title
    " + NL + "
    " + - "test - boolean value
    " + NL + "
    Throws:" + + "test - boolean value" + NL + "
    Throws:" + "
    " + NL + "
    java.lang.IllegalArgumentException" + " - if the owner's" + NL + " GraphicsConfiguration" + " is not from a screen device
    " + NL + "
    " + "HeadlessException
    " + NL + "
    "}, - {BUG_ID + FS + "pkg1" + FS + "C1.html", "
    " + NL + "
    Parameters:" + + {BUG_ID + FS + "pkg1" + FS + "C1.html", "
    " + NL + "
    Parameters:" + "
    " + NL + "
    undecorated - true" + " if no decorations are" + NL + " to be enabled;" + NL + " false if decorations are to be enabled." + - "
    " + NL + "
    Since:
    " + NL + "
    1.4
    " + NL + - "
    See Also:
    " + NL + "
    " + + "
    " + NL + "
    Since:
    " + NL + "
    1.4
    " + NL + + "
    See Also:
    " + NL + "
    " + "readObject()
    " + NL + "
    "}, - {BUG_ID + FS + "pkg1" + FS + "C1.html", "
    " + NL + "
    Throws:" + + {BUG_ID + FS + "pkg1" + FS + "C1.html", "
    " + NL + "
    Throws:" + "
    " + NL + "
    java.io.IOException
    " + NL + "
    " + - "See Also:
    " + NL + "
    " + + "See Also:
    " + NL + "
    " + "setUndecorated(boolean)
    " + NL + "
    "}, - {BUG_ID + FS + "serialized-form.html", "
    " + NL + "
    Throws:" + + {BUG_ID + FS + "serialized-form.html", "
    " + NL + "
    Throws:" + "
    " + NL + "
    " + - "java.io.IOException
    " + NL + "
    See Also:" + + "java.io.IOException" + NL + "
    See Also:" + "
    " + NL + "
    " + "C1.setUndecorated(boolean)
    " + NL + "
    "}, - {BUG_ID + FS + "serialized-form.html", "Deprecated." + - " As of JDK version 1.5, replaced by" + NL + + {BUG_ID + FS + "serialized-form.html", "Deprecated." + + " As of JDK version 1.5, replaced by" + NL + " " + "setUndecorated(boolean)." + NL + "
    This field indicates whether the C1 is " + - "undecorated.
    " + NL + " " + NL + "
    " + NL + "
    Since:
    " + NL + - "
    1.4
    " + NL + "
    See Also:" + + "undecorated." + NL + " " + NL + "
    " + NL + "
    Since:
    " + NL + + "
    1.4
    " + NL + "
    See Also:" + "
    " + NL + "
    " + "C1.setUndecorated(boolean)
    " + NL + "
    "}, - {BUG_ID + FS + "serialized-form.html", "Deprecated." + - " As of JDK version 1.5, replaced by" + NL + + {BUG_ID + FS + "serialized-form.html", "Deprecated." + + " As of JDK version 1.5, replaced by" + NL + " " + "setUndecorated(boolean)." + NL + "
    Reads the object stream.
    " + NL + - "
    " + NL + "
    Throws:" + + "
    " + NL + "
    Throws:" + "
    " + NL + "
    " + "IOException
    " + NL + "
    java.io.IOException
    " + NL + "
    "}, - {BUG_ID + FS + "serialized-form.html", "Deprecated." + + {BUG_ID + FS + "serialized-form.html", "Deprecated." + " " + NL + "
    " + "The name for this class.
    "}}; @@ -186,12 +186,12 @@ "title=\"enum in pkg1\">C1.ModalExclusionType " + "APPLICATION_EXCLUDE" + NL + ""}, {BUG_ID + FS + "serialized-form.html", "
    boolean " +
    -                 "undecorated
    " + NL + "
    " + - "Deprecated. As of JDK version 1.5, replaced by" + NL + + "undecorated" + NL + "
    " + + "Deprecated. As of JDK version 1.5, replaced by" + NL + " " + "setUndecorated(boolean).
    " + NL + ""}, - {BUG_ID + FS + "serialized-form.html", "" + - "Deprecated. As of JDK version" + + {BUG_ID + FS + "serialized-form.html", "" + + "Deprecated. As of JDK version" + " 1.5, replaced by" + NL + " " + "setUndecorated(boolean).
    " + NL + ""}}; diff -r fea486d30d41 -r 6b4d6205366c test/com/sun/javadoc/testHtmlStrongTag/TestHtmlStrongTag.java --- a/test/com/sun/javadoc/testHtmlStrongTag/TestHtmlStrongTag.java Thu Oct 31 12:36:36 2013 -0700 +++ b/test/com/sun/javadoc/testHtmlStrongTag/TestHtmlStrongTag.java Thu Oct 31 16:46:43 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 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 @@ -25,7 +25,7 @@ /* * @test - * @bug 6786028 + * @bug 6786028 8026567 * @summary This test verifys the use of HTML tag instead of by Javadoc std doclet. * @author Bhavesh Patel * @library ../lib/ @@ -38,7 +38,7 @@ private static final String BUG_ID = "6786028"; private static final String[][] TEST1 = { - {BUG_ID + FS + "pkg1" + FS + "C1.html", "See Also:"}}; + {BUG_ID + FS + "pkg1" + FS + "C1.html", "See Also:"}}; private static final String[][] NEGATED_TEST1 = { {BUG_ID + FS + "pkg1" + FS + "C1.html", "Method Summary"}, {BUG_ID + FS + "pkg1" + FS + "C1.html", ""}, diff -r fea486d30d41 -r 6b4d6205366c test/com/sun/javadoc/testIndex/TestIndex.java --- a/test/com/sun/javadoc/testIndex/TestIndex.java Thu Oct 31 12:36:36 2013 -0700 +++ b/test/com/sun/javadoc/testIndex/TestIndex.java Thu Oct 31 16:46:43 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2012, 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 4852280 4517115 4973608 4994589 + * @bug 4852280 4517115 4973608 4994589 8026567 * @summary Perform tests on index.html file. * Also test that index-all.html has the appropriate output. * Test for unnamed package in index. @@ -53,27 +53,27 @@ //Test index-all.html {BUG_ID + FS + "index-all.html", - "C" + + "C" + " - Class in pkg"}, {BUG_ID + FS + "index-all.html", "" + - "Interface - Interface in " + + "Interface - Interface in " + "pkg"}, {BUG_ID + FS + "index-all.html", "" + - "AnnotationType - Annotation Type in " + + "AnnotationType - Annotation Type in " + "pkg"}, {BUG_ID + FS + "index-all.html", "" + - "Coin - Enum in " + + "Coin - Enum in " + "pkg"}, {BUG_ID + FS + "index-all.html", "Class in <Unnamed>"}, {BUG_ID + FS + "index-all.html", - "
    " + NL + "
    " + + "
    " + NL + "
    " + "Java - Static variable in class pkg.C
    " + NL + "
     
    " + NL + - "
    JDK " + + "
    JDK " + "- Static variable in class pkg." + "C
    " + NL + "
     
    " + NL + "
    "}, }; diff -r fea486d30d41 -r 6b4d6205366c test/com/sun/javadoc/testInterface/TestInterface.java --- a/test/com/sun/javadoc/testInterface/TestInterface.java Thu Oct 31 12:36:36 2013 -0700 +++ b/test/com/sun/javadoc/testInterface/TestInterface.java Thu Oct 31 16:46:43 2013 -0700 @@ -23,7 +23,7 @@ /* * @test - * @bug 4682448 4947464 5029946 8025633 + * @bug 4682448 4947464 5029946 8025633 8026567 * @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 @@ -83,7 +83,7 @@ }, //Make sure "Specified By" has substituted type parameters. {BUG_ID + FS + "pkg" + FS + "Child.html", - "
    Specified by:
    " + NL + + "
    Specified by:
    " + NL + "
    method" + " in interface " + "" + @@ -92,7 +92,7 @@ }, //Make sure "Overrides" has substituted type parameters. {BUG_ID + FS + "pkg" + FS + "Child.html", - "
    Overrides:
    " + NL + + "
    Overrides:
    " + NL + "
    method" + " in class Parent<See Also:
    " + NL + "
    getRate(), " + NL + + "
    See Also:
    " + NL + "
    getRate(), " + NL + "setRate(double)
    "}, {"./" + BUG_ID + "/C.html", "
    public final void setRate(double value)
    " + NL + "
    Sets the value of the property rate.
    " + NL + - "
    " + NL + "
    Property description:
    " }, + "
    " + NL + "
    Property description:
    " }, {"./" + BUG_ID + "/C.html", "
    public final double getRate()
    " + NL + "
    Gets the value of the property rate.
    " + NL + - "
    " + NL + "
    Property description:
    " }, + "
    " + NL + "
    Property description:
    " }, {"./" + BUG_ID + "/C.html", - "
    " }, + "" }, {"./" + BUG_ID + "/C.html", "

    isPaused

    " + NL + "
    public final double isPaused()
    " + NL + diff -r fea486d30d41 -r 6b4d6205366c test/com/sun/javadoc/testLegacyTaglet/Check.java --- a/test/com/sun/javadoc/testLegacyTaglet/Check.java Thu Oct 31 12:36:36 2013 -0700 +++ b/test/com/sun/javadoc/testLegacyTaglet/Check.java Thu Oct 31 16:46:43 2013 -0700 @@ -126,7 +126,7 @@ * @param tag the tag representation of this custom tag. */ public String toString(Tag tag) { - return "
    " + TAG_HEADER + ":
    " + tag.text() + + return "
    " + TAG_HEADER + ":
    " + tag.text() + "
    \n"; } diff -r fea486d30d41 -r 6b4d6205366c test/com/sun/javadoc/testLinkOption/TestLinkOption.java --- a/test/com/sun/javadoc/testLinkOption/TestLinkOption.java Thu Oct 31 12:36:36 2013 -0700 +++ b/test/com/sun/javadoc/testLinkOption/TestLinkOption.java Thu Oct 31 16:46:43 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2011, 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 4720957 5020118 + * @bug 4720957 5020118 8026567 * @summary Test to make sure that -link and -linkoffline link to * right files. * @author jamieh @@ -61,7 +61,7 @@ "Object p3)" }, {BUG_ID + "-1" + FS + "java" + FS + "lang" + FS + "StringBuilderChild.html", - "
    public abstract class StringBuilderChild" + NL +
    +                "
    public abstract class StringBuilderChild" + NL +
                     "extends Object
    " }, diff -r fea486d30d41 -r 6b4d6205366c test/com/sun/javadoc/testMemberInheritence/TestMemberInheritence.java --- a/test/com/sun/javadoc/testMemberInheritence/TestMemberInheritence.java Thu Oct 31 12:36:36 2013 -0700 +++ b/test/com/sun/javadoc/testMemberInheritence/TestMemberInheritence.java Thu Oct 31 16:46:43 2013 -0700 @@ -23,7 +23,7 @@ /* * @test - * @bug 4638588 4635809 6256068 6270645 8025633 + * @bug 4638588 4635809 6256068 6270645 8025633 8026567 * @summary Test to make sure that members are inherited properly in the Javadoc. * Verify that inheritence labels are correct. * @author jamieh @@ -72,7 +72,7 @@ // Test overriding/implementing methods with generic parameters. {BUG_ID + FS + "pkg" + FS + "BaseClass.html", - "
    " + NL + "
    Specified by:
    " + NL + + "
    " + NL + "
    Specified by:
    " + NL + "
    " + "getAnnotation in interface " + "" + diff -r fea486d30d41 -r 6b4d6205366c test/com/sun/javadoc/testMemberSummary/TestMemberSummary.java --- a/test/com/sun/javadoc/testMemberSummary/TestMemberSummary.java Thu Oct 31 12:36:36 2013 -0700 +++ b/test/com/sun/javadoc/testMemberSummary/TestMemberSummary.java Thu Oct 31 16:46:43 2013 -0700 @@ -23,7 +23,7 @@ /* * @test - * @bug 4951228 6290760 8025633 + * @bug 4951228 6290760 8025633 8026567 * @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", "PublicChild" + NL + - "
    " }, @@ -372,7 +372,7 @@ "" }, {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "Foo2.html", - "" }, @@ -401,7 +401,7 @@ " " }, {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "ParamTest.html", - "" }, @@ -456,7 +456,7 @@ "Foo3 " }, {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "Foo3.html", - "" }, @@ -500,7 +500,7 @@ " " }, {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "ParamTest2.html", - "" }, {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "ParamTest2.html", @@ -538,7 +538,7 @@ "" }, {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "Foo4.html", - "" }, @@ -586,8 +586,8 @@ "" + NL + "" + NL + "" + NL + "" + NL + "" + NL + - "" + NL + @@ -663,14 +663,14 @@ // TYPE PARAMETER IN INDEX //================================= {BUG_ID + FS + "index-all.html", - "" + + "" + "method(Vector<Object>)" }, //================================= // TYPE PARAMETER IN INDEX //================================= {BUG_ID + FS + "index-all.html", - "" + + "" + "method(Vector<Object>)" }, }; @@ -679,7 +679,7 @@ // ENUM TESTING //================================= //NO constructor section - {BUG_ID + FS + "pkg" + FS + "Coin.html", "Constructor Summary"}, + {BUG_ID + FS + "pkg" + FS + "Coin.html", "

    Constructor Summary

    "}, //================================= // TYPE PARAMETER TESTING //================================= @@ -698,25 +698,25 @@ {BUG_ID + FS + "pkg" + FS + "AnnotationTypeUsage.html", "@AnnotationTypeUndocumented(optional=\"Class Annotation\"," + NL + " required=1994)" + NL + - "public class AnnotationTypeUsage
    extends java.lang.Object
    "}, + "public class AnnotationTypeUsage
    extends java.lang.Object
    "}, //FIELD {BUG_ID + FS + "pkg" + FS + "AnnotationTypeUsage.html", "@AnnotationTypeUndocumented(optional=\"Field Annotation\"," + NL + " required=1994)" + NL + - "public int field"}, + "public int field"}, //CONSTRUCTOR {BUG_ID + FS + "pkg" + FS + "AnnotationTypeUsage.html", "@AnnotationTypeUndocumented(optional=\"Constructor Annotation\"," + NL + " required=1994)" + NL + - "public AnnotationTypeUsage()"}, + "public AnnotationTypeUsage()"}, //METHOD {BUG_ID + FS + "pkg" + FS + "AnnotationTypeUsage.html", "@AnnotationTypeUndocumented(optional=\"Method Annotation\"," + NL + " required=1994)" + NL + - "public void method()"}, + "public void method()"}, //================================= // Make sure annotation types do not diff -r fea486d30d41 -r 6b4d6205366c test/com/sun/javadoc/testOverridenMethods/TestOverridenMethodDocCopy.java --- a/test/com/sun/javadoc/testOverridenMethods/TestOverridenMethodDocCopy.java Thu Oct 31 12:36:36 2013 -0700 +++ b/test/com/sun/javadoc/testOverridenMethods/TestOverridenMethodDocCopy.java Thu Oct 31 16:46:43 2013 -0700 @@ -23,7 +23,7 @@ /* * @test - * @bug 4368820 8025633 + * @bug 4368820 8025633 8026567 * @summary Inherited comment should link directly to member, not just * class * @author jamieh @@ -46,7 +46,7 @@ //Input for string search tests. private static final String[][] TEST = { {BUG_ID + FS + "pkg1" + FS + "SubClass.html", - "Description copied from class: " + + "Description copied from class: " + "" + "BaseClass" } diff -r fea486d30d41 -r 6b4d6205366c test/com/sun/javadoc/testOverridenMethods/TestOverridenPrivateMethods.java --- a/test/com/sun/javadoc/testOverridenMethods/TestOverridenPrivateMethods.java Thu Oct 31 12:36:36 2013 -0700 +++ b/test/com/sun/javadoc/testOverridenMethods/TestOverridenPrivateMethods.java Thu Oct 31 16:46:43 2013 -0700 @@ -23,7 +23,7 @@ /* * @test - * @bug 4634891 + * @bug 4634891 8026567 * @summary Determine if overriden methods are properly documented when * -protected (default) visibility flag is used. * @author jamieh @@ -40,12 +40,12 @@ private static final String[][] TEST = { //The public method should be overriden {BUG_ID + FS + "pkg1" + FS + "SubClass.html", - "
    Overrides:
    " + NL + + "
    Overrides:
    " + NL + "
    Overrides:" + NL + + "
    Overrides:
    " + NL + "
    Overrides:" + NL + + "
    Overrides:
    " + NL + "
    Overrides:" + NL + + "
    Overrides:
    " + NL + "
    Overrides:" + NL + + "
    Overrides:
    " + NL + "
    Overrides:" + NL + + "
    Overrides:
    " + NL + "
    " + "publicMethod in class " + "BaseClass
    "}, //The public method in different package should be overriden {BUG_ID + FS + "pkg2" + FS + "SubClass.html", - "
    Overrides:
    " + NL + + "
    Overrides:
    " + NL + "
    " + "publicMethod in class " + "BaseClass
    "}, @@ -55,7 +55,7 @@ //The package private method should be overriden since the base and sub class are in the same //package. {BUG_ID + FS + "pkg1" + FS + "SubClass.html", - "
    Overrides:
    " + NL + + "
    Overrides:
    " + NL + "
    " + "packagePrivateMethod in class " + "BaseClass
    "} @@ -65,18 +65,18 @@ //The private method in should not be overriden {BUG_ID + FS + "pkg1" + FS + "SubClass.html", - "
    Overrides:
    " + NL + + "
    Overrides:
    " + NL + "
    "}, //The private method in different package should not be overriden {BUG_ID + FS + "pkg2" + FS + "SubClass.html", - "
    Overrides:
    " + NL + + "
    Overrides:
    " + NL + "
    "}, //The package private method should not be overriden since the base and sub class are in //different packages. {BUG_ID + FS + "pkg2" + FS + "SubClass.html", - "
    Overrides:
    " + NL + + "
    Overrides:
    " + NL + "
    "}, }; diff -r fea486d30d41 -r 6b4d6205366c test/com/sun/javadoc/testOverridenMethods/TestOverridenPrivateMethodsWithPrivateFlag.java --- a/test/com/sun/javadoc/testOverridenMethods/TestOverridenPrivateMethodsWithPrivateFlag.java Thu Oct 31 12:36:36 2013 -0700 +++ b/test/com/sun/javadoc/testOverridenMethods/TestOverridenPrivateMethodsWithPrivateFlag.java Thu Oct 31 16:46:43 2013 -0700 @@ -23,7 +23,7 @@ /* * @test - * @bug 4634891 + * @bug 4634891 8026567 * @summary Determine if overriden methods are properly documented when * -protected (default) visibility flag is used. * @author jamieh @@ -40,18 +40,18 @@ private static final String[][] TEST = { //The public method should be overriden {BUG_ID + FS + "pkg1" + FS + "SubClass.html", - "
    Overrides:
    " + NL + + "
    Overrides:
    " + NL + "
    Overrides:" + NL + + "
    Overrides:
    " + NL + "
    Overrides:" + NL + + "
    Overrides:
    " + NL + "
    Overrides:" + NL + + "
    Overrides:
    " + NL + "
    Overrides:" + NL + + "
    Overrides:
    " + NL + "
    Overrides:" + NL + + "
    Overrides:
    " + NL + "
    Deprecated." + NL + - "
    This package is Deprecated." + + "
    Deprecated." + NL + + "
    This package is Deprecated." + "
    " }, {BUG_ID + "-1" + FS + "deprecated-list.html", diff -r fea486d30d41 -r 6b4d6205366c test/com/sun/javadoc/testParamTaglet/TestParamTaglet.java --- a/test/com/sun/javadoc/testParamTaglet/TestParamTaglet.java Thu Oct 31 12:36:36 2013 -0700 +++ b/test/com/sun/javadoc/testParamTaglet/TestParamTaglet.java Thu Oct 31 16:46:43 2013 -0700 @@ -23,7 +23,7 @@ /* * @test - * @bug 4802275 4967243 + * @bug 4802275 4967243 8026567 * @summary Make sure param tags are still printed even though they do not * match up with a real parameters. * Make sure inheritDoc cannot be used in an invalid param tag. @@ -48,12 +48,12 @@ private static final String[][] TEST = { //Regular param tags. {BUG_ID + FS + "pkg" + FS + "C.html", - "Parameters:" + NL + "
    param1 - testing 1 2 3.
    " + + "Parameters:" + NL + "
    param1 - testing 1 2 3.
    " + NL + "
    param2 - testing 1 2 3." }, //Param tags that don't match with any real parameters. {BUG_ID + FS + "pkg" + FS + "C.html", - "Parameters:" + NL + "
    p1 - testing 1 2 3.
    " + + "Parameters:" + NL + "
    p1 - testing 1 2 3.
    " + NL + "
    p2 - testing 1 2 3." }, //{@inherit} doc misuse does not cause doclet to throw exception. diff -r fea486d30d41 -r 6b4d6205366c test/com/sun/javadoc/testPrivateClasses/TestPrivateClasses.java --- a/test/com/sun/javadoc/testPrivateClasses/TestPrivateClasses.java Thu Oct 31 12:36:36 2013 -0700 +++ b/test/com/sun/javadoc/testPrivateClasses/TestPrivateClasses.java Thu Oct 31 16:46:43 2013 -0700 @@ -23,7 +23,7 @@ /* * @test - * @bug 4780441 4874845 4978816 8014017 8016328 8025633 + * @bug 4780441 4874845 4978816 8014017 8016328 8025633 8026567 * @summary Make sure that when the -private flag is not used, members * inherited from package private class are documented in the child. * @@ -112,12 +112,12 @@ private static final String[][] NEGATED_TEST1 = { // Should not document that a method overrides method from private class. {BUG_ID + "-1" + FS + "pkg" + FS + "PublicChild.html", - "Overrides:"}, + "Overrides:"}, // Should not document that a method specified by private interface. {BUG_ID + "-1" + FS + "pkg" + FS + "PublicChild.html", - "Specified by:"}, + "Specified by:"}, {BUG_ID + "-1" + FS + "pkg" + FS + "PublicInterface.html", - "Specified by:"}, + "Specified by:"}, // Should not mention that any documentation was copied. {BUG_ID + "-1" + FS + "pkg" + FS + "PublicChild.html", "Description copied from"}, @@ -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", - "hello"}, + "hello"}, }; // Test output when -private flag is used. @@ -176,14 +176,14 @@ }, // Should document that a method overrides method from private class. {BUG_ID + "-2" + FS + "pkg" + FS + "PublicChild.html", - "
    Overrides:
    " + NL + + "
    Overrides:
    " + NL + "
    " + "methodOverridenFromParent in class " + "" + "PrivateParent
    "}, // Should document that a method is specified by private interface. {BUG_ID + "-2" + FS + "pkg" + FS + "PublicChild.html", - "
    Specified by:
    " + NL + + "
    Specified by:
    " + NL + "
    " + "methodInterface in interface " + "" + @@ -227,11 +227,11 @@ //Since private flag is used, we can document that private interface method //with generic parameters has been implemented. {BUG_ID + "-2" + FS + "pkg2" + FS + "C.html", - "Description copied from interface: " + + "Description copied from interface: " + "I"}, {BUG_ID + "-2" + FS + "pkg2" + FS + "C.html", - "
    Specified by:
    " + NL + + "
    Specified by:
    " + NL + "
    hello" + " in interface " + "I" + @@ -240,14 +240,14 @@ //Make sure when no modifier appear in the class signature, the //signature is displayed correctly without extra space at the beginning. {BUG_ID + "-2" + FS + "pkg" + FS + "PrivateParent.html", - "
    class PrivateParent"},
    +            "
    class PrivateParent"},
     
           {BUG_ID + "-2" + FS + "pkg" + FS + "PublicChild.html",
    -            "
    public class PublicChild"},
    +            "
    public class PublicChild"},
         };
         private static final String[][] NEGATED_TEST2 = {
             {BUG_ID + "-2" + FS + "pkg" + FS + "PrivateParent.html",
    -            "
     class PrivateParent"},
    +            "
     class PrivateParent"},
         };
     
         /**
    diff -r fea486d30d41 -r 6b4d6205366c test/com/sun/javadoc/testProfiles/TestProfiles.java
    --- a/test/com/sun/javadoc/testProfiles/TestProfiles.java	Thu Oct 31 12:36:36 2013 -0700
    +++ b/test/com/sun/javadoc/testProfiles/TestProfiles.java	Thu Oct 31 16:46:43 2013 -0700
    @@ -23,7 +23,7 @@
     
     /*
      * @test
    - * @bug      8006124 8009684 8016921 8023700 8024096 8008164
    + * @bug      8006124 8009684 8016921 8023700 8024096 8008164 8026567 8026770
      * @summary  Test javadoc support for profiles.
      * @author   Bhavesh Patel, Evgeniya Stepanova
      * @library  ../lib/
    @@ -85,6 +85,20 @@
                 "

    pkg2

    " }, + {PROFILE_BUG_ID + FS + "compact2-summary.html", + "
    {@code kind() } {@code name() }
    {@code @throws } {@code @throws }
    DEFAULT_NAME" + " rate" + NL + + "rate" + NL + "
    Defines the direction/speed at which the Timeline is expected to"}, {"./" + BUG_ID + "/C.html", - "Default value:"}, + "Default value:"}, {"./" + BUG_ID + "/C.html", - "Since:" + NL + "
    JavaFX 8.0
    " }, + "Since:" + NL + "
    JavaFX 8.0
    " }, {"./" + BUG_ID + "/C.html", "

    Sets the value of the property Property"}, {"./" + BUG_ID + "/C.html", "

    Gets the value of the property Property"}, {"./" + BUG_ID + "/C.html", - "Property description:"}, + "Property description:"}, {"./" + BUG_ID + "/C.html", - "

    setTestMethodProperty() setTestMethodProperty() " + + "" + "returnTypeTest()" }, // Check return type in member detail. diff -r fea486d30d41 -r 6b4d6205366c test/com/sun/javadoc/testNavigation/TestNavigation.java --- a/test/com/sun/javadoc/testNavigation/TestNavigation.java Thu Oct 31 12:36:36 2013 -0700 +++ b/test/com/sun/javadoc/testNavigation/TestNavigation.java Thu Oct 31 16:46:43 2013 -0700 @@ -23,7 +23,7 @@ /* * @test - * @bug 4131628 4664607 7025314 8023700 7198273 8025633 + * @bug 4131628 4664607 7025314 8023700 7198273 8025633 8026567 * @summary Make sure the Next/Prev Class links iterate through all types. * Make sure the navagation is 2 columns, not 3. * @author jamieh @@ -46,17 +46,17 @@ private static final String[][] TEST = { {BUG_ID + FS + "pkg" + FS + "A.html", "
  • Prev Class
  • "}, {BUG_ID + FS + "pkg" + FS + "A.html", - "Next Class"}, + "Next Class"}, {BUG_ID + FS + "pkg" + FS + "C.html", - "Prev Class"}, + "Prev Class"}, {BUG_ID + FS + "pkg" + FS + "C.html", - "Next Class"}, + "Next Class"}, {BUG_ID + FS + "pkg" + FS + "E.html", - "Prev Class"}, + "Prev Class"}, {BUG_ID + FS + "pkg" + FS + "E.html", - "Next Class"}, + "Next Class"}, {BUG_ID + FS + "pkg" + FS + "I.html", - "Prev Class"}, + "Prev Class"}, {BUG_ID + FS + "pkg" + FS + "I.html", "
  • Next Class
  • "}, // Test for 4664607 {BUG_ID + FS + "pkg" + FS + "I.html", diff -r fea486d30d41 -r 6b4d6205366c test/com/sun/javadoc/testNewLanguageFeatures/TestNewLanguageFeatures.java --- a/test/com/sun/javadoc/testNewLanguageFeatures/TestNewLanguageFeatures.java Thu Oct 31 12:36:36 2013 -0700 +++ b/test/com/sun/javadoc/testNewLanguageFeatures/TestNewLanguageFeatures.java Thu Oct 31 16:46:43 2013 -0700 @@ -23,7 +23,7 @@ /* * @test - * @bug 4789689 4905985 4927164 4827184 4993906 5004549 7025314 7010344 8025633 + * @bug 4789689 4905985 4927164 4827184 4993906 5004549 7025314 7010344 8025633 8026567 * @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. @@ -53,7 +53,7 @@ {BUG_ID + FS + "pkg" + FS + "Coin.html", "Enum Coin"}, //Make sure enum signature is correct. {BUG_ID + FS + "pkg" + FS + "Coin.html", "
    public enum " +
    -                     "Coin" + NL +
    +                     "Coin" + NL +
                          "extends java.lang.Enum<Coin>
    " }, @@ -62,7 +62,7 @@ " "}, //Detail for enum constant {BUG_ID + FS + "pkg" + FS + "Coin.html", - "Dime"}, + "Dime"}, //Automatically insert documentation for values() and valueOf(). {BUG_ID + FS + "pkg" + FS + "Coin.html", "Returns an array containing the constants of this enum type,"}, @@ -80,11 +80,11 @@ "Class TypeParameters<E>"}, //Check class type parameters section. {BUG_ID + FS + "pkg" + FS + "TypeParameters.html", - "
    Type Parameters:
    " + NL + "
    E - " + + "
    Type Parameters:
    " + NL + "
    E - " + "the type parameter for this class."}, //Type parameters in @see/@link {BUG_ID + FS + "pkg" + FS + "TypeParameters.html", - "
    " + NL + "
    See Also:
    " + NL + "
    " + + "
    " + NL + "
    See Also:
    " + NL + "
    " + "" + "TypeParameters
    " + NL + "
    "}, //Method that uses class type parameter. @@ -93,7 +93,7 @@ "parameter in TypeParameters\">E param)"}, //Method type parameter section. {BUG_ID + FS + "pkg" + FS + "TypeParameters.html", - "Type Parameters:" + NL + "
    T - This is the first " + + "Type Parameters:" + NL + "
    T - This is the first " + "type parameter.
    " + NL + "
    V - This is the second type " + "parameter."}, //Signature of method with type parameters @@ -118,7 +118,7 @@ //Signature of subclass that has type parameters. {BUG_ID + FS + "pkg" + FS + "TypeParameterSubClass.html", - "
    public class TypeParameterSubClass<T extends " +
    +                "
    public class TypeParameterSubClass<T extends " +
                     "java.lang.String>" + NL + "extends " +
                     "" +
                     "TypeParameterSuperClass<T>
    "}, @@ -168,7 +168,7 @@ "Annotation Type AnnotationType"}, //Make sure the signature is correct. {BUG_ID + FS + "pkg" + FS + "AnnotationType.html", - "public @interface AnnotationType"}, + "public @interface AnnotationType"}, //Make sure member summary headings are correct. {BUG_ID + FS + "pkg" + FS + "AnnotationType.html", "

    Required Element Summary

    "}, @@ -198,7 +198,7 @@ "optional" + "=\"Class Annotation\"," + NL + " " + - "required=1994)" + NL + "public class " + + "required=1994)" + NL + "public class " + "AnnotationTypeUsage" + NL + "extends java.lang.Object
    "}, //FIELD @@ -299,7 +299,7 @@ {BUG_ID + FS + "pkg1" + FS + "B.html", "
    @A"},
                 {BUG_ID + FS + "pkg1" + FS + "B.html",
    -                "public interface B
    "}, + "public interface B"}, //============================================================== @@ -320,7 +320,7 @@ "Foo " }, {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "Foo.html", - "
    ClassUseTest1<T extends " + "Foo" + " & " + @@ -333,8 +333,8 @@ "pkg2\">Foo " }, {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "Foo.html", - "ClassUseTest1." + - "ClassUseTest1." + + "method" + "(T t) ClassUseTest1<T extends " + "Foo" + " & " + @@ -386,8 +386,8 @@ "" }, {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "Foo2.html", - "" + - "ClassUseTest1." + + "ClassUseTest1.method" + "(T t) ClassUseTest2<T extends " + "" + "ParamTest<" + @@ -415,8 +415,8 @@ " " }, {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "ParamTest.html", - "ClassUseTest2." + - "ClassUseTest2." + + "method" + "(T t) ClassUseTest2<T extends " + "" + "ParamTest<" + @@ -470,8 +470,8 @@ "" }, {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "Foo3.html", - "ClassUseTest2." + - "ClassUseTest2." + + "method" + "(T t) ClassUseTest3<T extends " + "" + "ParamTest2<java.util.List<? extends " + @@ -515,8 +515,8 @@ " " }, {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "ParamTest2.html", - "ClassUseTest3" + - ".ClassUseTest3" + + ".method(T t) ClassUseTest3<T extends " + "" + "ParamTest2<java.util.List<? extends " + @@ -552,8 +552,8 @@ "pkg2\">Foo4 " }, {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "Foo4.html", - "ClassUseTest3." + - "ClassUseTest3." + + "method(T t)" + " Method and Description
    voidClassUseTest3." + - "ClassUseTest3." + + "method(java." + "util.Set<Foo4> p) 
    " + }, + {PROFILE_BUG_ID + FS + "compact2-summary.html", + "
    " + }, // Tests for profileName-package-summary.html listing the summary for a // package in a profile. {PROFILE_BUG_ID + FS + "pkg5" + FS + "compact3-package-summary.html", @@ -94,6 +108,12 @@ {PROFILE_BUG_ID + FS + "pkg5" + FS + "compact3-package-summary.html", "
    compact3
    " }, + {PROFILE_BUG_ID + FS + "pkg5" + FS + "compact3-package-summary.html", + "
      " + NL + "
    • " + NL + + "
    " + }, //Test for "overview-frame.html" showing the "All Profiles" link. {PROFILE_BUG_ID + FS + "overview-frame.html", "" + "pkg2.Class1Pkg2" - + NL +"
    Class1Pkg2. This class is deprecated
    " + + NL +"
    Class1Pkg2. This class is deprecated
    " }, //Test deprecated package in profile {PROFILE_BUG_ID + FS + "deprecated-list.html","
    " + "pkgDeprecated" - + NL +"
    This package is Deprecated." + + NL +"
    This package is Deprecated." + " Use pkg1.
    " }, {PROFILE_BUG_ID + FS + "pkgDeprecated" + FS + "package-summary.html", - "
    Deprecated." - + NL + "
    This package is Deprecated." + "
    Deprecated." + + NL + "
    This package is Deprecated." + " Use pkg1.
    " }, // need to add teststring when JDK-8015496 will be fixed @@ -171,6 +191,21 @@ + "target=\"classFrame\">Anno1Pkg4" }, {PROFILE_BUG_ID + FS + "compact1-summary.html","
  • Use
  • " + }, + {PROFILE_BUG_ID + FS + "compact2-summary.html", + "
      " + NL + "
    • " + NL + + "

      " + + "pkg2

      " + NL + "
    • " + NL + + "" + }, + {PROFILE_BUG_ID + FS + "pkg5" + FS + "compact3-package-summary.html", + "
        " + NL + "
      • " + NL + + "
      • " + NL + + "
      " } }; private static final String[][] PACKAGES_TEST = { diff -r fea486d30d41 -r 6b4d6205366c test/com/sun/javadoc/testProfiles/TestProfilesConfiguration.java --- a/test/com/sun/javadoc/testProfiles/TestProfilesConfiguration.java Thu Oct 31 12:36:36 2013 -0700 +++ b/test/com/sun/javadoc/testProfiles/TestProfilesConfiguration.java Thu Oct 31 16:46:43 2013 -0700 @@ -23,7 +23,7 @@ /* * @test - * @bug 8006124 8009684 8015663 8015496 + * @bug 8006124 8009684 8015663 8015496 8026567 * @summary Test javadoc options support for profiles. * @author Evgeniya Stepanova * @library ../lib/ @@ -87,7 +87,7 @@ {PROFILE_CONFIGURATION_BUG_ID + FS + "compact1-summary.html", "

      pkgDeprecated

      " + NL + "
      " + - "Deprecated.
      " + "Deprecated." } }; private static final String[][] PROFILES_CONFIGURATION_NEGATED_TEST = { diff -r fea486d30d41 -r 6b4d6205366c test/com/sun/javadoc/testSerializedFormDeprecationInfo/TestSerializedFormDeprecationInfo.java --- a/test/com/sun/javadoc/testSerializedFormDeprecationInfo/TestSerializedFormDeprecationInfo.java Thu Oct 31 12:36:36 2013 -0700 +++ b/test/com/sun/javadoc/testSerializedFormDeprecationInfo/TestSerializedFormDeprecationInfo.java Thu Oct 31 16:46:43 2013 -0700 @@ -25,7 +25,7 @@ /* * @test - * @bug 6802694 8025633 + * @bug 6802694 8025633 8026567 * @summary This test verifies deprecation info in serialized-form.html. * @author Bhavesh Patel * @library ../lib/ @@ -42,29 +42,29 @@ // display the inline comments, tags and deprecation information if any. private static final String[][] TEST_CMNT_DEPR = { {BUG_ID + FS + "serialized-form.html", "
      " + NL + - "
      Throws:
      " + NL + "
      " + - "java.io.IOException
      "+ NL + "
      See Also:" + + "
      Throws:
      " + NL + "
      " + + "java.io.IOException
      "+ NL + "
      See Also:" + "
      " + NL + "
      " + "C1.setUndecorated(boolean)
      " + NL + "
      "}, - {BUG_ID + FS + "serialized-form.html", "Deprecated." + - " As of JDK version 1.5, replaced by" + NL + + {BUG_ID + FS + "serialized-form.html", "Deprecated." + + " As of JDK version 1.5, replaced by" + NL + " " + "setUndecorated(boolean)." + NL + "
      This field indicates whether the C1 " + "is undecorated.
      " + NL + " " + NL + - "
      " + NL + "
      Since:
      " + NL + - "
      1.4
      " + NL + "
      See Also:" + + "
      " + NL + "
      Since:
      " + NL + + "
      1.4
      " + NL + "
      See Also:" + "
      " + NL + "
      " + "C1.setUndecorated(boolean)
      " + NL + "
      "}, - {BUG_ID + FS + "serialized-form.html", "Deprecated." + - " As of JDK version 1.5, replaced by" + NL + + {BUG_ID + FS + "serialized-form.html", "Deprecated." + + " As of JDK version 1.5, replaced by" + NL + " " + "setUndecorated(boolean)." + NL + "
      Reads the object stream.
      " + NL + - "
      " + NL + "
      Throws:
      " + NL + "
      " + + "
      " + NL + "
      Throws:
      " + NL + "
      " + "IOException
      " + NL + "
      java.io.IOException
      " + NL + "
      "}, - {BUG_ID + FS + "serialized-form.html", "Deprecated." + + {BUG_ID + FS + "serialized-form.html", "Deprecated." + " " + NL + "
      " + "The name for this class.
      "}}; @@ -73,12 +73,12 @@ // information if any. private static final String[][] TEST_NOCMNT = { {BUG_ID + FS + "serialized-form.html", "
      boolean undecorated
      " + NL + - "
      Deprecated. " + + "
      Deprecated. " + "As of JDK version 1.5, replaced by" + NL + " " + "setUndecorated(boolean).
      " + NL + ""}, - {BUG_ID + FS + "serialized-form.html", "" + - "Deprecated. As of JDK version" + + {BUG_ID + FS + "serialized-form.html", "" + + "Deprecated. As of JDK version" + " 1.5, replaced by" + NL + " " + "setUndecorated(boolean).
      " + NL + ""}}; diff -r fea486d30d41 -r 6b4d6205366c test/com/sun/javadoc/testSimpleTag/TestSimpleTag.java --- a/test/com/sun/javadoc/testSimpleTag/TestSimpleTag.java Thu Oct 31 12:36:36 2013 -0700 +++ b/test/com/sun/javadoc/testSimpleTag/TestSimpleTag.java Thu Oct 31 16:46:43 2013 -0700 @@ -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 4695326 4750173 4920381 + * @bug 4695326 4750173 4920381 8026567 * @summary Test the declarartion of simple tags using -tag. Verify that * "-tag name" is a shortcut for "-tag name:a:Name:". Also verity that * you can escape the ":" character with a back slash so that it is not @@ -42,13 +42,13 @@ private static final String[][] TEST = new String[][] { {"./" + BUG_ID + "/C.html", - "Todo:"}, + "Todo:"}, {"./" + BUG_ID + "/C.html", - "EJB Beans:"}, + "EJB Beans:"}, {"./" + BUG_ID + "/C.html", - "Regular Tag:"}, + "Regular Tag:"}, {"./" + BUG_ID + "/C.html", - "Back-Slash-Tag:"}, + "Back-Slash-Tag:"}, }; private static final String[] ARGS = new String[] { diff -r fea486d30d41 -r 6b4d6205366c test/com/sun/javadoc/testSimpleTagInherit/TestSimpleTagInherit.java --- a/test/com/sun/javadoc/testSimpleTagInherit/TestSimpleTagInherit.java Thu Oct 31 12:36:36 2013 -0700 +++ b/test/com/sun/javadoc/testSimpleTagInherit/TestSimpleTagInherit.java Thu Oct 31 16:46:43 2013 -0700 @@ -23,7 +23,7 @@ /* * @test - * @bug 8008768 + * @bug 8008768 8026567 * @summary Using {@inheritDoc} in simple tag defined via -tag fails * @library ../lib/ * @build JavadocTester TestSimpleTagInherit @@ -46,10 +46,10 @@ //Input for string search tests. private static final String[][] TEST = { { BUG_ID + FS + "p" + FS + "TestClass.html", - "
      Custom:
      " + NL + + "
      Custom:
      " + NL + "
      doc for BaseClass class
      " }, { BUG_ID + FS + "p" + FS + "TestClass.html", - "
      Custom:
      " + NL + + "
      Custom:
      " + NL + "
      doc for BaseClass method
      " } }; private static final String[][] NEGATED_TEST = NO_TEST; diff -r fea486d30d41 -r 6b4d6205366c test/com/sun/javadoc/testSinceTag/TestSinceTag.java --- a/test/com/sun/javadoc/testSinceTag/TestSinceTag.java Thu Oct 31 12:36:36 2013 -0700 +++ b/test/com/sun/javadoc/testSinceTag/TestSinceTag.java Thu Oct 31 16:46:43 2013 -0700 @@ -23,7 +23,7 @@ /* * @test - * @bug 7180906 + * @bug 7180906 8026567 * @summary Test to make sure that the since tag works correctly * @author Bhavesh Patel * @library ../lib/ @@ -48,11 +48,11 @@ //Input for string search tests. private static final String[][] TEST = { {BUG_ID + FS + "pkg1" + FS + "C1.html", - "
      " + NL + "
      Since:
      " + NL + + "
      " + NL + "
      Since:
      " + NL + "
      JDK1.0
      " }, {BUG_ID + FS + "serialized-form.html", - "
      " + NL + "
      Since:
      " + NL + + "
      " + NL + "
      Since:
      " + NL + "
      1.4
      " } }; diff -r fea486d30d41 -r 6b4d6205366c test/com/sun/javadoc/testTagOutput/TestTagOutput.java --- a/test/com/sun/javadoc/testTagOutput/TestTagOutput.java Thu Oct 31 12:36:36 2013 -0700 +++ b/test/com/sun/javadoc/testTagOutput/TestTagOutput.java Thu Oct 31 16:46:43 2013 -0700 @@ -25,7 +25,7 @@ /* * @test - * @bug 8026370 + * @bug 8026370 8026567 * @summary This test checks the generated tag output. * @author Bhavesh Patel * @library ../lib/ @@ -38,15 +38,15 @@ private static final String BUG_ID = "8026370"; private static final String[][] TEST = { {BUG_ID + FS + "pkg1" + FS + "DeprecatedTag.html", - "
      Deprecated. 
      "}, + "
      Deprecated. 
      "}, {BUG_ID + FS + "pkg1" + FS + "DeprecatedTag.html", - "
      Deprecated. " + - "Do not use this.
      "}}; + "
      Deprecated. " + + "Do not use this.
      "}}; private static final String[][] NEGATED_TEST = { {BUG_ID + FS + "pkg1" + FS + "DeprecatedTag.html", - "
      Deprecated." + - " 
      "}}; + "
      Deprecated." + + " 
      "}}; private static final String[] ARGS = new String[] { diff -r fea486d30d41 -r 6b4d6205366c test/com/sun/javadoc/testTaglets/TestTaglets.java --- a/test/com/sun/javadoc/testTaglets/TestTaglets.java Thu Oct 31 12:36:36 2013 -0700 +++ b/test/com/sun/javadoc/testTaglets/TestTaglets.java Thu Oct 31 16:46:43 2013 -0700 @@ -55,7 +55,7 @@ //Input for string search tests. private static final String[][] TEST_4654308 = new String[][] { - {"4654308" + FS + "C.html", "Foo:
      " + + {"4654308" + FS + "C.html", "Foo:" + "
      my only method is here" + "
      "} }; diff -r fea486d30d41 -r 6b4d6205366c test/com/sun/javadoc/testTaglets/taglets/Foo.java --- a/test/com/sun/javadoc/testTaglets/taglets/Foo.java Thu Oct 31 12:36:36 2013 -0700 +++ b/test/com/sun/javadoc/testTaglets/taglets/Foo.java Thu Oct 31 16:46:43 2013 -0700 @@ -50,7 +50,7 @@ */ public Content getTagletOutput(Tag tag, TagletWriter writer) { ArrayList inlineTags = new ArrayList(); - inlineTags.add(new TextTag(tag.holder(), "
      Foo:
      ")); + inlineTags.add(new TextTag(tag.holder(), "
      Foo:
      ")); inlineTags.addAll(Arrays.asList(tag.inlineTags())); inlineTags.add(new TextTag(tag.holder(), "
      ")); return writer.commentTagsToOutput(tag, diff -r fea486d30d41 -r 6b4d6205366c test/com/sun/javadoc/testThrowsHead/TestThrowsHead.java --- a/test/com/sun/javadoc/testThrowsHead/TestThrowsHead.java Thu Oct 31 12:36:36 2013 -0700 +++ b/test/com/sun/javadoc/testThrowsHead/TestThrowsHead.java Thu Oct 31 16:46:43 2013 -0700 @@ -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 4530727 + * @bug 4530727 8026567 * @summary When an exception is declared in the method signature but * not documented with a throws tag, we generate a link to it in the * throws section. Make sure that the link is below a Throws heading. @@ -38,7 +38,7 @@ private static final String BUG_ID = "4530727"; private static final String[][] TEST = { - {BUG_ID + FS + "C.html", "
      Throws:"} + {BUG_ID + FS + "C.html", "
      Throws:"} }; private static final String[][] NEGATED_TEST = NO_TEST; private static final String[] ARGS = new String[] { diff -r fea486d30d41 -r 6b4d6205366c test/com/sun/javadoc/testTypeAnnotations/TestTypeAnnotations.java --- a/test/com/sun/javadoc/testTypeAnnotations/TestTypeAnnotations.java Thu Oct 31 12:36:36 2013 -0700 +++ b/test/com/sun/javadoc/testTypeAnnotations/TestTypeAnnotations.java Thu Oct 31 16:46:43 2013 -0700 @@ -23,7 +23,7 @@ /* * @test - * @bug 8005091 8009686 8025633 + * @bug 8005091 8009686 8025633 8026567 * @summary Make sure that type annotations are displayed correctly * @author Bhavesh Patel * @library ../lib/ @@ -74,12 +74,12 @@ // Test for type annotations on Class Parameters (ClassParameters.java). {BUG_ID + FS + "typeannos" + FS + "ExtendsBound.html", - "class ExtendsBound<K extends ExtendsBound<K extends @ClassParamA java.lang.String>" }, {BUG_ID + FS + "typeannos" + FS + "ExtendsGeneric.html", - "
      class ExtendsGeneric<K extends " +
      +            "
      class ExtendsGeneric<K extends " +
                   "@ClassParamA Unannotated< java.lang.String>>"
               },
               {BUG_ID + FS + "typeannos" + FS + "TwoBounds.html",
      -            "
      class TwoBounds<K extends class TwoBounds<K extends " +
                   "@ClassParamA java.lang.String,V extends @ClassParamB" +
                   " java.lang.String>"
               },
               {BUG_ID + FS + "typeannos" + FS + "Complex1.html",
      -            "class Complex1<K extends Complex1<K extends " +
                   "@ClassParamA java.lang.String & java.lang.Runnable>"
               },
               {BUG_ID + FS + "typeannos" + FS + "Complex2.html",
      -            "class Complex2<K extends java.lang." +
      +            "class Complex2<K extends java.lang." +
                   "String & @ClassParamB java.lang.Runnable>"
               },
               {BUG_ID + FS + "typeannos" + FS + "ComplexBoth.html",
      -            "class ComplexBoth<K extends ComplexBoth<K extends @ClassParamA java.lang.String & @ClassParamA" +
      diff -r fea486d30d41 -r 6b4d6205366c test/com/sun/javadoc/testValueTag/TestValueTag.java
      --- a/test/com/sun/javadoc/testValueTag/TestValueTag.java	Thu Oct 31 12:36:36 2013 -0700
      +++ b/test/com/sun/javadoc/testValueTag/TestValueTag.java	Thu Oct 31 16:46:43 2013 -0700
      @@ -23,7 +23,7 @@
       
       /*
        * @test
      - * @bug      4764045 8004825
      + * @bug      4764045 8004825 8026567
        * @summary  This test ensures that the value tag works in all
        * use cases. The explainations for each test case are written below.
        * @author   jamieh
      @@ -94,7 +94,7 @@
                   "Result: \"Test 17 passes\""},
               //Test @value tag used with custom tag.
               {BUG_ID + FS + "pkg1" + FS + "CustomTagUsage.html",
      -            "
      Todo:
      " + NL + + "
      Todo:
      " + NL + "
      the value of this constant is 55.
      "}, //Test @value errors printed dues to invalid use or when used with //non-constant or with bad references. diff -r fea486d30d41 -r 6b4d6205366c test/tools/doclint/CustomTagTest.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/doclint/CustomTagTest.java Thu Oct 31 16:46:43 2013 -0700 @@ -0,0 +1,19 @@ +/* + * @test /nodynamiccopyright/ + * @bug 8006248 + * @summary DocLint should report unknown tags + * @build DocLintTester + * @run main DocLintTester CustomTagTest.java + * @run main DocLintTester -XcustomTags: -ref CustomTagTest.out CustomTagTest.java + * @run main DocLintTester -XcustomTags:customTag -ref CustomTagTestWithOption.out CustomTagTest.java + * @run main DocLintTester -XcustomTags:customTag,anotherCustomTag -ref CustomTagTestWithOption.out CustomTagTest.java + * @author bpatel + */ + +/** + * @customTag Text for a custom tag. + * @unknownTag Text for an unknown tag. + */ +public class CustomTagTest { +} + diff -r fea486d30d41 -r 6b4d6205366c test/tools/doclint/CustomTagTest.out --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/doclint/CustomTagTest.out Thu Oct 31 16:46:43 2013 -0700 @@ -0,0 +1,8 @@ +CustomTagTest.java:14: error: unknown tag: customTag + * @customTag Text for a custom tag. + ^ +CustomTagTest.java:15: error: unknown tag: unknownTag + * @unknownTag Text for an unknown tag. + ^ +2 errors + diff -r fea486d30d41 -r 6b4d6205366c test/tools/doclint/CustomTagTestWithOption.out --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/doclint/CustomTagTestWithOption.out Thu Oct 31 16:46:43 2013 -0700 @@ -0,0 +1,5 @@ +CustomTagTest.java:15: error: unknown tag: unknownTag + * @unknownTag Text for an unknown tag. + ^ +1 error + diff -r fea486d30d41 -r 6b4d6205366c test/tools/doclint/DocLintTester.java --- a/test/tools/doclint/DocLintTester.java Thu Oct 31 12:36:36 2013 -0700 +++ b/test/tools/doclint/DocLintTester.java Thu Oct 31 16:46:43 2013 -0700 @@ -58,6 +58,8 @@ badArgs = true; } else if (arg.startsWith("-Xmsgs")) { opts.add(arg); + } else if (arg.startsWith("-XcustomTags")) { + opts.add(arg); } else if (arg.startsWith("-")) { opts.add(arg); if (i < args.length - 1 && !args[i+1].startsWith("-")) diff -r fea486d30d41 -r 6b4d6205366c test/tools/javac/ExtDirs/ExtDirTest.java --- a/test/tools/javac/ExtDirs/ExtDirTest.java Thu Oct 31 12:36:36 2013 -0700 +++ b/test/tools/javac/ExtDirs/ExtDirTest.java Thu Oct 31 16:46:43 2013 -0700 @@ -112,11 +112,6 @@ } void createJars() throws Exception { - -// for i in 1 2 3; do -// if test ! -d ext${i}; then mkdir ext${i}; fi -// cp ${TESTSRC}${FS}ext${i}${FS}*.jar ext${i} -// done sun.tools.jar.Main jarGenerator = new sun.tools.jar.Main(System.out, System.err, "jar"); @@ -155,19 +150,19 @@ void compileWithExtDirs() throws Exception { -//"$javac" ${TESTTOOLVMOPTS} -d . -extdirs ext1 "${TESTSRC}${FS}ExtDirTest_1.java" +//javac -extdirs ext1 ExtDirTest_1.java ToolBox.JavaToolArgs params = new ToolBox.JavaToolArgs() .setOptions("-d", ".", "-extdirs", "ext1") .setSources(ExtDirTest_1Src); ToolBox.javac(params); -//"$javac" ${TESTTOOLVMOPTS} -d . -extdirs ext1${PS}ext2 "${TESTSRC}${FS}ExtDirTest_2.java" +//javac -extdirs ext1:ext2 ExtDirTest_2.java params.setOptions("-d", ".", "-extdirs", "ext1" + File.pathSeparator + "ext2") .setSources(ExtDirTest_2Src); ToolBox.javac(params); -//"$javac" ${TESTTOOLVMOPTS} -d . -extdirs ext3 "${TESTSRC}${FS}ExtDirTest_3.java" +//javac -extdirs ext3 ExtDirTest_3.java params.setOptions("-d", ".", "-extdirs", "ext3") .setSources(ExtDirTest_3Src); ToolBox.javac(params); diff -r fea486d30d41 -r 6b4d6205366c test/tools/javac/ExtDirs/ext1/pkg1.jar Binary file test/tools/javac/ExtDirs/ext1/pkg1.jar has changed diff -r fea486d30d41 -r 6b4d6205366c test/tools/javac/ExtDirs/ext2/pkg2.jar Binary file test/tools/javac/ExtDirs/ext2/pkg2.jar has changed diff -r fea486d30d41 -r 6b4d6205366c test/tools/javac/ExtDirs/ext3/pkg1.jar Binary file test/tools/javac/ExtDirs/ext3/pkg1.jar has changed diff -r fea486d30d41 -r 6b4d6205366c test/tools/javac/ExtDirs/ext3/pkg2.jar Binary file test/tools/javac/ExtDirs/ext3/pkg2.jar has changed diff -r fea486d30d41 -r 6b4d6205366c test/tools/javac/MethodParameters/LambdaTest.out --- a/test/tools/javac/MethodParameters/LambdaTest.out Thu Oct 31 12:36:36 2013 -0700 +++ b/test/tools/javac/MethodParameters/LambdaTest.out Thu Oct 31 16:46:43 2013 -0700 @@ -1,7 +1,7 @@ class LambdaTest -- LambdaTest.() LambdaTest.foo(i) -LambdaTest.lambda$1(arg0, arg1)/*synthetic*/ -LambdaTest.lambda$0(arg0)/*synthetic*/ +LambdaTest.lambda$static$1(arg0)/*synthetic*/ +LambdaTest.lambda$null$0(arg0, arg1)/*synthetic*/ static interface LambdaTest$I -- inner -LambdaTest$I.m(x) \ No newline at end of file +LambdaTest$I.m(x) diff -r fea486d30d41 -r 6b4d6205366c test/tools/javac/MethodParameters/Tester.java --- a/test/tools/javac/MethodParameters/Tester.java Thu Oct 31 12:36:36 2013 -0700 +++ b/test/tools/javac/MethodParameters/Tester.java Thu Oct 31 16:46:43 2013 -0700 @@ -27,7 +27,6 @@ import java.nio.file.Files; import java.util.ArrayList; import java.util.Arrays; -import java.util.Collections; import java.util.List; /** @@ -152,14 +151,14 @@ throws FileNotFoundException, IOException { List refFileList = Files.readAllLines(refFile.toPath(), StandardCharsets.UTF_8); - List sbList = Arrays.asList(sb.split(System.getProperty("line.separator"))); + List sbList = Arrays.asList(sb.split("[\r\n]+")); // Check if test output contains unexpected lines or is missing expected lines. - List sbOnly = new ArrayList(sbList); + List sbOnly = new ArrayList<>(sbList); sbOnly.removeAll(refFileList); for (String line: sbOnly) error("unexpected line found: " + line); - List refOnly = new ArrayList(refFileList); + List refOnly = new ArrayList<>(refFileList); refOnly.removeAll(sbList); for (String line: refOnly) error("expected line not found: " + line); diff -r fea486d30d41 -r 6b4d6205366c test/tools/javac/T8019486/WrongLNTForLambdaTest.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/T8019486/WrongLNTForLambdaTest.java Thu Oct 31 16:46:43 2013 -0700 @@ -0,0 +1,160 @@ +/* + * 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. + */ + +/* + * @test + * @bug 8019486 8026861 + * @summary javac, generates erroneous LVT for a test case with lambda code + * @library /tools/javac/lib + * @build ToolBox + * @run main WrongLNTForLambdaTest + */ + +import java.io.File; +import java.nio.file.Paths; + +import com.sun.tools.classfile.ClassFile; +import com.sun.tools.classfile.Code_attribute; +import com.sun.tools.classfile.LineNumberTable_attribute; +import com.sun.tools.classfile.Method; +import com.sun.tools.javac.util.Assert; + +public class WrongLNTForLambdaTest { + + static final String testSource = + /* 01 */ "import java.util.List;\n" + + /* 02 */ "import java.util.Arrays;\n" + + /* 03 */ "import java.util.stream.Collectors;\n" + + /* 04 */ "\n" + + /* 05 */ "public class Foo {\n" + + /* 06 */ " void bar(int value) {\n" + + /* 07 */ " final List numbers = Arrays.asList(1, 2, 3);\n" + + /* 08 */ " final List numbersPlusOne = \n" + + /* 09 */ " numbers.stream().map(number -> number / 1).collect(Collectors.toList());\n" + + /* 10 */ " }\n" + + /* 11 */ " void variablesInLambdas(int value) {\n" + + /* 12 */ " Runnable r1 = () -> {\n" + + /* 13 */ " int i = value;\n" + + /* 14 */ " class FooBar {\n" + + /* 15 */ " public void run() {\n" + + /* 16 */ " T t = null;\n" + + /* 17 */ " }\n" + + /* 18 */ " }\n" + + /* 19 */ " };\n" + + /* 20 */ " Runnable r2 = () -> System.err.println(1);\n" + + /* 21 */ " Runnable r3 = (Runnable & java.io.Serializable) this::foo;\n" + + /* 22 */ " Runnable r4 = super :: notify;\n" + + /* 23 */ " }\n" + + /* 24 */ " private void foo() {}\n" + + /* 25 */ "}"; + + static final int[][] simpleLambdaExpectedLNT = { + // {line-number, start-pc}, + {9, 0}, //number -> number / 1 + }; + + static final int[][] lambdaWithVarsExpectedLNT = { + // {line-number, start-pc}, + {13, 0}, //number -> number / 1 + {19, 2}, //number -> number / 1 + }; + + static final int[][] insideLambdaWithVarsExpectedLNT = { + // {line-number, start-pc}, + {16, 0}, //number -> number / 1 + {17, 2}, //number -> number / 1 + }; + + static final int[][] lambdaVoid2VoidExpectedLNT = { + // {line-number, start-pc}, + {20, 0}, //number -> number / 1 + }; + + static final int[][] deserializeExpectedLNT = { + // {line-number, start-pc}, + {05, 0}, //number -> number / 1 + }; + + static final int[][] lambdaBridgeExpectedLNT = { + // {line-number, start-pc}, + {22, 0}, //number -> number / 1 + }; + + public static void main(String[] args) throws Exception { + new WrongLNTForLambdaTest().run(); + } + + void run() throws Exception { + compileTestClass(); + checkClassFile(new File(Paths.get(System.getProperty("user.dir"), + "Foo.class").toUri()), "lambda$bar$0", simpleLambdaExpectedLNT); + checkClassFile(new File(Paths.get(System.getProperty("user.dir"), + "Foo.class").toUri()), "lambda$variablesInLambdas$1", lambdaWithVarsExpectedLNT); + checkClassFile(new File(Paths.get(System.getProperty("user.dir"), + "Foo$1FooBar.class").toUri()), "run", insideLambdaWithVarsExpectedLNT); + checkClassFile(new File(Paths.get(System.getProperty("user.dir"), + "Foo.class").toUri()), "lambda$variablesInLambdas$2", lambdaVoid2VoidExpectedLNT); + checkClassFile(new File(Paths.get(System.getProperty("user.dir"), + "Foo.class").toUri()), "$deserializeLambda$", deserializeExpectedLNT); + checkClassFile(new File(Paths.get(System.getProperty("user.dir"), + "Foo.class").toUri()), "lambda$MR$variablesInLambdas$notify$8bc4f5bd$1", lambdaBridgeExpectedLNT); + } + + void compileTestClass() throws Exception { + ToolBox.JavaToolArgs javacSuccessArgs = + new ToolBox.JavaToolArgs().setSources(testSource); + ToolBox.javac(javacSuccessArgs); + } + + void checkClassFile(final File cfile, String methodToFind, int[][] expectedLNT) throws Exception { + ClassFile classFile = ClassFile.read(cfile); + boolean methodFound = false; + for (Method method : classFile.methods) { + if (method.getName(classFile.constant_pool).equals(methodToFind)) { + methodFound = true; + Code_attribute code = (Code_attribute) method.attributes.get("Code"); + LineNumberTable_attribute lnt = + (LineNumberTable_attribute) code.attributes.get("LineNumberTable"); + Assert.check(lnt.line_number_table_length == expectedLNT.length, + "The LineNumberTable found has a length different to the expected one"); + int i = 0; + for (LineNumberTable_attribute.Entry entry: lnt.line_number_table) { + Assert.check(entry.line_number == expectedLNT[i][0] && + entry.start_pc == expectedLNT[i][1], + "LNT entry at pos " + i + " differ from expected." + + "Found " + entry.line_number + ":" + entry.start_pc + + ". Expected " + expectedLNT[i][0] + ":" + expectedLNT[i][1]); + i++; + } + } + } + Assert.check(methodFound, "The seek method was not found"); + } + + void error(String msg) { + throw new AssertionError(msg); + } + +} diff -r fea486d30d41 -r 6b4d6205366c test/tools/javac/T8019486/WrongLVTForLambdaTest.java --- a/test/tools/javac/T8019486/WrongLVTForLambdaTest.java Thu Oct 31 12:36:36 2013 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,111 +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. - */ - -/* - * @test - * @bug 8019486 - * @summary javac, generates erroneous LVT for a test case with lambda code - * @library /tools/javac/lib - * @build ToolBox - * @run main WrongLVTForLambdaTest - */ - -import java.io.File; -import java.nio.file.Paths; - -import com.sun.tools.classfile.ClassFile; -import com.sun.tools.classfile.Code_attribute; -import com.sun.tools.classfile.LineNumberTable_attribute; -import com.sun.tools.classfile.Method; -import com.sun.tools.javac.util.Assert; - -public class WrongLVTForLambdaTest { - - static final String testSource = - /* 01 */ "import java.util.List;\n" + - /* 02 */ "import java.util.Arrays;\n" + - /* 03 */ "import java.util.stream.Collectors;\n" + - /* 04 */ "\n" + - /* 05 */ "public class Foo {\n" + - /* 06 */ " void bar(int value) {\n" + - /* 07 */ " final List numbers = Arrays.asList(1, 2, 3);\n" + - /* 08 */ " final List numbersPlusOne = \n" + - /* 09 */ " numbers.stream().map(number -> number / 1).collect(Collectors.toList());\n" + - /* 10 */ " }\n" + - /* 11 */ "}"; - - static final int[][] expectedLNT = { - // {line-number, start-pc}, - {9, 0}, //number -> number / 1 - }; - - static final String methodToLookFor = "lambda$0"; - - public static void main(String[] args) throws Exception { - new WrongLVTForLambdaTest().run(); - } - - void run() throws Exception { - compileTestClass(); - checkClassFile(new File(Paths.get(System.getProperty("user.dir"), - "Foo.class").toUri()), methodToLookFor); - } - - void compileTestClass() throws Exception { - ToolBox.JavaToolArgs javacSuccessArgs = - new ToolBox.JavaToolArgs().setSources(testSource); - ToolBox.javac(javacSuccessArgs); - } - - void checkClassFile(final File cfile, String methodToFind) throws Exception { - ClassFile classFile = ClassFile.read(cfile); - boolean methodFound = false; - for (Method method : classFile.methods) { - if (method.getName(classFile.constant_pool).equals(methodToFind)) { - methodFound = true; - Code_attribute code = (Code_attribute) method.attributes.get("Code"); - LineNumberTable_attribute lnt = - (LineNumberTable_attribute) code.attributes.get("LineNumberTable"); - Assert.check(lnt.line_number_table_length == expectedLNT.length, - "The LineNumberTable found has a length different to the expected one"); - int i = 0; - for (LineNumberTable_attribute.Entry entry: lnt.line_number_table) { - Assert.check(entry.line_number == expectedLNT[i][0] && - entry.start_pc == expectedLNT[i][1], - "LNT entry at pos " + i + " differ from expected." + - "Found " + entry.line_number + ":" + entry.start_pc + - ". Expected " + expectedLNT[i][0] + ":" + expectedLNT[i][1]); - i++; - } - } - } - Assert.check(methodFound, "The seek method was not found"); - } - - void error(String msg) { - throw new AssertionError(msg); - } - -} diff -r fea486d30d41 -r 6b4d6205366c test/tools/javac/annotations/typeAnnotations/failures/CantAnnotateStaticClass2.java --- a/test/tools/javac/annotations/typeAnnotations/failures/CantAnnotateStaticClass2.java Thu Oct 31 12:36:36 2013 -0700 +++ b/test/tools/javac/annotations/typeAnnotations/failures/CantAnnotateStaticClass2.java Thu Oct 31 16:46:43 2013 -0700 @@ -3,7 +3,6 @@ * @bug 8006733 8006775 * @summary Ensure behavior for nested types is correct. * @author Werner Dietl - * @ignore * @compile/fail/ref=CantAnnotateStaticClass2.out -XDrawDiagnostics CantAnnotateStaticClass2.java */ diff -r fea486d30d41 -r 6b4d6205366c test/tools/javac/annotations/typeAnnotations/failures/CantAnnotateStaticClass2.out --- a/test/tools/javac/annotations/typeAnnotations/failures/CantAnnotateStaticClass2.out Thu Oct 31 12:36:36 2013 -0700 +++ b/test/tools/javac/annotations/typeAnnotations/failures/CantAnnotateStaticClass2.out Thu Oct 31 16:46:43 2013 -0700 @@ -24,10 +24,6 @@ CantAnnotateStaticClass2.java:58:12: compiler.err.cant.type.annotate.scoping.1: @Top.TB CantAnnotateStaticClass2.java:65:12: compiler.err.cant.type.annotate.scoping.1: @Top.TB CantAnnotateStaticClass2.java:66:12: compiler.err.cant.type.annotate.scoping.1: @Top.TB -CantAnnotateStaticClass2.java:105:18: compiler.err.cant.type.annotate.scoping.1: @Top.TB -CantAnnotateStaticClass2.java:107:18: compiler.err.cant.type.annotate.scoping.1: @Top.TB -CantAnnotateStaticClass2.java:112:18: compiler.err.cant.type.annotate.scoping.1: @Top.TB -CantAnnotateStaticClass2.java:114:18: compiler.err.cant.type.annotate.scoping.1: @Top.TB CantAnnotateStaticClass2.java:120:14: compiler.err.cant.type.annotate.scoping.1: @Top.TB CantAnnotateStaticClass2.java:121:14: compiler.err.cant.type.annotate.scoping.1: @Top.TB CantAnnotateStaticClass2.java:128:14: compiler.err.cant.type.annotate.scoping.1: @Top.TB @@ -50,6 +46,10 @@ CantAnnotateStaticClass2.java:167:22: compiler.err.cant.type.annotate.scoping.1: @Top.TB CantAnnotateStaticClass2.java:169:22: compiler.err.cant.type.annotate.scoping.1: @Top.TB CantAnnotateStaticClass2.java:171:22: compiler.err.cant.type.annotate.scoping.1: @Top.TB +CantAnnotateStaticClass2.java:105:18: compiler.err.cant.type.annotate.scoping.1: @Top.TB +CantAnnotateStaticClass2.java:107:18: compiler.err.cant.type.annotate.scoping.1: @Top.TB +CantAnnotateStaticClass2.java:112:18: compiler.err.cant.type.annotate.scoping.1: @Top.TB +CantAnnotateStaticClass2.java:114:18: compiler.err.cant.type.annotate.scoping.1: @Top.TB CantAnnotateStaticClass2.java:184:35: compiler.err.cant.type.annotate.scoping.1: @Top.TB CantAnnotateStaticClass2.java:186:41: compiler.err.cant.type.annotate.scoping.1: @Top.TB CantAnnotateStaticClass2.java:187:41: compiler.err.cant.type.annotate.scoping.1: @Top.TB @@ -62,4 +62,4 @@ CantAnnotateStaticClass2.java:202:44: compiler.err.cant.type.annotate.scoping.1: @Top.TB CantAnnotateStaticClass2.java:203:44: compiler.err.cant.type.annotate.scoping.1: @Top.TB CantAnnotateStaticClass2.java:204:49: compiler.err.cant.type.annotate.scoping: @Top.TA,@Top.TB,@Top.TC -64 errors \ No newline at end of file +64 errors diff -r fea486d30d41 -r 6b4d6205366c test/tools/javac/annotations/typeAnnotations/failures/TypeOnAnonClass.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/annotations/typeAnnotations/failures/TypeOnAnonClass.java Thu Oct 31 16:46:43 2013 -0700 @@ -0,0 +1,13 @@ +/* + * @test /nodynamiccopyright/ + * @bug 8023682 + * @summary Cannot annotate an anonymous class with a target type of TYPE + * @compile/fail/ref=TypeOnAnonClass.out -XDrawDiagnostics TypeOnAnonClass.java + */ +import java.lang.annotation.*; + +@Retention(RetentionPolicy.RUNTIME) +@Target(ElementType.TYPE) +@interface X {} +interface Foo {} +class TypeOnAnonClass { void m() { new @X Foo() {}; } } diff -r fea486d30d41 -r 6b4d6205366c test/tools/javac/annotations/typeAnnotations/failures/TypeOnAnonClass.out --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/annotations/typeAnnotations/failures/TypeOnAnonClass.out Thu Oct 31 16:46:43 2013 -0700 @@ -0,0 +1,2 @@ +TypeOnAnonClass.java:13:40: compiler.err.annotation.type.not.applicable +1 error diff -r fea486d30d41 -r 6b4d6205366c test/tools/javac/annotations/typeAnnotations/failures/common/arrays/DeclarationAnnotation.out --- a/test/tools/javac/annotations/typeAnnotations/failures/common/arrays/DeclarationAnnotation.out Thu Oct 31 12:36:36 2013 -0700 +++ b/test/tools/javac/annotations/typeAnnotations/failures/common/arrays/DeclarationAnnotation.out Thu Oct 31 16:46:43 2013 -0700 @@ -1,4 +1,5 @@ DeclarationAnnotation.java:10:21: compiler.err.annotation.type.not.applicable DeclarationAnnotation.java:11:21: compiler.err.annotation.type.not.applicable DeclarationAnnotation.java:12:21: compiler.err.annotation.type.not.applicable -3 errors \ No newline at end of file +DeclarationAnnotation.java:16:21: compiler.err.annotation.type.not.applicable +4 errors diff -r fea486d30d41 -r 6b4d6205366c test/tools/javac/annotations/typeAnnotations/newlocations/AnonymousClass.java --- a/test/tools/javac/annotations/typeAnnotations/newlocations/AnonymousClass.java Thu Oct 31 12:36:36 2013 -0700 +++ b/test/tools/javac/annotations/typeAnnotations/newlocations/AnonymousClass.java Thu Oct 31 16:46:43 2013 -0700 @@ -32,12 +32,9 @@ */ class AnonymousClass { Object o1 = new @TA Object() { }; - // Declaration annotations are also allowed. - Object o2 = new @TA @DA Object() { }; + Object o2 = new @TA Object() { }; } -@interface DA { } - @Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER}) @interface TA { } diff -r fea486d30d41 -r 6b4d6205366c test/tools/javac/annotations/typeAnnotations/newlocations/MultiCatch.java --- a/test/tools/javac/annotations/typeAnnotations/newlocations/MultiCatch.java Thu Oct 31 12:36:36 2013 -0700 +++ b/test/tools/javac/annotations/typeAnnotations/newlocations/MultiCatch.java Thu Oct 31 16:46:43 2013 -0700 @@ -25,7 +25,6 @@ /* * @test - * @ignore 8008762 Type annotations failures * @bug 8006775 * @summary new type annotation location: multicatch * @author Werner Dietl diff -r fea486d30d41 -r 6b4d6205366c test/tools/javac/annotations/typeAnnotations/referenceinfos/Constructors.java --- a/test/tools/javac/annotations/typeAnnotations/referenceinfos/Constructors.java Thu Oct 31 12:36:36 2013 -0700 +++ b/test/tools/javac/annotations/typeAnnotations/referenceinfos/Constructors.java Thu Oct 31 16:46:43 2013 -0700 @@ -21,14 +21,16 @@ * questions. */ -import static com.sun.tools.classfile.TypeAnnotation.TargetType.*; - /* * @test + * @bug 8026791 * @summary Test population of reference info for constructor results * @compile -g Driver.java ReferenceInfoUtil.java Constructors.java * @run main Driver Constructors */ + +import static com.sun.tools.classfile.TypeAnnotation.TargetType.*; + public class Constructors { @TADescriptions({ @@ -42,8 +44,8 @@ } @TADescriptions({ - @TADescription(annotation = "TA", type = METHOD_RETURN), - @TADescription(annotation = "TB", type = METHOD_RETURN), + @TADescription(annotation = "TA", type = METHOD_RETURN, genericLocation = {1, 0}), + @TADescription(annotation = "TB", type = METHOD_RETURN, genericLocation = {1, 0}), @TADescription(annotation = "TC", type = METHOD_FORMAL_PARAMETER, paramIndex = 0) }) @TestClass("Test$Inner") @@ -56,9 +58,9 @@ @TADescriptions({ @TADescription(annotation = "TA", type = METHOD_RECEIVER), - @TADescription(annotation = "TB", type = METHOD_RETURN), + @TADescription(annotation = "TB", type = METHOD_RETURN, genericLocation = {1, 0}), @TADescription(annotation = "TC", type = METHOD_RECEIVER), - @TADescription(annotation = "TD", type = METHOD_RETURN), + @TADescription(annotation = "TD", type = METHOD_RETURN, genericLocation = {1, 0}), @TADescription(annotation = "TE", type = METHOD_FORMAL_PARAMETER, paramIndex = 0) }) @TestClass("Test$Inner") @@ -72,9 +74,9 @@ @TADescriptions({ @TADescription(annotation = "TA", type = METHOD_RECEIVER), @TADescription(annotation = "TB", type = METHOD_RECEIVER, genericLocation = {1, 0}), - @TADescription(annotation = "TC", type = METHOD_RETURN), + @TADescription(annotation = "TC", type = METHOD_RETURN, genericLocation = {1, 0, 1, 0}), @TADescription(annotation = "TD", type = METHOD_RECEIVER, genericLocation = {1, 0}), - @TADescription(annotation = "TE", type = METHOD_RETURN), + @TADescription(annotation = "TE", type = METHOD_RETURN, genericLocation = {1, 0, 1, 0}), @TADescription(annotation = "TF", type = METHOD_FORMAL_PARAMETER, paramIndex = 0) }) @TestClass("Outer$Middle$Inner") diff -r fea486d30d41 -r 6b4d6205366c test/tools/javac/annotations/typeAnnotations/referenceinfos/MultiCatch.java --- a/test/tools/javac/annotations/typeAnnotations/referenceinfos/MultiCatch.java Thu Oct 31 12:36:36 2013 -0700 +++ b/test/tools/javac/annotations/typeAnnotations/referenceinfos/MultiCatch.java Thu Oct 31 16:46:43 2013 -0700 @@ -25,7 +25,6 @@ /* * @test - * @ignore 8008762 Type annotation failures * @bug 8006732 8006775 * @summary Test population of reference info for multicatch exception parameters * @author Werner Dietl diff -r fea486d30d41 -r 6b4d6205366c test/tools/javac/lambda/8016081/T8016081.java --- a/test/tools/javac/lambda/8016081/T8016081.java Thu Oct 31 12:36:36 2013 -0700 +++ b/test/tools/javac/lambda/8016081/T8016081.java Thu Oct 31 16:46:43 2013 -0700 @@ -32,7 +32,7 @@ interface fint { int get(); } @interface atype { - fint fld = ()->( fld == null ?0 : 1); + fint fld = ()->1; } @atype class T {} diff -r fea486d30d41 -r 6b4d6205366c test/tools/javac/lambda/LambdaExpr13.java --- a/test/tools/javac/lambda/LambdaExpr13.java Thu Oct 31 12:36:36 2013 -0700 +++ b/test/tools/javac/lambda/LambdaExpr13.java Thu Oct 31 16:46:43 2013 -0700 @@ -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 @@ -26,13 +26,14 @@ * @bug 8003280 * @summary Add lambda tests * check that recursive lambda (through field ref) is accepted in all contexts + * but field initialization * @compile LambdaExpr13.java */ class LambdaExpr13 { - Runnable ir = () -> { ir.run(); };; - static Runnable sr = () -> { sr.run(); }; + Runnable ir; + static Runnable sr; { ir = () -> { ir.run(); }; } static { sr = () -> { sr.run(); }; } diff -r fea486d30d41 -r 6b4d6205366c test/tools/javac/lambda/LocalVariableTable.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/lambda/LocalVariableTable.java Thu Oct 31 16:46:43 2013 -0700 @@ -0,0 +1,220 @@ +/* + * 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 8025998 8026749 + * @summary Missing LV table in lambda bodies + * @compile -g LocalVariableTable.java + * @run main LocalVariableTable + */ + +import java.io.*; +import java.lang.annotation.*; +import java.util.*; +import com.sun.tools.classfile.*; + +/* + * The test checks that a LocalVariableTable attribute is generated for the + * method bodies representing lambda expressions, and checks that the expected + * set of entries is found in the attribute. + * + * Since the bug was about missing entries in the LVT, not malformed entries, + * the test is not intended to be a detailed test of the contents of each + * LocalVariableTable entry: it is assumed that if a entry is present, it + * will have the correct contents. + * + * The test looks for test cases represented by nested classes whose + * name begins with "Lambda". Each such class contains a lambda expression + * that will mapped into a lambda method, and because the test is compiled + * with -g, these methods should have a LocalVariableTable. The set of + * expected names in the LVT is provided in an annotation on the class for + * the test case. + */ +public class LocalVariableTable { + public static void main(String... args) throws Exception { + new LocalVariableTable().run(); + } + + void run() throws Exception { + // the declared classes are returned in an unspecified order, + // so for neatness, sort them by name before processing them + Class[] classes = getClass().getDeclaredClasses(); + Arrays.sort(classes, (c1, c2) -> c1.getName().compareTo(c2.getName())); + + for (Class c : classes) { + if (c.getSimpleName().startsWith("Lambda")) + check(c); + } + if (errors > 0) + throw new Exception(errors + " errors found"); + } + + /** Check an individual test case. */ + void check(Class c) throws Exception { + System.err.println("Checking " + c.getSimpleName()); + + Expect expect = c.getAnnotation(Expect.class); + if (expect == null) { + error("@Expect not found for class " + c.getSimpleName()); + return; + } + + ClassFile cf = ClassFile.read(getClass().getResource(c.getName() + ".class").openStream()); + Method m = getLambdaMethod(cf); + if (m == null) { + error("lambda method not found"); + return; + } + + Code_attribute code = (Code_attribute) m.attributes.get(Attribute.Code); + if (code == null) { + error("Code attribute not found"); + return; + } + + LocalVariableTable_attribute lvt = + (LocalVariableTable_attribute) code.attributes.get(Attribute.LocalVariableTable); + if (lvt == null) { + error("LocalVariableTable attribute not found"); + return; + } + + Set foundNames = new LinkedHashSet<>(); + for (LocalVariableTable_attribute.Entry e: lvt.local_variable_table) { + foundNames.add(cf.constant_pool.getUTF8Value(e.name_index)); + } + + Set expectNames = new LinkedHashSet<>(Arrays.asList(expect.value())); + if (!foundNames.equals(expectNames)) { + Set foundOnly = new LinkedHashSet<>(foundNames); + foundOnly.removeAll(expectNames); + for (String s: foundOnly) + error("Unexpected name found: " + s); + Set expectOnly = new LinkedHashSet<>(expectNames); + expectOnly.removeAll(foundNames); + for (String s: expectOnly) + error("Expected name not found: " + s); + } + } + + /** Get a method whose name begins "lambda$...". */ + Method getLambdaMethod(ClassFile cf) throws ConstantPoolException { + for (Method m: cf.methods) { + if (m.getName(cf.constant_pool).startsWith("lambda$")) + return m; + } + return null; + } + + /** Report an error. */ + void error(String msg) { + System.err.println("Error: " + msg); + errors++; + } + + int errors; + + /** + * Annotation used to provide the set of names expected in the LVT attribute. + */ + @Retention(RetentionPolicy.RUNTIME) + @interface Expect { + String[] value(); + } + + /** Functional interface with nullary method. */ + interface Run0 { + public void run(); + } + + /** Functional interface with 1-ary method. */ + interface Run1 { + public void run(int a0); + } + + /** Functional interface with 2-ary method. */ + interface Run2 { + public void run(int a0, int a1); + } + + /* + * ---------- Test cases --------------------------------------------------- + */ + + @Expect({ "x" }) + static class Lambda_Args0_Local1 { + Run0 r = () -> { int x = 0; }; + } + + @Expect({ "x", "this" }) + static class Lambda_Args0_Local1_this { + int v; + Run0 r = () -> { int x = v; }; + } + + @Expect({ "a" }) + static class Lambda_Args1_Local0 { + Run1 r = (a) -> { }; + } + + @Expect({ "a", "x" }) + static class Lambda_Args1_Local1 { + Run1 r = (a) -> { int x = a; }; + } + + @Expect({ "a", "x" }) + static class Lambda_Args1_Local1_Captured1 { + void m() { + int v = 0; + Run1 r = (a) -> { int x = a + v; }; + } + } + + @Expect({ "a1", "a2", "x1", "x2", "this" }) + static class Lambda_Args2_Local2_Captured2_this { + int v; + void m() { + int v1 = 0; + int v2 = 0; + Run2 r = (a1, a2) -> { + int x1 = a1 + v1 + v; + int x2 = a2 + v2 + v; + }; + } + } + + @Expect({ "e" }) + static class Lambda_Try_Catch { + private static Runnable asUncheckedRunnable(Closeable c) { + return () -> { + try { + c.close(); + } catch (IOException e) { + throw new UncheckedIOException(e); + } + }; + } + } +} + diff -r fea486d30d41 -r 6b4d6205366c test/tools/javac/lambda/T8024809/SelfInitializerInLambdaTesta.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/lambda/T8024809/SelfInitializerInLambdaTesta.java Thu Oct 31 16:46:43 2013 -0700 @@ -0,0 +1,65 @@ +/* + * 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 8024809 + * @summary javac, some lambda programs are rejected by flow analysis + * @compile/fail/ref=SelfInitializerInLambdaTesta.out -XDrawDiagnostics SelfInitializerInLambdaTesta.java + */ + +public class SelfInitializerInLambdaTesta { + + final Runnable r1 = ()->System.out.println(r1); + + final Object lock = new Object(); + + final Runnable r2 = ()->{ + System.out.println(r2); + synchronized (lock){} + }; + + final Runnable r3 = ()->{ + synchronized (lock){ + System.out.println(r3); + } + }; + + final Runnable r4 = ()->{ + System.out.println(r4); + }; + + interface SAM { + int m(String s); + } + + final SAM s1 = (String s)->{ + System.out.println(s + s1.toString()); + return 0; + }; + + final SAM s2 = (s)->{ + System.out.println(s + s2.toString()); + return 0; + }; +} diff -r fea486d30d41 -r 6b4d6205366c test/tools/javac/lambda/T8024809/SelfInitializerInLambdaTesta.out --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/lambda/T8024809/SelfInitializerInLambdaTesta.out Thu Oct 31 16:46:43 2013 -0700 @@ -0,0 +1,7 @@ +SelfInitializerInLambdaTesta.java:33:48: compiler.err.illegal.self.ref +SelfInitializerInLambdaTesta.java:38:28: compiler.err.illegal.self.ref +SelfInitializerInLambdaTesta.java:44:32: compiler.err.illegal.self.ref +SelfInitializerInLambdaTesta.java:49:28: compiler.err.illegal.self.ref +SelfInitializerInLambdaTesta.java:57:32: compiler.err.illegal.self.ref +SelfInitializerInLambdaTesta.java:62:32: compiler.err.illegal.self.ref +6 errors diff -r fea486d30d41 -r 6b4d6205366c test/tools/javac/lambda/T8024809/SelfInitializerInLambdaTestb.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/lambda/T8024809/SelfInitializerInLambdaTestb.java Thu Oct 31 16:46:43 2013 -0700 @@ -0,0 +1,40 @@ +/* + * 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 8024809 + * @summary javac, some lambda programs are rejected by flow analysis + * @compile/fail/ref=SelfInitializerInLambdaTestb.out -XDrawDiagnostics SelfInitializerInLambdaTestb.java + */ + +public class SelfInitializerInLambdaTestb { + + final Runnable r1; + + final Runnable r2 = ()-> System.out.println(r1); + + SelfInitializerInLambdaTestb() { + r1 = ()->System.out.println(r1); + } +} diff -r fea486d30d41 -r 6b4d6205366c test/tools/javac/lambda/T8024809/SelfInitializerInLambdaTestb.out --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/lambda/T8024809/SelfInitializerInLambdaTestb.out Thu Oct 31 16:46:43 2013 -0700 @@ -0,0 +1,3 @@ +SelfInitializerInLambdaTestb.java:35:49: compiler.err.var.might.not.have.been.initialized: r1 +SelfInitializerInLambdaTestb.java:38:37: compiler.err.var.might.not.have.been.initialized: r1 +2 errors diff -r fea486d30d41 -r 6b4d6205366c test/tools/javac/lambda/T8025290/ExplicitVSImplicitLambdaTest.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/lambda/T8025290/ExplicitVSImplicitLambdaTest.java Thu Oct 31 16:46:43 2013 -0700 @@ -0,0 +1,73 @@ +/* + * 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 8025290 + * @summary javac implicit versus explicit lambda compilation error + * @compile ExplicitVSImplicitLambdaTest.java + */ + +import java.util.function.*; + +public class ExplicitVSImplicitLambdaTest { + private void test() + { + /* in the explicit case "e" is inferred to String so we can use a String + * only method. + */ + MyComparator.mycomparing1((String e) -> e.concat("")); + MyComparator.mycomparing2((String e) -> e.concat("")); + MyComparator.mycomparing3((String e) -> e.concat("")); + MyComparator.mycomparing4((String e) -> e.concat("")); + + /* in the implicit case "e" is inferred to Object so toString() is OK. + */ + MyComparator.mycomparing1((e) -> e.toString()); + MyComparator.mycomparing2((e) -> e.toString()); + MyComparator.mycomparing3((e) -> e.toString()); + MyComparator.mycomparing4((e) -> e.toString()); + } +} + +interface MyComparator { + public static > MyComparator mycomparing1( + Function keyExtractor) { + return null; + } + + public static > MyComparator mycomparing2( + Function keyExtractor) { + return null; + } + + public static > MyComparator mycomparing3( + Function keyExtractor) { + return null; + } + + public static > MyComparator mycomparing4( + Function keyExtractor) { + return null; + } +} diff -r fea486d30d41 -r 6b4d6205366c test/tools/javac/lambda/TargetType58.java --- a/test/tools/javac/lambda/TargetType58.java Thu Oct 31 12:36:36 2013 -0700 +++ b/test/tools/javac/lambda/TargetType58.java Thu Oct 31 16:46:43 2013 -0700 @@ -35,7 +35,7 @@ class TargetType58 { void test(List li) { - g(li, s -> s.substream(200), Collections.emptyList()); + g(li, s -> s.skip(200), Collections.emptyList()); } , diff -r fea486d30d41 -r 6b4d6205366c test/tools/javac/lambda/TestSelfRef.java --- a/test/tools/javac/lambda/TestSelfRef.java Thu Oct 31 12:36:36 2013 -0700 +++ b/test/tools/javac/lambda/TestSelfRef.java Thu Oct 31 16:46:43 2013 -0700 @@ -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 @@ -29,7 +29,6 @@ * consistently w.r.t. local inner classes */ -import com.sun.source.util.JavacTask; import java.net.URI; import java.util.Arrays; import javax.tools.Diagnostic; @@ -38,6 +37,7 @@ import javax.tools.SimpleJavaFileObject; import javax.tools.StandardJavaFileManager; import javax.tools.ToolProvider; +import com.sun.source.util.JavacTask; public class TestSelfRef { @@ -176,10 +176,16 @@ check(); } - void check() { + boolean isErrorExpected() { //illegal forward ref - boolean errorExpected = ik.inMethodContext(sk) && - (rk.selfRef || rk.forwardRef); + boolean result = ik.inMethodContext(sk) && (rk.selfRef || rk.forwardRef); + result |= (rk == RefKind.SELF_LAMBDA || rk == RefKind.FORWARD_LAMBDA); + return result; + } + + void check() { + checkCount++; + boolean errorExpected = isErrorExpected(); if (diagChecker.errorFound != errorExpected) { throw new Error("invalid diagnostics for source:\n" + source.getCharContent(true) + diff -r fea486d30d41 -r 6b4d6205366c test/tools/javac/lambda/lambdaNaming/TestSerializedLambdaNameStability.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/lambda/lambdaNaming/TestSerializedLambdaNameStability.java Thu Oct 31 16:46:43 2013 -0700 @@ -0,0 +1,166 @@ +/* + * 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 8023668 + * @summary Desugar serializable lambda bodies using more robust naming scheme + * @library /tools/javac/lib + * @build ToolBox + * @run main TestSerializedLambdaNameStability + */ + +import java.io.*; +import java.lang.reflect.Constructor; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.nio.file.*; + +public class TestSerializedLambdaNameStability { + + final ClassLoader writingClassLoader; + final ClassLoader clonedClassLoader; + final ClassLoader checkingClassLoader; + + TestSerializedLambdaNameStability() { + writingClassLoader = new TestClassLoader("before"); + clonedClassLoader = new TestClassLoader("before"); + checkingClassLoader = new TestClassLoader("after"); + } + + public static void main(String... args) throws Exception { + new TestSerializedLambdaNameStability().doit("NameOfCapturedArgs", true); + new TestSerializedLambdaNameStability().doit("TypesOfCapturedArgs", true); + new TestSerializedLambdaNameStability().doit("OrderOfCapturedArgs", true); + new TestSerializedLambdaNameStability().doit("VariableAssignmentTarget", false); + new TestSerializedLambdaNameStability().doit("TargetName", true); + new TestSerializedLambdaNameStability().doit("TargetType", true); + } + + public void doit(String name, boolean expectFail) throws Exception { + String iName = "I" + name; + String testName = "TEST" + name; + Class kw = writingClassLoader.loadClass(testName); + Object instw = getInstance(kw); + Method mw = getMethod(kw, "write", ObjectOutput.class); + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + try (ObjectOutput out = new ObjectOutputStream(baos)) { + mw.invoke(instw, out); + } + byte[] ser = baos.toByteArray(); + + // Read and check clone + readCheck(iName, testName, clonedClassLoader, ser); + System.err.printf("cloned test readCheck %s\n", testName); + + // Read and check other + if (expectFail) { + try { + readCheck(iName, testName, checkingClassLoader, ser); + } catch (InvocationTargetException ite) { + Throwable underlying = ite; + while (underlying != null && !(underlying instanceof IllegalArgumentException)) { + underlying = underlying.getCause(); + } + if (underlying != null) { + if (underlying.getMessage().contains("deserialization")) { + System.err.printf("PASS: other test %s got expected exception %s\n", testName, underlying); + return; + } + } + System.err.printf("FAIL: other test %s got unexpected exception %s\n", testName, ite); + throw new Exception("unexpected exception ", ite); + } + System.err.printf("FAIL: other test %s expected an exception", testName); + throw new Exception("expected an exception" + testName); + } else { + readCheck(iName, testName, checkingClassLoader, ser); + System.err.printf("PASS: other test %s readCheck\n", testName); + } + } + + void readCheck(String iName, String testName, ClassLoader loader, byte[] ser) throws Exception { + Class k = loader.loadClass(testName); + Object inst = getInstance(k); + Method mrc = getMethod(k, "readCheck", ObjectInput.class); + ByteArrayInputStream bais = new ByteArrayInputStream(ser); + try (ObjectInput in = new ObjectInputStream(bais)) { + mrc.invoke(inst, in); + } + } + + Method getMethod(Class k, String name, Class argTypes) throws Exception { + Method meth = k.getDeclaredMethod(name, argTypes); + meth.setAccessible(true); + return meth; + } + + Object getInstance(Class k) throws Exception { + Constructor cons = k.getConstructors()[0]; + cons.setAccessible(true); + return cons.newInstance(); + } + + static class TestClassLoader extends ClassLoader { + static final String compiledDir = System.getProperty("user.dir"); + static final String sourceBaseDir = System.getProperty("test.src"); + + final String context; + + public TestClassLoader(String context) { + super(); + this.context = context; + } + + @Override + public Class findClass(String name) throws ClassNotFoundException { + byte[] b; + + try { + b = loadClassData(name); + } catch (Throwable th) { + // th.printStackTrace(); + throw new ClassNotFoundException("Loading error", th); + } + return defineClass(name, b, 0, b.length); + } + + private byte[] loadClassData(String name) throws Exception { + String srcName; + if (name.startsWith("TEST")) + srcName = name; + else if (name.startsWith("I")) + srcName = "TEST" + name.substring(1); + else + throw new Exception("Did not expect to load " + name); + Path srcFile = Paths.get(sourceBaseDir, context, srcName + ".java"); + String testSource = new String(Files.readAllBytes(srcFile)); + ToolBox.JavaToolArgs javacSuccessArgs = + new ToolBox.JavaToolArgs().setSources(testSource); + ToolBox.javac(javacSuccessArgs); + Path cfFile = Paths.get(compiledDir, name + ".class"); + byte[] bytes = Files.readAllBytes(cfFile); + return bytes; + } + } +} diff -r fea486d30d41 -r 6b4d6205366c test/tools/javac/lambda/lambdaNaming/after/TESTNameOfCapturedArgs.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/lambda/lambdaNaming/after/TESTNameOfCapturedArgs.java Thu Oct 31 16:46:43 2013 -0700 @@ -0,0 +1,48 @@ +/* + * 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.*; + +interface INameOfCapturedArgs extends Serializable { + int get(); +} + +class TESTNameOfCapturedArgs { + + public TESTNameOfCapturedArgs() { + } + + public void write(ObjectOutput out) throws IOException { + int y = 44; + INameOfCapturedArgs res = () -> y; + out.writeObject(res); + } + + public void readCheck(ObjectInput in) throws Exception { + INameOfCapturedArgs lam = (INameOfCapturedArgs) in.readObject(); + int val = lam.get(); + if (val != 44) { + throw new IllegalArgumentException("Expected 44"); + } + } +} diff -r fea486d30d41 -r 6b4d6205366c test/tools/javac/lambda/lambdaNaming/after/TESTOrderOfCapturedArgs.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/lambda/lambdaNaming/after/TESTOrderOfCapturedArgs.java Thu Oct 31 16:46:43 2013 -0700 @@ -0,0 +1,49 @@ +/* + * 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.*; + +interface IOrderOfCapturedArgs extends Serializable { + String get(); +} + +class TESTOrderOfCapturedArgs { + + public TESTOrderOfCapturedArgs() { + } + + public void write(ObjectOutput out) throws IOException { + String a = "fu"; + String b = "bar"; + IOrderOfCapturedArgs res = () -> b + a; + out.writeObject(res); + } + + public void readCheck(ObjectInput in) throws Exception { + IOrderOfCapturedArgs lam = (IOrderOfCapturedArgs) in.readObject(); + Object val = lam.get(); + if (!val.equals("fubar")) { + throw new IllegalArgumentException("Expected 'fubar'"); + } + } +} diff -r fea486d30d41 -r 6b4d6205366c test/tools/javac/lambda/lambdaNaming/after/TESTTargetName.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/lambda/lambdaNaming/after/TESTTargetName.java Thu Oct 31 16:46:43 2013 -0700 @@ -0,0 +1,47 @@ +/* + * 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.*; + +interface ITargetName extends Serializable { + String get(); +} + +class TESTTargetName { + + public TESTTargetName() { + } + + public void write(ObjectOutput out) throws IOException { + ITargetName resist = () -> "fubar"; + out.writeObject(resist); + } + + public void readCheck(ObjectInput in) throws Exception { + ITargetName lam = (ITargetName) in.readObject(); + Object val = lam.get(); + if (!val.equals("fubar")) { + throw new IllegalArgumentException("Expected 'fubar'"); + } + } +} diff -r fea486d30d41 -r 6b4d6205366c test/tools/javac/lambda/lambdaNaming/after/TESTTargetType.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/lambda/lambdaNaming/after/TESTTargetType.java Thu Oct 31 16:46:43 2013 -0700 @@ -0,0 +1,40 @@ +/* + * 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.*; +import java.util.function.*; + +class TESTTargetType { + + public TESTTargetType() { + } + + public void write(ObjectOutput out) throws IOException { + Object res = (Predicate & Serializable) ((str) -> str.length() > 3); + out.writeObject(res); + } + + public void readCheck(ObjectInput in) throws Exception { + in.readObject(); + } +} diff -r fea486d30d41 -r 6b4d6205366c test/tools/javac/lambda/lambdaNaming/after/TESTTypesOfCapturedArgs.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/lambda/lambdaNaming/after/TESTTypesOfCapturedArgs.java Thu Oct 31 16:46:43 2013 -0700 @@ -0,0 +1,48 @@ +/* + * 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.*; + +interface ITypesOfCapturedArgs extends Serializable { + Object get(); +} + +class TESTTypesOfCapturedArgs { + + public TESTTypesOfCapturedArgs() { + } + + public void write(ObjectOutput out) throws IOException { + Object x = "hi"; + ITypesOfCapturedArgs res = () -> x; + out.writeObject(res); + } + + public void readCheck(ObjectInput in) throws Exception { + ITypesOfCapturedArgs lam = (ITypesOfCapturedArgs) in.readObject(); + Object val = lam.get(); + if (!val.equals("hi")) { + throw new IllegalArgumentException("Expected 'hi'"); + } + } +} diff -r fea486d30d41 -r 6b4d6205366c test/tools/javac/lambda/lambdaNaming/after/TESTVariableAssignmentTarget.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/lambda/lambdaNaming/after/TESTVariableAssignmentTarget.java Thu Oct 31 16:46:43 2013 -0700 @@ -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. + * + * 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.*; + +interface IVariableAssignmentTarget extends Serializable { + String get(); +} + +class TESTVariableAssignmentTarget { + + public TESTVariableAssignmentTarget() { + } + + public void write(ObjectOutput out) throws IOException { + IVariableAssignmentTarget res2 = () -> "bar"; + IVariableAssignmentTarget res1 = () -> "fu"; + out.writeObject(res1); + out.writeObject(res2); + } + + public void readCheck(ObjectInput in) throws Exception { + IVariableAssignmentTarget lam = (IVariableAssignmentTarget) in.readObject(); + Object val = lam.get(); + if (!val.equals("fu")) { + throw new IllegalArgumentException("Expected 'fu'"); + } + lam = (IVariableAssignmentTarget) in.readObject(); + val = lam.get(); + if (!val.equals("bar")) { + throw new IllegalArgumentException("Expected 'bar'"); + } + } +} diff -r fea486d30d41 -r 6b4d6205366c test/tools/javac/lambda/lambdaNaming/before/TESTNameOfCapturedArgs.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/lambda/lambdaNaming/before/TESTNameOfCapturedArgs.java Thu Oct 31 16:46:43 2013 -0700 @@ -0,0 +1,48 @@ +/* + * 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.*; + +interface INameOfCapturedArgs extends Serializable { + int get(); +} + +class TESTNameOfCapturedArgs { + + public TESTNameOfCapturedArgs() { + } + + public void write(ObjectOutput out) throws IOException { + int x = 44; + INameOfCapturedArgs res = () -> x; + out.writeObject(res); + } + + public void readCheck(ObjectInput in) throws Exception { + INameOfCapturedArgs lam = (INameOfCapturedArgs) in.readObject(); + int val = lam.get(); + if (val != 44) { + throw new IllegalArgumentException("Expected 44"); + } + } +} diff -r fea486d30d41 -r 6b4d6205366c test/tools/javac/lambda/lambdaNaming/before/TESTOrderOfCapturedArgs.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/lambda/lambdaNaming/before/TESTOrderOfCapturedArgs.java Thu Oct 31 16:46:43 2013 -0700 @@ -0,0 +1,49 @@ +/* + * 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.*; + +interface IOrderOfCapturedArgs extends Serializable { + String get(); +} + +class TESTOrderOfCapturedArgs { + + public TESTOrderOfCapturedArgs() { + } + + public void write(ObjectOutput out) throws IOException { + String a = "fu"; + String b = "bar"; + IOrderOfCapturedArgs res = () -> a + b; + out.writeObject(res); + } + + public void readCheck(ObjectInput in) throws Exception { + IOrderOfCapturedArgs lam = (IOrderOfCapturedArgs) in.readObject(); + Object val = lam.get(); + if (!val.equals("fubar")) { + throw new IllegalArgumentException("Expected 'fubar'"); + } + } +} diff -r fea486d30d41 -r 6b4d6205366c test/tools/javac/lambda/lambdaNaming/before/TESTTargetName.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/lambda/lambdaNaming/before/TESTTargetName.java Thu Oct 31 16:46:43 2013 -0700 @@ -0,0 +1,47 @@ +/* + * 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.*; + +interface ITargetName extends Serializable { + String get(); +} + +class TESTTargetName { + + public TESTTargetName() { + } + + public void write(ObjectOutput out) throws IOException { + ITargetName res = () -> "fubar"; + out.writeObject(res); + } + + public void readCheck(ObjectInput in) throws Exception { + ITargetName lam = (ITargetName) in.readObject(); + Object val = lam.get(); + if (!val.equals("fubar")) { + throw new IllegalArgumentException("Expected 'fubar'"); + } + } +} diff -r fea486d30d41 -r 6b4d6205366c test/tools/javac/lambda/lambdaNaming/before/TESTTargetType.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/lambda/lambdaNaming/before/TESTTargetType.java Thu Oct 31 16:46:43 2013 -0700 @@ -0,0 +1,40 @@ +/* + * 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.*; +import java.util.function.*; + +class TESTTargetType { + + public TESTTargetType() { + } + + public void write(ObjectOutput out) throws IOException { + Object res = (Function & Serializable) ((str) -> str.length() > 3); + out.writeObject(res); + } + + public void readCheck(ObjectInput in) throws Exception { + in.readObject(); + } +} diff -r fea486d30d41 -r 6b4d6205366c test/tools/javac/lambda/lambdaNaming/before/TESTTypesOfCapturedArgs.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/lambda/lambdaNaming/before/TESTTypesOfCapturedArgs.java Thu Oct 31 16:46:43 2013 -0700 @@ -0,0 +1,48 @@ +/* + * 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.*; + +interface ITypesOfCapturedArgs extends Serializable { + Object get(); +} + +class TESTTypesOfCapturedArgs { + + public TESTTypesOfCapturedArgs() { + } + + public void write(ObjectOutput out) throws IOException { + String x = "hi"; + ITypesOfCapturedArgs res = () -> x; + out.writeObject(res); + } + + public void readCheck(ObjectInput in) throws Exception { + ITypesOfCapturedArgs lam = (ITypesOfCapturedArgs) in.readObject(); + Object val = lam.get(); + if (!val.equals("hi")) { + throw new IllegalArgumentException("Expected 'hi'"); + } + } +} diff -r fea486d30d41 -r 6b4d6205366c test/tools/javac/lambda/lambdaNaming/before/TESTVariableAssignmentTarget.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/lambda/lambdaNaming/before/TESTVariableAssignmentTarget.java Thu Oct 31 16:46:43 2013 -0700 @@ -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. + * + * 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.*; + +interface IVariableAssignmentTarget extends Serializable { + String get(); +} + +class TESTVariableAssignmentTarget { + + public TESTVariableAssignmentTarget() { + } + + public void write(ObjectOutput out) throws IOException { + IVariableAssignmentTarget res1 = () -> "fu"; + IVariableAssignmentTarget res2 = () -> "bar"; + out.writeObject(res1); + out.writeObject(res2); + } + + public void readCheck(ObjectInput in) throws Exception { + IVariableAssignmentTarget lam = (IVariableAssignmentTarget) in.readObject(); + Object val = lam.get(); + if (!val.equals("fu")) { + throw new IllegalArgumentException("Expected 'fu'"); + } + lam = (IVariableAssignmentTarget) in.readObject(); + val = lam.get(); + if (!val.equals("bar")) { + throw new IllegalArgumentException("Expected 'bar'"); + } + } +} diff -r fea486d30d41 -r 6b4d6205366c test/tools/javac/lambda/privateMethodReferences/MethodInvoker.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/lambda/privateMethodReferences/MethodInvoker.java Thu Oct 31 16:46:43 2013 -0700 @@ -0,0 +1,52 @@ +/* + * 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 8022720 + * @summary private method should be accessible (nested classes) + * @run main MethodInvoker + */ + +interface MyFunctionalInterface1 { + int invokeMethodReference(); +} + +public class MethodInvoker { + public static void main(String[] args) throws Exception { + MethodInvoker.invoke(); + System.out.println("Passed!"); + } + public static void invoke() throws Exception { + MethodSupplier ms = new MethodSupplier(); + MyFunctionalInterface1 fi = ms::m; + if (fi.invokeMethodReference() != 123) { + throw new Exception(); + } + } + static class MethodSupplier { + private int m() { + return 123; + } + } +} diff -r fea486d30d41 -r 6b4d6205366c test/tools/javac/lambda/privateMethodReferences/MethodSupplier.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/lambda/privateMethodReferences/MethodSupplier.java Thu Oct 31 16:46:43 2013 -0700 @@ -0,0 +1,52 @@ +/* + * 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 8022720 + * @summary private method should be accessible (nested classes) + * @run main MethodSupplier + */ + +interface MyFunctionalInterface2 { + int invokeMethodReference(); +} + +public class MethodSupplier { + public static void main(String[] args) throws Exception { + MethodInvoker.invoke(); + System.out.println("Passed!"); + } + private int m() { + return 4321; + } + static class MethodInvoker { + public static void invoke() throws Exception { + MethodSupplier ms = new MethodSupplier(); + MyFunctionalInterface2 fi = ms::m; + if (fi.invokeMethodReference() != 4321) { + throw new Exception(); + } + } + } +} diff -r fea486d30d41 -r 6b4d6205366c test/tools/javac/lambda/privateMethodReferences/ThirdClass.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/lambda/privateMethodReferences/ThirdClass.java Thu Oct 31 16:46:43 2013 -0700 @@ -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 8022720 + * @summary private method should be accessible (nested classes) + * @run main ThirdClass + */ + +interface MyFunctionalInterface3 { + int invokeMethodReference(); +} + +public class ThirdClass { + public static void main(String[] args) throws Exception { + MethodInvoker.invoke(); + System.out.println("Passed!"); + } + static class MethodSupplier { + private int m() { + return 999; + } + } + + static class MethodInvoker { + public static void invoke() throws Exception { + MethodSupplier ms = new MethodSupplier(); + MyFunctionalInterface3 fi = ms::m; + if (fi.invokeMethodReference() != 999) { + throw new Exception(); + } + } + } +} diff -r fea486d30d41 -r 6b4d6205366c test/tools/javac/lambdaShapes/org/openjdk/tests/separate/Compiler.java --- a/test/tools/javac/lambdaShapes/org/openjdk/tests/separate/Compiler.java Thu Oct 31 12:36:36 2013 -0700 +++ b/test/tools/javac/lambdaShapes/org/openjdk/tests/separate/Compiler.java Thu Oct 31 16:46:43 2013 -0700 @@ -46,7 +46,7 @@ USECACHE // Keeps results around for reuse. Only use this is // you're sure that each compilation name maps to the // same source code - }; + } private static final AtomicInteger counter = new AtomicInteger(); private static final String targetDir = "gen-separate"; @@ -85,7 +85,7 @@ } public void setFlags(Flags ... flags) { - this.flags = new HashSet(Arrays.asList(flags)); + this.flags = new HashSet<>(Arrays.asList(flags)); } public void addPostprocessor(ClassFilePreprocessor cfp) { @@ -131,17 +131,10 @@ outputDirs.put(type.getName(), outDir); Class superClass = type.getSuperclass(); - if (superClass != null) { - for( Map.Entry each : compileHierarchy(superClass).entrySet()) { - outputDirs.put(each.getKey(), each.getValue()); - } - } - for (Extends ext : type.getSupertypes()) { - Type iface = ext.getType(); - for( Map.Entry each : compileHierarchy(iface).entrySet()) { - outputDirs.put(each.getKey(), each.getValue()); - } - } + if (superClass != null) + outputDirs.putAll(compileHierarchy(superClass)); + for (Extends ext : type.getSupertypes()) + outputDirs.putAll(compileHierarchy(ext.getType())); return outputDirs; } @@ -157,8 +150,12 @@ SourceProcessor accum = (name, src) -> { files.add(new SourceFile(name, src)); }; - for (Type dep : type.typeDependencies()) { - dep.generateAsDependency(accum, type.methodDependencies()); + Collection deps = type.typeDependencies(type.isFullCompilation()); + for (Type dep : deps) { + if (type.isFullCompilation()) + dep.generate(accum); + else + dep.generateAsDependency(accum, type.methodDependencies()); } type.generate(accum); @@ -185,7 +182,7 @@ StandardLocation.CLASS_OUTPUT, Arrays.asList(destDir)); } catch (IOException e) { throw new RuntimeException( - "IOException encountered during compilation"); + "IOException encountered during compilation", e); } Boolean result = ct.call(); if (result == Boolean.FALSE) { diff -r fea486d30d41 -r 6b4d6205366c test/tools/javac/lambdaShapes/org/openjdk/tests/separate/SourceModel.java --- a/test/tools/javac/lambdaShapes/org/openjdk/tests/separate/SourceModel.java Thu Oct 31 12:36:36 2013 -0700 +++ b/test/tools/javac/lambdaShapes/org/openjdk/tests/separate/SourceModel.java Thu Oct 31 16:46:43 2013 -0700 @@ -48,7 +48,7 @@ generate(pw); return sw.toString(); } - }; + } public static class AccessFlag extends Element { private String flag; @@ -125,6 +125,7 @@ // (and thus will be present in stubs) private Set methodDependencies; private List typeDependencies; + private boolean fullCompilation; protected Type(String name, List flags, List params, @@ -214,6 +215,14 @@ methodDependencies.add(m); } + public boolean isFullCompilation() { + return fullCompilation; + } + + public void setFullCompilation(boolean fullCompilation) { + this.fullCompilation = fullCompilation; + } + // Convenience method for creating an Extends object using this // class and specified type arguments. public Extends with(String ... args) { @@ -255,14 +264,23 @@ pw.println("}"); } - public Collection typeDependencies() { + public Collection typeDependencies(boolean recursive) { HashMap dependencies = new HashMap<>(); Type superclass = getSuperclass(); if (superclass != null) { dependencies.put(superclass.getName(), superclass); + if (recursive) { + for (Type t : superclass.typeDependencies(true)) + dependencies.put(t.getName(), t); + } } - for (Extends e : getSupertypes()) + for (Extends e : getSupertypes()) { dependencies.put(e.getType().getName(), e.getType()); + if (recursive) { + for (Type t : e.getType().typeDependencies(true)) + dependencies.put(t.getName(), t); + } + } // Do these last so that they override for (Type t : this.typeDependencies) dependencies.put(t.getName(), t); diff -r fea486d30d41 -r 6b4d6205366c test/tools/javac/lambdaShapes/org/openjdk/tests/separate/TestHarness.java --- a/test/tools/javac/lambdaShapes/org/openjdk/tests/separate/TestHarness.java Thu Oct 31 12:36:36 2013 -0700 +++ b/test/tools/javac/lambdaShapes/org/openjdk/tests/separate/TestHarness.java Thu Oct 31 16:46:43 2013 -0700 @@ -198,7 +198,7 @@ assertEquals(res, value); } } catch (InvocationTargetException | IllegalAccessException e) { - fail("Unexpected exception thrown: " + e.getCause()); + fail("Unexpected exception thrown: " + e.getCause(), e.getCause()); } } @@ -227,8 +227,7 @@ * a return type of 'int', and no arguments. */ public void assertInvokeVirtualEquals(int value, Class target) { - assertInvokeVirtualEquals( - new Integer(value), target, stdCM, "-1"); + assertInvokeVirtualEquals(value, target, stdCM, "-1"); } /** @@ -260,12 +259,31 @@ Compiler compiler = compilerLocal.get(); compiler.setFlags(compilerFlags()); - assertInvokeInterfaceEquals( - new Integer(value), target, new Extends(iface), stdAM); + assertInvokeInterfaceEquals(value, target, new Extends(iface), stdAM); compiler.cleanup(); } + protected void assertInvokeInterfaceThrows(java.lang.Class errorClass, + Class target, Extends iface, AbstractMethod method, + String... args) { + try { + assertInvokeInterfaceEquals(0, target, iface, method, args); + fail("Expected exception: " + errorClass); + } + catch (AssertionError e) { + Throwable cause = e.getCause(); + if (cause == null) + throw e; + else if ((errorClass.isAssignableFrom(cause.getClass()))) { + // this is success + return; + } + else + throw e; + } + } + /** * Creates a class which calls target::method(args) via invokevirtual, * compiles and loads both the new class and 'target', and then invokes @@ -300,7 +318,7 @@ if (verboseLocal.get() == Boolean.TRUE) { System.out.println(e.getCause()); } - assertEquals(e.getCause().getClass(), exceptionType); + assertTrue(exceptionType.isAssignableFrom(e.getCause().getClass())); } compiler.cleanup(); } diff -r fea486d30d41 -r 6b4d6205366c test/tools/javac/lambdaShapes/org/openjdk/tests/vm/DefaultMethodsTest.java --- a/test/tools/javac/lambdaShapes/org/openjdk/tests/vm/DefaultMethodsTest.java Thu Oct 31 12:36:36 2013 -0700 +++ b/test/tools/javac/lambdaShapes/org/openjdk/tests/vm/DefaultMethodsTest.java Thu Oct 31 16:46:43 2013 -0700 @@ -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 @@ -25,18 +25,22 @@ package org.openjdk.tests.vm; -import java.lang.reflect.*; -import java.util.*; -import java.io.File; -import java.io.IOException; - +import org.openjdk.tests.separate.Compiler; +import org.openjdk.tests.separate.TestHarness; import org.testng.annotations.Test; -import org.openjdk.tests.separate.*; -import org.openjdk.tests.separate.Compiler; -import static org.testng.Assert.*; -import static org.openjdk.tests.separate.SourceModel.*; +import static org.openjdk.tests.separate.SourceModel.AbstractMethod; +import static org.openjdk.tests.separate.SourceModel.AccessFlag; import static org.openjdk.tests.separate.SourceModel.Class; +import static org.openjdk.tests.separate.SourceModel.ConcreteMethod; +import static org.openjdk.tests.separate.SourceModel.DefaultMethod; +import static org.openjdk.tests.separate.SourceModel.Extends; +import static org.openjdk.tests.separate.SourceModel.Interface; +import static org.openjdk.tests.separate.SourceModel.MethodParameter; +import static org.openjdk.tests.separate.SourceModel.TypeParameter; +import static org.testng.Assert.assertEquals; +import static org.testng.Assert.assertNotNull; +import static org.testng.Assert.fail; @Test(groups = "vm") public class DefaultMethodsTest extends TestHarness { @@ -186,7 +190,7 @@ * TEST: D d = new D(); d.m() == 22; * TEST: I i = new D(); i.m() == 22; */ - void testExistingInheritedOverride() { + public void testExistingInheritedOverride() { Interface I = new Interface("I", DefaultMethod.std("99")); Class C = new Class("C", I, ConcreteMethod.std("11")); Class D = new Class("D", C, ConcreteMethod.std("22")); @@ -255,15 +259,14 @@ * interface J { default int m() { return 88; } } * class C implements I, J {} * - * TEST: C c = new C(); c.m() throws AME + * TEST: C c = new C(); c.m() throws ICCE */ public void testConflict() { - // debugTest(); Interface I = new Interface("I", DefaultMethod.std("99")); Interface J = new Interface("J", DefaultMethod.std("88")); Class C = new Class("C", I, J); - assertThrows(AbstractMethodError.class, C); + assertThrows(IncompatibleClassChangeError.class, C); } /** @@ -271,14 +274,14 @@ * interface J { default int m() { return 88; } } * class C implements I, J {} * - * TEST: C c = new C(); c.m() throws AME + * TEST: C c = new C(); c.m() == 88 */ public void testAmbiguousReabstract() { Interface I = new Interface("I", AbstractMethod.std()); Interface J = new Interface("J", DefaultMethod.std("88")); Class C = new Class("C", I, J); - assertThrows(AbstractMethodError.class, C); + assertInvokeVirtualEquals(88, C); } /** @@ -390,19 +393,16 @@ /** * interface I { default int m(T t) { return 99; } } - * Class C implements I { public int m() { return 88; } } + * Class C implements I { public int m(String s) { return 88; } } * - * TEST: C c = new C(); c.m() == 88; - * TEST: I i = new C(); i.m() == 88; + * TEST: C c = new C(); c.m("string") == 88; + * TEST: I i = new C(); i.m("string") == 88; */ - @Test(enabled=false) public void testSelfFill() { // This test ensures that a concrete method overrides a default method // that matches at the language-level, but has a different method // signature due to erasure. - // debugTest(); - DefaultMethod dm = new DefaultMethod( "int", "m", "return 99;", new MethodParameter("T", "t")); ConcreteMethod cm = new ConcreteMethod( @@ -415,9 +415,11 @@ AbstractMethod pm = new AbstractMethod( "int", "m", new MethodParameter("T", "t")); - assertInvokeVirtualEquals(new Integer(88), C, cm, "-1", "\"string\""); - assertInvokeInterfaceEquals( - new Integer(88), C, I.with("String"), pm, "\"string\""); + assertInvokeVirtualEquals(88, C, cm, "-1", "\"string\""); + assertInvokeInterfaceEquals(99, C, I.with("String"), pm, "\"string\""); + + C.setFullCompilation(true); // Force full bridge generation + assertInvokeInterfaceEquals(88, C, I.with("String"), pm, "\"string\""); } /** @@ -485,7 +487,6 @@ * TEST: J j = new C(); j.m("A","B","C") == 88; * TEST: K k = new C(); k.m("A","B","C") == 88; */ - @Test(enabled=false) public void testBridges() { DefaultMethod dm = new DefaultMethod("int", stdMethodName, "return 99;", new MethodParameter("T", "t"), new MethodParameter("V", "v"), @@ -518,13 +519,17 @@ J.with("String", "T"), pm2); Class C = new Class("C", K.with("String"), cm); + // First, without compiler bridges String[] args = new String[] { "\"A\"", "\"B\"", "\"C\"" }; - assertInvokeInterfaceEquals(new Integer(88), C, - I.with("String", "String", "String"), pm0, args); - assertInvokeInterfaceEquals(new Integer(88), C, - J.with("String", "String"), pm1, args); - assertInvokeInterfaceEquals(new Integer(88), C, - K.with("String"), pm2, args); + assertInvokeInterfaceEquals(99, C, I.with("String", "String", "String"), pm0, args); + assertInvokeInterfaceThrows(AbstractMethodError.class, C, J.with("String", "String"), pm1, args); + assertInvokeInterfaceThrows(AbstractMethodError.class, C, K.with("String"), pm2, args); + + // Then with compiler bridges + C.setFullCompilation(true); + assertInvokeInterfaceEquals(88, C, I.with("String", "String", "String"), pm0, args); + assertInvokeInterfaceEquals(88, C, J.with("String", "String"), pm1, args); + assertInvokeInterfaceEquals(88, C, K.with("String"), pm2, args); } /** @@ -536,8 +541,6 @@ * TEST: I i = new C(); i.m() == 88; */ public void testSuperBasic() { - // debugTest(); - Interface J = new Interface("J", DefaultMethod.std("88")); Interface I = new Interface("I", J, new DefaultMethod( "int", stdMethodName, "return J.super.m();")); @@ -555,12 +558,10 @@ * interface I extends J, K { int m() default { J.super.m(); } } * class C implements I {} * - * TEST: C c = new C(); c.m() throws AME - * TODO: add case for K k = new C(); k.m() throws AME + * TEST: C c = new C(); c.m() throws ICCE + * TODO: add case for K k = new C(); k.m() throws ICCE */ public void testSuperConflict() { - // debugTest(); - Interface K = new Interface("K", DefaultMethod.std("99")); Interface L = new Interface("L", DefaultMethod.std("101")); Interface J = new Interface("J", K, L); @@ -571,7 +572,7 @@ I.addCompilationDependency(Jstub.findMethod(stdMethodName)); Class C = new Class("C", I); - assertThrows(AbstractMethodError.class, C); + assertThrows(IncompatibleClassChangeError.class, C); } /** @@ -579,8 +580,8 @@ * interface J extends I { default int m() { return 55; } } * class C implements I, J { public int m() { return I.super.m(); } } * - * TEST: C c = new C(); c.m() throws AME - * TODO: add case for J j = new C(); j.m() throws AME + * TEST: C c = new C(); c.m() == 99 + * TODO: add case for J j = new C(); j.m() == ??? */ public void testSuperDisqual() { Interface I = new Interface("I", DefaultMethod.std("99")); @@ -590,7 +591,7 @@ AccessFlag.PUBLIC)); C.addCompilationDependency(I.findMethod(stdMethodName)); - assertThrows(AbstractMethodError.class, C); + assertInvokeVirtualEquals(99, C); } /** @@ -635,8 +636,7 @@ AbstractMethod pm = new AbstractMethod("int", stdMethodName, new MethodParameter("String", "s")); - assertInvokeInterfaceEquals( - new Integer(88), C, new Extends(I), pm, "\"\""); + assertInvokeInterfaceEquals(88, C, new Extends(I), pm, "\"\""); } /** @@ -646,7 +646,7 @@ * public int m(String s) { return I.super.m(s); } * } * - * TEST: C c = new C(); c.m("string") throws AME + * TEST: C c = new C(); c.m("string") == 44 */ public void testSuperGenericDisqual() { MethodParameter t = new MethodParameter("T", "t"); @@ -661,7 +661,7 @@ "return I.super.m(s);", AccessFlag.PUBLIC, s)); C.addCompilationDependency(I.findMethod(stdMethodName)); - assertThrows(AbstractMethodError.class, C, + assertInvokeVirtualEquals(44, C, new ConcreteMethod( "int", stdMethodName, "return -1;", AccessFlag.PUBLIC, s), "-1", "\"string\""); @@ -674,7 +674,6 @@ * class S { Object foo() { return (new D()).m(); } // link sig: ()LInteger; * TEST: S s = new S(); s.foo() == new Integer(99) */ - @Test(enabled=false) public void testCovarBridge() { Interface I = new Interface("I", new DefaultMethod( "Integer", "m", "return new Integer(88);")); @@ -692,7 +691,8 @@ S.addCompilationDependency(Dstub); S.addCompilationDependency(DstubMethod); - assertInvokeVirtualEquals(new Integer(99), S, toCall, "null"); + // NEGATIVE test for separate compilation -- dispatches to I, not C + assertInvokeVirtualEquals(88, S, toCall, "null"); } /** @@ -719,7 +719,7 @@ S.addCompilationDependency(Dstub); S.addCompilationDependency(DstubMethod); - assertInvokeVirtualEquals(new Integer(88), S, toCall, "null"); + assertInvokeVirtualEquals(88, S, toCall, "null"); } /** @@ -757,7 +757,6 @@ * Test that a erased-signature-matching method does not implement * non-language-level matching methods */ - @Test(enabled=false) public void testNonConcreteFill() { AbstractMethod ipm = new AbstractMethod("int", "m", new MethodParameter("T", "t"), @@ -781,13 +780,14 @@ new MethodParameter("T", "t"), new MethodParameter("String", "s"), new MethodParameter("String", "w")); + DefaultMethod kdm = new DefaultMethod("int", "m", "return 99;", + new MethodParameter("T", "t"), + new MethodParameter("String", "v"), + new MethodParameter("String", "w")); Interface K = new Interface("K", new TypeParameter("T"), J.with("T", "String"), - new DefaultMethod("int", "m", "return 99;", - new MethodParameter("T", "t"), - new MethodParameter("String", "v"), - new MethodParameter("String", "w"))); + kdm); Class C = new Class("C", K.with("String"), @@ -797,13 +797,18 @@ new MethodParameter("Object", "v"), new MethodParameter("String", "w"))); + // First, without compiler bridges String a = "\"\""; - assertInvokeInterfaceEquals(99, C, - K.with("String"), kpm, a, a, a); - assertInvokeInterfaceEquals(77, C, - J.with("String", "String"), jpm, a, a, a); - assertInvokeInterfaceEquals(99, C, - I.with("String", "String", "String"), ipm, a, a, a); + assertInvokeInterfaceEquals(99, C, K.with("String"), kpm, a, a, a); + assertInvokeInterfaceEquals(77, C, J.with("String", "String"), jpm, a, a, a); + assertInvokeInterfaceThrows(AbstractMethodError.class, C, I.with("String", "String", "String"), ipm, a, a, a); + + // Now, with bridges + J.setFullCompilation(true); + K.setFullCompilation(true); + assertInvokeInterfaceEquals(99, C, K.with("String"), kpm, a, a, a); + assertInvokeInterfaceEquals(77, C, J.with("String", "String"), jpm, a, a, a); + assertInvokeInterfaceEquals(99, C, I.with("String", "String", "String"), ipm, a, a, a); } public void testStrictfpDefault() { diff -r fea486d30d41 -r 6b4d6205366c test/tools/javac/processing/model/element/TestEmptyContainer.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/processing/model/element/TestEmptyContainer.java Thu Oct 31 16:46:43 2013 -0700 @@ -0,0 +1,82 @@ +/* + * 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 8026857 + * @summary Test that an empty container does not stop us from looking at + * supertypes for inherited repeated annotations. + * @library /tools/javac/lib + * @build JavacTestingAbstractProcessor TestEmptyContainer + * @compile -processor TestEmptyContainer -proc:only TestEmptyContainer.java + */ + +import com.sun.tools.javac.util.Assert; + +import java.lang.annotation.*; +import java.util.Arrays; +import java.util.Set; +import javax.annotation.processing.*; +import javax.lang.model.element.Element; +import javax.lang.model.element.TypeElement; + +import static javax.lang.model.util.ElementFilter.*; + +@TestEmptyContainer.Foo(1) +public class TestEmptyContainer extends JavacTestingAbstractProcessor { + public boolean process(Set annotations, + RoundEnvironment roundEnv) { + if (!roundEnv.processingOver()) { + boolean hasRun = false; + for (Element element : roundEnv.getRootElements()) + for (TypeElement te : typesIn(element.getEnclosedElements())) + if (te.getQualifiedName().contentEquals("TestEmptyContainer.T2")) { + hasRun = true; + Foo[] foos = te.getAnnotationsByType(Foo.class); + System.out.println(" " + te); + System.out.println(" " + Arrays.asList(foos)); + Assert.check(foos.length == 1, "Should find one @Foo"); + Assert.check(foos[0].value() == 1, "Should find @Foo(1)"); + } + if (!hasRun) + throw new RuntimeException("Annotation processor couldn't find class T2, test broken!"); + } + return true; + } + + // This empty container should not stop us from finding @Foo(1) on TestEmptyContainer above + @TestEmptyContainer.FooContainer({}) + public static class T2 extends TestEmptyContainer { + } + + @Repeatable(FooContainer.class) + @Inherited + public static @interface Foo { + int value(); + } + + @Inherited + public static @interface FooContainer { + Foo[] value(); + } +} diff -r fea486d30d41 -r 6b4d6205366c test/tools/javac/processing/model/element/TestNonInherited.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/processing/model/element/TestNonInherited.java Thu Oct 31 16:46:43 2013 -0700 @@ -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. + */ + +/* + * @test + * @bug 8026855 + * @summary Javac should only look on supertypes for repeatable annotations if + * both container and containee are inherited. + * @library /tools/javac/lib + * @build JavacTestingAbstractProcessor TestNonInherited + * @compile -processor TestNonInherited -proc:only TestNonInherited.java + */ + +import com.sun.tools.javac.util.Assert; + +import java.lang.annotation.*; +import java.util.Arrays; +import java.util.Set; +import javax.annotation.processing.*; +import javax.lang.model.element.*; +import javax.lang.model.util.*; + +import static javax.lang.model.util.ElementFilter.*; + +@TestNonInherited.Foo(1) +public class TestNonInherited extends JavacTestingAbstractProcessor { + public boolean process(Set annotations, + RoundEnvironment roundEnv) { + if (!roundEnv.processingOver()) { + boolean hasRun = false; + for (Element element : roundEnv.getRootElements()) + for (TypeElement te : typesIn(element.getEnclosedElements())) + if (te.getQualifiedName().contentEquals("TestNonInherited.T2")) { + hasRun = true; + Foo[] foos = te.getAnnotationsByType(Foo.class); + System.out.println(" " + te); + System.out.println(" " + Arrays.asList(foos)); + Assert.check(foos.length == 0, "Should not find any instance of @Foo"); + } + if (!hasRun) + throw new RuntimeException("The annotation processor could not find the declaration of T2, test broken!"); + } + return true; + } + + public static class T2 extends TestNonInherited { + } + + @Repeatable(FooContainer.class) + public static @interface Foo { + int value(); + } + + @Inherited + public static @interface FooContainer { + Foo[] value(); + } +} diff -r fea486d30d41 -r 6b4d6205366c test/tools/jdeps/Basic.java --- a/test/tools/jdeps/Basic.java Thu Oct 31 12:36:36 2013 -0700 +++ b/test/tools/jdeps/Basic.java Thu Oct 31 16:46:43 2013 -0700 @@ -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 @@ -23,9 +23,9 @@ /* * @test - * @bug 8003562 8005428 8015912 + * @bug 8003562 8005428 8015912 8027481 * @summary Basic tests for jdeps tool - * @build Test p.Foo + * @build Test p.Foo p.Bar javax.activity.NotCompactProfile * @run main Basic */ @@ -33,10 +33,12 @@ import java.io.IOException; import java.io.PrintWriter; import java.io.StringWriter; +import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; import java.util.*; import java.util.regex.*; +import static java.nio.file.StandardCopyOption.*; public class Basic { private static boolean symbolFileExist = initProfiles(); @@ -74,23 +76,25 @@ new String[] {"java.lang", "p"}, new String[] {"compact1", "not found"}); // test a directory + // also test non-SE javax.activity class dependency test(new File(testDir, "p"), - new String[] {"java.lang", "java.util", "java.lang.management"}, - new String[] {"compact1", "compact1", "compact3"}); + new String[] {"java.lang", "java.util", "java.lang.management", "javax.activity", "javax.crypto"}, + new String[] {"compact1", "compact1", "compact3", testDir.getName(), "compact1"}, + new String[] {"-classpath", testDir.getPath()}); // test class-level dependency output test(new File(testDir, "Test.class"), - new String[] {"java.lang.Object", "java.lang.String", "p.Foo"}, - new String[] {"compact1", "compact1", "not found"}, + new String[] {"java.lang.Object", "java.lang.String", "p.Foo", "p.Bar"}, + new String[] {"compact1", "compact1", "not found", "not found"}, new String[] {"-verbose:class"}); // test -p option test(new File(testDir, "Test.class"), - new String[] {"p.Foo"}, - new String[] {"not found"}, + new String[] {"p.Foo", "p.Bar"}, + new String[] {"not found", "not found"}, new String[] {"-verbose:class", "-p", "p"}); // test -e option test(new File(testDir, "Test.class"), - new String[] {"p.Foo"}, - new String[] {"not found"}, + new String[] {"p.Foo", "p.Bar"}, + new String[] {"not found", "not found"}, new String[] {"-verbose:class", "-e", "p\\..*"}); test(new File(testDir, "Test.class"), new String[] {"java.lang"}, @@ -99,13 +103,34 @@ // test -classpath and -include options test(null, new String[] {"java.lang", "java.util", - "java.lang.management"}, - new String[] {"compact1", "compact1", "compact3"}, + "java.lang.management", "javax.crypto"}, + new String[] {"compact1", "compact1", "compact3", "compact1"}, new String[] {"-classpath", testDir.getPath(), "-include", "p.+|Test.class"}); test(new File(testDir, "Test.class"), - new String[] {"java.lang.Object", "java.lang.String", "p.Foo"}, - new String[] {"compact1", "compact1", testDir.getName()}, + new String[] {"java.lang.Object", "java.lang.String", "p.Foo", "p.Bar"}, + new String[] {"compact1", "compact1", testDir.getName(), testDir.getName()}, new String[] {"-v", "-classpath", testDir.getPath(), "Test.class"}); + + // split package p - move p/Foo.class to dir1 and p/Bar.class to dir2 + Path testClassPath = testDir.toPath(); + Path dirP = testClassPath.resolve("p"); + Path dir1 = testClassPath.resolve("dir1"); + Path subdir1P = dir1.resolve("p"); + Path dir2 = testClassPath.resolve("dir2"); + Path subdir2P = dir2.resolve("p"); + if (!Files.exists(subdir1P)) + Files.createDirectories(subdir1P); + if (!Files.exists(subdir2P)) + Files.createDirectories(subdir2P); + Files.move(dirP.resolve("Foo.class"), subdir1P.resolve("Foo.class"), REPLACE_EXISTING); + Files.move(dirP.resolve("Bar.class"), subdir2P.resolve("Bar.class"), REPLACE_EXISTING); + StringBuilder cpath = new StringBuilder(testDir.toString()); + cpath.append(File.pathSeparator).append(dir1.toString()); + cpath.append(File.pathSeparator).append(dir2.toString()); + test(new File(testDir, "Test.class"), + new String[] {"java.lang.Object", "java.lang.String", "p.Foo", "p.Bar"}, + new String[] {"compact1", "compact1", dir1.toFile().getName(), dir2.toFile().getName()}, + new String[] {"-v", "-classpath", cpath.toString(), "Test.class"}); return errors; } @@ -148,7 +173,7 @@ // Use the linePattern to break the given String into lines, applying // the pattern to each line to see if we have a match private static Map findDeps(String out) { - Map result = new HashMap<>(); + Map result = new LinkedHashMap<>(); Matcher lm = linePattern.matcher(out); // Line matcher Matcher pm = null; // Pattern matcher int lines = 0; diff -r fea486d30d41 -r 6b4d6205366c test/tools/jdeps/Test.java --- a/test/tools/jdeps/Test.java Thu Oct 31 12:36:36 2013 -0700 +++ b/test/tools/jdeps/Test.java Thu Oct 31 16:46:43 2013 -0700 @@ -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 @@ -24,6 +24,7 @@ public class Test { public void test() { p.Foo f = new p.Foo(); + p.Bar b = new p.Bar(); } private String name() { return "this test"; diff -r fea486d30d41 -r 6b4d6205366c test/tools/jdeps/javax/activity/NotCompactProfile.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/jdeps/javax/activity/NotCompactProfile.java Thu Oct 31 16:46:43 2013 -0700 @@ -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. + */ + +package javax.activity; + +public class NotCompactProfile { + public static String name() { + return "not Java SE API"; + } +} diff -r fea486d30d41 -r 6b4d6205366c test/tools/jdeps/p/Bar.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/jdeps/p/Bar.java Thu Oct 31 16:46:43 2013 -0700 @@ -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. + */ + +package p; + +public class Bar extends javax.activity.NotCompactProfile { + public String bar() { + return "bar"; + } + public javax.crypto.Cipher getCiper() { + return null; + } +}