--- a/langtools/src/share/classes/com/sun/javadoc/Tag.java Thu Oct 31 12:36:36 2013 -0700
+++ b/langtools/src/share/classes/com/sun/javadoc/Tag.java Thu Oct 31 16:46:43 2013 -0700
@@ -72,7 +72,7 @@
* <code>kind() == name()</code>;
* the following table lists those cases where there is more
* than one tag of a given kind:
- * <p>
+ *
* <table border="1" cellpadding="4" cellspacing="0" summary="related tags">
* <tr><th>{@code kind() }</th> <th>{@code name() }</th></tr>
* <tr><td>{@code @throws }</td> <td>{@code @throws }</td></tr>
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/AbstractExecutableMemberWriter.java Thu Oct 31 12:36:36 2013 -0700
+++ b/langtools/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);
}
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/AbstractIndexWriter.java Thu Oct 31 12:36:36 2013 -0700
+++ b/langtools/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)) {
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/AbstractMemberWriter.java Thu Oct 31 12:36:36 2013 -0700
+++ b/langtools/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);
}
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeFieldWriterImpl.java Thu Oct 31 12:36:36 2013 -0700
+++ b/langtools/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);
}
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeRequiredMemberWriterImpl.java Thu Oct 31 12:36:36 2013 -0700
+++ b/langtools/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);
}
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeWriterImpl.java Thu Oct 31 12:36:36 2013 -0700
+++ b/langtools/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) {
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ClassWriterImpl.java Thu Oct 31 12:36:36 2013 -0700
+++ b/langtools/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) {
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ConfigurationImpl.java Thu Oct 31 12:36:36 2013 -0700
+++ b/langtools/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());
}
}
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/EnumConstantWriterImpl.java Thu Oct 31 12:36:36 2013 -0700
+++ b/langtools/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);
}
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/FieldWriterImpl.java Thu Oct 31 12:36:36 2013 -0700
+++ b/langtools/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);
}
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/HelpWriter.java Thu Oct 31 12:36:36 2013 -0700
+++ b/langtools/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);
}
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java Thu Oct 31 12:36:36 2013 -0700
+++ b/langtools/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);
}
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/MethodWriterImpl.java Thu Oct 31 12:36:36 2013 -0700
+++ b/langtools/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,
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/NestedClassWriterImpl.java Thu Oct 31 12:36:36 2013 -0700
+++ b/langtools/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);
}
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageFrameWriter.java Thu Oct 31 12:36:36 2013 -0700
+++ b/langtools/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);
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageTreeWriter.java Thu Oct 31 12:36:36 2013 -0700
+++ b/langtools/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);
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageWriterImpl.java Thu Oct 31 12:36:36 2013 -0700
+++ b/langtools/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();
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ProfilePackageFrameWriter.java Thu Oct 31 12:36:36 2013 -0700
+++ b/langtools/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);
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ProfilePackageWriterImpl.java Thu Oct 31 12:36:36 2013 -0700
+++ b/langtools/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);
}
/**
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ProfileWriterImpl.java Thu Oct 31 12:36:36 2013 -0700
+++ b/langtools/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();
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PropertyWriterImpl.java Thu Oct 31 12:36:36 2013 -0700
+++ b/langtools/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);
}
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/SubWriterHolderWriter.java Thu Oct 31 12:36:36 2013 -0700
+++ b/langtools/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);
}
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/TagletWriterImpl.java Thu Oct 31 12:36:36 2013 -0700
+++ b/langtools/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;
}
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/TreeWriter.java Thu Oct 31 12:36:36 2013 -0700
+++ b/langtools/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);
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlDocWriter.java Thu Oct 31 12:36:36 2013 -0700
+++ b/langtools/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);
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlStyle.java Thu Oct 31 12:36:36 2013 -0700
+++ b/langtools/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;
}
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/resources/stylesheet.css Thu Oct 31 12:36:36 2013 -0700
+++ b/langtools/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;
}
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/TagletManager.java Thu Oct 31 12:36:36 2013 -0700
+++ b/langtools/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<String> getCustomTagNames() {
+ return customTags.keySet();
+ }
+
/**
* Add a new <code>Taglet</code>. Print a message to indicate whether or not
* the Taglet was registered properly.
--- a/langtools/src/share/classes/com/sun/tools/doclint/Checker.java Thu Oct 31 12:36:36 2013 -0700
+++ b/langtools/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()) {
--- a/langtools/src/share/classes/com/sun/tools/doclint/DocLint.java Thu Oct 31 12:36:36 2013 -0700
+++ b/langtools/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 = ",";
// <editor-fold defaultstate="collapsed" desc="Command-line entry point">
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);
}
--- a/langtools/src/share/classes/com/sun/tools/doclint/Env.java Thu Oct 31 12:36:36 2013 -0700
+++ b/langtools/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<String> customTags;
+
// Utility classes
DocTrees trees;
Elements elements;
@@ -135,6 +138,14 @@
implicitHeaderLevel = n;
}
+ void setCustomTags(String cTags) {
+ customTags = new LinkedHashSet<String>();
+ 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;
--- a/langtools/src/share/classes/com/sun/tools/javac/code/AnnoConstruct.java Thu Oct 31 12:36:36 2013 -0700
+++ b/langtools/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<Attribute.Compound> compounds = new ListBuffer<>();
- if (contained0 != null) {
- for (Attribute a : contained0)
- if (a instanceof Attribute.Compound)
- compounds = compounds.append((Attribute.Compound)a);
- }
- Attribute.Compound[] contained = compounds.toArray(new Attribute.Compound[compounds.size()]);
+ 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<Attribute.Compound> 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 extends Annotation> A getAnnotation(Class<A> annoType) {
--- a/langtools/src/share/classes/com/sun/tools/javac/code/Flags.java Thu Oct 31 12:36:36 2013 -0700
+++ b/langtools/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;
--- a/langtools/src/share/classes/com/sun/tools/javac/code/Symbol.java Thu Oct 31 12:36:36 2013 -0700
+++ b/langtools/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<Attribute.Compound> getRawAttributes() {
- return (annotations == null)
+ return (metadata == null)
? List.<Attribute.Compound>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<Attribute.TypeCompound> getRawTypeAttributes() {
- return (annotations == null)
+ return (metadata == null)
? List.<Attribute.TypeCompound>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<Attribute.Compound> l) {
if (l.nonEmpty()) {
- initedAnnos().append(l);
+ initedMetadata().append(l);
}
}
public void appendClassInitTypeAttributes(List<Attribute.TypeCompound> l) {
if (l.nonEmpty()) {
- initedAnnos().appendClassInitTypeAttributes(l);
+ initedMetadata().appendClassInitTypeAttributes(l);
}
}
public void appendInitTypeAttributes(List<Attribute.TypeCompound> l) {
if (l.nonEmpty()) {
- initedAnnos().appendInitTypeAttributes(l);
+ initedMetadata().appendInitTypeAttributes(l);
}
}
public void appendTypeAttributesWithCompletion(final Annotate.AnnotateRepeatedContext<Attribute.TypeCompound> ctx) {
- initedAnnos().appendTypeAttributesWithCompletion(ctx);
+ initedMetadata().appendTypeAttributesWithCompletion(ctx);
}
public void appendUniqueTypeAttributes(List<Attribute.TypeCompound> l) {
if (l.nonEmpty()) {
- initedAnnos().appendUniqueTypes(l);
+ initedMetadata().appendUniqueTypes(l);
}
}
public List<Attribute.TypeCompound> getClassInitTypeAttributes() {
- return (annotations == null)
+ return (metadata == null)
? List.<Attribute.TypeCompound>nil()
- : annotations.getClassInitTypeAttributes();
+ : metadata.getClassInitTypeAttributes();
}
public List<Attribute.TypeCompound> getInitTypeAttributes() {
- return (annotations == null)
+ return (metadata == null)
? List.<Attribute.TypeCompound>nil()
- : annotations.getInitTypeAttributes();
+ : metadata.getInitTypeAttributes();
}
public List<Attribute.Compound> getDeclarationAttributes() {
- return (annotations == null)
+ return (metadata == null)
? List.<Attribute.Compound>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<Attribute.Compound> 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<Attribute.Compound> a) {
- if (annotations != null || a.nonEmpty()) {
- initedAnnos().setDeclarationAttributes(a);
+ if (metadata != null || a.nonEmpty()) {
+ initedMetadata().setDeclarationAttributes(a);
}
}
public void setDeclarationAttributesWithCompletion(final Annotate.AnnotateRepeatedContext<Attribute.Compound> ctx) {
- initedAnnos().setDeclarationAttributesWithCompletion(ctx);
+ initedMetadata().setDeclarationAttributesWithCompletion(ctx);
}
public void setTypeAttributes(List<Attribute.TypeCompound> 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;
}
// </editor-fold>
@@ -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);
}
}
--- a/langtools/src/share/classes/com/sun/tools/javac/code/TypeAnnotations.java Thu Oct 31 12:36:36 2013 -0700
+++ b/langtools/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<Attribute.TypeCompound> newattrs =
+ new ListBuffer<Attribute.TypeCompound>();
+
+ 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?
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Attr.java Thu Oct 31 12:36:36 2013 -0700
+++ b/langtools/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<JCAnnotation> 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<Attribute.TypeCompound> fromAnnotations(List<JCAnnotation> annotations) {
- if (annotations.isEmpty())
+ if (annotations.isEmpty()) {
return List.nil();
+ }
ListBuffer<Attribute.TypeCompound> 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();
}
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Check.java Thu Oct 31 12:36:36 2013 -0700
+++ b/langtools/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)
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Flow.java Thu Oct 31 12:36:36 2013 -0700
+++ b/langtools/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);
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Infer.java Thu Oct 31 12:36:36 2013 -0700
+++ b/langtools/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);
}
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java Thu Oct 31 12:36:36 2013 -0700
+++ b/langtools/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;
+ // <editor-fold defaultstate="collapsed" desc="Instantiating">
+ protected static final Context.Key<LambdaToMethod> unlambdaKey =
+ new Context.Key<LambdaToMethod>();
+
+ 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);
+ }
+ // </editor-fold>
+
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<String, ListBuffer<JCStatement>>();
MethodType type = new MethodType(List.of(syms.serializedLambdaType), syms.objectType,
List.<Type>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 @@
}
}
- // <editor-fold defaultstate="collapsed" desc="Instantiating">
- private static final Context.Key<LambdaToMethod> unlambdaKey =
- new Context.Key<LambdaToMethod>();
-
- 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);
- }
- // </editor-fold>
-
// <editor-fold defaultstate="collapsed" desc="translate methods">
@Override
public <T extends JCTree> 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<JCTree> 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.<JCStatement>of(stat));
- } else if (isLambda_void && isTarget_Void) {
- //void to Void conversion:
- // BODY; return null;
- ListBuffer<JCStatement> 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.<JCStatement>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.<JCStatement>of(stat));
+ } else if (isLambda_void && isTarget_Void) {
+ //void to Void conversion:
+ // BODY; return null;
+ ListBuffer<JCStatement> 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.<JCStatement>of(make.Return(retExpr)));
+ }
+ } finally {
+ make.at(prevPos);
}
}
@@ -587,10 +606,10 @@
DiagnosticPosition pos, List<Object> 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<JCExpression> 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<String, Integer> serializableLambdaCounts =
- new HashMap<String, Integer>();
+ private class SyntheticMethodNameCounter {
+ private Map<String, Integer> 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<Symbol, JCClassDecl> localClassDefs;
@@ -1133,13 +1171,13 @@
@Override
public void visitClassDef(JCClassDecl tree) {
List<Frame> prevStack = frameStack;
- Map<String, Integer> prevSerializableLambdaCount =
- serializableLambdaCounts;
+ SyntheticMethodNameCounter prevSyntheticMethodNameCounts =
+ syntheticMethodNameCounts;
Map<ClassSymbol, Symbol> prevClinits = clinits;
DiagnosticSource prevSource = log.currentSource();
try {
log.useSource(tree.sym.sourcefile);
- serializableLambdaCounts = new HashMap<String, Integer>();
+ syntheticMethodNameCounts = new SyntheticMethodNameCounter();
prevClinits = new HashMap<ClassSymbol, Symbol>();
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<JCVariableDecl> paramBuff = new ListBuffer<JCVariableDecl>();
int i = 0;
for (List<Type> 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<JCVariableDecl> 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("<clinit>"))
- methodName = "static";
- else if (methodName.equals("<init>"))
- 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<T extends JCFunctionalExpression> {
/** 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<Symbol> bridges;
+ final List<Symbol> 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("<clinit>")) {
+ methodName = "static";
+ } else if (methodName.equals("<init>")) {
+ methodName = "new";
+ }
+ return methodName;
+ }
}
/**
@@ -1699,22 +1720,12 @@
private class LambdaTranslationContext extends TranslationContext<JCLambda> {
/** variable in the enclosing context to which this lambda is assigned */
- Symbol self;
-
- /** map from original to translated lambda parameters */
- Map<Symbol, Symbol> lambdaParams = new LinkedHashMap<Symbol, Symbol>();
-
- /** map from original to translated lambda locals */
- Map<Symbol, Symbol> lambdaLocals = new LinkedHashMap<Symbol, Symbol>();
+ final Symbol self;
- /** map from variables in enclosing scope to translated synthetic parameters */
- Map<Symbol, Symbol> capturedLocals = new LinkedHashMap<Symbol, Symbol>();
+ /** 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<Symbol, Symbol> capturedThis = new LinkedHashMap<Symbol, Symbol>();
-
- /** map from original to translated lambda locals */
- Map<Symbol, Symbol> typeVars = new LinkedHashMap<Symbol, Symbol>();
+ Map<LambdaSymbolKind, Map<Symbol, Symbol>> 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<Symbol, Symbol>());
+ translatedSymbols.put(LOCAL_VAR, new LinkedHashMap<Symbol, Symbol>());
+ translatedSymbols.put(CAPTURED_VAR, new LinkedHashMap<Symbol, Symbol>());
+ translatedSymbols.put(CAPTURED_THIS, new LinkedHashMap<Symbol, Symbol>());
+ translatedSymbols.put(TYPE_VAR, new LinkedHashMap<Symbol, Symbol>());
+ }
+
+ /**
+ * 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<Symbol, Symbol> transMap = null;
+ Map<Symbol, Symbol> 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<Symbol, Symbol> getSymbolMap(LambdaSymbolKind... skinds) {
- LinkedHashMap<Symbol, Symbol> translationMap = new LinkedHashMap<Symbol, Symbol>();
- 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<Symbol, Symbol> getSymbolMap(LambdaSymbolKind skind) {
+ Map<Symbol, Symbol> m = translatedSymbols.get(skind);
+ Assert.checkNonNull(m);
+ return m;
+ }
+
+ JCTree translate(JCIdent lambdaIdent) {
+ for (Map<Symbol, Symbol> 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 @@
}
// </editor-fold>
+ /*
+ * 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();
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/MemberEnter.java Thu Oct 31 12:36:36 2013 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/MemberEnter.java Thu Oct 31 16:46:43 2013 -0700
@@ -573,45 +573,51 @@
Env<AttrContext> 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<VarSymbol> params = new ListBuffer<VarSymbol>();
- JCVariableDecl lastParam = null;
- for (List<JCVariableDecl> 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<VarSymbol> params = new ListBuffer<VarSymbol>();
+ JCVariableDecl lastParam = null;
+ for (List<JCVariableDecl> 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<AttrContext> 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<AttrContext> 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) {
--- a/langtools/src/share/classes/com/sun/tools/javac/jvm/Gen.java Thu Oct 31 12:36:36 2013 -0700
+++ b/langtools/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);
}
--- a/langtools/src/share/classes/com/sun/tools/javac/main/JavaCompiler.java Thu Oct 31 12:36:36 2013 -0700
+++ b/langtools/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<Env<AttrContext>> dependencies = new LinkedHashSet<Env<AttrContext>>();
+ protected boolean hasLambdas;
@Override
public void visitClassDef(JCClassDecl node) {
Type st = types.supertype(node.sym.type);
@@ -1402,7 +1397,18 @@
Env<AttrContext> 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);
}
--- a/langtools/src/share/classes/com/sun/tools/javac/util/JavacMessages.java Thu Oct 31 12:36:36 2013 -0700
+++ b/langtools/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<ResourceBundle> 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<ResourceBundle> 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);
}
}
--- a/langtools/src/share/classes/com/sun/tools/javadoc/DocEnv.java Thu Oct 31 12:36:36 2013 -0700
+++ b/langtools/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<String> opts) {
+ void initDoclint(Collection<String> opts, Collection<String> customTagNames) {
ArrayList<String> doclintOpts = new ArrayList<String>();
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
--- a/langtools/src/share/classes/com/sun/tools/javadoc/RootDocImpl.java Thu Oct 31 12:36:36 2013 -0700
+++ b/langtools/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<String> opts) {
- env.initDoclint(opts);
+ public void initDocLint(Collection<String> opts, Collection<String> customTagNames) {
+ env.initDoclint(opts, customTagNames);
}
public boolean showTagMessages() {
--- a/langtools/src/share/classes/com/sun/tools/jdeps/Analyzer.java Thu Oct 31 12:36:36 2013 -0700
+++ b/langtools/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<Archive, ArchiveDeps> results = new HashMap<>();
- private final Map<String, Archive> map = new HashMap<>();
+ private final Map<Location, Archive> 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<Archive> 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<String> 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<Archive,String> 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<String, SortedSet<ArchiveDeps.Dep>> 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<Archive,String> requireArchives;
- final SortedMap<String, SortedSet<String>> deps;
- Profile profile = null;
+ final SortedMap<String, SortedSet<Dep>> 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<String> set = deps.get(origin);
+ void add(String origin, String target, Archive targetArchive, String pkgName) {
+ SortedSet<Dep> 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<Dep> requireArchives() {
+ Map<Archive,Profile> map = new HashMap<>();
+ for (Set<Dep> 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<Dep> list = new ArrayList<>();
+ for (Map.Entry<Archive,Profile> 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<Dep> {
+ 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() ? "<unnamed>" : pkg;
}
- public Profile getTargetProfile(String target) {
- return Profile.getProfile(target);
- }
}
}
--- a/langtools/src/share/classes/com/sun/tools/jdeps/Archive.java Thu Oct 31 12:36:36 2013 -0700
+++ b/langtools/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<Location> set = deps.get(origin);
if (set == null) {
@@ -76,21 +77,27 @@
set.add(target);
}
- public void visit(Visitor v) {
+ public Set<Location> getClasses() {
+ return deps.keySet();
+ }
+
+ public void visitDependences(Visitor v) {
for (Map.Entry<Location,Set<Location>> 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);
}
}
--- a/langtools/src/share/classes/com/sun/tools/jdeps/JdepsTask.java Thu Oct 31 12:36:36 2013 -0700
+++ b/langtools/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<Archive> 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<String> 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<String> 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<Archive> {
+ @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<String> {
+ private String packageOf(String cn) {
+ int i = cn.lastIndexOf('.');
+ return i > 0 ? cn.substring(0, i) : "<unnamed>";
+ }
+ @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<T> implements Analyzer.Visitor {
+ private final Set<Edge> 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;
+ }
}
}
}
--- a/langtools/src/share/classes/com/sun/tools/jdeps/Profile.java Thu Oct 31 12:36:36 2013 -0700
+++ b/langtools/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<String, Profile> map = initProfiles();
-
private static Map<String, Profile> 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) {
--- a/langtools/src/share/classes/javax/annotation/processing/Processor.java Thu Oct 31 12:36:36 2013 -0700
+++ b/langtools/src/share/classes/javax/annotation/processing/Processor.java Thu Oct 31 16:46:43 2013 -0700
@@ -209,11 +209,11 @@
* <dl>
* <dt><i>SupportedOptionString:</i>
* <dd><i>Identifiers</i>
- * <p>
+ *
* <dt><i>Identifiers:</i>
* <dd> <i>Identifier</i>
* <dd> <i>Identifier</i> {@code .} <i>Identifiers</i>
- * <p>
+ *
* <dt><i>Identifier:</i>
* <dd>Syntactic identifier, including keywords and literals
* </dl>
@@ -250,7 +250,7 @@
* <dt><i>SupportedAnnotationTypeString:</i>
* <dd><i>TypeName</i> <i>DotStar</i><sub><i>opt</i></sub>
* <dd><tt>*</tt>
- * <p>
+ *
* <dt><i>DotStar:</i>
* <dd><tt>.</tt> <tt>*</tt>
* </dl>
--- a/langtools/src/share/classes/jdk/Exported.java Thu Oct 31 12:36:36 2013 -0700
+++ b/langtools/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.
+ *
+ * <p>If in one release a type or package is
+ * <code>@Exported(true)</code>, in a subsequent major release such a
+ * type or package can transition to <code>@Exported(false)</code>.
+ *
+ * <p>If a type or package is <code>@Exported(false)</code> in a
+ * release, it may be removed in a subsequent major release.
+ *
+ * <p>If a top-level type has an <code>@Exported</code> annotation,
+ * any nested member types with the top-level type should have an
+ * <code>@Exported</code> 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
+ * <code>@Exported(false)</code> while its enclosing type was
+ * <code>@Exported(true)</code>.)
+ *
+ * Likewise, if a package has an <code>@Exported</code> annotation,
+ * top-level types within that package should also have an
+ * <code>@Exported</code> annotation.
+ *
+ * Sometimes a top-level type may have a different
+ * <code>@Exported</code> value than its package.
*
* @since 1.8
*/
--- a/langtools/test/com/sun/javadoc/AuthorDD/AuthorDD.java Thu Oct 31 12:36:36 2013 -0700
+++ b/langtools/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 </DD> tags when using multiple @author tags
* @author dkramer
* @run main AuthorDD
@@ -86,12 +86,12 @@
// Test single @since tag:
- { "<dt><span class=\"strong\">Since:</span></dt>"+NL+"<dd>JDK 1.0</dd>",
+ { "<dt><span class=\"simpleTagLabel\">Since:</span></dt>"+NL+"<dd>JDK 1.0</dd>",
BUGID + FS + "p1" + FS + "C1.html" },
// Test multiple @author tags:
- { "<dt><span class=\"strong\">Author:</span></dt>"+NL+"<dd>Doug Kramer, Jamie, Neal</dd>",
+ { "<dt><span class=\"simpleTagLabel\">Author:</span></dt>"+NL+"<dd>Doug Kramer, Jamie, Neal</dd>",
BUGID + FS + "p1" + FS + "C1.html" },
};
--- a/langtools/test/com/sun/javadoc/testAnnotationTypes/TestAnnotationTypes.java Thu Oct 31 12:36:36 2013 -0700
+++ b/langtools/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",
"<h3>Field Summary</h3>"},
{BUG_ID + FS + "pkg" + FS + "AnnotationTypeField.html",
- "<td class=\"colLast\"><code><span class=\"strong\"><a href=\"../" +
+ "<td class=\"colLast\"><code><span class=\"memberNameLink\"><a href=\"../" +
"pkg/AnnotationTypeField.html#DEFAULT_NAME\">DEFAULT_NAME</a></span>" +
"</code> </td>"},
{BUG_ID + FS + "pkg" + FS + "AnnotationTypeField.html",
--- a/langtools/test/com/sun/javadoc/testClassCrossReferences/TestClassCrossReferences.java Thu Oct 31 12:36:36 2013 -0700
+++ b/langtools/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 @@
"<a href=\"http://java.sun.com/j2se/1.4/docs/api/java/math/BigInteger.html?is-external=true#gcd-java.math.BigInteger-\" " +
"title=\"class or interface in java.math\"><code>Link to external member gcd</code></a>"},
{BUG_ID + FS + "C.html",
- "<dl>" + NL + "<dt><span class=\"strong\">Overrides:</span></dt>" + NL +
+ "<dl>" + NL + "<dt><span class=\"overrideSpecifyLabel\">Overrides:</span></dt>" + NL +
"<dd><code>toString</code> in class <code>java.lang.Object</code></dd>" + NL +
"</dl>"}
};
--- a/langtools/test/com/sun/javadoc/testClassTree/TestClassTree.java Thu Oct 31 12:36:36 2013 -0700
+++ b/langtools/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",
"<ul>" + NL + "<li type=\"circle\">pkg.<a href=\"../pkg/ParentClass.html\" " +
- "title=\"class in pkg\"><span class=\"strong\">ParentClass</span></a>"},
+ "title=\"class in pkg\"><span class=\"typeNameLink\">ParentClass</span></a>"},
{BUG_ID + FS + "pkg" + FS + "package-tree.html",
"<h2 title=\"Annotation Type Hierarchy\">Annotation Type Hierarchy</h2>" + NL +
"<ul>" + NL + "<li type=\"circle\">pkg.<a href=\"../pkg/AnnotationType.html\" " +
- "title=\"annotation in pkg\"><span class=\"strong\">AnnotationType</span></a> " +
+ "title=\"annotation in pkg\"><span class=\"typeNameLink\">AnnotationType</span></a> " +
"(implements java.lang.annotation.Annotation)</li>" + NL + "</ul>"},
{BUG_ID + FS + "pkg" + FS + "package-tree.html",
@@ -63,14 +63,14 @@
"<li type=\"circle\">java.lang.Enum<E> (implements java.lang." +
"Comparable<T>, java.io.Serializable)" + NL + "<ul>" + NL +
"<li type=\"circle\">pkg.<a href=\"../pkg/Coin.html\" " +
- "title=\"enum in pkg\"><span class=\"strong\">Coin</span></a></li>" + NL +
+ "title=\"enum in pkg\"><span class=\"typeNameLink\">Coin</span></a></li>" + NL +
"</ul>" + NL + "</li>" + NL + "</ul>" + NL + "</li>" + NL + "</ul>"
},
};
private static final String[][] NEGATED_TEST = {
{BUG_ID + FS + "pkg" + FS + "package-tree.html",
"<li type=\"circle\">class pkg.<a href=\"../pkg/ParentClass.html\" " +
- "title=\"class in pkg\"><span class=\"strong\">ParentClass</span></a></li>"}
+ "title=\"class in pkg\"><span class=\"typeNameLink\">ParentClass</span></a></li>"}
};
/**
--- a/langtools/test/com/sun/javadoc/testConstructorIndent/TestConstructorIndent.java Thu Oct 31 12:36:36 2013 -0700
+++ b/langtools/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
* <dl></dl>. Check for this in the output.
* @author jamieh
@@ -47,7 +47,7 @@
private static final String[][] TEST = {
{BUG_ID + FS + "C.html", "<div class=\"block\">" +
"This is just a simple constructor.</div>" + NL +
- "<dl>" + NL + "<dt><span class=\"strong\">Parameters:</span></dt>" + NL +
+ "<dl>" + NL + "<dt><span class=\"paramLabel\">Parameters:</span></dt>" + NL +
"<dd><code>i</code> - a param.</dd>" + NL +"</dl>"
}
};
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/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(){}
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/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();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/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(), "<dt><span class=\"simpleTagLabel\">Custom Tag:</span></dt><dd>"));
+ inlineTags.addAll(Arrays.asList(tag.inlineTags()));
+ inlineTags.add(new TextTag(tag.holder(), "</dd>"));
+ return writer.commentTagsToOutput(tag,
+ (Tag[]) inlineTags.toArray(new Tag[] {}));
+ }
+}
--- a/langtools/test/com/sun/javadoc/testDeprecatedDocs/TestDeprecatedDocs.java Thu Oct 31 12:36:36 2013 -0700
+++ b/langtools/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 <DESC>
* @author jamieh
* @library ../lib/
@@ -76,20 +76,20 @@
{TARGET_FILE, "pkg.DeprecatedClassByAnnotation.field"},
{TARGET_FILE2, "<pre>@Deprecated" + NL +
- "public class <span class=\"strong\">DeprecatedClassByAnnotation</span>" + NL +
+ "public class <span class=\"typeNameLabel\">DeprecatedClassByAnnotation</span>" + NL +
"extends java.lang.Object</pre>"},
{TARGET_FILE2, "<pre>@Deprecated" + NL +
"public int field</pre>" + NL +
- "<div class=\"block\"><span class=\"strong\">Deprecated.</span> </div>"},
+ "<div class=\"block\"><span class=\"deprecatedLabel\">Deprecated.</span> </div>"},
{TARGET_FILE2, "<pre>@Deprecated" + NL +
"public DeprecatedClassByAnnotation()</pre>" + NL +
- "<div class=\"block\"><span class=\"strong\">Deprecated.</span> </div>"},
+ "<div class=\"block\"><span class=\"deprecatedLabel\">Deprecated.</span> </div>"},
{TARGET_FILE2, "<pre>@Deprecated" + NL +
"public void method()</pre>" + NL +
- "<div class=\"block\"><span class=\"strong\">Deprecated.</span> </div>"},
+ "<div class=\"block\"><span class=\"deprecatedLabel\">Deprecated.</span> </div>"},
};
private static final String[][] NEGATED_TEST = NO_TEST;
--- a/langtools/test/com/sun/javadoc/testExternalOverridenMethod/TestExternalOverridenMethod.java Thu Oct 31 12:36:36 2013 -0700
+++ b/langtools/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",
- "<dt><span class=\"strong\">Overrides:</span></dt>" + NL +
+ "<dt><span class=\"overrideSpecifyLabel\">Overrides:</span></dt>" + NL +
"<dd><code><a href=\"http://java.sun.com/j2se/1.4.1/docs/api/java/io/FilterReader.html?is-external=true#read--\" " +
"title=\"class or interface in java.io\">read</a></code> in class <code>" +
"<a href=\"http://java.sun.com/j2se/1.4.1/docs/api/java/io/FilterReader.html?is-external=true\" " +
"title=\"class or interface in java.io\">FilterReader</a></code></dd>"},
{BUG_ID + FS + "pkg" + FS + "XReader.html",
- "<dt><span class=\"strong\">Specified by:</span></dt>" + NL +
+ "<dt><span class=\"overrideSpecifyLabel\">Specified by:</span></dt>" + NL +
"<dd><code><a href=\"http://java.sun.com/j2se/1.4.1/docs/api/java/io/DataInput.html?is-external=true#readInt--\" " +
"title=\"class or interface in java.io\">readInt</a></code> in interface <code>" +
"<a href=\"http://java.sun.com/j2se/1.4.1/docs/api/java/io/DataInput.html?is-external=true\" " +
--- a/langtools/test/com/sun/javadoc/testHref/TestHref.java Thu Oct 31 12:36:36 2013 -0700
+++ b/langtools/test/com/sun/javadoc/testHref/TestHref.java Thu Oct 31 16:46:43 2013 -0700
@@ -23,7 +23,7 @@
/*
* @test
- * @bug 4663254 8016328 8025633
+ * @bug 4663254 8016328 8025633 8026567
* @summary Verify that spaces do not appear in hrefs and anchors.
* @author jamieh
* @library ../lib/
@@ -80,7 +80,7 @@
//Signature does not link to the page itself.
{BUG_ID + FS + "pkg" + FS + "C4.html",
- "public abstract class <span class=\"strong\">C4<E extends C4<E>></span>"
+ "public abstract class <span class=\"typeNameLabel\">C4<E extends C4<E>></span>"
},
};
private static final String[][] NEGATED_TEST =
--- a/langtools/test/com/sun/javadoc/testHtmlDefinitionListTag/TestHtmlDefinitionListTag.java Thu Oct 31 12:36:36 2013 -0700
+++ b/langtools/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", "<pre>public class " +
- "<span class=\"strong\">C1</span>" + NL +
+ "<span class=\"typeNameLabel\">C1</span>" + NL +
"extends java.lang.Object" + NL + "implements java.io.Serializable</pre>"},
{BUG_ID + FS + "pkg1" + FS + "C4.html", "<dl>" + NL +
"<dt>Default:</dt>" + NL + "<dd>true</dd>" + 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", "<dl>" + NL +
- "<dt><span class=\"strong\">Since:</span></dt>" + NL +
+ "<dt><span class=\"simpleTagLabel\">Since:</span></dt>" + NL +
"<dd>JDK1.0</dd>" + NL + "</dl>"},
- {BUG_ID + FS + "pkg1" + FS + "C1.html", "<dl>" + NL + "<dt><span class=\"strong\">Since:</span></dt>" + NL +
- "<dd>JDK1.0</dd>" + NL + "<dt><span class=\"strong\">See Also:</span></dt>" + NL +
+ {BUG_ID + FS + "pkg1" + FS + "C1.html", "<dl>" + NL + "<dt><span class=\"simpleTagLabel\">Since:</span></dt>" + NL +
+ "<dd>JDK1.0</dd>" + NL + "<dt><span class=\"seeLabel\">See Also:</span></dt>" + NL +
"<dd><a href=\"../pkg1/C2.html\" title=\"class in pkg1\"><code>" +
"C2</code></a>, " + NL + "<a href=\"../serialized-form.html#pkg1.C1\">" +
"Serialized Form</a></dd>" + NL + "</dl>"},
- {BUG_ID + FS + "pkg1" + FS + "C1.html", "<dl>" + NL + "<dt><span class=\"strong\">Since:</span></dt>" + NL +
+ {BUG_ID + FS + "pkg1" + FS + "C1.html", "<dl>" + NL + "<dt><span class=\"simpleTagLabel\">Since:</span></dt>" + NL +
"<dd>1.4</dd>" + NL +
- "<dt><span class=\"strong\">See Also:</span></dt>" + NL + "<dd>" +
+ "<dt><span class=\"seeLabel\">See Also:</span></dt>" + NL + "<dd>" +
"<a href=\"../pkg1/C1.html#setUndecorated-boolean-\">" +
"<code>setUndecorated(boolean)</code></a></dd>" + NL + "</dl>"},
- {BUG_ID + FS + "pkg1" + FS + "C1.html", "<dl>"+ NL + "<dt><span class=\"strong\">Parameters:</span></dt>" + NL + "<dd><code>title" +
+ {BUG_ID + FS + "pkg1" + FS + "C1.html", "<dl>"+ NL + "<dt><span class=\"paramLabel\">Parameters:</span></dt>" + NL + "<dd><code>title" +
"</code> - the title</dd>" + NL + "<dd><code>test</code> - boolean value" +
- "</dd>" + NL + "<dt><span class=\"strong\">Throws:</span></dt>" + NL +
+ "</dd>" + NL + "<dt><span class=\"throwsLabel\">Throws:</span></dt>" + NL +
"<dd><code>java.lang.IllegalArgumentException</code> - if the " +
"<code>owner</code>'s" + NL +
" <code>GraphicsConfiguration</code> is not from a screen " +
"device</dd>" + NL + "<dd><code>HeadlessException</code></dd>" + NL + "</dl>"},
- {BUG_ID + FS + "pkg1" + FS + "C1.html", "<dl>" + NL + "<dt><span class=\"strong\">Parameters:</span></dt>" + NL + "<dd><code>undecorated" +
+ {BUG_ID + FS + "pkg1" + FS + "C1.html", "<dl>" + NL + "<dt><span class=\"paramLabel\">Parameters:</span></dt>" + NL + "<dd><code>undecorated" +
"</code> - <code>true</code> if no decorations are" + NL +
" to be enabled;" + NL + " <code>false</code> " +
- "if decorations are to be enabled.</dd>" + NL + "<dt><span class=\"strong\">Since:" +
+ "if decorations are to be enabled.</dd>" + NL + "<dt><span class=\"simpleTagLabel\">Since:" +
"</span></dt>" + NL + "<dd>1.4</dd>" + NL +
- "<dt><span class=\"strong\">See Also:</span></dt>" + NL + "<dd>" +
+ "<dt><span class=\"seeLabel\">See Also:</span></dt>" + NL + "<dd>" +
"<a href=\"../pkg1/C1.html#readObject--\"><code>readObject()" +
"</code></a></dd>" + NL + "</dl>"},
- {BUG_ID + FS + "pkg1" + FS + "C1.html", "<dl>" + NL + "<dt><span class=\"strong\">Throws:</span></dt>" + NL +
- "<dd><code>java.io.IOException</code></dd>" + NL + "<dt><span class=\"strong\">See Also:" +
+ {BUG_ID + FS + "pkg1" + FS + "C1.html", "<dl>" + NL + "<dt><span class=\"throwsLabel\">Throws:</span></dt>" + NL +
+ "<dd><code>java.io.IOException</code></dd>" + NL + "<dt><span class=\"seeLabel\">See Also:" +
"</span></dt>" + NL + "<dd><a href=\"../pkg1/C1.html#setUndecorated-boolean-\">" +
"<code>setUndecorated(boolean)</code></a></dd>" + NL + "</dl>"},
- {BUG_ID + FS + "pkg1" + FS + "C2.html", "<dl>" + NL + "<dt><span class=\"strong\">Parameters:" +
- "</span></dt>" + NL + "<dd><code>set</code> - boolean</dd>" + NL + "<dt><span class=\"strong\">" +
+ {BUG_ID + FS + "pkg1" + FS + "C2.html", "<dl>" + NL + "<dt><span class=\"paramLabel\">Parameters:" +
+ "</span></dt>" + NL + "<dd><code>set</code> - boolean</dd>" + NL + "<dt><span class=\"simpleTagLabel\">" +
"Since:</span></dt>" + NL + "<dd>1.4</dd>" + NL + "</dl>"},
- {BUG_ID + FS + "serialized-form.html", "<dl>" + NL + "<dt><span class=\"strong\">Throws:</span>" +
+ {BUG_ID + FS + "serialized-form.html", "<dl>" + NL + "<dt><span class=\"throwsLabel\">Throws:</span>" +
"</dt>" + NL + "<dd><code>" +
- "java.io.IOException</code></dd>" + NL + "<dt><span class=\"strong\">See Also:</span>" +
+ "java.io.IOException</code></dd>" + NL + "<dt><span class=\"seeLabel\">See Also:</span>" +
"</dt>" + NL + "<dd><a href=\"pkg1/C1.html#setUndecorated-boolean-\">" +
"<code>C1.setUndecorated(boolean)</code></a></dd>" + NL + "</dl>"},
- {BUG_ID + FS + "serialized-form.html", "<span class=\"strong\">Deprecated.</span>" +
- " <span class=\"italic\">As of JDK version 1.5, replaced by" + NL +
+ {BUG_ID + FS + "serialized-form.html", "<span class=\"deprecatedLabel\">Deprecated.</span>" +
+ " <span class=\"deprecationComment\">As of JDK version 1.5, replaced by" + NL +
" <a href=\"pkg1/C1.html#setUndecorated-boolean-\">" +
"<code>setUndecorated(boolean)</code></a>.</span></div>" + NL +
"<div class=\"block\">This field indicates whether the C1 is " +
- "undecorated.</div>" + NL + " " + NL + "<dl>" + NL + "<dt><span class=\"strong\">Since:</span></dt>" + NL +
- "<dd>1.4</dd>" + NL + "<dt><span class=\"strong\">See Also:</span>" +
+ "undecorated.</div>" + NL + " " + NL + "<dl>" + NL + "<dt><span class=\"simpleTagLabel\">Since:</span></dt>" + NL +
+ "<dd>1.4</dd>" + NL + "<dt><span class=\"seeLabel\">See Also:</span>" +
"</dt>" + NL + "<dd><a href=\"pkg1/C1.html#setUndecorated-boolean-\">" +
"<code>C1.setUndecorated(boolean)</code></a></dd>" + NL + "</dl>"},
- {BUG_ID + FS + "serialized-form.html", "<span class=\"strong\">Deprecated.</span>" +
- " <span class=\"italic\">As of JDK version 1.5, replaced by" + NL +
+ {BUG_ID + FS + "serialized-form.html", "<span class=\"deprecatedLabel\">Deprecated.</span>" +
+ " <span class=\"deprecationComment\">As of JDK version 1.5, replaced by" + NL +
" <a href=\"pkg1/C1.html#setUndecorated-boolean-\">" +
"<code>setUndecorated(boolean)</code></a>.</span></div>" + NL +
"<div class=\"block\">Reads the object stream.</div>" + NL +
- "<dl>" + NL + "<dt><span class=\"strong\">Throws:" +
+ "<dl>" + NL + "<dt><span class=\"throwsLabel\">Throws:" +
"</span></dt>" + NL + "<dd><code><code>" +
"IOException</code></code></dd>" + NL +
"<dd><code>java.io.IOException</code></dd>" + NL + "</dl>"},
- {BUG_ID + FS + "serialized-form.html", "<span class=\"strong\">Deprecated.</span>" +
+ {BUG_ID + FS + "serialized-form.html", "<span class=\"deprecatedLabel\">Deprecated.</span>" +
" </div>" + NL +
"<div class=\"block\">The name for this class.</div>"}};
@@ -122,55 +122,55 @@
// and deprecated information.
private static final String[][] TEST_NODEPR = {
{BUG_ID + FS + "pkg1" + FS + "package-summary.html", "<dl>" + NL +
- "<dt><span class=\"strong\">Since:</span></dt>" + NL +
+ "<dt><span class=\"simpleTagLabel\">Since:</span></dt>" + NL +
"<dd>JDK1.0</dd>" + NL + "</dl>"},
- {BUG_ID + FS + "pkg1" + FS + "C1.html", "<dl>" + NL + "<dt><span class=\"strong\">Since:</span>" +
- "</dt>" + NL + "<dd>JDK1.0</dd>" + NL + "<dt><span class=\"strong\">See Also:" +
+ {BUG_ID + FS + "pkg1" + FS + "C1.html", "<dl>" + NL + "<dt><span class=\"simpleTagLabel\">Since:</span>" +
+ "</dt>" + NL + "<dd>JDK1.0</dd>" + NL + "<dt><span class=\"seeLabel\">See Also:" +
"</span></dt>" + NL + "<dd><a href=\"../pkg1/C2.html\" title=\"class in pkg1\">" +
"<code>C2</code></a>, " + NL + "<a href=\"../serialized-form.html#pkg1.C1\">" +
"Serialized Form</a></dd>" + NL + "</dl>"},
- {BUG_ID + FS + "pkg1" + FS + "C1.html", "<dl>" + NL + "<dt><span class=\"strong\">Parameters:" +
+ {BUG_ID + FS + "pkg1" + FS + "C1.html", "<dl>" + NL + "<dt><span class=\"paramLabel\">Parameters:" +
"</span></dt>" + NL + "<dd><code>title</code> - the title</dd>" + NL + "<dd><code>" +
- "test</code> - boolean value</dd>" + NL + "<dt><span class=\"strong\">Throws:" +
+ "test</code> - boolean value</dd>" + NL + "<dt><span class=\"throwsLabel\">Throws:" +
"</span></dt>" + NL + "<dd><code>java.lang.IllegalArgumentException" +
"</code> - if the <code>owner</code>'s" + NL + " <code>GraphicsConfiguration" +
"</code> is not from a screen device</dd>" + NL + "<dd><code>" +
"HeadlessException</code></dd>" + NL + "</dl>"},
- {BUG_ID + FS + "pkg1" + FS + "C1.html", "<dl>" + NL + "<dt><span class=\"strong\">Parameters:" +
+ {BUG_ID + FS + "pkg1" + FS + "C1.html", "<dl>" + NL + "<dt><span class=\"paramLabel\">Parameters:" +
"</span></dt>" + NL + "<dd><code>undecorated</code> - <code>true</code>" +
" if no decorations are" + NL + " to be enabled;" + NL +
" <code>false</code> if decorations are to be enabled." +
- "</dd>" + NL + "<dt><span class=\"strong\">Since:</span></dt>" + NL + "<dd>1.4</dd>" + NL +
- "<dt><span class=\"strong\">See Also:</span></dt>" + NL + "<dd><a href=\"../pkg1/C1.html#readObject--\">" +
+ "</dd>" + NL + "<dt><span class=\"simpleTagLabel\">Since:</span></dt>" + NL + "<dd>1.4</dd>" + NL +
+ "<dt><span class=\"seeLabel\">See Also:</span></dt>" + NL + "<dd><a href=\"../pkg1/C1.html#readObject--\">" +
"<code>readObject()</code></a></dd>" + NL + "</dl>"},
- {BUG_ID + FS + "pkg1" + FS + "C1.html", "<dl>" + NL + "<dt><span class=\"strong\">Throws:</span>" +
+ {BUG_ID + FS + "pkg1" + FS + "C1.html", "<dl>" + NL + "<dt><span class=\"throwsLabel\">Throws:</span>" +
"</dt>" + NL + "<dd><code>java.io.IOException</code></dd>" + NL + "<dt>" +
- "<span class=\"strong\">See Also:</span></dt>" + NL + "<dd><a href=\"../pkg1/C1.html#setUndecorated-boolean-\">" +
+ "<span class=\"seeLabel\">See Also:</span></dt>" + NL + "<dd><a href=\"../pkg1/C1.html#setUndecorated-boolean-\">" +
"<code>setUndecorated(boolean)</code></a></dd>" + NL + "</dl>"},
- {BUG_ID + FS + "serialized-form.html", "<dl>" + NL + "<dt><span class=\"strong\">Throws:</span>" +
+ {BUG_ID + FS + "serialized-form.html", "<dl>" + NL + "<dt><span class=\"throwsLabel\">Throws:</span>" +
"</dt>" + NL + "<dd><code>" +
- "java.io.IOException</code></dd>" + NL + "<dt><span class=\"strong\">See Also:</span>" +
+ "java.io.IOException</code></dd>" + NL + "<dt><span class=\"seeLabel\">See Also:</span>" +
"</dt>" + NL + "<dd><a href=\"pkg1/C1.html#setUndecorated-boolean-\">" +
"<code>C1.setUndecorated(boolean)</code></a></dd>" + NL + "</dl>"},
- {BUG_ID + FS + "serialized-form.html", "<span class=\"strong\">Deprecated.</span>" +
- " <span class=\"italic\">As of JDK version 1.5, replaced by" + NL +
+ {BUG_ID + FS + "serialized-form.html", "<span class=\"deprecatedLabel\">Deprecated.</span>" +
+ " <span class=\"deprecationComment\">As of JDK version 1.5, replaced by" + NL +
" <a href=\"pkg1/C1.html#setUndecorated-boolean-\">" +
"<code>setUndecorated(boolean)</code></a>.</span></div>" + NL +
"<div class=\"block\">This field indicates whether the C1 is " +
- "undecorated.</div>" + NL + " " + NL + "<dl>" + NL + "<dt><span class=\"strong\">Since:</span></dt>" + NL +
- "<dd>1.4</dd>" + NL + "<dt><span class=\"strong\">See Also:</span>" +
+ "undecorated.</div>" + NL + " " + NL + "<dl>" + NL + "<dt><span class=\"simpleTagLabel\">Since:</span></dt>" + NL +
+ "<dd>1.4</dd>" + NL + "<dt><span class=\"seeLabel\">See Also:</span>" +
"</dt>" + NL + "<dd><a href=\"pkg1/C1.html#setUndecorated-boolean-\">" +
"<code>C1.setUndecorated(boolean)</code></a></dd>" + NL + "</dl>"},
- {BUG_ID + FS + "serialized-form.html", "<span class=\"strong\">Deprecated.</span>" +
- " <span class=\"italic\">As of JDK version 1.5, replaced by" + NL +
+ {BUG_ID + FS + "serialized-form.html", "<span class=\"deprecatedLabel\">Deprecated.</span>" +
+ " <span class=\"deprecationComment\">As of JDK version 1.5, replaced by" + NL +
" <a href=\"pkg1/C1.html#setUndecorated-boolean-\">" +
"<code>setUndecorated(boolean)</code></a>.</span></div>" + NL +
"<div class=\"block\">Reads the object stream.</div>" + NL +
- "<dl>" + NL + "<dt><span class=\"strong\">Throws:" +
+ "<dl>" + NL + "<dt><span class=\"throwsLabel\">Throws:" +
"</span></dt>" + NL + "<dd><code><code>" +
"IOException</code></code></dd>" + NL +
"<dd><code>java.io.IOException</code></dd>" + NL + "</dl>"},
- {BUG_ID + FS + "serialized-form.html", "<span class=\"strong\">Deprecated.</span>" +
+ {BUG_ID + FS + "serialized-form.html", "<span class=\"deprecatedLabel\">Deprecated.</span>" +
" </div>" + NL + "<div class=\"block\">" +
"The name for this class.</div>"}};
@@ -186,12 +186,12 @@
"title=\"enum in pkg1\">C1.ModalExclusionType</a> " +
"APPLICATION_EXCLUDE</pre>" + NL + "</li>"},
{BUG_ID + FS + "serialized-form.html", "<pre>boolean " +
- "undecorated</pre>" + NL + "<div class=\"block\"><span class=\"strong\">" +
- "Deprecated.</span> <span class=\"italic\">As of JDK version 1.5, replaced by" + NL +
+ "undecorated</pre>" + NL + "<div class=\"block\"><span class=\"deprecatedLabel\">" +
+ "Deprecated.</span> <span class=\"deprecationComment\">As of JDK version 1.5, replaced by" + NL +
" <a href=\"pkg1/C1.html#setUndecorated-boolean-\"><code>" +
"setUndecorated(boolean)</code></a>.</span></div>" + NL + "</li>"},
- {BUG_ID + FS + "serialized-form.html", "<span class=\"strong\">" +
- "Deprecated.</span> <span class=\"italic\">As of JDK version" +
+ {BUG_ID + FS + "serialized-form.html", "<span class=\"deprecatedLabel\">" +
+ "Deprecated.</span> <span class=\"deprecationComment\">As of JDK version" +
" 1.5, replaced by" + NL +
" <a href=\"pkg1/C1.html#setUndecorated-boolean-\">" +
"<code>setUndecorated(boolean)</code></a>.</span></div>" + NL + "</li>"}};
--- a/langtools/test/com/sun/javadoc/testHtmlStrongTag/TestHtmlStrongTag.java Thu Oct 31 12:36:36 2013 -0700
+++ b/langtools/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 <strong> HTML tag instead of <B> 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", "<span class=\"strong\">See Also:</span>"}};
+ {BUG_ID + FS + "pkg1" + FS + "C1.html", "<span class=\"seeLabel\">See Also:</span>"}};
private static final String[][] NEGATED_TEST1 = {
{BUG_ID + FS + "pkg1" + FS + "C1.html", "<STRONG>Method Summary</STRONG>"},
{BUG_ID + FS + "pkg1" + FS + "C1.html", "<B>"},
--- a/langtools/test/com/sun/javadoc/testIndex/TestIndex.java Thu Oct 31 12:36:36 2013 -0700
+++ b/langtools/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",
- "<a href=\"pkg/C.html\" title=\"class in pkg\"><span class=\"strong\">C</span></a>" +
+ "<a href=\"pkg/C.html\" title=\"class in pkg\"><span class=\"typeNameLink\">C</span></a>" +
" - Class in <a href=\"pkg/package-summary.html\">pkg</a>"},
{BUG_ID + FS + "index-all.html",
"<a href=\"pkg/Interface.html\" title=\"interface in pkg\">" +
- "<span class=\"strong\">Interface</span></a> - Interface in " +
+ "<span class=\"typeNameLink\">Interface</span></a> - Interface in " +
"<a href=\"pkg/package-summary.html\">pkg</a>"},
{BUG_ID + FS + "index-all.html",
"<a href=\"pkg/AnnotationType.html\" title=\"annotation in pkg\">" +
- "<span class=\"strong\">AnnotationType</span></a> - Annotation Type in " +
+ "<span class=\"typeNameLink\">AnnotationType</span></a> - Annotation Type in " +
"<a href=\"pkg/package-summary.html\">pkg</a>"},
{BUG_ID + FS + "index-all.html",
"<a href=\"pkg/Coin.html\" title=\"enum in pkg\">" +
- "<span class=\"strong\">Coin</span></a> - Enum in " +
+ "<span class=\"typeNameLink\">Coin</span></a> - Enum in " +
"<a href=\"pkg/package-summary.html\">pkg</a>"},
{BUG_ID + FS + "index-all.html",
"Class in <a href=\"package-summary.html\"><Unnamed></a>"},
{BUG_ID + FS + "index-all.html",
- "<dl>" + NL + "<dt><span class=\"strong\"><a href=\"pkg/C.html#Java\">" +
+ "<dl>" + NL + "<dt><span class=\"memberNameLink\"><a href=\"pkg/C.html#Java\">" +
"Java</a></span> - Static variable in class pkg.<a href=\"pkg/C.html\" " +
"title=\"class in pkg\">C</a></dt>" + NL + "<dd> </dd>" + NL +
- "<dt><span class=\"strong\"><a href=\"pkg/C.html#JDK\">JDK</a></span> " +
+ "<dt><span class=\"memberNameLink\"><a href=\"pkg/C.html#JDK\">JDK</a></span> " +
"- Static variable in class pkg.<a href=\"pkg/C.html\" title=\"class in pkg\">" +
"C</a></dt>" + NL + "<dd> </dd>" + NL + "</dl>"},
};
--- a/langtools/test/com/sun/javadoc/testInterface/TestInterface.java Thu Oct 31 12:36:36 2013 -0700
+++ b/langtools/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",
- "<dt><span class=\"strong\">Specified by:</span></dt>" + NL +
+ "<dt><span class=\"overrideSpecifyLabel\">Specified by:</span></dt>" + NL +
"<dd><code><a href=\"../pkg/Interface.html#method--\">method</a>" +
"</code> in interface <code>" +
"<a href=\"../pkg/Interface.html\" title=\"interface in pkg\">" +
@@ -92,7 +92,7 @@
},
//Make sure "Overrides" has substituted type parameters.
{BUG_ID + FS + "pkg" + FS + "Child.html",
- "<dt><span class=\"strong\">Overrides:</span></dt>" + NL +
+ "<dt><span class=\"overrideSpecifyLabel\">Overrides:</span></dt>" + NL +
"<dd><code><a href=\"../pkg/Parent.html#method--\">method</a>" +
"</code> in class <code><a href=\"../pkg/Parent.html\" " +
"title=\"class in pkg\">Parent</a><<a href=\"../pkg/Child.html\" " +
--- a/langtools/test/com/sun/javadoc/testJavaFX/TestJavaFX.java Thu Oct 31 12:36:36 2013 -0700
+++ b/langtools/test/com/sun/javadoc/testJavaFX/TestJavaFX.java Thu Oct 31 16:46:43 2013 -0700
@@ -23,7 +23,7 @@
/*
* @test
- * @bug 7112427 8012295 8025633
+ * @bug 7112427 8012295 8025633 8026567
* @summary Test of the JavaFX doclet features.
* @author jvalenta
* @library ../lib/
@@ -38,32 +38,32 @@
private static final String[][] TEST =
new String[][] {
{"./" + BUG_ID + "/C.html",
- "<dt><span class=\"strong\">See Also:</span></dt>" + NL + "<dd><a href=\"C.html#getRate--\"><code>getRate()</code></a>, " + NL +
+ "<dt><span class=\"seeLabel\">See Also:</span></dt>" + NL + "<dd><a href=\"C.html#getRate--\"><code>getRate()</code></a>, " + NL +
"<a href=\"C.html#setRate-double-\"><code>setRate(double)</code></a></dd>"},
{"./" + BUG_ID + "/C.html",
"<pre>public final void setRate(double value)</pre>" + NL +
"<div class=\"block\">Sets the value of the property rate.</div>" + NL +
- "<dl>" + NL + "<dt><span class=\"strong\">Property description:</span></dt>" },
+ "<dl>" + NL + "<dt><span class=\"simpleTagLabel\">Property description:</span></dt>" },
{"./" + BUG_ID + "/C.html",
"<pre>public final double getRate()</pre>" + NL +
"<div class=\"block\">Gets the value of the property rate.</div>" + NL +
- "<dl>" + NL + "<dt><span class=\"strong\">Property description:</span></dt>" },
+ "<dl>" + NL + "<dt><span class=\"simpleTagLabel\">Property description:</span></dt>" },
{"./" + BUG_ID + "/C.html",
- "<td class=\"colLast\"><code><span class=\"strong\"><a href=\"C.html#rateProperty\">rate</a></span></code>" + NL +
+ "<td class=\"colLast\"><code><span class=\"memberNameLink\"><a href=\"C.html#rateProperty\">rate</a></span></code>" + NL +
"<div class=\"block\">Defines the direction/speed at which the <code>Timeline</code> is expected to"},
{"./" + BUG_ID + "/C.html",
- "<span class=\"strong\">Default value:</span>"},
+ "<span class=\"simpleTagLabel\">Default value:</span>"},
{"./" + BUG_ID + "/C.html",
- "<span class=\"strong\">Since:</span></dt>" + NL + "<dd>JavaFX 8.0</dd>" },
+ "<span class=\"simpleTagLabel\">Since:</span></dt>" + NL + "<dd>JavaFX 8.0</dd>" },
{"./" + BUG_ID + "/C.html",
"<p>Sets the value of the property <code>Property</code>"},
{"./" + BUG_ID + "/C.html",
"<p>Gets the value of the property <code>Property</code>"},
{"./" + BUG_ID + "/C.html",
- "<span class=\"strong\">Property description:</span>"},
+ "<span class=\"simpleTagLabel\">Property description:</span>"},
{"./" + BUG_ID + "/C.html",
- "<td class=\"colLast\"><code><span class=\"strong\"><a href=\"C.html#setTestMethodProperty--\">setTestMethodProperty</a></span>()</code> </td>" },
+ "<td class=\"colLast\"><code><span class=\"memberNameLink\"><a href=\"C.html#setTestMethodProperty--\">setTestMethodProperty</a></span>()</code> </td>" },
{"./" + BUG_ID + "/C.html",
"<h4>isPaused</h4>" + NL +
"<pre>public final double isPaused()</pre>" + NL +
--- a/langtools/test/com/sun/javadoc/testLegacyTaglet/Check.java Thu Oct 31 12:36:36 2013 -0700
+++ b/langtools/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 "<dt><span class=\"strong\">" + TAG_HEADER + ":</span></dt><dd>" + tag.text() +
+ return "<dt><span class=\"simpleTagLabel\">" + TAG_HEADER + ":</span></dt><dd>" + tag.text() +
"</dd>\n";
}
--- a/langtools/test/com/sun/javadoc/testLinkOption/TestLinkOption.java Thu Oct 31 12:36:36 2013 -0700
+++ b/langtools/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</a> p3)"
},
{BUG_ID + "-1" + FS + "java" + FS + "lang" + FS + "StringBuilderChild.html",
- "<pre>public abstract class <span class=\"strong\">StringBuilderChild</span>" + NL +
+ "<pre>public abstract class <span class=\"typeNameLabel\">StringBuilderChild</span>" + NL +
"extends <a href=\"http://java.sun.com/j2se/1.4/docs/api/java/lang/Object.html?is-external=true\" " +
"title=\"class or interface in java.lang\">Object</a></pre>"
},
--- a/langtools/test/com/sun/javadoc/testMemberInheritence/TestMemberInheritence.java Thu Oct 31 12:36:36 2013 -0700
+++ b/langtools/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",
- "<dl>" + NL + "<dt><span class=\"strong\">Specified by:</span></dt>" + NL +
+ "<dl>" + NL + "<dt><span class=\"overrideSpecifyLabel\">Specified by:</span></dt>" + NL +
"<dd><code><a href=\"../pkg/BaseInterface.html#getAnnotation-java.lang.Class-\">" +
"getAnnotation</a></code> in interface <code>" +
"<a href=\"../pkg/BaseInterface.html\" title=\"interface in pkg\">" +
--- a/langtools/test/com/sun/javadoc/testMemberSummary/TestMemberSummary.java Thu Oct 31 12:36:36 2013 -0700
+++ b/langtools/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",
"<code><a href=\"../pkg/PublicChild.html\" title=\"class in pkg\">PublicChild</a></code></td>" + NL +
- "<td class=\"colLast\"><code><span class=\"strong\"><a href=\"../pkg/PublicChild.html#returnTypeTest--\">" +
+ "<td class=\"colLast\"><code><span class=\"memberNameLink\"><a href=\"../pkg/PublicChild.html#returnTypeTest--\">" +
"returnTypeTest</a></span>()</code>"
},
// Check return type in member detail.
--- a/langtools/test/com/sun/javadoc/testNavigation/TestNavigation.java Thu Oct 31 12:36:36 2013 -0700
+++ b/langtools/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", "<li>Prev Class</li>"},
{BUG_ID + FS + "pkg" + FS + "A.html",
- "<a href=\"../pkg/C.html\" title=\"class in pkg\"><span class=\"strong\">Next Class</span></a>"},
+ "<a href=\"../pkg/C.html\" title=\"class in pkg\"><span class=\"typeNameLink\">Next Class</span></a>"},
{BUG_ID + FS + "pkg" + FS + "C.html",
- "<a href=\"../pkg/A.html\" title=\"annotation in pkg\"><span class=\"strong\">Prev Class</span></a>"},
+ "<a href=\"../pkg/A.html\" title=\"annotation in pkg\"><span class=\"typeNameLink\">Prev Class</span></a>"},
{BUG_ID + FS + "pkg" + FS + "C.html",
- "<a href=\"../pkg/E.html\" title=\"enum in pkg\"><span class=\"strong\">Next Class</span></a>"},
+ "<a href=\"../pkg/E.html\" title=\"enum in pkg\"><span class=\"typeNameLink\">Next Class</span></a>"},
{BUG_ID + FS + "pkg" + FS + "E.html",
- "<a href=\"../pkg/C.html\" title=\"class in pkg\"><span class=\"strong\">Prev Class</span></a>"},
+ "<a href=\"../pkg/C.html\" title=\"class in pkg\"><span class=\"typeNameLink\">Prev Class</span></a>"},
{BUG_ID + FS + "pkg" + FS + "E.html",
- "<a href=\"../pkg/I.html\" title=\"interface in pkg\"><span class=\"strong\">Next Class</span></a>"},
+ "<a href=\"../pkg/I.html\" title=\"interface in pkg\"><span class=\"typeNameLink\">Next Class</span></a>"},
{BUG_ID + FS + "pkg" + FS + "I.html",
- "<a href=\"../pkg/E.html\" title=\"enum in pkg\"><span class=\"strong\">Prev Class</span></a>"},
+ "<a href=\"../pkg/E.html\" title=\"enum in pkg\"><span class=\"typeNameLink\">Prev Class</span></a>"},
{BUG_ID + FS + "pkg" + FS + "I.html", "<li>Next Class</li>"},
// Test for 4664607
{BUG_ID + FS + "pkg" + FS + "I.html",
--- a/langtools/test/com/sun/javadoc/testNewLanguageFeatures/TestNewLanguageFeatures.java Thu Oct 31 12:36:36 2013 -0700
+++ b/langtools/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</h2>"},
//Make sure enum signature is correct.
{BUG_ID + FS + "pkg" + FS + "Coin.html", "<pre>public enum " +
- "<span class=\"strong\">Coin</span>" + NL +
+ "<span class=\"typeNameLabel\">Coin</span>" + NL +
"extends java.lang.Enum<<a href=\"../pkg/Coin.html\" " +
"title=\"enum in pkg\">Coin</a>></pre>"
},
@@ -62,7 +62,7 @@
"</span><span class=\"tabEnd\"> </span></caption>"},
//Detail for enum constant
{BUG_ID + FS + "pkg" + FS + "Coin.html",
- "<span class=\"strong\"><a href=\"../pkg/Coin.html#Dime\">Dime</a></span>"},
+ "<span class=\"memberNameLink\"><a href=\"../pkg/Coin.html#Dime\">Dime</a></span>"},
//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></h2>"},
//Check class type parameters section.
{BUG_ID + FS + "pkg" + FS + "TypeParameters.html",
- "<dt><span class=\"strong\">Type Parameters:</span></dt>" + NL + "<dd><code>E</code> - " +
+ "<dt><span class=\"paramLabel\">Type Parameters:</span></dt>" + NL + "<dd><code>E</code> - " +
"the type parameter for this class."},
//Type parameters in @see/@link
{BUG_ID + FS + "pkg" + FS + "TypeParameters.html",
- "<dl>" + NL + "<dt><span class=\"strong\">See Also:</span></dt>" + NL + "<dd>" +
+ "<dl>" + NL + "<dt><span class=\"seeLabel\">See Also:</span></dt>" + NL + "<dd>" +
"<a href=\"../pkg/TypeParameters.html\" title=\"class in pkg\">" +
"<code>TypeParameters</code></a></dd>" + NL + "</dl>"},
//Method that uses class type parameter.
@@ -93,7 +93,7 @@
"parameter in TypeParameters\">E</a> param)"},
//Method type parameter section.
{BUG_ID + FS + "pkg" + FS + "TypeParameters.html",
- "<span class=\"strong\">Type Parameters:</span></dt>" + NL + "<dd><code>T</code> - This is the first " +
+ "<span class=\"paramLabel\">Type Parameters:</span></dt>" + NL + "<dd><code>T</code> - This is the first " +
"type parameter.</dd>" + NL + "<dd><code>V</code> - 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",
- "<pre>public class <span class=\"strong\">TypeParameterSubClass<T extends " +
+ "<pre>public class <span class=\"typeNameLabel\">TypeParameterSubClass<T extends " +
"java.lang.String></span>" + NL + "extends " +
"<a href=\"../pkg/TypeParameterSuperClass.html\" title=\"class in pkg\">" +
"TypeParameterSuperClass</a><T></pre>"},
@@ -168,7 +168,7 @@
"Annotation Type AnnotationType</h2>"},
//Make sure the signature is correct.
{BUG_ID + FS + "pkg" + FS + "AnnotationType.html",
- "public @interface <span class=\"strong\">AnnotationType</span>"},
+ "public @interface <span class=\"memberNameLabel\">AnnotationType</span>"},
//Make sure member summary headings are correct.
{BUG_ID + FS + "pkg" + FS + "AnnotationType.html",
"<h3>Required Element Summary</h3>"},
@@ -198,7 +198,7 @@
"<a href=\"../pkg/AnnotationType.html#optional--\">optional</a>" +
"=\"Class Annotation\"," + NL +
" <a href=\"../pkg/AnnotationType.html#required--\">" +
- "required</a>=1994)" + NL + "public class <span class=\"strong\">" +
+ "required</a>=1994)" + NL + "public class <span class=\"typeNameLabel\">" +
"AnnotationTypeUsage</span>" + NL + "extends java.lang.Object</pre>"},
//FIELD
@@ -299,7 +299,7 @@
{BUG_ID + FS + "pkg1" + FS + "B.html",
"<pre><a href=\"../pkg1/A.html\" title=\"annotation in pkg1\">@A</a>"},
{BUG_ID + FS + "pkg1" + FS + "B.html",
- "public interface <span class=\"strong\">B</span></pre>"},
+ "public interface <span class=\"typeNameLabel\">B</span></pre>"},
//==============================================================
@@ -320,7 +320,7 @@
"Foo</a></span><span class=\"tabEnd\"> </span></caption>"
},
{BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "Foo.html",
- "<td class=\"colLast\"><code><span class=\"strong\"><a href=\"../../pkg2/ClassUseTest1.html\" " +
+ "<td class=\"colLast\"><code><span class=\"memberNameLink\"><a href=\"../../pkg2/ClassUseTest1.html\" " +
"title=\"class in pkg2\">ClassUseTest1</a><T extends " +
"<a href=\"../../pkg2/Foo.html\" title=\"class in pkg2\">Foo" +
"</a> & <a href=\"../../pkg2/Foo2.html\" title=\"interface in pkg2\">" +
@@ -333,8 +333,8 @@
"pkg2\">Foo</a></span><span class=\"tabEnd\"> </span></caption>"
},
{BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "Foo.html",
- "<td class=\"colLast\"><span class=\"strong\">ClassUseTest1." +
- "</span><code><span class=\"strong\"><a href=\"../../pkg2/" +
+ "<td class=\"colLast\"><span class=\"typeNameLabel\">ClassUseTest1." +
+ "</span><code><span class=\"memberNameLink\"><a href=\"../../pkg2/" +
"ClassUseTest1.html#method-T-\">method</a></span>" +
"(T t)</code> </td>"
},
@@ -372,7 +372,7 @@
"</span></caption>"
},
{BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "Foo2.html",
- "<td class=\"colLast\"><code><span class=\"strong\"><a href=\"../../pkg2/ClassUseTest1.html\" " +
+ "<td class=\"colLast\"><code><span class=\"memberNameLink\"><a href=\"../../pkg2/ClassUseTest1.html\" " +
"title=\"class in pkg2\">ClassUseTest1</a><T extends " +
"<a href=\"../../pkg2/Foo.html\" title=\"class in pkg2\">Foo" +
"</a> & <a href=\"../../pkg2/Foo2.html\" title=\"interface in pkg2\">" +
@@ -386,8 +386,8 @@
"</span></caption>"
},
{BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "Foo2.html",
- "<td class=\"colLast\"><span class=\"strong\">" +
- "ClassUseTest1.</span><code><span class=\"strong\"><a href=\"../../" +
+ "<td class=\"colLast\"><span class=\"typeNameLabel\">" +
+ "ClassUseTest1.</span><code><span class=\"memberNameLink\"><a href=\"../../" +
"pkg2/ClassUseTest1.html#method-T-\">method</a></span>" +
"(T t)</code> </td>"
},
@@ -401,7 +401,7 @@
" </span></caption>"
},
{BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "ParamTest.html",
- "<td class=\"colLast\"><code><span class=\"strong\"><a href=\"../../pkg2/ClassUseTest2.html\" " +
+ "<td class=\"colLast\"><code><span class=\"memberNameLink\"><a href=\"../../pkg2/ClassUseTest2.html\" " +
"title=\"class in pkg2\">ClassUseTest2</a><T extends " +
"<a href=\"../../pkg2/ParamTest.html\" title=\"class in pkg2\">" +
"ParamTest</a><<a href=\"../../pkg2/Foo3.html\" title=\"class in pkg2\">" +
@@ -415,8 +415,8 @@
" </span></caption>"
},
{BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "ParamTest.html",
- "<td class=\"colLast\"><span class=\"strong\">ClassUseTest2." +
- "</span><code><span class=\"strong\"><a href=\"../../pkg2/" +
+ "<td class=\"colLast\"><span class=\"typeNameLabel\">ClassUseTest2." +
+ "</span><code><span class=\"memberNameLink\"><a href=\"../../pkg2/" +
"ClassUseTest2.html#method-T-\">method</a></span>" +
"(T t)</code> </td>"
},
@@ -456,7 +456,7 @@
"Foo3</a></span><span class=\"tabEnd\"> </span></caption>"
},
{BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "Foo3.html",
- "<td class=\"colLast\"><code><span class=\"strong\"><a href=\"../../pkg2/ClassUseTest2.html\" " +
+ "<td class=\"colLast\"><code><span class=\"memberNameLink\"><a href=\"../../pkg2/ClassUseTest2.html\" " +
"title=\"class in pkg2\">ClassUseTest2</a><T extends " +
"<a href=\"../../pkg2/ParamTest.html\" title=\"class in pkg2\">" +
"ParamTest</a><<a href=\"../../pkg2/Foo3.html\" title=\"class in pkg2\">" +
@@ -470,8 +470,8 @@
"</span></caption>"
},
{BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "Foo3.html",
- "<td class=\"colLast\"><span class=\"strong\">ClassUseTest2." +
- "</span><code><span class=\"strong\"><a href=\"../../pkg2/" +
+ "<td class=\"colLast\"><span class=\"typeNameLabel\">ClassUseTest2." +
+ "</span><code><span class=\"memberNameLink\"><a href=\"../../pkg2/" +
"ClassUseTest2.html#method-T-\">method</a></span>" +
"(T t)</code> </td>"
},
@@ -500,7 +500,7 @@
" </span></caption>"
},
{BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "ParamTest2.html",
- "<td class=\"colLast\"><code><span class=\"strong\"><a href=\"../../pkg2/ClassUseTest3.html\" " +
+ "<td class=\"colLast\"><code><span class=\"memberNameLink\"><a href=\"../../pkg2/ClassUseTest3.html\" " +
"title=\"class in pkg2\">ClassUseTest3</a><T extends " +
"<a href=\"../../pkg2/ParamTest2.html\" title=\"class in pkg2\">" +
"ParamTest2</a><java.util.List<? extends " +
@@ -515,8 +515,8 @@
" </span></caption>"
},
{BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "ParamTest2.html",
- "<td class=\"colLast\"><span class=\"strong\">ClassUseTest3" +
- ".</span><code><span class=\"strong\"><a href=\"../../pkg2/ClassUseTest3." +
+ "<td class=\"colLast\"><span class=\"typeNameLabel\">ClassUseTest3" +
+ ".</span><code><span class=\"memberNameLink\"><a href=\"../../pkg2/ClassUseTest3." +
"html#method-T-\">method</a></span>(T t)</code> </td>"
},
{BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "ParamTest2.html",
@@ -538,7 +538,7 @@
"</span></caption>"
},
{BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "Foo4.html",
- "<td class=\"colLast\"><code><span class=\"strong\"><a href=\"../../pkg2/ClassUseTest3.html\" " +
+ "<td class=\"colLast\"><code><span class=\"memberNameLink\"><a href=\"../../pkg2/ClassUseTest3.html\" " +
"title=\"class in pkg2\">ClassUseTest3</a><T extends " +
"<a href=\"../../pkg2/ParamTest2.html\" title=\"class in pkg2\">" +
"ParamTest2</a><java.util.List<? extends " +
@@ -552,8 +552,8 @@
"pkg2\">Foo4</a></span><span class=\"tabEnd\"> </span></caption>"
},
{BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "Foo4.html",
- "<td class=\"colLast\"><span class=\"strong\">ClassUseTest3." +
- "</span><code><span class=\"strong\"><a href=\"../../pkg2/ClassUseTest3." +
+ "<td class=\"colLast\"><span class=\"typeNameLabel\">ClassUseTest3." +
+ "</span><code><span class=\"memberNameLink\"><a href=\"../../pkg2/ClassUseTest3." +
"html#method-T-\">method</a></span>(T t)</code>" +
" </td>"
},
@@ -586,8 +586,8 @@
"<th class=\"colLast\" scope=\"col\">Method and Description</th>" + NL +
"</tr>" + NL + "<tbody>" + NL + "<tr class=\"altColor\">" + NL +
"<td class=\"colFirst\"><code>void</code></td>" + NL +
- "<td class=\"colLast\"><span class=\"strong\">ClassUseTest3." +
- "</span><code><span class=\"strong\"><a href=\"../../pkg2/ClassUseTest3." +
+ "<td class=\"colLast\"><span class=\"typeNameLabel\">ClassUseTest3." +
+ "</span><code><span class=\"memberNameLink\"><a href=\"../../pkg2/ClassUseTest3." +
"html#method-java.util.Set-\">method</a></span>(java." +
"util.Set<<a href=\"../../pkg2/Foo4.html\" title=\"" +
"class in pkg2\">Foo4</a>> p)</code> </td>" + NL +
@@ -663,14 +663,14 @@
// TYPE PARAMETER IN INDEX
//=================================
{BUG_ID + FS + "index-all.html",
- "<span class=\"strong\"><a href=\"pkg2/Foo.html#method-java.util.Vector-\">" +
+ "<span class=\"memberNameLink\"><a href=\"pkg2/Foo.html#method-java.util.Vector-\">" +
"method(Vector<Object>)</a></span>"
},
//=================================
// TYPE PARAMETER IN INDEX
//=================================
{BUG_ID + FS + "index-all.html",
- "<span class=\"strong\"><a href=\"pkg2/Foo.html#method-java.util.Vector-\">" +
+ "<span class=\"memberNameLink\"><a href=\"pkg2/Foo.html#method-java.util.Vector-\">" +
"method(Vector<Object>)</a></span>"
},
};
@@ -679,7 +679,7 @@
// ENUM TESTING
//=================================
//NO constructor section
- {BUG_ID + FS + "pkg" + FS + "Coin.html", "<span class=\"strong\">Constructor Summary</span>"},
+ {BUG_ID + FS + "pkg" + FS + "Coin.html", "<h3>Constructor Summary</h3>"},
//=================================
// TYPE PARAMETER TESTING
//=================================
@@ -698,25 +698,25 @@
{BUG_ID + FS + "pkg" + FS + "AnnotationTypeUsage.html",
"<a href=\"../pkg/AnnotationTypeUndocumented.html\" title=\"annotation in pkg\">@AnnotationTypeUndocumented</a>(<a href=\"../pkg/AnnotationType.html#optional\">optional</a>=\"Class Annotation\"," + NL +
" <a href=\"../pkg/AnnotationType.html#required\">required</a>=1994)" + NL +
- "public class <span class=\"strong\">AnnotationTypeUsage</span></dt><dt>extends java.lang.Object</dt>"},
+ "public class <span class=\"typeNameLabel\">AnnotationTypeUsage</span></dt><dt>extends java.lang.Object</dt>"},
//FIELD
{BUG_ID + FS + "pkg" + FS + "AnnotationTypeUsage.html",
"<a href=\"../pkg/AnnotationTypeUndocumented.html\" title=\"annotation in pkg\">@AnnotationTypeUndocumented</a>(<a href=\"../pkg/AnnotationType.html#optional\">optional</a>=\"Field Annotation\"," + NL +
" <a href=\"../pkg/AnnotationType.html#required\">required</a>=1994)" + NL +
- "public int <span class=\"strong\">field</span>"},
+ "public int <span class=\"memberNameLabel\">field</span>"},
//CONSTRUCTOR
{BUG_ID + FS + "pkg" + FS + "AnnotationTypeUsage.html",
"<a href=\"../pkg/AnnotationTypeUndocumented.html\" title=\"annotation in pkg\">@AnnotationTypeUndocumented</a>(<a href=\"../pkg/AnnotationType.html#optional\">optional</a>=\"Constructor Annotation\"," + NL +
" <a href=\"../pkg/AnnotationType.html#required\">required</a>=1994)" + NL +
- "public <span class=\"strong\">AnnotationTypeUsage</span>()"},
+ "public <span class=\"typeNameLabel\">AnnotationTypeUsage</span>()"},
//METHOD
{BUG_ID + FS + "pkg" + FS + "AnnotationTypeUsage.html",
"<a href=\"../pkg/AnnotationTypeUndocumented.html\" title=\"annotation in pkg\">@AnnotationTypeUndocumented</a>(<a href=\"../pkg/AnnotationType.html#optional\">optional</a>=\"Method Annotation\"," + NL +
" <a href=\"../pkg/AnnotationType.html#required\">required</a>=1994)" + NL +
- "public void <span class=\"strong\">method</span>()"},
+ "public void <span class=\"memberNameLabel\">method</span>()"},
//=================================
// Make sure annotation types do not
--- a/langtools/test/com/sun/javadoc/testOverridenMethods/TestOverridenMethodDocCopy.java Thu Oct 31 12:36:36 2013 -0700
+++ b/langtools/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",
- "<span class=\"strong\">Description copied from class: <code>" +
+ "<span class=\"descfrmTypeLabel\">Description copied from class: <code>" +
"<a href=\"../pkg1/BaseClass.html#overridenMethodWithDocsToCopy--\">" +
"BaseClass</a></code></span>"
}
--- a/langtools/test/com/sun/javadoc/testOverridenMethods/TestOverridenPrivateMethods.java Thu Oct 31 12:36:36 2013 -0700
+++ b/langtools/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",
- "<dt><span class=\"strong\">Overrides:</span></dt>" + NL +
+ "<dt><span class=\"overrideSpecifyLabel\">Overrides:</span></dt>" + NL +
"<dd><code><a href=\"../pkg1/BaseClass.html#publicMethod"},
//The public method in different package should be overriden
{BUG_ID + FS + "pkg2" + FS + "SubClass.html",
- "<dt><span class=\"strong\">Overrides:</span></dt>" + NL +
+ "<dt><span class=\"overrideSpecifyLabel\">Overrides:</span></dt>" + NL +
"<dd><code><a href=\"../pkg1/BaseClass.html#publicMethod"}
};
@@ -54,17 +54,17 @@
//The package private method should be overriden since the base and sub class are in the same
//package. However, the link should not show up because the package private methods are not documented.
{BUG_ID + FS + "pkg1" + FS + "SubClass.html",
- "<dt><span class=\"strong\">Overrides:</span></dt>" + NL +
+ "<dt><span class=\"overrideSpecifyLabel\">Overrides:</span></dt>" + NL +
"<dd><code><a href=\"../pkg1/BaseClass.html#packagePrivateMethod"},
//The private method in should not be overriden
{BUG_ID + FS + "pkg1" + FS + "SubClass.html",
- "<dt><span class=\"strong\">Overrides:</span></dt>" + NL +
+ "<dt><span class=\"overrideSpecifyLabel\">Overrides:</span></dt>" + NL +
"<dd><code><a href=\"../pkg1/BaseClass.html#privateMethod"},
//The private method in different package should not be overriden
{BUG_ID + FS + "pkg2" + FS + "SubClass.html",
- "<dt><span class=\"strong\">Overrides:</span></dt>" + NL +
+ "<dt><span class=\"overrideSpecifyLabel\">Overrides:</span></dt>" + NL +
"<dd><code><a href=\"../pkg1/BaseClass.html#privateMethod"},
//The package private method should not be overriden since the base and sub class are in
--- a/langtools/test/com/sun/javadoc/testOverridenMethods/TestOverridenPrivateMethodsWithPackageFlag.java Thu Oct 31 12:36:36 2013 -0700
+++ b/langtools/test/com/sun/javadoc/testOverridenMethods/TestOverridenPrivateMethodsWithPackageFlag.java Thu Oct 31 16:46:43 2013 -0700
@@ -23,7 +23,7 @@
/*
* @test
- * @bug 4634891 8025633
+ * @bug 4634891 8025633 8026567
* @summary Determine if overriden methods are properly documented when
* -protected (default) visibility flag is used.
* @author jamieh
@@ -40,14 +40,14 @@
private static final String[][] TEST = {
//The public method should be overriden
{BUG_ID + FS + "pkg1" + FS + "SubClass.html",
- "<dt><span class=\"strong\">Overrides:</span></dt>" + NL +
+ "<dt><span class=\"overrideSpecifyLabel\">Overrides:</span></dt>" + NL +
"<dd><code><a href=\"../pkg1/BaseClass.html#publicMethod--\">" +
"publicMethod</a></code> in class <code>" +
"<a href=\"../pkg1/BaseClass.html\" title=\"class in pkg1\">BaseClass</a></code></dd>"},
//The public method in different package should be overriden
{BUG_ID + FS + "pkg2" + FS + "SubClass.html",
- "<dt><span class=\"strong\">Overrides:</span></dt>" + NL +
+ "<dt><span class=\"overrideSpecifyLabel\">Overrides:</span></dt>" + NL +
"<dd><code><a href=\"../pkg1/BaseClass.html#publicMethod--\">" +
"publicMethod</a></code> in class <code>" +
"<a href=\"../pkg1/BaseClass.html\" title=\"class in pkg1\">BaseClass</a></code></dd>"},
@@ -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",
- "<dt><span class=\"strong\">Overrides:</span></dt>" + NL +
+ "<dt><span class=\"overrideSpecifyLabel\">Overrides:</span></dt>" + NL +
"<dd><code><a href=\"../pkg1/BaseClass.html#packagePrivateMethod--\">" +
"packagePrivateMethod</a></code> in class <code>" +
"<a href=\"../pkg1/BaseClass.html\" title=\"class in pkg1\">BaseClass</a></code></dd>"}
@@ -65,18 +65,18 @@
//The private method in should not be overriden
{BUG_ID + FS + "pkg1" + FS + "SubClass.html",
- "<dt><span class=\"strong\">Overrides:</span></dt>" + NL +
+ "<dt><span class=\"overrideSpecifyLabel\">Overrides:</span></dt>" + NL +
"<dd><code><a href=\"../pkg1/BaseClass.html#privateMethod()\">"},
//The private method in different package should not be overriden
{BUG_ID + FS + "pkg2" + FS + "SubClass.html",
- "<dt><span class=\"strong\">Overrides:</span></dt>" + NL +
+ "<dt><span class=\"overrideSpecifyLabel\">Overrides:</span></dt>" + NL +
"<dd><code><a href=\"../pkg1/BaseClass.html#privateMethod()\">"},
//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",
- "<dt><span class=\"strong\">Overrides:</span></dt>" + NL +
+ "<dt><span class=\"overrideSpecifyLabel\">Overrides:</span></dt>" + NL +
"<dd><code><a href=\"../pkg1/BaseClass.html#packagePrivateMethod()\">"},
};
--- a/langtools/test/com/sun/javadoc/testOverridenMethods/TestOverridenPrivateMethodsWithPrivateFlag.java Thu Oct 31 12:36:36 2013 -0700
+++ b/langtools/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",
- "<dt><span class=\"strong\">Overrides:</span></dt>" + NL +
+ "<dt><span class=\"overrideSpecifyLabel\">Overrides:</span></dt>" + NL +
"<dd><code><a href=\"../pkg1/BaseClass.html#publicMethod"},
//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",
- "<dt><span class=\"strong\">Overrides:</span></dt>" + NL +
+ "<dt><span class=\"overrideSpecifyLabel\">Overrides:</span></dt>" + NL +
"<dd><code><a href=\"../pkg1/BaseClass.html#packagePrivateMethod"},
//The public method in different package should be overriden
{BUG_ID + FS + "pkg2" + FS + "SubClass.html",
- "<dt><span class=\"strong\">Overrides:</span></dt>" + NL +
+ "<dt><span class=\"overrideSpecifyLabel\">Overrides:</span></dt>" + NL +
"<dd><code><a href=\"../pkg1/BaseClass.html#publicMethod"},
};
@@ -59,18 +59,18 @@
//The private method in should not be overriden
{BUG_ID + FS + "pkg1" + FS + "SubClass.html",
- "<dt><span class=\"strong\">Overrides:</span></dt>" + NL +
+ "<dt><span class=\"overrideSpecifyLabel\">Overrides:</span></dt>" + NL +
"<dd><code><a href=\"../pkg1/BaseClass.html#privateMethod"},
//The private method in different package should not be overriden
{BUG_ID + FS + "pkg2" + FS + "SubClass.html",
- "<dt><span class=\"strong\">Overrides:</span></dt>" + NL +
+ "<dt><span class=\"overrideSpecifyLabel\">Overrides:</span></dt>" + NL +
"<dd><code><a href=\"../pkg1/BaseClass.html#privateMethod"},
//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",
- "<dt><span class=\"strong\">Overrides:</span></dt>" + NL +
+ "<dt><span class=\"overrideSpecifyLabel\">Overrides:</span></dt>" + NL +
"<dd><code><a href=\"../pkg1/BaseClass.html#packagePrivateMethod"}
--- a/langtools/test/com/sun/javadoc/testPackageDeprecation/TestPackageDeprecation.java Thu Oct 31 12:36:36 2013 -0700
+++ b/langtools/test/com/sun/javadoc/testPackageDeprecation/TestPackageDeprecation.java Thu Oct 31 16:46:43 2013 -0700
@@ -23,7 +23,7 @@
/*
* @test
- * @bug 6492694
+ * @bug 6492694 8026567
* @summary Test package deprecation.
* @author bpatel
* @library ../lib/
@@ -49,8 +49,8 @@
//Input for string search tests.
private static final String[][] TEST1 = {
{BUG_ID + "-1" + FS + "pkg1" + FS + "package-summary.html",
- "<div class=\"deprecatedContent\"><span class=\"strong\">Deprecated.</span>" + NL +
- "<div class=\"block\"><span class=\"italic\">This package is Deprecated." +
+ "<div class=\"deprecatedContent\"><span class=\"deprecatedLabel\">Deprecated.</span>" + NL +
+ "<div class=\"block\"><span class=\"deprecationComment\">This package is Deprecated." +
"</span></div>"
},
{BUG_ID + "-1" + FS + "deprecated-list.html",
--- a/langtools/test/com/sun/javadoc/testParamTaglet/TestParamTaglet.java Thu Oct 31 12:36:36 2013 -0700
+++ b/langtools/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",
- "<span class=\"strong\">Parameters:</span></dt>" + NL + "<dd><code>param1</code> - testing 1 2 3.</dd>" +
+ "<span class=\"paramLabel\">Parameters:</span></dt>" + NL + "<dd><code>param1</code> - testing 1 2 3.</dd>" +
NL + "<dd><code>param2</code> - testing 1 2 3."
},
//Param tags that don't match with any real parameters.
{BUG_ID + FS + "pkg" + FS + "C.html",
- "<span class=\"strong\">Parameters:</span></dt>" + NL + "<dd><code><I>p1</I></code> - testing 1 2 3.</dd>" +
+ "<span class=\"paramLabel\">Parameters:</span></dt>" + NL + "<dd><code><I>p1</I></code> - testing 1 2 3.</dd>" +
NL + "<dd><code><I>p2</I></code> - testing 1 2 3."
},
//{@inherit} doc misuse does not cause doclet to throw exception.
--- a/langtools/test/com/sun/javadoc/testPrivateClasses/TestPrivateClasses.java Thu Oct 31 12:36:36 2013 -0700
+++ b/langtools/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",
- "<span class=\"strong\">Overrides:</span>"},
+ "<span class=\"overrideSpecifyLabel\">Overrides:</span>"},
// Should not document that a method specified by private interface.
{BUG_ID + "-1" + FS + "pkg" + FS + "PublicChild.html",
- "<span class=\"strong\">Specified by:</span>"},
+ "<span class=\"overrideSpecifyLabel\">Specified by:</span>"},
{BUG_ID + "-1" + FS + "pkg" + FS + "PublicInterface.html",
- "<span class=\"strong\">Specified by:</span>"},
+ "<span class=\"overrideSpecifyLabel\">Specified by:</span>"},
// 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",
- "<span class=\"strong\"><a href=\"../pkg2/I.html#hello-T-\">hello</a></span>"},
+ "<span class=\"memberNameLink\"><a href=\"../pkg2/I.html#hello-T-\">hello</a></span>"},
};
// 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",
- "<dt><span class=\"strong\">Overrides:</span></dt>" + NL +
+ "<dt><span class=\"overrideSpecifyLabel\">Overrides:</span></dt>" + NL +
"<dd><code><a href=\"../pkg/PrivateParent.html#methodOverridenFromParent-char:A-int-T-V-java.util.List-\">" +
"methodOverridenFromParent</a></code> in class <code>" +
"<a href=\"../pkg/PrivateParent.html\" title=\"class in pkg\">" +
"PrivateParent</a></code></dd>"},
// Should document that a method is specified by private interface.
{BUG_ID + "-2" + FS + "pkg" + FS + "PublicChild.html",
- "<dt><span class=\"strong\">Specified by:</span></dt>" + NL +
+ "<dt><span class=\"overrideSpecifyLabel\">Specified by:</span></dt>" + NL +
"<dd><code><a href=\"../pkg/PrivateInterface.html#methodInterface-int-\">" +
"methodInterface</a></code> in interface <code>" +
"<a href=\"../pkg/PrivateInterface.html\" title=\"interface in pkg\">" +
@@ -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",
- "<span class=\"strong\">Description copied from interface: <code>" +
+ "<span class=\"descfrmTypeLabel\">Description copied from interface: <code>" +
"<a href=\"../pkg2/I.html#hello-T-\">I</a></code></span>"},
{BUG_ID + "-2" + FS + "pkg2" + FS + "C.html",
- "<dt><span class=\"strong\">Specified by:</span></dt>" + NL +
+ "<dt><span class=\"overrideSpecifyLabel\">Specified by:</span></dt>" + NL +
"<dd><code><a href=\"../pkg2/I.html#hello-T-\">hello</a></code>" +
" in interface <code>" +
"<a href=\"../pkg2/I.html\" title=\"interface in pkg2\">I</a>" +
@@ -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",
- "<pre>class <span class=\"strong\">PrivateParent</span>"},
+ "<pre>class <span class=\"typeNameLabel\">PrivateParent</span>"},
{BUG_ID + "-2" + FS + "pkg" + FS + "PublicChild.html",
- "<pre>public class <span class=\"strong\">PublicChild</span>"},
+ "<pre>public class <span class=\"typeNameLabel\">PublicChild</span>"},
};
private static final String[][] NEGATED_TEST2 = {
{BUG_ID + "-2" + FS + "pkg" + FS + "PrivateParent.html",
- "<pre> class <span class=\"strong\">PrivateParent</span>"},
+ "<pre> class <span class=\"typeNameLabel\">PrivateParent</span>"},
};
/**
--- a/langtools/test/com/sun/javadoc/testProfiles/TestProfiles.java Thu Oct 31 12:36:36 2013 -0700
+++ b/langtools/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 @@
"<h3><a href=\"pkg2/compact2-package-summary.html\" "
+ "target=\"classFrame\">pkg2</a></h3>"
},
+ {PROFILE_BUG_ID + FS + "compact2-summary.html",
+ "<ul class=\"blockList\">" + NL + "<li class=\"blockList\">" + NL
+ + "<h3><a href=\"pkg2/compact2-package-summary.html\" target=\"classFrame\">"
+ + "pkg2</a></h3>" + NL + "<table class=\"typeSummary\" border=\"0\" "
+ + "cellpadding=\"3\" cellspacing=\"0\" summary=\"Class Summary table, "
+ + "listing classes, and an explanation\">"
+ },
+ {PROFILE_BUG_ID + FS + "compact2-summary.html",
+ "<ul class=\"blockList\">" + NL + "<li class=\"blockList\">" + NL
+ + "<h3><a href=\"pkg4/compact2-package-summary.html\" target=\"classFrame\">"
+ + "pkg4</a></h3>" + NL + "<table class=\"typeSummary\" border=\"0\" "
+ + "cellpadding=\"3\" cellspacing=\"0\" summary=\"Class Summary table, "
+ + "listing classes, and an explanation\">"
+ },
// 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",
"<div class=\"subTitle\">compact3</div>"
},
+ {PROFILE_BUG_ID + FS + "pkg5" + FS + "compact3-package-summary.html",
+ "<ul class=\"blockList\">" + NL + "<li class=\"blockList\">" + NL
+ + "<table class=\"typeSummary\" border=\"0\" cellpadding=\"3\" "
+ + "cellspacing=\"0\" summary=\"Interface Summary table, listing "
+ + "interfaces, and an explanation\">"
+ },
//Test for "overview-frame.html" showing the "All Profiles" link.
{PROFILE_BUG_ID + FS + "overview-frame.html",
"<span><a href=\"profile-overview-frame.html\" "
@@ -122,17 +142,17 @@
},
{PROFILE_BUG_ID + FS + "deprecated-list.html","<td class=\"colOne\">"
+ "<a href=\"pkg2/Class1Pkg2.html\" title=\"class in pkg2\">pkg2.Class1Pkg2</a>"
- + NL +"<div class=\"block\"><span class=\"italic\">Class1Pkg2. This class is deprecated</span></div>"
+ + NL +"<div class=\"block\"><span class=\"deprecationComment\">Class1Pkg2. This class is deprecated</span></div>"
},
//Test deprecated package in profile
{PROFILE_BUG_ID + FS + "deprecated-list.html","<td class=\"colOne\">"
+ "<a href=\"pkgDeprecated/package-summary.html\">pkgDeprecated</a>"
- + NL +"<div class=\"block\"><span class=\"italic\">This package is <b>Deprecated</b>."
+ + NL +"<div class=\"block\"><span class=\"deprecationComment\">This package is <b>Deprecated</b>."
+ " Use pkg1.</span></div>"
},
{PROFILE_BUG_ID + FS + "pkgDeprecated" + FS + "package-summary.html",
- "<div class=\"deprecatedContent\"><span class=\"strong\">Deprecated.</span>"
- + NL + "<div class=\"block\"><span class=\"italic\">This package is <b>Deprecated</b>."
+ "<div class=\"deprecatedContent\"><span class=\"deprecatedLabel\">Deprecated.</span>"
+ + NL + "<div class=\"block\"><span class=\"deprecationComment\">This package is <b>Deprecated</b>."
+ " Use pkg1.</span></div>"
},
// need to add teststring when JDK-8015496 will be fixed
@@ -171,6 +191,21 @@
+ "target=\"classFrame\">Anno1Pkg4</a></li>"
},
{PROFILE_BUG_ID + FS + "compact1-summary.html","<li>Use</li>"
+ },
+ {PROFILE_BUG_ID + FS + "compact2-summary.html",
+ "<ul class=\"blockList\">" + NL + "<li class=\"blockList\">" + NL
+ + "<h3><a href=\"pkg2/compact2-package-summary.html\" target=\"classFrame\">"
+ + "pkg2</a></h3>" + NL + "<li class=\"blockList\">" + NL
+ + "<table class=\"typeSummary\" border=\"0\" "
+ + "cellpadding=\"3\" cellspacing=\"0\" summary=\"Class Summary table, "
+ + "listing classes, and an explanation\">"
+ },
+ {PROFILE_BUG_ID + FS + "pkg5" + FS + "compact3-package-summary.html",
+ "<ul class=\"blockList\">" + NL + "<li class=\"blockList\">" + NL
+ + "<li class=\"blockList\">" + NL
+ + "<table class=\"typeSummary\" border=\"0\" cellpadding=\"3\" "
+ + "cellspacing=\"0\" summary=\"Interface Summary table, listing "
+ + "interfaces, and an explanation\">"
}
};
private static final String[][] PACKAGES_TEST = {
--- a/langtools/test/com/sun/javadoc/testProfiles/TestProfilesConfiguration.java Thu Oct 31 12:36:36 2013 -0700
+++ b/langtools/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",
"<h3><a href=\"pkgDeprecated/compact1-package-summary.html\" target=\"" +
"classFrame\">pkgDeprecated</a></h3>" + NL + "<div class=\"deprecatedContent\">" +
- "<span class=\"strong\">Deprecated.</span></div>"
+ "<span class=\"deprecatedLabel\">Deprecated.</span></div>"
}
};
private static final String[][] PROFILES_CONFIGURATION_NEGATED_TEST = {
--- a/langtools/test/com/sun/javadoc/testSerializedFormDeprecationInfo/TestSerializedFormDeprecationInfo.java Thu Oct 31 12:36:36 2013 -0700
+++ b/langtools/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", "<dl>" + NL +
- "<dt><span class=\"strong\">Throws:</span></dt>" + NL + "<dd><code>" +
- "java.io.IOException</code></dd>"+ NL + "<dt><span class=\"strong\">See Also:</span>" +
+ "<dt><span class=\"throwsLabel\">Throws:</span></dt>" + NL + "<dd><code>" +
+ "java.io.IOException</code></dd>"+ NL + "<dt><span class=\"seeLabel\">See Also:</span>" +
"</dt>" + NL + "<dd><a href=\"pkg1/C1.html#setUndecorated-boolean-\">" +
"<code>C1.setUndecorated(boolean)</code></a></dd>" + NL + "</dl>"},
- {BUG_ID + FS + "serialized-form.html", "<span class=\"strong\">Deprecated.</span>" +
- " <span class=\"italic\">As of JDK version 1.5, replaced by" + NL +
+ {BUG_ID + FS + "serialized-form.html", "<span class=\"deprecatedLabel\">Deprecated.</span>" +
+ " <span class=\"deprecationComment\">As of JDK version 1.5, replaced by" + NL +
" <a href=\"pkg1/C1.html#setUndecorated-boolean-\">" +
"<code>setUndecorated(boolean)</code></a>.</span></div>" + NL +
"<div class=\"block\">This field indicates whether the C1 " +
"is undecorated.</div>" + NL + " " + NL +
- "<dl>" + NL + "<dt><span class=\"strong\">Since:</span></dt>" + NL +
- "<dd>1.4</dd>" + NL + "<dt><span class=\"strong\">See Also:</span>" +
+ "<dl>" + NL + "<dt><span class=\"simpleTagLabel\">Since:</span></dt>" + NL +
+ "<dd>1.4</dd>" + NL + "<dt><span class=\"seeLabel\">See Also:</span>" +
"</dt>" + NL + "<dd><a href=\"pkg1/C1.html#setUndecorated-boolean-\">" +
"<code>C1.setUndecorated(boolean)</code></a></dd>" + NL + "</dl>"},
- {BUG_ID + FS + "serialized-form.html", "<span class=\"strong\">Deprecated.</span>" +
- " <span class=\"italic\">As of JDK version 1.5, replaced by" + NL +
+ {BUG_ID + FS + "serialized-form.html", "<span class=\"deprecatedLabel\">Deprecated.</span>" +
+ " <span class=\"deprecationComment\">As of JDK version 1.5, replaced by" + NL +
" <a href=\"pkg1/C1.html#setUndecorated-boolean-\">" +
"<code>setUndecorated(boolean)</code></a>.</span></div>" + NL +
"<div class=\"block\">Reads the object stream.</div>" + NL +
- "<dl>" + NL + "<dt><span class=\"strong\">Throws:</span></dt>" + NL + "<dd><code><code>" +
+ "<dl>" + NL + "<dt><span class=\"throwsLabel\">Throws:</span></dt>" + NL + "<dd><code><code>" +
"IOException</code></code></dd>" + NL +
"<dd><code>java.io.IOException</code></dd>" + NL + "</dl>"},
- {BUG_ID + FS + "serialized-form.html", "<span class=\"strong\">Deprecated.</span>" +
+ {BUG_ID + FS + "serialized-form.html", "<span class=\"deprecatedLabel\">Deprecated.</span>" +
" </div>" + NL + "<div class=\"block\">" +
"The name for this class.</div>"}};
@@ -73,12 +73,12 @@
// information if any.
private static final String[][] TEST_NOCMNT = {
{BUG_ID + FS + "serialized-form.html", "<pre>boolean undecorated</pre>" + NL +
- "<div class=\"block\"><span class=\"strong\">Deprecated.</span> <span class=\"italic\">" +
+ "<div class=\"block\"><span class=\"deprecatedLabel\">Deprecated.</span> <span class=\"deprecationComment\">" +
"As of JDK version 1.5, replaced by" + NL +
" <a href=\"pkg1/C1.html#setUndecorated-boolean-\"><code>" +
"setUndecorated(boolean)</code></a>.</span></div>" + NL + "</li>"},
- {BUG_ID + FS + "serialized-form.html", "<span class=\"strong\">" +
- "Deprecated.</span> <span class=\"italic\">As of JDK version" +
+ {BUG_ID + FS + "serialized-form.html", "<span class=\"deprecatedLabel\">" +
+ "Deprecated.</span> <span class=\"deprecationComment\">As of JDK version" +
" 1.5, replaced by" + NL +
" <a href=\"pkg1/C1.html#setUndecorated-boolean-\">" +
"<code>setUndecorated(boolean)</code></a>.</span></div>" + NL + "</li>"}};
--- a/langtools/test/com/sun/javadoc/testSimpleTag/TestSimpleTag.java Thu Oct 31 12:36:36 2013 -0700
+++ b/langtools/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",
- "<span class=\"strong\">Todo:</span>"},
+ "<span class=\"simpleTagLabel\">Todo:</span>"},
{"./" + BUG_ID + "/C.html",
- "<span class=\"strong\">EJB Beans:</span>"},
+ "<span class=\"simpleTagLabel\">EJB Beans:</span>"},
{"./" + BUG_ID + "/C.html",
- "<span class=\"strong\">Regular Tag:</span>"},
+ "<span class=\"simpleTagLabel\">Regular Tag:</span>"},
{"./" + BUG_ID + "/C.html",
- "<span class=\"strong\">Back-Slash-Tag:</span>"},
+ "<span class=\"simpleTagLabel\">Back-Slash-Tag:</span>"},
};
private static final String[] ARGS = new String[] {
--- a/langtools/test/com/sun/javadoc/testSimpleTagInherit/TestSimpleTagInherit.java Thu Oct 31 12:36:36 2013 -0700
+++ b/langtools/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",
- "<dt><span class=\"strong\"><em>Custom:</em></span></dt>" + NL +
+ "<dt><span class=\"simpleTagLabel\"><em>Custom:</em></span></dt>" + NL +
"<dd>doc for BaseClass class</dd>" },
{ BUG_ID + FS + "p" + FS + "TestClass.html",
- "<dt><span class=\"strong\"><em>Custom:</em></span></dt>" + NL +
+ "<dt><span class=\"simpleTagLabel\"><em>Custom:</em></span></dt>" + NL +
"<dd>doc for BaseClass method</dd>" }
};
private static final String[][] NEGATED_TEST = NO_TEST;
--- a/langtools/test/com/sun/javadoc/testSinceTag/TestSinceTag.java Thu Oct 31 12:36:36 2013 -0700
+++ b/langtools/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",
- "<dl>" + NL + "<dt><span class=\"strong\">Since:</span></dt>" + NL +
+ "<dl>" + NL + "<dt><span class=\"simpleTagLabel\">Since:</span></dt>" + NL +
"<dd>JDK1.0</dd>"
},
{BUG_ID + FS + "serialized-form.html",
- "<dl>" + NL + "<dt><span class=\"strong\">Since:</span></dt>" + NL +
+ "<dl>" + NL + "<dt><span class=\"simpleTagLabel\">Since:</span></dt>" + NL +
"<dd>1.4</dd>"
}
};
--- a/langtools/test/com/sun/javadoc/testTagOutput/TestTagOutput.java Thu Oct 31 12:36:36 2013 -0700
+++ b/langtools/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",
- "<div class=\"block\"><span class=\"strong\">Deprecated.</span> </div>"},
+ "<div class=\"block\"><span class=\"deprecatedLabel\">Deprecated.</span> </div>"},
{BUG_ID + FS + "pkg1" + FS + "DeprecatedTag.html",
- "<div class=\"block\"><span class=\"strong\">Deprecated.</span> " +
- "<span class=\"italic\">Do not use this.</span></div>"}};
+ "<div class=\"block\"><span class=\"deprecatedLabel\">Deprecated.</span> " +
+ "<span class=\"deprecationComment\">Do not use this.</span></div>"}};
private static final String[][] NEGATED_TEST = {
{BUG_ID + FS + "pkg1" + FS + "DeprecatedTag.html",
- "<div class=\"block\"><span class=\"strong\">Deprecated." +
- "</span> <span class=\"italic\"></span></div>"}};
+ "<div class=\"block\"><span class=\"deprecatedLabel\">Deprecated." +
+ "</span> <span class=\"deprecationComment\"></span></div>"}};
private static final String[] ARGS =
new String[] {
--- a/langtools/test/com/sun/javadoc/testTaglets/TestTaglets.java Thu Oct 31 12:36:36 2013 -0700
+++ b/langtools/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", "<span class=\"strong\">Foo:</span></dt>" +
+ {"4654308" + FS + "C.html", "<span class=\"simpleTagLabel\">Foo:</span></dt>" +
"<dd>my only method is <a href=\"C.html#method--\"><code>here" +
"</code></a></dd></dl>"}
};
--- a/langtools/test/com/sun/javadoc/testTaglets/taglets/Foo.java Thu Oct 31 12:36:36 2013 -0700
+++ b/langtools/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(), "<dt><span class=\"strong\">Foo:</span></dt><dd>"));
+ inlineTags.add(new TextTag(tag.holder(), "<dt><span class=\"simpleTagLabel\">Foo:</span></dt><dd>"));
inlineTags.addAll(Arrays.asList(tag.inlineTags()));
inlineTags.add(new TextTag(tag.holder(), "</dd>"));
return writer.commentTagsToOutput(tag,
--- a/langtools/test/com/sun/javadoc/testThrowsHead/TestThrowsHead.java Thu Oct 31 12:36:36 2013 -0700
+++ b/langtools/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", "<dt><span class=\"strong\">Throws:</span>"}
+ {BUG_ID + FS + "C.html", "<dt><span class=\"throwsLabel\">Throws:</span>"}
};
private static final String[][] NEGATED_TEST = NO_TEST;
private static final String[] ARGS = new String[] {
--- a/langtools/test/com/sun/javadoc/testTypeAnnotations/TestTypeAnnotations.java Thu Oct 31 12:36:36 2013 -0700
+++ b/langtools/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 <span class=\"strong\">ExtendsBound<K extends <a " +
+ "class <span class=\"typeNameLabel\">ExtendsBound<K extends <a " +
"href=\"../typeannos/ClassParamA.html\" title=\"annotation in " +
"typeannos\">@ClassParamA</a> java.lang.String></span>"
},
{BUG_ID + FS + "typeannos" + FS + "ExtendsGeneric.html",
- "<pre>class <span class=\"strong\">ExtendsGeneric<K extends " +
+ "<pre>class <span class=\"typeNameLabel\">ExtendsGeneric<K extends " +
"<a href=\"../typeannos/ClassParamA.html\" title=\"annotation in " +
"typeannos\">@ClassParamA</a> <a href=\"../typeannos/Unannotated.html\" " +
"title=\"class in typeannos\">Unannotated</a><<a href=\"" +
@@ -87,24 +87,24 @@
"@ClassParamB</a> java.lang.String>></span>"
},
{BUG_ID + FS + "typeannos" + FS + "TwoBounds.html",
- "<pre>class <span class=\"strong\">TwoBounds<K extends <a href=\"" +
+ "<pre>class <span class=\"typeNameLabel\">TwoBounds<K extends <a href=\"" +
"../typeannos/ClassParamA.html\" title=\"annotation in typeannos\">" +
"@ClassParamA</a> java.lang.String,V extends <a href=\"../typeannos/" +
"ClassParamB.html\" title=\"annotation in typeannos\">@ClassParamB" +
"</a> java.lang.String></span>"
},
{BUG_ID + FS + "typeannos" + FS + "Complex1.html",
- "class <span class=\"strong\">Complex1<K extends <a href=\"../" +
+ "class <span class=\"typeNameLabel\">Complex1<K extends <a href=\"../" +
"typeannos/ClassParamA.html\" title=\"annotation in typeannos\">" +
"@ClassParamA</a> java.lang.String & java.lang.Runnable></span>"
},
{BUG_ID + FS + "typeannos" + FS + "Complex2.html",
- "class <span class=\"strong\">Complex2<K extends java.lang." +
+ "class <span class=\"typeNameLabel\">Complex2<K extends java.lang." +
"String & <a href=\"../typeannos/ClassParamB.html\" title=\"" +
"annotation in typeannos\">@ClassParamB</a> java.lang.Runnable></span>"
},
{BUG_ID + FS + "typeannos" + FS + "ComplexBoth.html",
- "class <span class=\"strong\">ComplexBoth<K extends <a href=\"" +
+ "class <span class=\"typeNameLabel\">ComplexBoth<K extends <a href=\"" +
"../typeannos/ClassParamA.html\" title=\"annotation in typeannos\"" +
">@ClassParamA</a> java.lang.String & <a href=\"../typeannos/" +
"ClassParamA.html\" title=\"annotation in typeannos\">@ClassParamA" +
--- a/langtools/test/com/sun/javadoc/testValueTag/TestValueTag.java Thu Oct 31 12:36:36 2013 -0700
+++ b/langtools/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: <a href=\"../pkg2/Class3.html#TEST_17_PASSES\">\"Test 17 passes\"</a>"},
//Test @value tag used with custom tag.
{BUG_ID + FS + "pkg1" + FS + "CustomTagUsage.html",
- "<dt><span class=\"strong\">Todo:</span></dt>" + NL +
+ "<dt><span class=\"simpleTagLabel\">Todo:</span></dt>" + NL +
"<dd>the value of this constant is 55.</dd>"},
//Test @value errors printed dues to invalid use or when used with
//non-constant or with bad references.
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/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 {
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/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
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/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
+
--- a/langtools/test/tools/doclint/DocLintTester.java Thu Oct 31 12:36:36 2013 -0700
+++ b/langtools/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("-"))
--- a/langtools/test/tools/javac/ExtDirs/ExtDirTest.java Thu Oct 31 12:36:36 2013 -0700
+++ b/langtools/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);
Binary file langtools/test/tools/javac/ExtDirs/ext1/pkg1.jar has changed
Binary file langtools/test/tools/javac/ExtDirs/ext2/pkg2.jar has changed
Binary file langtools/test/tools/javac/ExtDirs/ext3/pkg1.jar has changed
Binary file langtools/test/tools/javac/ExtDirs/ext3/pkg2.jar has changed
--- a/langtools/test/tools/javac/MethodParameters/LambdaTest.out Thu Oct 31 12:36:36 2013 -0700
+++ b/langtools/test/tools/javac/MethodParameters/LambdaTest.out Thu Oct 31 16:46:43 2013 -0700
@@ -1,7 +1,7 @@
class LambdaTest --
LambdaTest.<init>()
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)
--- a/langtools/test/tools/javac/MethodParameters/Tester.java Thu Oct 31 12:36:36 2013 -0700
+++ b/langtools/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<String> refFileList = Files.readAllLines(refFile.toPath(), StandardCharsets.UTF_8);
- List<String> sbList = Arrays.asList(sb.split(System.getProperty("line.separator")));
+ List<String> sbList = Arrays.asList(sb.split("[\r\n]+"));
// Check if test output contains unexpected lines or is missing expected lines.
- List<String> sbOnly = new ArrayList<String>(sbList);
+ List<String> sbOnly = new ArrayList<>(sbList);
sbOnly.removeAll(refFileList);
for (String line: sbOnly)
error("unexpected line found: " + line);
- List<String> refOnly = new ArrayList<String>(refFileList);
+ List<String> refOnly = new ArrayList<>(refFileList);
refOnly.removeAll(sbList);
for (String line: refOnly)
error("expected line not found: " + line);
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/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<Integer> numbers = Arrays.asList(1, 2, 3);\n" +
+ /* 08 */ " final List<Integer> 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<T extends CharSequence> {\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);
+ }
+
+}
--- a/langtools/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<Integer> numbers = Arrays.asList(1, 2, 3);\n" +
- /* 08 */ " final List<Integer> 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);
- }
-
-}
--- a/langtools/test/tools/javac/annotations/typeAnnotations/failures/CantAnnotateStaticClass2.java Thu Oct 31 12:36:36 2013 -0700
+++ b/langtools/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
*/
--- a/langtools/test/tools/javac/annotations/typeAnnotations/failures/CantAnnotateStaticClass2.out Thu Oct 31 12:36:36 2013 -0700
+++ b/langtools/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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/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() {}; } }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/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
--- a/langtools/test/tools/javac/annotations/typeAnnotations/failures/common/arrays/DeclarationAnnotation.out Thu Oct 31 12:36:36 2013 -0700
+++ b/langtools/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
--- a/langtools/test/tools/javac/annotations/typeAnnotations/newlocations/AnonymousClass.java Thu Oct 31 12:36:36 2013 -0700
+++ b/langtools/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 { }
--- a/langtools/test/tools/javac/annotations/typeAnnotations/newlocations/MultiCatch.java Thu Oct 31 12:36:36 2013 -0700
+++ b/langtools/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
--- a/langtools/test/tools/javac/annotations/typeAnnotations/referenceinfos/Constructors.java Thu Oct 31 12:36:36 2013 -0700
+++ b/langtools/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")
--- a/langtools/test/tools/javac/annotations/typeAnnotations/referenceinfos/MultiCatch.java Thu Oct 31 12:36:36 2013 -0700
+++ b/langtools/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
--- a/langtools/test/tools/javac/lambda/8016081/T8016081.java Thu Oct 31 12:36:36 2013 -0700
+++ b/langtools/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 {}
--- a/langtools/test/tools/javac/lambda/LambdaExpr13.java Thu Oct 31 12:36:36 2013 -0700
+++ b/langtools/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(); }; }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/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<String> foundNames = new LinkedHashSet<>();
+ for (LocalVariableTable_attribute.Entry e: lvt.local_variable_table) {
+ foundNames.add(cf.constant_pool.getUTF8Value(e.name_index));
+ }
+
+ Set<String> expectNames = new LinkedHashSet<>(Arrays.asList(expect.value()));
+ if (!foundNames.equals(expectNames)) {
+ Set<String> foundOnly = new LinkedHashSet<>(foundNames);
+ foundOnly.removeAll(expectNames);
+ for (String s: foundOnly)
+ error("Unexpected name found: " + s);
+ Set<String> 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);
+ }
+ };
+ }
+ }
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/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;
+ };
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/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);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/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<T> {
+ public static <T, U extends Comparable<? super U>> MyComparator<T> mycomparing1(
+ Function<? super T, ? extends U> keyExtractor) {
+ return null;
+ }
+
+ public static <T, U extends Comparable<? super U>> MyComparator<T> mycomparing2(
+ Function<? super T, ? super U> keyExtractor) {
+ return null;
+ }
+
+ public static <T, U extends Comparable<? super U>> MyComparator<T> mycomparing3(
+ Function<? extends T, ? extends U> keyExtractor) {
+ return null;
+ }
+
+ public static <T, U extends Comparable<? super U>> MyComparator<T> mycomparing4(
+ Function<? extends T, ? super U> keyExtractor) {
+ return null;
+ }
+}
--- a/langtools/test/tools/javac/lambda/TargetType58.java Thu Oct 31 12:36:36 2013 -0700
+++ b/langtools/test/tools/javac/lambda/TargetType58.java Thu Oct 31 16:46:43 2013 -0700
@@ -35,7 +35,7 @@
class TargetType58 {
void test(List<Integer> li) {
- g(li, s -> s.substream(200), Collections.emptyList());
+ g(li, s -> s.skip(200), Collections.emptyList());
}
<T, U, S_OUT extends Stream<U>,
--- a/langtools/test/tools/javac/lambda/TestSelfRef.java Thu Oct 31 12:36:36 2013 -0700
+++ b/langtools/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) +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/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;
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/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");
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/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'");
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/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'");
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/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<String> & Serializable) ((str) -> str.length() > 3);
+ out.writeObject(res);
+ }
+
+ public void readCheck(ObjectInput in) throws Exception {
+ in.readObject();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/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'");
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/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'");
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/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");
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/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'");
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/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'");
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/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<String, Boolean> & Serializable) ((str) -> str.length() > 3);
+ out.writeObject(res);
+ }
+
+ public void readCheck(ObjectInput in) throws Exception {
+ in.readObject();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/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'");
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/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'");
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/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;
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/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();
+ }
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/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();
+ }
+ }
+ }
+}
--- a/langtools/test/tools/javac/lambdaShapes/org/openjdk/tests/separate/Compiler.java Thu Oct 31 12:36:36 2013 -0700
+++ b/langtools/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<Flags>(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<String,File> each : compileHierarchy(superClass).entrySet()) {
- outputDirs.put(each.getKey(), each.getValue());
- }
- }
- for (Extends ext : type.getSupertypes()) {
- Type iface = ext.getType();
- for( Map.Entry<String,File> 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<Type> 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) {
--- a/langtools/test/tools/javac/lambdaShapes/org/openjdk/tests/separate/SourceModel.java Thu Oct 31 12:36:36 2013 -0700
+++ b/langtools/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<Method> methodDependencies;
private List<Type> typeDependencies;
+ private boolean fullCompilation;
protected Type(String name,
List<AccessFlag> flags, List<TypeParameter> 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<Type> typeDependencies() {
+ public Collection<Type> typeDependencies(boolean recursive) {
HashMap<String,Type> 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);
--- a/langtools/test/tools/javac/lambdaShapes/org/openjdk/tests/separate/TestHarness.java Thu Oct 31 12:36:36 2013 -0700
+++ b/langtools/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<? extends Throwable> 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();
}
--- a/langtools/test/tools/javac/lambdaShapes/org/openjdk/tests/vm/DefaultMethodsTest.java Thu Oct 31 12:36:36 2013 -0700
+++ b/langtools/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<T> { default int m(T t) { return 99; } }
- * Class C implements I<String> { public int m() { return 88; } }
+ * Class C implements I<String> { 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<String,String> j = new C(); j.m("A","B","C") == 88;
* TEST: K<String> 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() {
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/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<? extends TypeElement> 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();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/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<? extends TypeElement> 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();
+ }
+}
--- a/langtools/test/tools/jdeps/Basic.java Thu Oct 31 12:36:36 2013 -0700
+++ b/langtools/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<String,String> findDeps(String out) {
- Map<String,String> result = new HashMap<>();
+ Map<String,String> result = new LinkedHashMap<>();
Matcher lm = linePattern.matcher(out); // Line matcher
Matcher pm = null; // Pattern matcher
int lines = 0;
--- a/langtools/test/tools/jdeps/Test.java Thu Oct 31 12:36:36 2013 -0700
+++ b/langtools/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";
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/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";
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/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;
+ }
+}