--- a/langtools/make/build.xml Fri Oct 11 03:09:42 2013 -0700
+++ b/langtools/make/build.xml Fri Oct 11 23:31:06 2013 -0700
@@ -360,7 +360,7 @@
datafile="${build.coverage.dir}/cobertura.ser"/>
</target>
- <target name="diags-examples" depends="build-javac">
+ <target name="diags-examples" depends="build-javac,build-javap">
<!-- can override the following on the command line if desired. -->
<property name="diags.examples.out" location="${build.dir}/diag-examples/diags-examples.html"/>
<mkdir dir="${build.dir}/diag-examples/classes"/>
@@ -370,7 +370,7 @@
destdir="${build.dir}/diag-examples/classes"
includes="ArgTypeCompilerFactory.java,Example.java,FileManager.java,HTMLWriter.java,RunExamples.java,DocCommentProcessor.java"
sourcepath=""
- classpath="${dist.lib.dir}/javac.jar"
+ classpath="${dist.lib.dir}/javac.jar;${dist.lib.dir}/javap.jar"
includeAntRuntime="no"
debug="${javac.debug}"
debuglevel="${javac.debuglevel}">
@@ -379,7 +379,7 @@
<java fork="true"
jvm="${target.java.home}/bin/java"
dir="test/tools/javac/diags"
- classpath="${build.dir}/diag-examples/classes;${dist.lib.dir}/javac.jar"
+ classpath="${build.dir}/diag-examples/classes;${dist.lib.dir}/javac.jar;${dist.lib.dir}/javap.jar"
classname="RunExamples">
<jvmarg value="-Dtest.classes=${build.dir}/diag-examples/classes"/>
<arg value="-examples"/>
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/AbstractExecutableMemberWriter.java Fri Oct 11 03:09:42 2013 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/AbstractExecutableMemberWriter.java Fri Oct 11 23:31:06 2013 -0700
@@ -305,6 +305,6 @@
buf.append(t.dimension());
}
buf.append(")");
- return foundTypeVariable ? buf.toString() : null;
+ return foundTypeVariable ? writer.getName(buf.toString()) : null;
}
}
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/AbstractIndexWriter.java Fri Oct 11 03:09:42 2013 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/AbstractIndexWriter.java Fri Oct 11 23:31:06 2013 -0700
@@ -89,10 +89,11 @@
* @param memberlist List of members for the unicode character
* @param contentTree the content tree to which the information will be added
*/
- protected void addContents(Character unicode, List<? extends Doc> memberlist,
+ protected void addContents(Character uc, List<? extends Doc> memberlist,
Content contentTree) {
- contentTree.addContent(getMarkerAnchor("_" + unicode + "_"));
- Content headContent = new StringContent(unicode.toString());
+ String unicode = uc.toString();
+ contentTree.addContent(getMarkerAnchorForIndex(unicode));
+ Content headContent = new StringContent(unicode);
Content heading = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING, false,
HtmlStyle.title, headContent);
contentTree.addContent(heading);
@@ -253,4 +254,24 @@
addPreQualifiedClassLink(LinkInfoImpl.Kind.INDEX, containing,
false, contentTree);
}
+
+ /**
+ * Get the marker anchor which will be added to the index documentation tree.
+ *
+ * @param anchorNameForIndex the anchor name attribute for index page
+ * @return a content tree for the marker anchor
+ */
+ public Content getMarkerAnchorForIndex(String anchorNameForIndex) {
+ return getMarkerAnchor(getNameForIndex(anchorNameForIndex), null);
+ }
+
+ /**
+ * Generate a valid HTML name for member index page.
+ *
+ * @param unicode the string that needs to be converted to valid HTML name.
+ * @return a valid HTML name string.
+ */
+ public String getNameForIndex(String unicode) {
+ return "I:" + getName(unicode);
+ }
}
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeFieldWriterImpl.java Fri Oct 11 03:09:42 2013 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeFieldWriterImpl.java Fri Oct 11 23:31:06 2013 -0700
@@ -88,7 +88,7 @@
Content memberDetailsTree) {
if (!writer.printedAnnotationFieldHeading) {
memberDetailsTree.addContent(writer.getMarkerAnchor(
- "annotation_type_field_detail"));
+ SectionName.ANNOTATION_TYPE_FIELD_DETAIL));
Content heading = HtmlTree.HEADING(HtmlConstants.DETAILS_HEADING,
writer.fieldDetailsLabel);
memberDetailsTree.addContent(heading);
@@ -217,7 +217,7 @@
*/
public void addSummaryAnchor(ClassDoc cd, Content memberTree) {
memberTree.addContent(writer.getMarkerAnchor(
- "annotation_type_field_summary"));
+ SectionName.ANNOTATION_TYPE_FIELD_SUMMARY));
}
/**
@@ -272,7 +272,8 @@
*/
protected Content getNavSummaryLink(ClassDoc cd, boolean link) {
if (link) {
- return writer.getHyperLink("annotation_type_field_summary",
+ return writer.getHyperLink(
+ SectionName.ANNOTATION_TYPE_FIELD_SUMMARY,
writer.getResource("doclet.navField"));
} else {
return writer.getResource("doclet.navField");
@@ -284,7 +285,8 @@
*/
protected void addNavDetailLink(boolean link, Content liNav) {
if (link) {
- liNav.addContent(writer.getHyperLink("annotation_type_field_detail",
+ liNav.addContent(writer.getHyperLink(
+ SectionName.ANNOTATION_TYPE_FIELD_DETAIL,
writer.getResource("doclet.navField")));
} else {
liNav.addContent(writer.getResource("doclet.navField"));
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeOptionalMemberWriterImpl.java Fri Oct 11 03:09:42 2013 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeOptionalMemberWriterImpl.java Fri Oct 11 23:31:06 2013 -0700
@@ -133,7 +133,7 @@
*/
public void addSummaryAnchor(ClassDoc cd, Content memberTree) {
memberTree.addContent(writer.getMarkerAnchor(
- "annotation_type_optional_element_summary"));
+ SectionName.ANNOTATION_TYPE_OPTIONAL_ELEMENT_SUMMARY));
}
/**
@@ -141,7 +141,8 @@
*/
protected Content getNavSummaryLink(ClassDoc cd, boolean link) {
if (link) {
- return writer.getHyperLink("annotation_type_optional_element_summary",
+ return writer.getHyperLink(
+ SectionName.ANNOTATION_TYPE_OPTIONAL_ELEMENT_SUMMARY,
writer.getResource("doclet.navAnnotationTypeOptionalMember"));
} else {
return writer.getResource("doclet.navAnnotationTypeOptionalMember");
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeRequiredMemberWriterImpl.java Fri Oct 11 03:09:42 2013 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeRequiredMemberWriterImpl.java Fri Oct 11 23:31:06 2013 -0700
@@ -89,7 +89,7 @@
Content memberDetailsTree) {
if (!writer.printedAnnotationHeading) {
memberDetailsTree.addContent(writer.getMarkerAnchor(
- "annotation_type_element_detail"));
+ SectionName.ANNOTATION_TYPE_ELEMENT_DETAIL));
Content heading = HtmlTree.HEADING(HtmlConstants.DETAILS_HEADING,
writer.annotationTypeDetailsLabel);
memberDetailsTree.addContent(heading);
@@ -219,7 +219,7 @@
*/
public void addSummaryAnchor(ClassDoc cd, Content memberTree) {
memberTree.addContent(writer.getMarkerAnchor(
- "annotation_type_required_element_summary"));
+ SectionName.ANNOTATION_TYPE_REQUIRED_ELEMENT_SUMMARY));
}
/**
@@ -274,7 +274,8 @@
*/
protected Content getNavSummaryLink(ClassDoc cd, boolean link) {
if (link) {
- return writer.getHyperLink("annotation_type_required_element_summary",
+ return writer.getHyperLink(
+ SectionName.ANNOTATION_TYPE_REQUIRED_ELEMENT_SUMMARY,
writer.getResource("doclet.navAnnotationTypeRequiredMember"));
} else {
return writer.getResource("doclet.navAnnotationTypeRequiredMember");
@@ -286,7 +287,8 @@
*/
protected void addNavDetailLink(boolean link, Content liNav) {
if (link) {
- liNav.addContent(writer.getHyperLink("annotation_type_element_detail",
+ liNav.addContent(writer.getHyperLink(
+ SectionName.ANNOTATION_TYPE_ELEMENT_DETAIL,
writer.getResource("doclet.navAnnotationTypeMember")));
} else {
liNav.addContent(writer.getResource("doclet.navAnnotationTypeMember"));
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ConstantsSummaryWriterImpl.java Fri Oct 11 03:09:42 2013 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ConstantsSummaryWriterImpl.java Fri Oct 11 23:31:06 2013 -0700
@@ -107,7 +107,8 @@
//add link to summary
Content link;
if (packageName.length() == 0) {
- link = getHyperLink(DocLink.fragment(DocletConstants.UNNAMED_PACKAGE_ANCHOR),
+ link = getHyperLink(getDocLink(
+ SectionName.UNNAMED_PACKAGE_ANCHOR),
defaultPackageLabel, "", "");
} else {
Content packageNameContent = getPackageLabel(parsedPackageName);
@@ -153,7 +154,7 @@
Content pkgNameContent;
if (parsedPackageName.length() == 0) {
summariesTree.addContent(getMarkerAnchor(
- DocletConstants.UNNAMED_PACKAGE_ANCHOR));
+ SectionName.UNNAMED_PACKAGE_ANCHOR));
pkgNameContent = defaultPackageLabel;
} else {
summariesTree.addContent(getMarkerAnchor(
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ConstructorWriterImpl.java Fri Oct 11 03:09:42 2013 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ConstructorWriterImpl.java Fri Oct 11 23:31:06 2013 -0700
@@ -97,7 +97,8 @@
Content memberDetailsTree) {
memberDetailsTree.addContent(HtmlConstants.START_OF_CONSTRUCTOR_DETAILS);
Content constructorDetailsTree = writer.getMemberTreeHeader();
- constructorDetailsTree.addContent(writer.getMarkerAnchor("constructor_detail"));
+ constructorDetailsTree.addContent(writer.getMarkerAnchor(
+ SectionName.CONSTRUCTOR_DETAIL));
Content heading = HtmlTree.HEADING(HtmlConstants.DETAILS_HEADING,
writer.constructorDetailsLabel);
constructorDetailsTree.addContent(heading);
@@ -256,7 +257,8 @@
* {@inheritDoc}
*/
public void addSummaryAnchor(ClassDoc cd, Content memberTree) {
- memberTree.addContent(writer.getMarkerAnchor("constructor_summary"));
+ memberTree.addContent(writer.getMarkerAnchor(
+ SectionName.CONSTRUCTOR_SUMMARY));
}
/**
@@ -280,7 +282,7 @@
*/
protected Content getNavSummaryLink(ClassDoc cd, boolean link) {
if (link) {
- return writer.getHyperLink("constructor_summary",
+ return writer.getHyperLink(SectionName.CONSTRUCTOR_SUMMARY,
writer.getResource("doclet.navConstructor"));
} else {
return writer.getResource("doclet.navConstructor");
@@ -292,7 +294,8 @@
*/
protected void addNavDetailLink(boolean link, Content liNav) {
if (link) {
- liNav.addContent(writer.getHyperLink("constructor_detail",
+ liNav.addContent(writer.getHyperLink(
+ SectionName.CONSTRUCTOR_DETAIL,
writer.getResource("doclet.navConstructor")));
} else {
liNav.addContent(writer.getResource("doclet.navConstructor"));
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/DeprecatedListWriter.java Fri Oct 11 03:09:42 2013 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/DeprecatedListWriter.java Fri Oct 11 23:31:06 2013 -0700
@@ -48,8 +48,8 @@
private static final String[] ANCHORS = new String[] {
"package", "interface", "class", "enum", "exception", "error",
- "annotation_type", "field", "method", "constructor", "enum_constant",
- "annotation_type_member"
+ "annotation.type", "field", "method", "constructor", "enum.constant",
+ "annotation.type.member"
};
private static final String[] HEADING_KEYS = new String[] {
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/EnumConstantWriterImpl.java Fri Oct 11 03:09:42 2013 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/EnumConstantWriterImpl.java Fri Oct 11 23:31:06 2013 -0700
@@ -73,7 +73,8 @@
Content memberDetailsTree) {
memberDetailsTree.addContent(HtmlConstants.START_OF_ENUM_CONSTANT_DETAILS);
Content enumConstantsDetailsTree = writer.getMemberTreeHeader();
- enumConstantsDetailsTree.addContent(writer.getMarkerAnchor("enum_constant_detail"));
+ enumConstantsDetailsTree.addContent(writer.getMarkerAnchor(
+ SectionName.ENUM_CONSTANT_DETAIL));
Content heading = HtmlTree.HEADING(HtmlConstants.DETAILS_HEADING,
writer.enumConstantsDetailsLabel);
enumConstantsDetailsTree.addContent(heading);
@@ -202,7 +203,8 @@
* {@inheritDoc}
*/
public void addSummaryAnchor(ClassDoc cd, Content memberTree) {
- memberTree.addContent(writer.getMarkerAnchor("enum_constant_summary"));
+ memberTree.addContent(writer.getMarkerAnchor(
+ SectionName.ENUM_CONSTANT_SUMMARY));
}
/**
@@ -263,11 +265,14 @@
*/
protected Content getNavSummaryLink(ClassDoc cd, boolean link) {
if (link) {
- return writer.getHyperLink((cd == null)?
- "enum_constant_summary":
- "enum_constants_inherited_from_class_" +
- configuration.getClassName(cd),
- writer.getResource("doclet.navEnum"));
+ if (cd == null) {
+ return writer.getHyperLink(SectionName.ENUM_CONSTANT_SUMMARY,
+ writer.getResource("doclet.navEnum"));
+ } else {
+ return writer.getHyperLink(
+ SectionName.ENUM_CONSTANTS_INHERITANCE,
+ configuration.getClassName(cd), writer.getResource("doclet.navEnum"));
+ }
} else {
return writer.getResource("doclet.navEnum");
}
@@ -278,7 +283,8 @@
*/
protected void addNavDetailLink(boolean link, Content liNav) {
if (link) {
- liNav.addContent(writer.getHyperLink("enum_constant_detail",
+ liNav.addContent(writer.getHyperLink(
+ SectionName.ENUM_CONSTANT_DETAIL,
writer.getResource("doclet.navEnum")));
} else {
liNav.addContent(writer.getResource("doclet.navEnum"));
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/FieldWriterImpl.java Fri Oct 11 03:09:42 2013 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/FieldWriterImpl.java Fri Oct 11 23:31:06 2013 -0700
@@ -74,7 +74,8 @@
Content memberDetailsTree) {
memberDetailsTree.addContent(HtmlConstants.START_OF_FIELD_DETAILS);
Content fieldDetailsTree = writer.getMemberTreeHeader();
- fieldDetailsTree.addContent(writer.getMarkerAnchor("field_detail"));
+ fieldDetailsTree.addContent(writer.getMarkerAnchor(
+ SectionName.FIELD_DETAIL));
Content heading = HtmlTree.HEADING(HtmlConstants.DETAILS_HEADING,
writer.fieldDetailsLabel);
fieldDetailsTree.addContent(heading);
@@ -224,7 +225,8 @@
* {@inheritDoc}
*/
public void addSummaryAnchor(ClassDoc cd, Content memberTree) {
- memberTree.addContent(writer.getMarkerAnchor("field_summary"));
+ memberTree.addContent(writer.getMarkerAnchor(
+ SectionName.FIELD_SUMMARY));
}
/**
@@ -232,7 +234,7 @@
*/
public void addInheritedSummaryAnchor(ClassDoc cd, Content inheritedTree) {
inheritedTree.addContent(writer.getMarkerAnchor(
- "fields_inherited_from_class_" + configuration.getClassName(cd)));
+ SectionName.FIELDS_INHERITANCE, configuration.getClassName(cd)));
}
/**
@@ -293,11 +295,15 @@
*/
protected Content getNavSummaryLink(ClassDoc cd, boolean link) {
if (link) {
- return writer.getHyperLink((cd == null)?
- "field_summary":
- "fields_inherited_from_class_" +
- configuration.getClassName(cd),
- writer.getResource("doclet.navField"));
+ if (cd == null) {
+ return writer.getHyperLink(
+ SectionName.FIELD_SUMMARY,
+ writer.getResource("doclet.navField"));
+ } else {
+ return writer.getHyperLink(
+ SectionName.FIELDS_INHERITANCE,
+ configuration.getClassName(cd), writer.getResource("doclet.navField"));
+ }
} else {
return writer.getResource("doclet.navField");
}
@@ -308,7 +314,8 @@
*/
protected void addNavDetailLink(boolean link, Content liNav) {
if (link) {
- liNav.addContent(writer.getHyperLink("field_detail",
+ liNav.addContent(writer.getHyperLink(
+ SectionName.FIELD_DETAIL,
writer.getResource("doclet.navField")));
} else {
liNav.addContent(writer.getResource("doclet.navField"));
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java Fri Oct 11 03:09:42 2013 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java Fri Oct 11 23:31:06 2013 -0700
@@ -509,28 +509,28 @@
body.addContent(HtmlConstants.START_OF_TOP_NAVBAR);
navDiv.addStyle(HtmlStyle.topNav);
allClassesId += "navbar_top";
- Content a = getMarkerAnchor("navbar_top");
+ Content a = getMarkerAnchor(SectionName.NAVBAR_TOP);
//WCAG - Hyperlinks should contain text or an image with alt text - for AT tools
navDiv.addContent(a);
Content skipLinkContent = HtmlTree.DIV(HtmlStyle.skipNav, getHyperLink(
- DocLink.fragment("skip-navbar_top"), skipNavLinks,
+ getDocLink(SectionName.SKIP_NAVBAR_TOP), skipNavLinks,
skipNavLinks.toString(), ""));
navDiv.addContent(skipLinkContent);
} else {
body.addContent(HtmlConstants.START_OF_BOTTOM_NAVBAR);
navDiv.addStyle(HtmlStyle.bottomNav);
allClassesId += "navbar_bottom";
- Content a = getMarkerAnchor("navbar_bottom");
+ Content a = getMarkerAnchor(SectionName.NAVBAR_BOTTOM);
navDiv.addContent(a);
Content skipLinkContent = HtmlTree.DIV(HtmlStyle.skipNav, getHyperLink(
- DocLink.fragment("skip-navbar_bottom"), skipNavLinks,
+ getDocLink(SectionName.SKIP_NAVBAR_BOTTOM), skipNavLinks,
skipNavLinks.toString(), ""));
navDiv.addContent(skipLinkContent);
}
if (header) {
- navDiv.addContent(getMarkerAnchor("navbar_top_firstrow"));
+ navDiv.addContent(getMarkerAnchor(SectionName.NAVBAR_TOP_FIRSTROW));
} else {
- navDiv.addContent(getMarkerAnchor("navbar_bottom_firstrow"));
+ navDiv.addContent(getMarkerAnchor(SectionName.NAVBAR_BOTTOM_FIRSTROW));
}
HtmlTree navList = new HtmlTree(HtmlTag.UL);
navList.addStyle(HtmlStyle.navList);
@@ -577,11 +577,11 @@
subDiv.addContent(getAllClassesLinkScript(allClassesId.toString()));
addSummaryDetailLinks(subDiv);
if (header) {
- subDiv.addContent(getMarkerAnchor("skip-navbar_top"));
+ subDiv.addContent(getMarkerAnchor(SectionName.SKIP_NAVBAR_TOP));
body.addContent(subDiv);
body.addContent(HtmlConstants.END_OF_TOP_NAVBAR);
} else {
- subDiv.addContent(getMarkerAnchor("skip-navbar_bottom"));
+ subDiv.addContent(getMarkerAnchor(SectionName.SKIP_NAVBAR_BOTTOM));
body.addContent(subDiv);
body.addContent(HtmlConstants.END_OF_BOTTOM_NAVBAR);
}
@@ -886,7 +886,28 @@
* @return a content tree for the marker anchor
*/
public Content getMarkerAnchor(String anchorName) {
- return getMarkerAnchor(anchorName, null);
+ return getMarkerAnchor(getName(anchorName), null);
+ }
+
+ /**
+ * Get the marker anchor which will be added to the documentation tree.
+ *
+ * @param sectionName the section name anchor attribute for page
+ * @return a content tree for the marker anchor
+ */
+ public Content getMarkerAnchor(SectionName sectionName) {
+ return getMarkerAnchor(sectionName.getName(), null);
+ }
+
+ /**
+ * Get the marker anchor which will be added to the documentation tree.
+ *
+ * @param sectionName the section name anchor attribute for page
+ * @param anchorName the anchor name combined with section name attribute for the page
+ * @return a content tree for the marker anchor
+ */
+ public Content getMarkerAnchor(SectionName sectionName, String anchorName) {
+ return getMarkerAnchor(sectionName.getName() + getName(anchorName), null);
}
/**
@@ -1291,10 +1312,10 @@
} else if (doc instanceof ExecutableMemberDoc) {
ExecutableMemberDoc emd = (ExecutableMemberDoc)doc;
return getLink(new LinkInfoImpl(configuration, context, classDoc)
- .label(label).where(getAnchor(emd, isProperty)).strong(strong));
+ .label(label).where(getName(getAnchor(emd, isProperty))).strong(strong));
} else if (doc instanceof MemberDoc) {
return getLink(new LinkInfoImpl(configuration, context, classDoc)
- .label(label).where(doc.name()).strong(strong));
+ .label(label).where(getName(doc.name())).strong(strong));
} else {
return label;
}
@@ -1319,10 +1340,10 @@
} else if (doc instanceof ExecutableMemberDoc) {
ExecutableMemberDoc emd = (ExecutableMemberDoc) doc;
return getLink(new LinkInfoImpl(configuration, context, classDoc)
- .label(label).where(getAnchor(emd)));
+ .label(label).where(getName(getAnchor(emd))));
} else if (doc instanceof MemberDoc) {
return getLink(new LinkInfoImpl(configuration, context, classDoc)
- .label(label).where(doc.name()));
+ .label(label).where(getName(doc.name())));
} else {
return label;
}
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/HtmlSerialFieldWriter.java Fri Oct 11 03:09:42 2013 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/HtmlSerialFieldWriter.java Fri Oct 11 23:31:06 2013 -0700
@@ -49,8 +49,6 @@
implements SerializedFormWriter.SerialFieldWriter {
ProgramElementDoc[] members = null;
- private boolean printedOverallAnchor = false;
-
public HtmlSerialFieldWriter(SubWriterHolderWriter writer,
ClassDoc classdoc) {
super(writer, classdoc);
@@ -98,10 +96,6 @@
HtmlTree li = new HtmlTree(HtmlTag.LI);
li.addStyle(HtmlStyle.blockList);
if (serializableFieldsTree.isValid()) {
- if (!printedOverallAnchor) {
- li.addContent(writer.getMarkerAnchor("serializedForm"));
- printedOverallAnchor = true;
- }
Content headingContent = new StringContent(heading);
Content serialHeading = HtmlTree.HEADING(HtmlConstants.SERIALIZED_MEMBER_HEADING,
headingContent);
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/HtmlSerialMethodWriter.java Fri Oct 11 03:09:42 2013 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/HtmlSerialMethodWriter.java Fri Oct 11 23:31:06 2013 -0700
@@ -85,12 +85,10 @@
* @return a content tree for the serializable methods content
*/
public Content getSerializableMethods(String heading, Content serializableMethodContent) {
- Content li = HtmlTree.LI(HtmlStyle.blockList, writer.getMarkerAnchor(
- "serialized_methods"));
Content headingContent = new StringContent(heading);
Content serialHeading = HtmlTree.HEADING(HtmlConstants.SERIALIZED_MEMBER_HEADING,
headingContent);
- li.addContent(serialHeading);
+ Content li = HtmlTree.LI(HtmlStyle.blockList, serialHeading);
li.addContent(serializableMethodContent);
return li;
}
@@ -113,8 +111,6 @@
* @param methodsContentTree the content tree to which the member header will be added
*/
public void addMemberHeader(MethodDoc member, Content methodsContentTree) {
- methodsContentTree.addContent(writer.getMarkerAnchor(
- writer.getAnchor(member)));
methodsContentTree.addContent(getHead(member));
methodsContentTree.addContent(getSignature(member));
}
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/MethodWriterImpl.java Fri Oct 11 03:09:42 2013 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/MethodWriterImpl.java Fri Oct 11 23:31:06 2013 -0700
@@ -85,7 +85,8 @@
Content memberDetailsTree) {
memberDetailsTree.addContent(HtmlConstants.START_OF_METHOD_DETAILS);
Content methodDetailsTree = writer.getMemberTreeHeader();
- methodDetailsTree.addContent(writer.getMarkerAnchor("method_detail"));
+ methodDetailsTree.addContent(writer.getMarkerAnchor(
+ SectionName.METHOD_DETAIL));
Content heading = HtmlTree.HEADING(HtmlConstants.DETAILS_HEADING,
writer.methodDetailsLabel);
methodDetailsTree.addContent(heading);
@@ -244,7 +245,8 @@
* {@inheritDoc}
*/
public void addSummaryAnchor(ClassDoc cd, Content memberTree) {
- memberTree.addContent(writer.getMarkerAnchor("method_summary"));
+ memberTree.addContent(writer.getMarkerAnchor(
+ SectionName.METHOD_SUMMARY));
}
/**
@@ -252,8 +254,7 @@
*/
public void addInheritedSummaryAnchor(ClassDoc cd, Content inheritedTree) {
inheritedTree.addContent(writer.getMarkerAnchor(
- "methods_inherited_from_class_" +
- configuration.getClassName(cd)));
+ SectionName.METHODS_INHERITANCE, configuration.getClassName(cd)));
}
/**
@@ -318,7 +319,7 @@
Content methlink = writer.getLink(
new LinkInfoImpl(writer.configuration, LinkInfoImpl.Kind.MEMBER,
overriddenType.asClassDoc())
- .where(writer.getAnchor(method)).label(name));
+ .where(writer.getName(writer.getAnchor(method))).label(name));
Content codeMethLink = HtmlTree.CODE(methlink);
Content dd = HtmlTree.DD(codeMethLink);
dd.addContent(writer.getSpace());
@@ -400,11 +401,15 @@
*/
protected Content getNavSummaryLink(ClassDoc cd, boolean link) {
if (link) {
- return writer.getHyperLink((cd == null)?
- "method_summary":
- "methods_inherited_from_class_" +
- configuration.getClassName(cd),
- writer.getResource("doclet.navMethod"));
+ if (cd == null) {
+ return writer.getHyperLink(
+ SectionName.METHOD_SUMMARY,
+ writer.getResource("doclet.navMethod"));
+ } else {
+ return writer.getHyperLink(
+ SectionName.METHODS_INHERITANCE,
+ configuration.getClassName(cd), writer.getResource("doclet.navMethod"));
+ }
} else {
return writer.getResource("doclet.navMethod");
}
@@ -415,8 +420,8 @@
*/
protected void addNavDetailLink(boolean link, Content liNav) {
if (link) {
- liNav.addContent(writer.getHyperLink("method_detail",
- writer.getResource("doclet.navMethod")));
+ liNav.addContent(writer.getHyperLink(
+ SectionName.METHOD_DETAIL, writer.getResource("doclet.navMethod")));
} else {
liNav.addContent(writer.getResource("doclet.navMethod"));
}
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/NestedClassWriterImpl.java Fri Oct 11 03:09:42 2013 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/NestedClassWriterImpl.java Fri Oct 11 23:31:06 2013 -0700
@@ -132,7 +132,8 @@
* {@inheritDoc}
*/
public void addSummaryAnchor(ClassDoc cd, Content memberTree) {
- memberTree.addContent(writer.getMarkerAnchor("nested_class_summary"));
+ memberTree.addContent(writer.getMarkerAnchor(
+ SectionName.NESTED_CLASS_SUMMARY));
}
/**
@@ -140,7 +141,8 @@
*/
public void addInheritedSummaryAnchor(ClassDoc cd, Content inheritedTree) {
inheritedTree.addContent(writer.getMarkerAnchor(
- "nested_classes_inherited_from_class_" + cd.qualifiedName()));
+ SectionName.NESTED_CLASSES_INHERITANCE,
+ cd.qualifiedName()));
}
/**
@@ -202,9 +204,15 @@
*/
protected Content getNavSummaryLink(ClassDoc cd, boolean link) {
if (link) {
- return writer.getHyperLink((cd == null) ? "nested_class_summary":
- "nested_classes_inherited_from_class_" + cd.qualifiedName(),
- writer.getResource("doclet.navNested"));
+ if (cd == null) {
+ return writer.getHyperLink(
+ SectionName.NESTED_CLASS_SUMMARY,
+ writer.getResource("doclet.navNested"));
+ } else {
+ return writer.getHyperLink(
+ SectionName.NESTED_CLASSES_INHERITANCE,
+ cd.qualifiedName(), writer.getResource("doclet.navNested"));
+ }
} else {
return writer.getResource("doclet.navNested");
}
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageIndexWriter.java Fri Oct 11 03:09:42 2013 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageIndexWriter.java Fri Oct 11 23:31:06 2013 -0700
@@ -203,8 +203,9 @@
Content see = seeLabel;
see.addContent(" ");
Content descPara = HtmlTree.P(see);
- Content descLink = getHyperLink(DocLink.fragment("overview_description"),
- descriptionLabel, "", "");
+ Content descLink = getHyperLink(getDocLink(
+ SectionName.OVERVIEW_DESCRIPTION),
+ descriptionLabel, "", "");
descPara.addContent(descLink);
div.addContent(descPara);
body.addContent(div);
@@ -220,7 +221,8 @@
*/
protected void addOverviewComment(Content htmltree) {
if (root.inlineTags().length > 0) {
- htmltree.addContent(getMarkerAnchor("overview_description"));
+ htmltree.addContent(
+ getMarkerAnchor(SectionName.OVERVIEW_DESCRIPTION));
addInlineComment(root, htmltree);
}
}
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageWriterImpl.java Fri Oct 11 03:09:42 2013 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageWriterImpl.java Fri Oct 11 23:31:06 2013 -0700
@@ -112,7 +112,8 @@
addSummaryComment(packageDoc, docSummaryDiv);
div.addContent(docSummaryDiv);
Content space = getSpace();
- Content descLink = getHyperLink(DocLink.fragment("package_description"),
+ Content descLink = getHyperLink(getDocLink(
+ SectionName.PACKAGE_DESCRIPTION),
descriptionLabel, "", "");
Content descPara = new HtmlTree(HtmlTag.P, seeLabel, space, descLink);
div.addContent(descPara);
@@ -211,7 +212,8 @@
*/
public void addPackageDescription(Content packageContentTree) {
if (packageDoc.inlineTags().length > 0) {
- packageContentTree.addContent(getMarkerAnchor("package_description"));
+ packageContentTree.addContent(
+ getMarkerAnchor(SectionName.PACKAGE_DESCRIPTION));
Content h2Content = new StringContent(
configuration.getText("doclet.Package_Description",
packageDoc.name()));
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ProfilePackageWriterImpl.java Fri Oct 11 03:09:42 2013 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ProfilePackageWriterImpl.java Fri Oct 11 23:31:06 2013 -0700
@@ -129,7 +129,8 @@
addSummaryComment(packageDoc, docSummaryDiv);
div.addContent(docSummaryDiv);
Content space = getSpace();
- Content descLink = getHyperLink(DocLink.fragment("package_description"),
+ Content descLink = getHyperLink(getDocLink(
+ SectionName.PACKAGE_DESCRIPTION),
descriptionLabel, "", "");
Content descPara = new HtmlTree(HtmlTag.P, seeLabel, space, descLink);
div.addContent(descPara);
@@ -192,7 +193,8 @@
*/
public void addPackageDescription(Content packageContentTree) {
if (packageDoc.inlineTags().length > 0) {
- packageContentTree.addContent(getMarkerAnchor("package_description"));
+ packageContentTree.addContent(
+ getMarkerAnchor(SectionName.PACKAGE_DESCRIPTION));
Content h2Content = new StringContent(
configuration.getText("doclet.Package_Description",
packageDoc.name()));
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PropertyWriterImpl.java Fri Oct 11 03:09:42 2013 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PropertyWriterImpl.java Fri Oct 11 23:31:06 2013 -0700
@@ -70,7 +70,8 @@
Content memberDetailsTree) {
memberDetailsTree.addContent(HtmlConstants.START_OF_PROPERTY_DETAILS);
Content propertyDetailsTree = writer.getMemberTreeHeader();
- propertyDetailsTree.addContent(writer.getMarkerAnchor("property_detail"));
+ propertyDetailsTree.addContent(writer.getMarkerAnchor(
+ SectionName.PROPERTY_DETAIL));
Content heading = HtmlTree.HEADING(HtmlConstants.DETAILS_HEADING,
writer.propertyDetailsLabel);
propertyDetailsTree.addContent(heading);
@@ -220,7 +221,8 @@
* {@inheritDoc}
*/
public void addSummaryAnchor(ClassDoc cd, Content memberTree) {
- memberTree.addContent(writer.getMarkerAnchor("property_summary"));
+ memberTree.addContent(writer.getMarkerAnchor(
+ SectionName.PROPERTY_SUMMARY));
}
/**
@@ -228,7 +230,8 @@
*/
public void addInheritedSummaryAnchor(ClassDoc cd, Content inheritedTree) {
inheritedTree.addContent(writer.getMarkerAnchor(
- "properties_inherited_from_class_" + configuration.getClassName(cd)));
+ SectionName.PROPERTIES_INHERITANCE,
+ configuration.getClassName(cd)));
}
/**
@@ -297,11 +300,15 @@
*/
protected Content getNavSummaryLink(ClassDoc cd, boolean link) {
if (link) {
- return writer.getHyperLink((cd == null)?
- "property_summary":
- "properties_inherited_from_class_" +
- configuration.getClassName(cd),
+ if (cd == null) {
+ return writer.getHyperLink(
+ SectionName.PROPERTY_SUMMARY,
writer.getResource("doclet.navProperty"));
+ } else {
+ return writer.getHyperLink(
+ SectionName.PROPERTIES_INHERITANCE,
+ configuration.getClassName(cd), writer.getResource("doclet.navProperty"));
+ }
} else {
return writer.getResource("doclet.navProperty");
}
@@ -312,7 +319,8 @@
*/
protected void addNavDetailLink(boolean link, Content liNav) {
if (link) {
- liNav.addContent(writer.getHyperLink("property_detail",
+ liNav.addContent(writer.getHyperLink(
+ SectionName.PROPERTY_DETAIL,
writer.getResource("doclet.navProperty")));
} else {
liNav.addContent(writer.getResource("doclet.navProperty"));
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/SectionName.java Fri Oct 11 23:31:06 2013 -0700
@@ -0,0 +1,80 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.tools.doclets.formats.html;
+
+/**
+ * Enum representing various section names of generated API documentation.
+ *
+ * <p><b>This is NOT part of any supported API.
+ * If you write code that depends on this, you do so at your own risk.
+ * This code and its internal interfaces are subject to change or
+ * deletion without notice.</b>
+ *
+ * @author Bhavesh Patel
+ */
+public enum SectionName {
+
+ ANNOTATION_TYPE_ELEMENT_DETAIL("annotation.type.element.detail"),
+ ANNOTATION_TYPE_FIELD_DETAIL("annotation.type.field.detail"),
+ ANNOTATION_TYPE_FIELD_SUMMARY("annotation.type.field.summary"),
+ ANNOTATION_TYPE_OPTIONAL_ELEMENT_SUMMARY("annotation.type.optional.element.summary"),
+ ANNOTATION_TYPE_REQUIRED_ELEMENT_SUMMARY("annotation.type.required.element.summary"),
+ CONSTRUCTOR_DETAIL("constructor.detail"),
+ CONSTRUCTOR_SUMMARY("constructor.summary"),
+ ENUM_CONSTANT_DETAIL("enum.constant.detail"),
+ ENUM_CONSTANTS_INHERITANCE("enum.constants.inherited.from.class."),
+ ENUM_CONSTANT_SUMMARY("enum.constant.summary"),
+ FIELD_DETAIL("field.detail"),
+ FIELDS_INHERITANCE("fields.inherited.from.class."),
+ FIELD_SUMMARY("field.summary"),
+ METHOD_DETAIL("method.detail"),
+ METHODS_INHERITANCE("methods.inherited.from.class."),
+ METHOD_SUMMARY("method.summary"),
+ NAVBAR_BOTTOM("navbar.bottom"),
+ NAVBAR_BOTTOM_FIRSTROW("navbar.bottom.firstrow"),
+ NAVBAR_TOP("navbar.top"),
+ NAVBAR_TOP_FIRSTROW("navbar.top.firstrow"),
+ NESTED_CLASSES_INHERITANCE("nested.classes.inherited.from.class."),
+ NESTED_CLASS_SUMMARY("nested.class.summary"),
+ OVERVIEW_DESCRIPTION("overview.description"),
+ PACKAGE_DESCRIPTION("package.description"),
+ PROPERTY_DETAIL("property.detail"),
+ PROPERTIES_INHERITANCE("properties.inherited.from.class."),
+ PROPERTY_SUMMARY("property.summary"),
+ SKIP_NAVBAR_BOTTOM("skip.navbar.bottom"),
+ SKIP_NAVBAR_TOP("skip.navbar.top"),
+ UNNAMED_PACKAGE_ANCHOR("unnamed.package");
+
+ private final String value;
+
+ SectionName(String sName) {
+ this.value = sName;
+ }
+
+ public String getName() {
+ return this.value;
+ }
+}
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/SingleIndexWriter.java Fri Oct 11 03:09:42 2013 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/SingleIndexWriter.java Fri Oct 11 23:31:06 2013 -0700
@@ -115,7 +115,8 @@
for (int i = 0; i < indexbuilder.elements().length; i++) {
String unicode = (indexbuilder.elements())[i].toString();
contentTree.addContent(
- getHyperLink("_" + unicode + "_", new StringContent(unicode)));
+ getHyperLink(getNameForIndex(unicode),
+ new StringContent(unicode)));
contentTree.addContent(getSpace());
}
}
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlDocWriter.java Fri Oct 11 03:09:42 2013 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlDocWriter.java Fri Oct 11 23:31:06 2013 -0700
@@ -30,6 +30,7 @@
import com.sun.javadoc.*;
import com.sun.tools.doclets.formats.html.ConfigurationImpl;
+import com.sun.tools.doclets.formats.html.SectionName;
import com.sun.tools.doclets.internal.toolkit.*;
import com.sun.tools.doclets.internal.toolkit.util.DocFile;
import com.sun.tools.doclets.internal.toolkit.util.DocLink;
@@ -78,7 +79,7 @@
}
/**
- * Get Html Hyper Link string.
+ * Get Html Hyper Link Content.
*
* @param where Position of the link in the file. Character '#' is not
* needed.
@@ -87,7 +88,125 @@
*/
public Content getHyperLink(String where,
Content label) {
- return getHyperLink(DocLink.fragment(where), label, "", "");
+ return getHyperLink(getDocLink(where), label, "", "");
+ }
+
+ /**
+ * Get Html Hyper Link Content.
+ *
+ * @param sectionName The section name to which the link will be created.
+ * @param label Tag for the link.
+ * @return a content tree for the hyper link
+ */
+ public Content getHyperLink(SectionName sectionName,
+ Content label) {
+ return getHyperLink(getDocLink(sectionName), label, "", "");
+ }
+
+ /**
+ * Get Html Hyper Link Content.
+ *
+ * @param sectionName The section name combined with where to which the link
+ * will be created.
+ * @param where The fragment combined with sectionName to which the link
+ * will be created.
+ * @param label Tag for the link.
+ * @return a content tree for the hyper link
+ */
+ public Content getHyperLink(SectionName sectionName, String where,
+ Content label) {
+ return getHyperLink(getDocLink(sectionName, where), label, "", "");
+ }
+
+ /**
+ * Get the link.
+ *
+ * @param where Position of the link in the file.
+ * @return a DocLink object for the hyper link
+ */
+ public DocLink getDocLink(String where) {
+ return DocLink.fragment(getName(where));
+ }
+
+ /**
+ * Get the link.
+ *
+ * @param sectionName The section name to which the link will be created.
+ * @return a DocLink object for the hyper link
+ */
+ public DocLink getDocLink(SectionName sectionName) {
+ return DocLink.fragment(sectionName.getName());
+ }
+
+ /**
+ * Get the link.
+ *
+ * @param sectionName The section name combined with where to which the link
+ * will be created.
+ * @param where The fragment combined with sectionName to which the link
+ * will be created.
+ * @return a DocLink object for the hyper link
+ */
+ public DocLink getDocLink(SectionName sectionName, String where) {
+ return DocLink.fragment(sectionName.getName() + getName(where));
+ }
+
+ /**
+ * Convert the name to a valid HTML name.
+ *
+ * @param name the name that needs to be converted to valid HTML name.
+ * @return a valid HTML name string.
+ */
+ public String getName(String name) {
+ StringBuilder sb = new StringBuilder();
+ char ch;
+ /* The HTML 4 spec at http://www.w3.org/TR/html4/types.html#h-6.2 mentions
+ * that the name/id should begin with a letter followed by other valid characters.
+ * The HTML 5 spec (draft) is more permissive on names/ids where the only restriction
+ * is that it should be at least one character long and should not contain spaces.
+ * The spec draft is @ http://www.w3.org/html/wg/drafts/html/master/dom.html#the-id-attribute.
+ *
+ * For HTML 4, we need to check for non-characters at the beginning of the name and
+ * substitute it accordingly, "_" and "$" can appear at the beginning of a member name.
+ * The method substitutes "$" with "Z:Z:D" and will prefix "_" with "Z:Z".
+ */
+ for (int i = 0; i < name.length(); i++) {
+ ch = name.charAt(i);
+ switch (ch) {
+ case '(':
+ case ')':
+ case '<':
+ case '>':
+ case ',':
+ sb.append('-');
+ break;
+ case ' ':
+ case '[':
+ break;
+ case ']':
+ sb.append(":A");
+ break;
+ // Any appearance of $ needs to be substituted with ":D" and not with hyphen
+ // since a field name "P$$ and a method P(), both valid member names, can end
+ // up as "P--". A member name beginning with $ needs to be substituted with
+ // "Z:Z:D".
+ case '$':
+ if (i == 0)
+ sb.append("Z:Z");
+ sb.append(":D");
+ break;
+ // A member name beginning with _ needs to be prefixed with "Z:Z" since valid anchor
+ // names can only begin with a letter.
+ case '_':
+ if (i == 0)
+ sb.append("Z:Z");
+ sb.append(ch);
+ break;
+ default:
+ sb.append(ch);
+ }
+ }
+ return sb.toString();
}
/**
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/DocletConstants.java Fri Oct 11 03:09:42 2013 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/DocletConstants.java Fri Oct 11 23:31:06 2013 -0700
@@ -58,9 +58,4 @@
* The default package file name.
*/
public static final String DEFAULT_PACKAGE_FILE_NAME = "default";
-
- /**
- * The anchor for the default package.
- */
- public static final String UNNAMED_PACKAGE_ANCHOR = "unnamed_package";
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/share/classes/com/sun/tools/javac/code/AnnoConstruct.java Fri Oct 11 23:31:06 2013 -0700
@@ -0,0 +1,238 @@
+/*
+ * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.sun.tools.javac.code;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+
+import javax.lang.model.AnnotatedConstruct;
+
+import com.sun.tools.javac.model.AnnotationProxyMaker;
+import com.sun.tools.javac.util.List;
+import com.sun.tools.javac.util.ListBuffer;
+
+/**
+ * Common super type for annotated constructs such as Types and Symbols.
+ *
+ * This class should *not* contain any fields since it would have a significant
+ * impact on the javac memory footprint.
+ *
+ * <p><b>This is NOT part of any supported API.
+ * If you write code that depends on this, you do so at your own
+ * risk. This code and its internal interfaces are subject to change
+ * or deletion without notice.</b></p>
+ */
+public abstract class AnnoConstruct implements AnnotatedConstruct {
+
+
+ // Override to enforce a narrower return type.
+ @Override
+ public abstract List<? extends Attribute.Compound> getAnnotationMirrors();
+
+
+ // This method is part of the javax.lang.model API, do not use this in javac code.
+ protected <A extends Annotation> Attribute.Compound getAttribute(Class<A> annoType) {
+ String name = annoType.getName();
+
+ for (Attribute.Compound anno : getAnnotationMirrors()) {
+ if (name.equals(anno.type.tsym.flatName().toString()))
+ return anno;
+ }
+
+ return null;
+ }
+
+
+ @SuppressWarnings("unchecked")
+ protected <A extends Annotation> A[] getInheritedAnnotations(Class<A> annoType) {
+ return (A[]) java.lang.reflect.Array.newInstance(annoType, 0); // annoType is the Class for A
+ }
+
+
+ // This method is part of the javax.lang.model API, do not use this in javac code.
+ public <A extends Annotation> A[] getAnnotationsByType(Class<A> annoType) {
+
+ if (!annoType.isAnnotation())
+ throw new IllegalArgumentException("Not an annotation type: "
+ + annoType);
+ // If annoType does not declare a container this is equivalent to wrapping
+ // getAnnotation(...) in an array.
+ Class <? extends Annotation> containerType = getContainer(annoType);
+ if (containerType == null) {
+ A res = getAnnotation(annoType);
+ int size = res == null ? 0 : 1;
+
+ @SuppressWarnings("unchecked") // annoType is the Class for A
+ A[] arr = (A[])java.lang.reflect.Array.newInstance(annoType, size);
+ if (res != null)
+ arr[0] = res;
+ return arr;
+ }
+
+ // So we have a containing type
+ String annoTypeName = annoType.getName();
+ String containerTypeName = containerType.getName();
+ int directIndex = -1, containerIndex = -1;
+ Attribute.Compound direct = null, container = null;
+ // Find directly (explicit or implicit) present annotations
+ int index = -1;
+ for (Attribute.Compound attribute : getAnnotationMirrors()) {
+ index++;
+ if (attribute.type.tsym.flatName().contentEquals(annoTypeName)) {
+ directIndex = index;
+ direct = attribute;
+ } else if(containerTypeName != null &&
+ attribute.type.tsym.flatName().contentEquals(containerTypeName)) {
+ containerIndex = index;
+ container = attribute;
+ }
+ }
+
+ // Deal with inherited annotations
+ if (direct == null && container == null)
+ return getInheritedAnnotations(annoType);
+
+ // Pack them in an array
+ Attribute[] contained0 = null;
+ if (container != null)
+ contained0 = unpackAttributes(container);
+ ListBuffer<Attribute.Compound> compounds = new ListBuffer<>();
+ if (contained0 != null) {
+ for (Attribute a : contained0)
+ if (a instanceof Attribute.Compound)
+ compounds = compounds.append((Attribute.Compound)a);
+ }
+ Attribute.Compound[] contained = compounds.toArray(new Attribute.Compound[compounds.size()]);
+
+ int size = (direct == null ? 0 : 1) + contained.length;
+ @SuppressWarnings("unchecked") // annoType is the Class for A
+ A[] arr = (A[])java.lang.reflect.Array.newInstance(annoType, size);
+
+ // if direct && container, which is first?
+ int insert = -1;
+ int length = arr.length;
+ if (directIndex >= 0 && containerIndex >= 0) {
+ if (directIndex < containerIndex) {
+ arr[0] = AnnotationProxyMaker.generateAnnotation(direct, annoType);
+ insert = 1;
+ } else {
+ arr[arr.length - 1] = AnnotationProxyMaker.generateAnnotation(direct, annoType);
+ insert = 0;
+ length--;
+ }
+ } else if (directIndex >= 0) {
+ arr[0] = AnnotationProxyMaker.generateAnnotation(direct, annoType);
+ return arr;
+ } else {
+ // Only container
+ insert = 0;
+ }
+
+ for (int i = 0; i + insert < length; i++)
+ arr[insert + i] = AnnotationProxyMaker.generateAnnotation(contained[i], annoType);
+
+ return arr;
+ }
+
+
+ // This method is part of the javax.lang.model API, do not use this in javac code.
+ public <A extends Annotation> A getAnnotation(Class<A> annoType) {
+
+ if (!annoType.isAnnotation())
+ throw new IllegalArgumentException("Not an annotation type: " + annoType);
+
+ Attribute.Compound c = getAttribute(annoType);
+ return c == null ? null : AnnotationProxyMaker.generateAnnotation(c, annoType);
+ }
+
+ // Needed to unpack the runtime view of containing annotations
+ private static final Class<? extends Annotation> REPEATABLE_CLASS = initRepeatable();
+ private static final Method VALUE_ELEMENT_METHOD = initValueElementMethod();
+
+ private static Class<? extends Annotation> initRepeatable() {
+ try {
+ // Repeatable will not be available when bootstrapping on
+ // JDK 7 so use a reflective lookup instead of a class
+ // literal for Repeatable.class.
+ return Class.forName("java.lang.annotation.Repeatable").asSubclass(Annotation.class);
+ } catch (ClassNotFoundException | SecurityException e) {
+ return null;
+ }
+ }
+
+ private static Method initValueElementMethod() {
+ if (REPEATABLE_CLASS == null)
+ return null;
+
+ Method m = null;
+ try {
+ m = REPEATABLE_CLASS.getMethod("value");
+ if (m != null)
+ m.setAccessible(true);
+ return m;
+ } catch (NoSuchMethodException e) {
+ return null;
+ }
+ }
+
+
+ // Helper to getAnnotationsByType
+ private static Class<? extends Annotation> getContainer(Class<? extends Annotation> annoType) {
+ // Since we can not refer to java.lang.annotation.Repeatable until we are
+ // bootstrapping with java 8 we need to get the Repeatable annotation using
+ // reflective invocations instead of just using its type and element method.
+ if (REPEATABLE_CLASS != null &&
+ VALUE_ELEMENT_METHOD != null) {
+ // Get the Repeatable instance on the annotations declaration
+ Annotation repeatable = (Annotation)annoType.getAnnotation(REPEATABLE_CLASS);
+ if (repeatable != null) {
+ try {
+ // Get the value element, it should be a class
+ // indicating the containing annotation type
+ @SuppressWarnings("unchecked")
+ Class<? extends Annotation> containerType = (Class)VALUE_ELEMENT_METHOD.invoke(repeatable);
+ if (containerType == null)
+ return null;
+
+ return containerType;
+ } catch (ClassCastException | IllegalAccessException | InvocationTargetException e) {
+ return null;
+ }
+ }
+ }
+ return null;
+ }
+
+
+ // Helper to getAnnotationsByType
+ private static Attribute[] unpackAttributes(Attribute.Compound container) {
+ // We now have an instance of the container,
+ // unpack it returning an instance of the
+ // contained type or null
+ return ((Attribute.Array)container.member(container.type.tsym.name.table.names.value)).values;
+ }
+
+}
--- a/langtools/src/share/classes/com/sun/tools/javac/code/Attribute.java Fri Oct 11 03:09:42 2013 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/code/Attribute.java Fri Oct 11 23:31:06 2013 -0700
@@ -64,6 +64,8 @@
return false;
}
+ public TypeAnnotationPosition getPosition() { return null; };
+
/** The value for an annotation element of primitive type or String. */
public static class Constant extends Attribute {
public final Object value;
@@ -191,8 +193,13 @@
}
public Attribute member(Name member) {
+ Pair<MethodSymbol,Attribute> res = getElemPair(member);
+ return res == null ? null : res.snd;
+ }
+
+ private Pair<MethodSymbol, Attribute> getElemPair(Name member) {
for (Pair<MethodSymbol,Attribute> pair : values)
- if (pair.fst.name == member) return pair.snd;
+ if (pair.fst.name == member) return pair;
return null;
}
@@ -208,6 +215,16 @@
return (DeclaredType) type;
}
+ @Override
+ public TypeAnnotationPosition getPosition() {
+ if (values.size() != 0) {
+ Name valueName = values.head.fst.name.table.names.value;
+ Pair<MethodSymbol, Attribute> res = getElemPair(valueName);
+ return res == null ? null : res.snd.getPosition();
+ }
+ return null;
+ }
+
public Map<MethodSymbol, Attribute> getElementValues() {
Map<MethodSymbol, Attribute> valmap =
new LinkedHashMap<MethodSymbol, Attribute>();
@@ -230,6 +247,14 @@
this.position = position;
}
+ @Override
+ public TypeAnnotationPosition getPosition() {
+ if (hasUnknownPosition()) {
+ position = super.getPosition();
+ }
+ return position;
+ }
+
public boolean hasUnknownPosition() {
return position == null || position.type == TargetType.UNKNOWN;
}
@@ -302,6 +327,14 @@
public <R, P> R accept(AnnotationValueVisitor<R, P> v, P p) {
return v.visitArray(getValue(), p);
}
+
+ @Override
+ public TypeAnnotationPosition getPosition() {
+ if (values.length != 0)
+ return values[0].getPosition();
+ else
+ return null;
+ }
}
/** The value for an annotation element of an enum type.
--- a/langtools/src/share/classes/com/sun/tools/javac/code/Symbol.java Fri Oct 11 03:09:42 2013 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/code/Symbol.java Fri Oct 11 23:31:06 2013 -0700
@@ -25,6 +25,8 @@
package com.sun.tools.javac.code;
+import java.lang.annotation.Annotation;
+import java.lang.annotation.Inherited;
import java.util.Set;
import java.util.concurrent.Callable;
@@ -37,8 +39,6 @@
import com.sun.tools.javac.comp.AttrContext;
import com.sun.tools.javac.comp.Env;
import com.sun.tools.javac.jvm.*;
-import com.sun.tools.javac.model.*;
-import com.sun.tools.javac.tree.JCTree;
import com.sun.tools.javac.util.*;
import com.sun.tools.javac.util.Name;
import static com.sun.tools.javac.code.Flags.*;
@@ -58,8 +58,7 @@
* This code and its internal interfaces are subject to change or
* deletion without notice.</b>
*/
-public abstract class Symbol implements Element {
- // public Throwable debug = new Throwable();
+public abstract class Symbol extends AnnoConstruct implements Element {
/** The kind of this symbol.
* @see Kinds
@@ -103,6 +102,7 @@
*/
protected SymbolMetadata annotations;
+
/** An accessor method for the attributes of this symbol.
* Attributes of class symbols should be accessed through the accessor
* method to make sure that the class symbol is loaded.
@@ -596,18 +596,6 @@
return getRawAttributes();
}
- /**
- * @deprecated this method should never be used by javac internally.
- */
- @Deprecated
- public <A extends java.lang.annotation.Annotation> A getAnnotation(Class<A> annoType) {
- return JavacAnnoConstructs.getAnnotation(this, annoType);
- }
-
- // This method is part of the javax.lang.model API, do not use this in javac code.
- public <A extends java.lang.annotation.Annotation> A[] getAnnotationsByType(Class<A> annoType) {
- return JavacAnnoConstructs.getAnnotationsByType(this, annoType);
- }
// TODO: getEnclosedElements should return a javac List, fix in FilteredMemberList
public java.util.List<Symbol> getEnclosedElements() {
@@ -793,6 +781,28 @@
return res = res.reverse();
}
+
+
+ // Helper to getAnnotation[s]
+ @Override
+ public <A extends Annotation> Attribute.Compound getAttribute(Class<A> annoType) {
+
+ String name = annoType.getName();
+
+ // Declaration annotations on type variables are stored in type attributes
+ // on the owner of the TypeVariableSymbol
+ List<Attribute.TypeCompound> candidates = owner.getRawTypeAttributes();
+ for (Attribute.TypeCompound anno : candidates)
+ if (anno.position.type == TargetType.CLASS_TYPE_PARAMETER ||
+ anno.position.type == TargetType.METHOD_TYPE_PARAMETER)
+ if (name.contentEquals(anno.type.tsym.flatName()))
+ return anno;
+
+ return null;
+ }
+
+
+
@Override
public <R, P> R accept(ElementVisitor<R, P> v, P p) {
return v.visitTypeParameter(this, p);
@@ -1049,6 +1059,31 @@
}
}
+ /**
+ * Returns the next class to search for inherited annotations or {@code null}
+ * if the next class can't be found.
+ */
+ private ClassSymbol getSuperClassToSearchForAnnotations() {
+
+ Type sup = getSuperclass();
+
+ if (!sup.hasTag(CLASS) || sup.isErroneous())
+ return null;
+
+ return (ClassSymbol) sup.tsym;
+ }
+
+
+ @Override
+ protected <A extends Annotation> A[] getInheritedAnnotations(Class<A> annoType) {
+
+ ClassSymbol sup = getSuperClassToSearchForAnnotations();
+
+ return sup == null ? super.getInheritedAnnotations(annoType)
+ : sup.getAnnotationsByType(annoType);
+ }
+
+
public ElementKind getKind() {
long flags = flags();
if ((flags & ANNOTATION) != 0)
@@ -1079,15 +1114,25 @@
return NestingKind.MEMBER;
}
- /**
- * Since this method works in terms of the runtime representation
- * of annotations, it should never be used by javac internally.
- */
+
@Override
- public <A extends java.lang.annotation.Annotation> A getAnnotation(Class<A> annoType) {
- return JavacAnnoConstructs.getAnnotation(this, annoType);
+ protected <A extends Annotation> Attribute.Compound getAttribute(final Class<A> annoType) {
+
+ Attribute.Compound attrib = super.getAttribute(annoType);
+
+ boolean inherited = annoType.isAnnotationPresent(Inherited.class);
+ if (attrib != null || !inherited)
+ return attrib;
+
+ // Search supertypes
+ ClassSymbol superType = getSuperClassToSearchForAnnotations();
+ return superType == null ? null
+ : superType.getAttribute(annoType);
}
+
+
+
public <R, P> R accept(ElementVisitor<R, P> v, P p) {
return v.visitType(this, p);
}
--- a/langtools/src/share/classes/com/sun/tools/javac/code/Type.java Fri Oct 11 03:09:42 2013 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/code/Type.java Fri Oct 11 23:31:06 2013 -0700
@@ -35,7 +35,6 @@
import javax.lang.model.type.*;
import com.sun.tools.javac.code.Symbol.*;
-import com.sun.tools.javac.model.JavacAnnoConstructs;
import com.sun.tools.javac.util.*;
import static com.sun.tools.javac.code.BoundKind.*;
import static com.sun.tools.javac.code.Flags.*;
@@ -70,7 +69,7 @@
*
* @see TypeTag
*/
-public abstract class Type implements TypeMirror {
+public abstract class Type extends AnnoConstruct implements TypeMirror {
/** Constant type: no type at all. */
public static final JCNoType noType = new JCNoType();
@@ -166,6 +165,12 @@
return lb.toList();
}
+ /**For ErrorType, returns the original type, otherwise returns the type itself.
+ */
+ public Type getOriginalType() {
+ return this;
+ }
+
public <R,S> R accept(Type.Visitor<R,S> v, S s) { return v.visitType(this, s); }
/** Define a type given its tag and type symbol
@@ -233,15 +238,17 @@
}
@Override
- public List<? extends Attribute.TypeCompound> getAnnotationMirrors() {
+ public List<Attribute.TypeCompound> getAnnotationMirrors() {
return List.nil();
}
+
@Override
public <A extends Annotation> A getAnnotation(Class<A> annotationType) {
return null;
}
+
@Override
public <A extends Annotation> A[] getAnnotationsByType(Class<A> annotationType) {
@SuppressWarnings("unchecked")
@@ -1846,19 +1853,10 @@
}
@Override
- public List<? extends Attribute.TypeCompound> getAnnotationMirrors() {
+ public List<Attribute.TypeCompound> getAnnotationMirrors() {
return typeAnnotations;
}
- @Override
- public <A extends Annotation> A getAnnotation(Class<A> annotationType) {
- return JavacAnnoConstructs.getAnnotation(this, annotationType);
- }
-
- @Override
- public <A extends Annotation> A[] getAnnotationsByType(Class<A> annotationType) {
- return JavacAnnoConstructs.getAnnotationsByType(this, annotationType);
- }
@Override
public TypeKind getKind() {
--- a/langtools/src/share/classes/com/sun/tools/javac/code/TypeAnnotations.java Fri Oct 11 03:09:42 2013 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/code/TypeAnnotations.java Fri Oct 11 23:31:06 2013 -0700
@@ -71,6 +71,7 @@
import com.sun.tools.javac.util.ListBuffer;
import com.sun.tools.javac.util.Log;
import com.sun.tools.javac.util.Names;
+import com.sun.tools.javac.util.Options;
/**
* Contains operations specific to processing type annotations.
@@ -94,6 +95,7 @@
final Names names;
final Symtab syms;
final Annotate annotate;
+ private final boolean typeAnnoAsserts;
protected TypeAnnotations(Context context) {
context.put(typeAnnosKey, this);
@@ -101,6 +103,8 @@
log = Log.instance(context);
syms = Symtab.instance(context);
annotate = Annotate.instance(context);
+ Options options = Options.instance(context);
+ typeAnnoAsserts = options.isSet("TypeAnnotationAsserts");
}
/**
@@ -265,10 +269,6 @@
*/
private void separateAnnotationsKinds(JCTree typetree, Type type, Symbol sym,
TypeAnnotationPosition pos) {
- /*
- System.out.printf("separateAnnotationsKinds(typetree: %s, type: %s, symbol: %s, pos: %s%n",
- typetree, type, sym, pos);
- */
List<Attribute.Compound> annotations = sym.getRawAttributes();
ListBuffer<Attribute.Compound> declAnnos = new ListBuffer<Attribute.Compound>();
ListBuffer<Attribute.TypeCompound> typeAnnos = new ListBuffer<Attribute.TypeCompound>();
@@ -1023,10 +1023,12 @@
@Override
public void visitMethodDef(final JCMethodDecl tree) {
if (tree.sym == null) {
- // Something most be wrong, e.g. a class not found.
- // Quietly ignore. (See test FailOver15.java)
+ if (typeAnnoAsserts) {
+ Assert.error("Visiting tree node before memberEnter");
+ } else {
return;
}
+ }
if (sigOnly) {
if (!tree.mods.annotations.isEmpty()) {
// Nothing to do for separateAnnotationsKinds if
@@ -1129,6 +1131,9 @@
// Nothing to do for separateAnnotationsKinds if
// there are no annotations of either kind.
} else if (tree.sym == null) {
+ if (typeAnnoAsserts) {
+ Assert.error("Visiting tree node before memberEnter");
+ }
// Something is wrong already. Quietly ignore.
} else if (tree.sym.getKind() == ElementKind.PARAMETER) {
// Parameters are handled in visitMethodDef or visitLambda.
@@ -1282,9 +1287,9 @@
private void findPosition(JCTree tree, JCTree frame, List<JCAnnotation> annotations) {
if (!annotations.isEmpty()) {
/*
- System.out.println("Finding pos for: " + annotations);
- System.out.println(" tree: " + tree + " kind: " + tree.getKind());
- System.out.println(" frame: " + frame + " kind: " + frame.getKind());
+ System.err.println("Finding pos for: " + annotations);
+ System.err.println(" tree: " + tree + " kind: " + tree.getKind());
+ System.err.println(" frame: " + frame + " kind: " + frame.getKind());
*/
TypeAnnotationPosition p = new TypeAnnotationPosition();
p.onLambda = currentLambda;
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Annotate.java Fri Oct 11 03:09:42 2013 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Annotate.java Fri Oct 11 23:31:06 2013 -0700
@@ -37,6 +37,7 @@
import static com.sun.tools.javac.code.TypeTag.ARRAY;
import static com.sun.tools.javac.code.TypeTag.CLASS;
import static com.sun.tools.javac.tree.JCTree.Tag.*;
+import javax.lang.model.type.ErrorType;
/** Enter annotations on symbols. Annotations accumulate in a queue,
* which is processed at the top level of any set of recursive calls
@@ -310,7 +311,6 @@
Attribute enterAttributeValue(Type expected,
JCExpression tree,
Env<AttrContext> env) {
- Type original = expected;
//first, try completing the attribution value sym - if a completion
//error is thrown, we should recover gracefully, and display an
//ordinary resolution diagnostic.
@@ -351,7 +351,7 @@
l.head,
env);
}
- return new Attribute.Error(original);
+ return new Attribute.Error(syms.errType);
}
if ((expected.tsym.flags() & Flags.ANNOTATION) != 0) {
if (tree.hasTag(ANNOTATION)) {
@@ -365,12 +365,12 @@
if (!expected.isErroneous())
log.error(tree.pos(), "annotation.not.valid.for.type", expected);
enterAnnotation((JCAnnotation)tree, syms.errType, env);
- return new Attribute.Error(original);
+ return new Attribute.Error(((JCAnnotation)tree).annotationType.type);
}
if (expected.isPrimitive() || types.isSameType(expected, syms.stringType)) {
Type result = attr.attribExpr(tree, env, expected);
if (result.isErroneous())
- return new Attribute.Error(expected);
+ return new Attribute.Error(result.getOriginalType());
if (result.constValue() == null) {
log.error(tree.pos(), "attribute.value.must.be.constant");
return new Attribute.Error(expected);
@@ -381,14 +381,15 @@
if (expected.tsym == syms.classType.tsym) {
Type result = attr.attribExpr(tree, env, expected);
if (result.isErroneous()) {
- // Does it look like a class literal?
- if (TreeInfo.name(tree) == names._class) {
+ // Does it look like an unresolved class literal?
+ if (TreeInfo.name(tree) == names._class &&
+ ((JCFieldAccess) tree).selected.type.isErroneous()) {
Name n = (((JCFieldAccess) tree).selected).type.tsym.flatName();
return new Attribute.UnresolvedClass(expected,
types.createErrorType(n,
syms.unknownSymbol, syms.classType));
} else {
- return new Attribute.Error(expected);
+ return new Attribute.Error(result.getOriginalType());
}
}
@@ -396,21 +397,21 @@
// at the tree level
if (TreeInfo.name(tree) != names._class) {
log.error(tree.pos(), "annotation.value.must.be.class.literal");
- return new Attribute.Error(expected);
+ return new Attribute.Error(syms.errType);
}
return new Attribute.Class(types,
(((JCFieldAccess) tree).selected).type);
}
if (expected.hasTag(CLASS) &&
(expected.tsym.flags() & Flags.ENUM) != 0) {
- attr.attribExpr(tree, env, expected);
+ Type result = attr.attribExpr(tree, env, expected);
Symbol sym = TreeInfo.symbol(tree);
if (sym == null ||
TreeInfo.nonstaticSelect(tree) ||
sym.kind != Kinds.VAR ||
(sym.flags() & Flags.ENUM) == 0) {
log.error(tree.pos(), "enum.annotation.must.be.enum.constant");
- return new Attribute.Error(expected);
+ return new Attribute.Error(result.getOriginalType());
}
VarSymbol enumerator = (VarSymbol) sym;
return new Attribute.Enum(expected, enumerator);
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Attr.java Fri Oct 11 03:09:42 2013 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Attr.java Fri Oct 11 23:31:06 2013 -0700
@@ -792,17 +792,19 @@
Type t = tree.type != null ?
tree.type :
attribType(tree, env);
- return checkBase(t, tree, env, classExpected, interfaceExpected, checkExtensible);
+ return checkBase(t, tree, env, classExpected, interfaceExpected, false, checkExtensible);
}
Type checkBase(Type t,
JCTree tree,
Env<AttrContext> env,
boolean classExpected,
- boolean interfaceOrArrayExpected,
+ boolean interfacesOnlyExpected,
+ boolean interfacesOrArraysExpected,
boolean checkExtensible) {
if (t.isErroneous())
return t;
- if (t.hasTag(TYPEVAR) && !classExpected && !interfaceOrArrayExpected) {
+ if (t.hasTag(TYPEVAR) && !classExpected &&
+ !interfacesOrArraysExpected && !interfacesOnlyExpected) {
// check that type variable is already visible
if (t.getUpperBound() == null) {
log.error(tree.pos(), "illegal.forward.ref");
@@ -814,9 +816,14 @@
t = chk.checkClassOrArrayType(tree.pos(), t,
checkExtensible|!allowGenerics);
}
- if (interfaceOrArrayExpected &&
+ if (interfacesOnlyExpected && !t.tsym.isInterface()) {
+ log.error(tree.pos(), "intf.expected.here");
+ // return errType is necessary since otherwise there might
+ // be undetected cycles which cause attribution to loop
+ return types.createErrorType(t);
+ } else if (interfacesOrArraysExpected &&
!(t.tsym.isInterface() || t.getTag() == ARRAY)) {
- log.error(tree.pos(), "intf.expected.here");
+ log.error(tree.pos(), "intf.or.array.expected.here");
// return errType is necessary since otherwise there might
// be undetected cycles which cause attribution to loop
return types.createErrorType(t);
@@ -3988,7 +3995,7 @@
Set<Type> boundSet = new HashSet<Type>();
if (bounds.nonEmpty()) {
// accept class or interface or typevar as first bound.
- bounds.head.type = checkBase(bounds.head.type, bounds.head, env, false, false, false);
+ bounds.head.type = checkBase(bounds.head.type, bounds.head, env, false, false, false, false);
boundSet.add(types.erasure(bounds.head.type));
if (bounds.head.type.isErroneous()) {
return bounds.head.type;
@@ -4004,7 +4011,7 @@
// if first bound was a class or interface, accept only interfaces
// as further bounds.
for (JCExpression bound : bounds.tail) {
- bound.type = checkBase(bound.type, bound, env, false, true, false);
+ bound.type = checkBase(bound.type, bound, env, false, false, true, false);
if (bound.type.isErroneous()) {
bounds = List.of(bound);
}
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Check.java Fri Oct 11 03:09:42 2013 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Check.java Fri Oct 11 23:31:06 2013 -0700
@@ -3420,15 +3420,14 @@
sym.name != names.error &&
(!staticImport || !e.isStaticallyImported())) {
if (!e.sym.type.isErroneous()) {
- String what = e.sym.toString();
if (!isClassDecl) {
if (staticImport)
- log.error(pos, "already.defined.static.single.import", what);
+ log.error(pos, "already.defined.static.single.import", e.sym);
else
- log.error(pos, "already.defined.single.import", what);
+ log.error(pos, "already.defined.single.import", e.sym);
}
else if (sym != e.sym)
- log.error(pos, "already.defined.this.unit", what);
+ log.error(pos, "already.defined.this.unit", e.sym);
}
return false;
}
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java Fri Oct 11 03:09:42 2013 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java Fri Oct 11 23:31:06 2013 -0700
@@ -128,10 +128,9 @@
private KlassInfo(Symbol kSym) {
appendedMethodList = new ListBuffer<>();
deserializeCases = new HashMap<String, ListBuffer<JCStatement>>();
- long flags = PRIVATE | STATIC | SYNTHETIC;
MethodType type = new MethodType(List.of(syms.serializedLambdaType), syms.objectType,
List.<Type>nil(), syms.methodClass);
- deserMethodSym = makeSyntheticMethod(flags, names.deserializeLambda, type, kSym);
+ deserMethodSym = makePrivateSyntheticMethod(STATIC, names.deserializeLambda, type, kSym);
deserParamSym = new VarSymbol(FINAL, names.fromString("lambda"),
syms.serializedLambdaType, deserMethodSym);
}
@@ -671,8 +670,8 @@
/**
* Create new synthetic method with given flags, name, type, owner
*/
- private MethodSymbol makeSyntheticMethod(long flags, Name name, Type type, Symbol owner) {
- return new MethodSymbol(flags | SYNTHETIC, name, type, owner);
+ private MethodSymbol makePrivateSyntheticMethod(long flags, Name name, Type type, Symbol owner) {
+ return new MethodSymbol(flags | SYNTHETIC | PRIVATE, name, type, owner);
}
/**
@@ -1067,12 +1066,12 @@
} else {
if (refSym.isStatic()) {
return ClassFile.REF_invokeStatic;
+ } else if ((refSym.flags() & PRIVATE) != 0) {
+ return ClassFile.REF_invokeSpecial;
} else if (refSym.enclClass().isInterface()) {
return ClassFile.REF_invokeInterface;
} else {
- return (refSym.flags() & PRIVATE) != 0 ?
- ClassFile.REF_invokeSpecial :
- ClassFile.REF_invokeVirtual;
+ return ClassFile.REF_invokeVirtual;
}
}
}
@@ -1480,7 +1479,7 @@
//static clinits are generated in Gen - so we need to fake them
Symbol clinit = clinits.get(csym);
if (clinit == null) {
- clinit = makeSyntheticMethod(STATIC,
+ clinit = makePrivateSyntheticMethod(STATIC,
names.clinit,
new MethodType(List.<Type>nil(), syms.voidType, List.<Type>nil(), syms.methodClass),
csym);
@@ -1729,7 +1728,7 @@
self = ((JCVariableDecl)frame.tree).sym;
}
Name name = isSerializable() ? serializedLambdaName(owner) : lambdaName();
- this.translatedSym = makeSyntheticMethod(0, name, null, owner.enclClass());
+ this.translatedSym = makePrivateSyntheticMethod(0, name, null, owner.enclClass());
if (dumpLambdaToMethodStats) {
log.note(tree, "lambda.stat", needsAltMetafactory(), translatedSym);
}
@@ -1845,9 +1844,9 @@
// If instance access isn't needed, make it static.
// Interface instance methods must be default methods.
- // Awaiting VM channges, default methods are public
+ // Lambda methods are private synthetic.
translatedSym.flags_field = SYNTHETIC |
- ((inInterface && thisReferenced)? PUBLIC : PRIVATE) |
+ PRIVATE |
(thisReferenced? (inInterface? DEFAULT : 0) : STATIC);
//compute synthetic params
@@ -1890,7 +1889,7 @@
super(tree);
this.isSuper = tree.hasKind(ReferenceKind.SUPER);
this.bridgeSym = needsBridge()
- ? makeSyntheticMethod(isSuper ? 0 : STATIC,
+ ? makePrivateSyntheticMethod(isSuper ? 0 : STATIC,
lambdaName().append(names.fromString("$bridge")), null,
owner.enclClass())
: null;
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Lower.java Fri Oct 11 03:09:42 2013 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Lower.java Fri Oct 11 23:31:06 2013 -0700
@@ -2172,6 +2172,18 @@
* Code for enabling/disabling assertions.
*************************************************************************/
+ private ClassSymbol assertionsDisabledClassCache;
+
+ /**Used to create an auxiliary class to hold $assertionsDisabled for interfaces.
+ */
+ private ClassSymbol assertionsDisabledClass() {
+ if (assertionsDisabledClassCache != null) return assertionsDisabledClassCache;
+
+ assertionsDisabledClassCache = makeEmptyClass(STATIC | SYNTHETIC, outermostClassDef.sym).sym;
+
+ return assertionsDisabledClassCache;
+ }
+
// This code is not particularly robust if the user has
// previously declared a member named '$assertionsDisabled'.
// The same faulty idiom also appears in the translation of
@@ -2182,8 +2194,9 @@
// Outermost class may be either true class or an interface.
ClassSymbol outermostClass = outermostClassDef.sym;
- // note that this is a class, as an interface can't contain a statement.
- ClassSymbol container = currentClass;
+ //only classes can hold a non-public field, look for a usable one:
+ ClassSymbol container = !currentClass.isInterface() ? currentClass :
+ assertionsDisabledClass();
VarSymbol assertDisabledSym =
(VarSymbol)lookupSynthetic(dollarAssertionsDisabled,
@@ -2208,6 +2221,16 @@
JCVariableDecl assertDisabledDef = make.VarDef(assertDisabledSym,
notStatus);
containerDef.defs = containerDef.defs.prepend(assertDisabledDef);
+
+ if (currentClass.isInterface()) {
+ //need to load the assertions enabled/disabled state while
+ //initializing the interface:
+ JCClassDecl currentClassDef = classDef(currentClass);
+ make_at(currentClassDef.pos());
+ JCStatement dummy = make.If(make.QualIdent(assertDisabledSym), make.Skip(), null);
+ JCBlock clinit = make.Block(STATIC, List.<JCStatement>of(dummy));
+ currentClassDef.defs = currentClassDef.defs.prepend(clinit);
+ }
}
make_at(pos);
return makeUnary(NOT, make.Ident(assertDisabledSym));
@@ -3929,6 +3952,7 @@
accessConstrTags = null;
accessed = null;
enumSwitchMap.clear();
+ assertionsDisabledClassCache = null;
}
return translated.toList();
}
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/MemberEnter.java Fri Oct 11 03:09:42 2013 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/MemberEnter.java Fri Oct 11 23:31:06 2013 -0700
@@ -114,12 +114,15 @@
deferredLintHandler = DeferredLintHandler.instance(context);
lint = Lint.instance(context);
allowTypeAnnos = source.allowTypeAnnotations();
+ allowRepeatedAnnos = source.allowRepeatedAnnotations();
}
/** Switch: support type annotations.
*/
boolean allowTypeAnnos;
+ boolean allowRepeatedAnnos;
+
/** A queue for classes whose members still need to be entered into the
* symbol table.
*/
@@ -640,9 +643,6 @@
if (TreeInfo.isEnumInit(tree)) {
attr.attribIdentAsEnumType(localEnv, (JCIdent)tree.vartype);
} else {
- // Make sure type annotations are processed.
- // But we don't have a symbol to attach them to yet - use null.
- typeAnnotate(tree.vartype, env, null, tree.pos());
attr.attribType(tree.vartype, localEnv);
if (tree.nameexpr != null) {
attr.attribExpr(tree.nameexpr, localEnv);
@@ -693,7 +693,6 @@
}
annotateLater(tree.mods.annotations, localEnv, v, tree.pos());
typeAnnotate(tree.vartype, env, v, tree.pos());
- annotate.flush();
v.pos = tree.pos;
}
// where
@@ -906,14 +905,14 @@
}
if (annotated.containsKey(a.type.tsym)) {
- if (source.allowRepeatedAnnotations()) {
- ListBuffer<Attribute.Compound> l = annotated.get(a.type.tsym);
- l = l.append(c);
- annotated.put(a.type.tsym, l);
- pos.put(c, a.pos());
- } else {
- log.error(a.pos(), "duplicate.annotation");
+ if (!allowRepeatedAnnos) {
+ log.error(a.pos(), "repeatable.annotations.not.supported.in.source");
+ allowRepeatedAnnos = true;
}
+ ListBuffer<Attribute.Compound> l = annotated.get(a.type.tsym);
+ l = l.append(c);
+ annotated.put(a.type.tsym, l);
+ pos.put(c, a.pos());
} else {
annotated.put(a.type.tsym, ListBuffer.of(c));
pos.put(c, a.pos());
@@ -1081,7 +1080,6 @@
// Do this here, where we have the symbol.
for (JCTypeParameter tp : tree.typarams)
typeAnnotate(tp, baseEnv, sym, tree.pos());
- annotate.flush();
// Add default constructor if needed.
if ((c.flags() & INTERFACE) == 0 &&
@@ -1197,7 +1195,7 @@
annotated.put(a.type.tsym, l);
pos.put(tc, a.pos());
} else {
- log.error(a.pos(), "duplicate.annotation");
+ log.error(a.pos(), "repeatable.annotations.not.supported.in.source");
}
} else {
annotated.put(a.type.tsym, ListBuffer.of(tc));
@@ -1381,7 +1379,7 @@
if (!t.hasTag(ERROR))
return t;
- return new ErrorType(((ErrorType) t).getOriginalType(), t.tsym) {
+ return new ErrorType(t.getOriginalType(), t.tsym) {
private Type modelType;
@Override
--- a/langtools/src/share/classes/com/sun/tools/javac/jvm/ClassReader.java Fri Oct 11 03:09:42 2013 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/jvm/ClassReader.java Fri Oct 11 23:31:06 2013 -0700
@@ -1993,11 +1993,15 @@
(flags & ABSTRACT) == 0 && !name.equals(names.clinit)) {
if (majorVersion > Target.JDK1_8.majorVersion ||
(majorVersion == Target.JDK1_8.majorVersion && minorVersion >= Target.JDK1_8.minorVersion)) {
- currentOwner.flags_field |= DEFAULT;
- flags |= DEFAULT | ABSTRACT;
+ if ((flags & STATIC) == 0) {
+ currentOwner.flags_field |= DEFAULT;
+ flags |= DEFAULT | ABSTRACT;
+ }
} else {
//protect against ill-formed classfiles
- throw new CompletionFailure(currentOwner, "default method found in pre JDK 8 classfile");
+ throw badClassFile((flags & STATIC) == 0 ? "invalid.default.interface" : "invalid.static.interface",
+ Integer.toString(majorVersion),
+ Integer.toString(minorVersion));
}
}
if (name == names.init && currentOwner.hasOuterInstance()) {
--- a/langtools/src/share/classes/com/sun/tools/javac/jvm/Gen.java Fri Oct 11 03:09:42 2013 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/jvm/Gen.java Fri Oct 11 23:31:06 2013 -0700
@@ -104,6 +104,8 @@
*/
private LVTRanges lvtRanges;
+ private final boolean typeAnnoAsserts;
+
protected Gen(Context context) {
context.put(genKey, this);
@@ -140,6 +142,7 @@
debugCode = options.isSet("debugcode");
allowInvokedynamic = target.hasInvokedynamic() || options.isSet("invokedynamic");
pool = new Pool(types);
+ typeAnnoAsserts = options.isSet("TypeAnnotationAsserts");
generateIproxies =
target.requiresIproxy() ||
@@ -562,9 +565,13 @@
ListBuffer<Attribute.TypeCompound> fieldTAs = new ListBuffer<Attribute.TypeCompound>();
ListBuffer<Attribute.TypeCompound> nonfieldTAs = new ListBuffer<Attribute.TypeCompound>();
for (TypeCompound ta : tas) {
- if (ta.position.type == TargetType.FIELD) {
+ if (ta.getPosition().type == TargetType.FIELD) {
fieldTAs.add(ta);
} else {
+ if (typeAnnoAsserts) {
+ Assert.error("Type annotation does not have a valid positior");
+ }
+
nonfieldTAs.add(ta);
}
}
--- a/langtools/src/share/classes/com/sun/tools/javac/jvm/Pool.java Fri Oct 11 03:09:42 2013 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/jvm/Pool.java Fri Oct 11 23:31:06 2013 -0700
@@ -296,7 +296,10 @@
interfaceOwner = true;
staticOk = true;
case ClassFile.REF_invokeVirtual:
+ expectedKind = Kinds.MTH;
+ break;
case ClassFile.REF_invokeSpecial:
+ interfaceOwner = true;
expectedKind = Kinds.MTH;
break;
}
--- a/langtools/src/share/classes/com/sun/tools/javac/model/JavacAnnoConstructs.java Fri Oct 11 03:09:42 2013 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,445 +0,0 @@
-/*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.sun.tools.javac.model;
-
-import java.lang.annotation.Annotation;
-import java.lang.annotation.Inherited;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-
-import com.sun.tools.javac.code.Attribute;
-import com.sun.tools.javac.code.Kinds;
-import com.sun.tools.javac.code.Symbol;
-import com.sun.tools.javac.code.Symbol.ClassSymbol;
-import com.sun.tools.javac.code.Symbol.TypeVariableSymbol;
-import com.sun.tools.javac.code.TargetType;
-import com.sun.tools.javac.code.Type;
-import com.sun.tools.javac.code.Type.AnnotatedType;
-import com.sun.tools.javac.util.ListBuffer;
-import static com.sun.tools.javac.code.TypeTag.CLASS;
-import com.sun.tools.javac.util.List;
-
-/**
- * Utility methods for operating on annotated constructs.
- *
- * <p><b>This is NOT part of any supported API.
- * If you write code that depends on this, you do so at your own
- * risk. This code and its internal interfaces are subject to change
- * or deletion without notice.</b></p>
- */
-public class JavacAnnoConstructs {
-
- // <editor-fold defaultstate="collapsed" desc="Symbols">
-
- /**
- * An internal-use utility that creates a runtime view of an
- * annotation. This is the implementation of
- * Element.getAnnotation(Class).
- */
- public static <A extends Annotation> A getAnnotation(Symbol annotated,
- Class<A> annoType) {
- if (!annoType.isAnnotation())
- throw new IllegalArgumentException("Not an annotation type: "
- + annoType);
- Attribute.Compound c;
- if (annotated.kind == Kinds.TYP &&
- annotated instanceof ClassSymbol) {
- c = getAttributeOnClass((ClassSymbol)annotated, annoType);
- } else if (annotated.kind == Kinds.TYP &&
- annotated instanceof TypeVariableSymbol) {
- c = getAttributeOnTypeVariable((TypeVariableSymbol)annotated, annoType);
- } else {
- c = getAttribute(annotated, annoType);
- }
- return c == null ? null : AnnotationProxyMaker.generateAnnotation(c, annoType);
- }
-
- // Helper to getAnnotation[s]
- private static <A extends Annotation> Attribute.Compound getAttribute(Symbol annotated,
- Class<A> annoType) {
- String name = annoType.getName();
-
- for (Attribute.Compound anno : annotated.getRawAttributes()) {
- if (name.equals(anno.type.tsym.flatName().toString()))
- return anno;
- }
-
- return null;
- }
-
- // Helper to getAnnotation[s]
- private static <A extends Annotation> Attribute.Compound
- getAttributeOnTypeVariable(TypeVariableSymbol annotated, Class<A> annoType) {
- String name = annoType.getName();
-
- // Declaration annotations on type variables are stored in type attributes
- // on the owner of the TypeVariableSymbol
- List<Attribute.Compound> res = List.nil();
- List<Attribute.TypeCompound> candidates = annotated.owner.getRawTypeAttributes();
- for (Attribute.TypeCompound anno : candidates)
- if (anno.position.type == TargetType.CLASS_TYPE_PARAMETER ||
- anno.position.type == TargetType.METHOD_TYPE_PARAMETER)
- if (name.equals(anno.type.tsym.flatName().toString()))
- return anno;
-
- return null;
- }
-
- // Helper to getAnnotation[s]
- private static <A extends Annotation> Attribute.Compound getAttributeOnClass(
- ClassSymbol annotated,
- final Class<A> annoType)
- {
- boolean inherited = annoType.isAnnotationPresent(Inherited.class);
- Attribute.Compound result = null;
-
- result = getAttribute(annotated, annoType);
- if (result != null || !inherited)
- return result;
-
- while ((annotated = nextSupertypeToSearch(annotated)) != null) {
- result = getAttribute(annotated, annoType);
- if (result != null)
- return result;
- }
- return null; // no more supertypes to search
- }
-
- /**
- * Returns the next type to search for inherited annotations or {@code null}
- * if the next type can't be found.
- */
- private static ClassSymbol nextSupertypeToSearch(ClassSymbol annotated) {
- if (annotated.name == annotated.name.table.names.java_lang_Object)
- return null;
-
- Type sup = annotated.getSuperclass();
- if (!sup.hasTag(CLASS) || sup.isErroneous())
- return null;
-
- return (ClassSymbol) sup.tsym;
- }
-
- /**
- * An internal-use utility that creates a runtime view of
- * annotations. This is the implementation of
- * Element.getAnnotations(Class).
- */
- public static <A extends Annotation> A[] getAnnotationsByType(Symbol annotated,
- Class<A> annoType)
- {
- if (!annoType.isAnnotation())
- throw new IllegalArgumentException("Not an annotation type: "
- + annoType);
- // If annoType does not declare a container this is equivalent to wrapping
- // getAnnotation(...) in an array.
- Class <? extends Annotation> containerType = getContainer(annoType);
- if (containerType == null) {
- A res = getAnnotation(annotated, annoType);
- int size;
- if (res == null) {
- size = 0;
- } else {
- size = 1;
- }
- @SuppressWarnings("unchecked") // annoType is the Class for A
- A[] arr = (A[])java.lang.reflect.Array.newInstance(annoType, size);
- if (res != null)
- arr[0] = res;
- return arr;
- }
-
- // So we have a containing type
- String annoTypeName = annoType.getName();
- String containerTypeName = containerType.getName();
- int directIndex = -1, containerIndex = -1;
- Attribute.Compound direct = null, container = null;
- // Find directly (explicit or implicit) present annotations
- int index = -1;
- for (List<Attribute.Compound> list = annotated.getAnnotationMirrors();
- !list.isEmpty();
- list = list.tail) {
- Attribute.Compound attribute = list.head;
- index++;
- if (attribute.type.tsym.flatName().contentEquals(annoTypeName)) {
- directIndex = index;
- direct = attribute;
- } else if(containerTypeName != null &&
- attribute.type.tsym.flatName().contentEquals(containerTypeName)) {
- containerIndex = index;
- container = attribute;
- }
- }
-
- // Deal with inherited annotations
- if (direct == null && container == null) {
- if (annotated.kind == Kinds.TYP &&
- (annotated instanceof ClassSymbol)) {
- ClassSymbol s = nextSupertypeToSearch((ClassSymbol)annotated);
- if (s != null)
- return getAnnotationsByType(s, annoType);
- }
- }
-
- // Pack them in an array
- Attribute[] contained0 = null;
- if (container != null)
- contained0 = unpackAttributes(container);
- ListBuffer<Attribute.Compound> compounds = new ListBuffer<>();
- if (contained0 != null) {
- for (Attribute a : contained0)
- if (a instanceof Attribute.Compound)
- compounds = compounds.append((Attribute.Compound)a);
- }
- Attribute.Compound[] contained = compounds.toArray(new Attribute.Compound[compounds.size()]);
-
- int size = (direct == null ? 0 : 1) + contained.length;
- @SuppressWarnings("unchecked") // annoType is the Class for A
- A[] arr = (A[])java.lang.reflect.Array.newInstance(annoType, size);
-
- // if direct && container, which is first?
- int insert = -1;
- int length = arr.length;
- if (directIndex >= 0 && containerIndex >= 0) {
- if (directIndex < containerIndex) {
- arr[0] = AnnotationProxyMaker.generateAnnotation(direct, annoType);
- insert = 1;
- } else {
- arr[arr.length - 1] = AnnotationProxyMaker.generateAnnotation(direct, annoType);
- insert = 0;
- length--;
- }
- } else if (directIndex >= 0) {
- arr[0] = AnnotationProxyMaker.generateAnnotation(direct, annoType);
- return arr;
- } else {
- // Only container
- insert = 0;
- }
-
- for (int i = 0; i + insert < length; i++)
- arr[insert + i] = AnnotationProxyMaker.generateAnnotation(contained[i], annoType);
-
- return arr;
- }
-
- // </editor-fold>
-
- // <editor-fold defaultstate="collapsed" desc="Types">
-
- /**
- * An internal-use utility that creates a runtime view of an
- * annotation. This is the implementation of
- * TypeMirror.getAnnotation(Class).
- */
- public static <A extends Annotation> A getAnnotation(AnnotatedType annotated, Class<A> annoType) {
- if (!annoType.isAnnotation())
- throw new IllegalArgumentException("Not an annotation type: "
- + annoType);
- Attribute.Compound c = getAttribute(annotated, annoType);
- return c == null ? null : AnnotationProxyMaker.generateAnnotation(c, annoType);
- }
-
- // Helper to getAnnotation[s]
- private static <A extends Annotation> Attribute.Compound getAttribute(Type annotated,
- Class<A> annoType) {
- String name = annoType.getName();
-
- for (Attribute.Compound anno : annotated.getAnnotationMirrors()) {
- if (name.equals(anno.type.tsym.flatName().toString()))
- return anno;
- }
-
- return null;
- }
-
- /**
- * An internal-use utility that creates a runtime view of
- * annotations. This is the implementation of
- * TypeMirror.getAnnotationsByType(Class).
- */
- public static <A extends Annotation> A[] getAnnotationsByType(AnnotatedType annotated, Class<A> annoType) {
- if (!annoType.isAnnotation())
- throw new IllegalArgumentException("Not an annotation type: "
- + annoType);
- // If annoType does not declare a container this is equivalent to wrapping
- // getAnnotation(...) in an array.
- Class <? extends Annotation> containerType = getContainer(annoType);
- if (containerType == null) {
- A res = getAnnotation(annotated, annoType);
- int size;
- if (res == null) {
- size = 0;
- } else {
- size = 1;
- }
- @SuppressWarnings("unchecked") // annoType is the Class for A
- A[] arr = (A[])java.lang.reflect.Array.newInstance(annoType, size);
- if (res != null)
- arr[0] = res;
- return arr;
- }
-
- // So we have a containing type
- String annoTypeName = annoType.getName();
- String containerTypeName = containerType.getName();
- int directIndex = -1, containerIndex = -1;
- Attribute.Compound direct = null, container = null;
- // Find directly (explicit or implicit) present annotations
- int index = -1;
- for (List<? extends Attribute.Compound> list = annotated.getAnnotationMirrors();
- !list.isEmpty();
- list = list.tail) {
- Attribute.Compound attribute = list.head;
- index++;
- if (attribute.type.tsym.flatName().contentEquals(annoTypeName)) {
- directIndex = index;
- direct = attribute;
- } else if(containerTypeName != null &&
- attribute.type.tsym.flatName().contentEquals(containerTypeName)) {
- containerIndex = index;
- container = attribute;
- }
- }
-
- // Pack them in an array
- Attribute[] contained0 = null;
- if (container != null)
- contained0 = unpackAttributes(container);
- ListBuffer<Attribute.Compound> compounds = new ListBuffer<>();
- if (contained0 != null) {
- for (Attribute a : contained0)
- if (a instanceof Attribute.Compound)
- compounds = compounds.append((Attribute.Compound)a);
- }
- Attribute.Compound[] contained = compounds.toArray(new Attribute.Compound[compounds.size()]);
-
- int size = (direct == null ? 0 : 1) + contained.length;
- @SuppressWarnings("unchecked") // annoType is the Class for A
- A[] arr = (A[])java.lang.reflect.Array.newInstance(annoType, size);
-
- // if direct && container, which is first?
- int insert = -1;
- int length = arr.length;
- if (directIndex >= 0 && containerIndex >= 0) {
- if (directIndex < containerIndex) {
- arr[0] = AnnotationProxyMaker.generateAnnotation(direct, annoType);
- insert = 1;
- } else {
- arr[arr.length - 1] = AnnotationProxyMaker.generateAnnotation(direct, annoType);
- insert = 0;
- length--;
- }
- } else if (directIndex >= 0) {
- arr[0] = AnnotationProxyMaker.generateAnnotation(direct, annoType);
- return arr;
- } else {
- // Only container
- insert = 0;
- }
-
- for (int i = 0; i + insert < length; i++)
- arr[insert + i] = AnnotationProxyMaker.generateAnnotation(contained[i], annoType);
-
- return arr;
- }
-
- // </editor-fold>
-
- // <editor-fold defaultstate="collapsed" desc="Container support">
-
- // Needed to unpack the runtime view of containing annotations
- private static final Class<? extends Annotation> REPEATABLE_CLASS = initRepeatable();
- private static final Method VALUE_ELEMENT_METHOD = initValueElementMethod();
-
- private static Class<? extends Annotation> initRepeatable() {
- try {
- // Repeatable will not be available when bootstrapping on
- // JDK 7 so use a reflective lookup instead of a class
- // literal for Repeatable.class.
- return Class.forName("java.lang.annotation.Repeatable").asSubclass(Annotation.class);
- } catch (ClassNotFoundException e) {
- return null;
- } catch (SecurityException e) {
- return null;
- }
- }
-
- private static Method initValueElementMethod() {
- if (REPEATABLE_CLASS == null)
- return null;
-
- Method m = null;
- try {
- m = REPEATABLE_CLASS.getMethod("value");
- if (m != null)
- m.setAccessible(true);
- return m;
- } catch (NoSuchMethodException e) {
- return null;
- }
- }
-
- // Helper to getAnnotations
- private static Class<? extends Annotation> getContainer(Class<? extends Annotation> annoType) {
- // Since we can not refer to java.lang.annotation.Repeatable until we are
- // bootstrapping with java 8 we need to get the Repeatable annotation using
- // reflective invocations instead of just using its type and element method.
- if (REPEATABLE_CLASS != null &&
- VALUE_ELEMENT_METHOD != null) {
- // Get the Repeatable instance on the annotations declaration
- Annotation repeatable = (Annotation)annoType.getAnnotation(REPEATABLE_CLASS);
- if (repeatable != null) {
- try {
- // Get the value element, it should be a class
- // indicating the containing annotation type
- @SuppressWarnings("unchecked")
- Class<? extends Annotation> containerType = (Class)VALUE_ELEMENT_METHOD.invoke(repeatable);
- if (containerType == null)
- return null;
-
- return containerType;
- } catch (ClassCastException e) {
- return null;
- } catch (IllegalAccessException e) {
- return null;
- } catch (InvocationTargetException e ) {
- return null;
- }
- }
- }
- return null;
- }
-
- // Helper to getAnnotations
- private static Attribute[] unpackAttributes(Attribute.Compound container) {
- // We now have an instance of the container,
- // unpack it returning an instance of the
- // contained type or null
- return ((Attribute.Array)container.member(container.type.tsym.name.table.names.value)).values;
- }
-
- // </editor-fold>
-}
--- a/langtools/src/share/classes/com/sun/tools/javac/resources/compiler.properties Fri Oct 11 03:09:42 2013 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/resources/compiler.properties Fri Oct 11 23:31:06 2013 -0700
@@ -78,26 +78,26 @@
# 0: string
compiler.err.already.defined.single.import=\
- {0} is already defined in a single-type import
+ a type with the same simple name is already defined by the single-type-import of {0}
# 0: string
compiler.err.already.defined.static.single.import=\
- {0} is already defined in a static single-type import
+ a type with the same simple name is already defined by the static single-type-import of {0}
compiler.err.already.defined.this.unit=\
{0} is already defined in this compilation unit
# 0: type, 1: list of name
compiler.err.annotation.missing.default.value=\
- annotation {0} is missing value for the attribute {1}
+ annotation @{0} is missing a default value for the element ''{1}''
# 0: type, 1: list of name
compiler.err.annotation.missing.default.value.1=\
- annotation {0} is missing values for attributes {1}
+ annotation @{0} is missing default values for elements {1}
# 0: type
compiler.err.annotation.not.valid.for.type=\
- annotation not valid for a value of type {0}
+ annotation not valid for an element of type {0}
compiler.err.annotation.type.not.applicable=\
annotation type not applicable to this kind of declaration
@@ -135,7 +135,7 @@
array required, but {0} found
compiler.err.attribute.value.must.be.constant=\
- attribute value must be constant
+ element value must be a constant expression
# 0: statement type
compiler.err.bad.initializer=\
@@ -298,8 +298,9 @@
compiler.err.cyclic.inheritance=\
cyclic inheritance involving {0}
+# 0: symbol
compiler.err.cyclic.annotation.element=\
- cyclic annotation element type
+ type of element {0} is cyclic
# 0: unused
compiler.err.call.to.super.not.allowed.in.enum.ctor=\
@@ -307,73 +308,70 @@
# 0: type
compiler.err.no.superclass=\
- {0} has no superclass
+ {0} has no superclass.
# 0: symbol, 1: type, 2: symbol, 3: type, 4: unused
compiler.err.concrete.inheritance.conflict=\
methods {0} from {1} and {2} from {3} are inherited with the same signature
compiler.err.default.allowed.in.intf.annotation.member=\
- default value only allowed in an @interface member
+ default value only allowed in an annotation type declaration
# 0: symbol
compiler.err.doesnt.exist=\
package {0} does not exist
-compiler.err.duplicate.annotation=\
- duplicate annotation
-
# 0: type
compiler.err.duplicate.annotation.invalid.repeated=\
- annotation {0} cannot be repeated\nIt does not define a valid containing annotation.
+ annotation {0} is not a valid repeatable annotation
# 0: name, 1: type
compiler.err.duplicate.annotation.member.value=\
- duplicate annotation member value {0} in {1}
-
-# 0: type, 1: type
+ duplicate element ''{0}'' in annotation @{1}.
+
+# 0: name, 1: unused
compiler.err.duplicate.annotation.missing.container=\
- duplicate annotation: the declaration of {0} does not have a valid {1} annotation
-
-# 0: type
+ {0} is not a repeatable annotation type
+
+# 0: type, 1: unused
compiler.err.invalid.repeatable.annotation=\
- duplicate annotation: {0} is annotated with an invalid Repeatable annotation
+ duplicate annotation: {0} is annotated with an invalid @Repeatable annotation
# 0: symbol or type
compiler.err.invalid.repeatable.annotation.no.value=\
- duplicate annotation: {0} is not a valid Repeatable, no value element method declared
+ {0} is not a valid @Repeatable, no value element method declared
# 0: type, 1: number
compiler.err.invalid.repeatable.annotation.multiple.values=\
- duplicate annotation: {0} is not a valid Repeatable, {1} value element methods declared
+ {0} is not a valid @Repeatable, {1} element methods named ''value'' declared
# 0: type
compiler.err.invalid.repeatable.annotation.invalid.value=\
- duplicate annotation: {0} is not a valid Repeatable: invalid value element
-
-# 0: symbol type, 1: type, 2: type
+ {0} is not a valid @Repeatable: invalid value element
+
+# 0: symbol type, 1: unused, 2: type
compiler.err.invalid.repeatable.annotation.value.return=\
- duplicate annotation: value element of containing annotation {0} should have type {2}, found {1}
+ containing annotation type ({0}) must declare an element named ''value'' of type {2}
# 0: symbol or type, 1: symbol
compiler.err.invalid.repeatable.annotation.elem.nondefault=\
- containing annotation {0} does not have a default value for element {1}
-
-# 0: symbol, 1: type, 2: symbol, 3: type
+ containing annotation type ({0}) does not have a default value for element {1}
+
+# 0: symbol, 1: unused, 2: symbol, 3: unused
compiler.err.invalid.repeatable.annotation.retention=\
- containing annotation {0} has shorter retention ({1}) than the contained annotation {2} with retention {3}
+ retention of containing annotation type ({0}) is shorter than the retention of repeatable annotation type ({2})
# 0: symbol, 1: symbol
compiler.err.invalid.repeatable.annotation.not.documented=\
- containing annotation type, {0}, is not @Documented while repeated annotation type, {1}, is
+ repeatable annotation type ({1}) is @Documented while containing annotation type ({0}) is not
# 0: symbol, 1: symbol
compiler.err.invalid.repeatable.annotation.not.inherited=\
- containing annotation type, {0}, is not @Inherited while repeated annotation type, {1}, is
+ repeatable annotation type ({1}) is @Inherited while containing annotation type ({0}) is not
# 0: symbol, 1: symbol
compiler.err.invalid.repeatable.annotation.incompatible.target=\
- target of container annotation {0} is not a subset of target of repeated annotation {1}
+ containing annotation type ({0}) is applicable to more targets than repeatable annotation type ({1})
# 0: symbol
compiler.err.invalid.repeatable.annotation.repeated.and.container.present=\
@@ -561,26 +559,31 @@
integer number too large: {0}
compiler.err.intf.annotation.members.cant.have.params=\
- @interface members may not have parameters
-
+ elements in annotation type declarations cannot declare formal parameters
+
+# 0: symbol
compiler.err.intf.annotation.cant.have.type.params=\
- @interface may not have type parameters
+ annotation type {0} cannot be generic
compiler.err.intf.annotation.members.cant.have.type.params=\
- @interface members may not have type parameters
+ elements in annotation type declarations cannot be generic methods
# 0: symbol, 1: type
compiler.err.intf.annotation.member.clash=\
- @interface member clashes with method ''{0}'' in {1}
+ annotation type {1} declares an element with the same name as method {0}
compiler.err.intf.expected.here=\
interface expected here
+compiler.err.intf.or.array.expected.here=\
+ interface or array type expected here
+
compiler.err.intf.meth.cant.have.body=\
interface abstract methods cannot have body
+# 0: symbol
compiler.err.invalid.annotation.member.type=\
- invalid type for annotation member
+ invalid type for element {0} of annotation type
compiler.err.invalid.binary.number=\
binary numbers must contain at least one binary digit
@@ -1699,6 +1702,7 @@
cannot access {0}\n\
{1}
+# 0: file name, 1: message segment
compiler.misc.bad.class.file.header=\
bad class file: {0}\n\
{1}\n\
@@ -1744,6 +1748,14 @@
compiler.misc.class.file.not.found=\
class file for {0} not found
+# 0: classfile major version, 1: classfile minor version
+compiler.misc.invalid.default.interface=\
+ default method found in version {0}.{1} classfile
+
+# 0: classfile major version, 1: classfile minor version
+compiler.misc.invalid.static.interface=\
+ static method found in version {0}.{1} classfile
+
# 0: name
compiler.misc.file.doesnt.contain.class=\
file does not contain class {0}
@@ -2301,8 +2313,13 @@
(use -source 8 or higher to enable type annotations)
# 0: string
+compiler.err.repeatable.annotations.not.supported.in.source=\
+ repeated annotations are not supported in -source {0}\n\
+(use -source 8 or higher to enable repeated annotations)
+
+# 0: string
compiler.err.foreach.not.supported.in.source=\
- for-each loops are not supported in -source {0}\n\
+ enhanced for loops are not supported in -source {0}\n\
(use -source 5 or higher to enable for-each loops)
# 0: string
--- a/langtools/src/share/classes/com/sun/tools/javac/tree/Pretty.java Fri Oct 11 03:09:42 2013 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/tree/Pretty.java Fri Oct 11 23:31:06 2013 -0700
@@ -782,9 +782,9 @@
public void visitConditional(JCConditional tree) {
try {
open(prec, TreeInfo.condPrec);
- printExpr(tree.cond, TreeInfo.condPrec);
+ printExpr(tree.cond, TreeInfo.condPrec + 1);
print(" ? ");
- printExpr(tree.truepart, TreeInfo.condPrec);
+ printExpr(tree.truepart);
print(" : ");
printExpr(tree.falsepart, TreeInfo.condPrec);
close(prec, TreeInfo.condPrec);
--- a/langtools/test/com/sun/javadoc/AccessSkipNav/AccessSkipNav.java Fri Oct 11 03:09:42 2013 -0700
+++ b/langtools/test/com/sun/javadoc/AccessSkipNav/AccessSkipNav.java Fri Oct 11 23:31:06 2013 -0700
@@ -23,7 +23,7 @@
/*
* @test
- * @bug 4638136 7198273
+ * @bug 4638136 7198273 8025633
* @summary Add ability to skip over nav bar for accessibility
* @author dkramer
* @run main AccessSkipNav
@@ -86,20 +86,20 @@
// Testing only for the presence of the <a href> and <a name>
// Top navbar <a href>
- { "<a href=\"#skip-navbar_top\" title=\"Skip navigation links\">Skip navigation links</a>",
+ { "<a href=\"#skip.navbar.top\" title=\"Skip navigation links\">Skip navigation links</a>",
TMPDEST_DIR1 + "p1" + FS + "C1.html" },
// Top navbar <a name>
- { "<a name=\"skip-navbar_top\">" + LS +
+ { "<a name=\"skip.navbar.top\">" + LS +
"<!-- -->" + LS + "</a>",
TMPDEST_DIR1 + "p1" + FS + "C1.html" },
// Bottom navbar <a href>
- { "<a href=\"#skip-navbar_bottom\" title=\"Skip navigation links\">Skip navigation links</a>",
+ { "<a href=\"#skip.navbar.bottom\" title=\"Skip navigation links\">Skip navigation links</a>",
TMPDEST_DIR1 + "p1" + FS + "C1.html" },
// Bottom navbar <a name>
- { "<a name=\"skip-navbar_bottom\">" + LS +
+ { "<a name=\"skip.navbar.bottom\">" + LS +
"<!-- -->" + LS + "</a>",
TMPDEST_DIR1 + "p1" + FS + "C1.html" }
};
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/com/sun/javadoc/testAnchorNames/TestAnchorNames.java Fri Oct 11 23:31:06 2013 -0700
@@ -0,0 +1,290 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8025633
+ * @summary Test for valid name attribute in HTML anchors.
+ * @author Bhavesh Patel
+ * @library ../lib/
+ * @build JavadocTester TestAnchorNames
+ * @run main TestAnchorNames
+ */
+
+public class TestAnchorNames extends JavadocTester {
+
+ private static final String BUG_ID = "8025633";
+
+ //Input for string search tests.
+ private static final String[][] TEST = {
+
+ //Test some section markers and links to these markers
+
+ {BUG_ID + FS + "pkg1" + FS + "RegClass.html",
+ "<a name=\"skip.navbar.top\">"
+ },
+ {BUG_ID + FS + "pkg1" + FS + "RegClass.html",
+ "<a href=\"#skip.navbar.top\" title=\"Skip navigation links\">"
+ },
+ {BUG_ID + FS + "pkg1" + FS + "RegClass.html",
+ "<a name=\"nested.class.summary\">"
+ },
+ {BUG_ID + FS + "pkg1" + FS + "RegClass.html",
+ "<a href=\"#nested.class.summary\">"
+ },
+ {BUG_ID + FS + "pkg1" + FS + "RegClass.html",
+ "<a name=\"method.summary\">"
+ },
+ {BUG_ID + FS + "pkg1" + FS + "RegClass.html",
+ "<a href=\"#method.summary\">"
+ },
+ {BUG_ID + FS + "pkg1" + FS + "RegClass.html",
+ "<a name=\"field.detail\">"
+ },
+ {BUG_ID + FS + "pkg1" + FS + "RegClass.html",
+ "<a href=\"#field.detail\">"
+ },
+ {BUG_ID + FS + "pkg1" + FS + "RegClass.html",
+ "<a name=\"constructor.detail\">"
+ },
+ {BUG_ID + FS + "pkg1" + FS + "RegClass.html",
+ "<a href=\"#constructor.detail\">"
+ },
+
+ //Test some members and link to these members
+
+ //The marker for this appears in the serialized-form.html which we will
+ //test below
+ {BUG_ID + FS + "pkg1" + FS + "RegClass.html",
+ "<a href=\"../serialized-form.html#pkg1.RegClass\">"
+ },
+ //Test some fields
+ {BUG_ID + FS + "pkg1" + FS + "RegClass.html",
+ "<a name=\"Z:Z_\">"
+ },
+ {BUG_ID + FS + "pkg1" + FS + "RegClass.html",
+ "<a href=\"../pkg1/RegClass.html#Z:Z_\">"
+ },
+ {BUG_ID + FS + "pkg1" + FS + "RegClass.html",
+ "<a name=\"Z:Z_:D\">"
+ },
+ {BUG_ID + FS + "pkg1" + FS + "RegClass.html",
+ "<a href=\"../pkg1/RegClass.html#Z:Z_:D\">"
+ },
+ {BUG_ID + FS + "pkg1" + FS + "RegClass.html",
+ "<a name=\"Z:Z:D_\">"
+ },
+ {BUG_ID + FS + "pkg1" + FS + "RegClass.html",
+ "<a href=\"../pkg1/RegClass.html#Z:Z:D_\">"
+ },
+ {BUG_ID + FS + "pkg1" + FS + "RegClass.html",
+ "<a name=\"Z:Z:Dfield\">"
+ },
+ {BUG_ID + FS + "pkg1" + FS + "RegClass.html",
+ "<a href=\"../pkg1/RegClass.html#Z:Z:Dfield\">"
+ },
+ {BUG_ID + FS + "pkg1" + FS + "RegClass.html",
+ "<a name=\"fieldInCla:D:D\">"
+ },
+ {BUG_ID + FS + "pkg1" + FS + "RegClass.html",
+ "<a href=\"../pkg1/RegClass.html#fieldInCla:D:D\">"
+ },
+ {BUG_ID + FS + "pkg1" + FS + "RegClass.html",
+ "<a name=\"S_:D:D:D:D:DINT\">"
+ },
+ {BUG_ID + FS + "pkg1" + FS + "RegClass.html",
+ "<a href=\"../pkg1/RegClass.html#S_:D:D:D:D:DINT\">"
+ },
+ {BUG_ID + FS + "pkg1" + FS + "RegClass.html",
+ "<a name=\"method:D:D\">"
+ },
+ {BUG_ID + FS + "pkg1" + FS + "RegClass.html",
+ "<a href=\"../pkg1/RegClass.html#method:D:D\">"
+ },
+ {BUG_ID + FS + "pkg1" + FS + "DeprMemClass.html",
+ "<a name=\"Z:Z_field_In_Class\">"
+ },
+ {BUG_ID + FS + "pkg1" + FS + "DeprMemClass.html",
+ "<a href=\"../pkg1/DeprMemClass.html#Z:Z_field_In_Class\">"
+ },
+ //Test constructor
+ {BUG_ID + FS + "pkg1" + FS + "RegClass.html",
+ "<a name=\"RegClass-java.lang.String-int-\">"
+ },
+ {BUG_ID + FS + "pkg1" + FS + "RegClass.html",
+ "<a href=\"../pkg1/RegClass.html#RegClass-java.lang.String-int-\">"
+ },
+ //Test some methods
+ {BUG_ID + FS + "pkg1" + FS + "RegClass.html",
+ "<a name=\"Z:Z_methodInClass-java.lang.String-\">"
+ },
+ {BUG_ID + FS + "pkg1" + FS + "RegClass.html",
+ "<a href=\"../pkg1/RegClass.html#Z:Z_methodInClass-java.lang.String-\">"
+ },
+ {BUG_ID + FS + "pkg1" + FS + "RegClass.html",
+ "<a name=\"method--\">"
+ },
+ {BUG_ID + FS + "pkg1" + FS + "RegClass.html",
+ "<a href=\"../pkg1/RegClass.html#method--\">"
+ },
+ {BUG_ID + FS + "pkg1" + FS + "RegClass.html",
+ "<a name=\"foo-java.util.Map-\">"
+ },
+ {BUG_ID + FS + "pkg1" + FS + "RegClass.html",
+ "<a href=\"../pkg1/RegClass.html#foo-java.util.Map-\">"
+ },
+ {BUG_ID + FS + "pkg1" + FS + "RegClass.html",
+ "<a name=\"methodInCla:Ds-java.lang.String:A-\">"
+ },
+ {BUG_ID + FS + "pkg1" + FS + "RegClass.html",
+ "<a href=\"../pkg1/RegClass.html#methodInCla:Ds-java.lang.String:A-\">"
+ },
+ {BUG_ID + FS + "pkg1" + FS + "RegClass.html",
+ "<a name=\"Z:Z_methodInClas:D-java.lang.String-int-\">"
+ },
+ {BUG_ID + FS + "pkg1" + FS + "RegClass.html",
+ "<a href=\"../pkg1/RegClass.html#Z:Z_methodInClas:D-java.lang.String-int-\">"
+ },
+ {BUG_ID + FS + "pkg1" + FS + "RegClass.html",
+ "<a name=\"methodD-pkg1.RegClass.:DA-\">"
+ },
+ {BUG_ID + FS + "pkg1" + FS + "RegClass.html",
+ "<a href=\"../pkg1/RegClass.html#methodD-pkg1.RegClass.:DA-\">"
+ },
+ {BUG_ID + FS + "pkg1" + FS + "RegClass.html",
+ "<a name=\"methodD-pkg1.RegClass.D:A-\">"
+ },
+ {BUG_ID + FS + "pkg1" + FS + "RegClass.html",
+ "<a href=\"../pkg1/RegClass.html#methodD-pkg1.RegClass.D:A-\">"
+ },
+ {BUG_ID + FS + "pkg1" + FS + "DeprMemClass.html",
+ "<a name=\"Z:Z:Dmethod_In_Class--\">"
+ },
+ {BUG_ID + FS + "pkg1" + FS + "DeprMemClass.html",
+ "<a href=\"../pkg1/DeprMemClass.html#Z:Z:Dmethod_In_Class--\">"
+ },
+
+ //Test enum
+
+ {BUG_ID + FS + "pkg1" + FS + "RegClass.Te$t_Enum.html",
+ "<a name=\"Z:Z:DFLD2\">"
+ },
+ {BUG_ID + FS + "pkg1" + FS + "RegClass.Te$t_Enum.html",
+ "<a href=\"../pkg1/RegClass.Te$t_Enum.html#Z:Z:DFLD2\">"
+ },
+
+ //Test nested class
+
+ {BUG_ID + FS + "pkg1" + FS + "RegClass._NestedClas$.html",
+ "<a name=\"RegClass._NestedClas:D--\">"
+ },
+ {BUG_ID + FS + "pkg1" + FS + "RegClass._NestedClas$.html",
+ "<a href=\"../pkg1/RegClass._NestedClas$.html#RegClass._NestedClas:D--\">"
+ },
+
+ //Test class use page
+
+ {BUG_ID + FS + "pkg1" + FS + "class-use" + FS + "DeprMemClass.html",
+ "<a href=\"../../pkg1/RegClass.html#d____mc\">"
+ },
+
+ //Test deprecated list page
+
+ {BUG_ID + FS + "deprecated-list.html",
+ "<a href=\"pkg1/DeprMemClass.html#Z:Z_field_In_Class\">"
+ },
+ {BUG_ID + FS + "deprecated-list.html",
+ "<a href=\"pkg1/DeprMemClass.html#Z:Z:Dmethod_In_Class--\">"
+ },
+
+ //Test constant values page
+
+ {BUG_ID + FS + "constant-values.html",
+ "<a href=\"pkg1/RegClass.html#S_:D:D:D:D:DINT\">"
+ },
+
+ //Test serialized form page
+
+ //This is the marker for the link that appears in the pkg1.RegClass.html page
+ {BUG_ID + FS + "serialized-form.html",
+ "<a name=\"pkg1.RegClass\">"
+ },
+
+ //Test member name index page
+
+ {BUG_ID + FS + "index-all.html",
+ "<a name=\"I:Z:Z:D\">"
+ },
+ {BUG_ID + FS + "index-all.html",
+ "<a href=\"#I:Z:Z:D\">$"
+ },
+ {BUG_ID + FS + "index-all.html",
+ "<a href=\"#I:Z:Z_\">_"
+ }
+ };
+
+ private static final String[][] NEGATED_TEST = {
+ //The marker name conversion should only affect HTML anchors. It should not
+ //affect the lables.
+ {BUG_ID + FS + "pkg1" + FS + "RegClass.html",
+ " Z:Z_"
+ },
+ {BUG_ID + FS + "pkg1" + FS + "RegClass.html",
+ " Z:Z:Dfield"
+ },
+ {BUG_ID + FS + "pkg1" + FS + "RegClass.html",
+ " Z:Z_field_In_Class"
+ },
+ {BUG_ID + FS + "pkg1" + FS + "RegClass.html",
+ " S_:D:D:D:D:DINT"
+ },
+ };
+
+ private static final String[] ARGS = new String[] {
+ "-d", BUG_ID, "-sourcepath", SRC_DIR, "-use", "pkg1"
+ };
+
+ /**
+ * The entry point of the test.
+ * @param args the array of command line arguments.
+ */
+ public static void main(String[] args) throws Exception {
+ TestAnchorNames tester = new TestAnchorNames();
+ run(tester, ARGS, TEST, NEGATED_TEST);
+ tester.printSummary();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public String getBugId() {
+ return BUG_ID;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public String getBugName() {
+ return getClass().getName();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/com/sun/javadoc/testAnchorNames/pkg1/DeprMemClass.java Fri Oct 11 23:31:06 2013 -0700
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package pkg1;
+
+public class DeprMemClass
+{
+ /**
+ * Field in the class.
+ * @deprecated Do not use this field.
+ */
+ public int _field_In_Class;
+
+ public int _fld;
+
+ /**
+ * Method in the class.
+ * @deprecated Do not use this method.
+ */
+ public void $method_In_Class() {
+ }
+
+ public void regularMethod() {
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/com/sun/javadoc/testAnchorNames/pkg1/RegClass.java Fri Oct 11 23:31:06 2013 -0700
@@ -0,0 +1,186 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package pkg1;
+
+import java.io.Serializable;
+import java.util.Map;
+
+/**
+ * @serial This is the serial tag's comment.
+ */
+public class RegClass implements Serializable {
+
+ /**
+ * Normal field in class.
+ */
+ public String field;
+
+ /**
+ * Normal field in class.
+ */
+ public String method$$;
+
+ /**
+ * Filed staring with $.
+ */
+ public String $field;
+
+ /**
+ * Filed staring with underscore.
+ */
+ public String _field;
+
+ /**
+ * Serial field
+ * @serial
+ */
+ public boolean t_e$t;
+
+ /**
+ * Field in class with a $ in the name.
+ */
+ public String fieldInCla$$;
+
+ /**
+ * Field name as just an underscore.
+ */
+ public int _;
+
+ /**
+ * Field name as just a $.
+ */
+ public int $;
+
+ /**
+ * Field name with underscore and $.
+ */
+ public int _$;
+
+ /**
+ * Field name with $ and underscore.
+ */
+ public int $_;
+
+ /**
+ * An array.
+ */
+ public int arr[];
+
+ /**
+ * Another array.
+ */
+ public int[] arr1;
+
+ /**
+ * A constant field.
+ */
+ public static final int S_$$$$$INT = 0;
+
+ /**
+ * Another field.
+ */
+ public DeprMemClass d____mc;
+
+ /**
+ * An enum.
+ */
+ public static enum Te$t_Enum {
+ FLD_1,
+ $FLD2
+ };
+
+ /**
+ * A constructor.
+ */
+ public RegClass(String p, int i) {
+ }
+
+ /**
+ * Method in Class.
+ * @param p a string
+ */
+ public void _methodInClass(String p) {
+ }
+
+ /**
+ * Method in Class.
+ * @param p a string
+ * @param i an int
+ */
+ public void _methodInClas$(String p, int i) {
+ }
+
+ /**
+ * Method with $ in the name.
+ * @param p a string array
+ */
+ public void methodInCla$s(String[] p) {
+ }
+
+ /**
+ * Method with D[] as a parameter.
+ * @param p an array of D
+ */
+ public void methodD(D[] p) {
+ }
+
+ /**
+ * Method with $A as a parameter.
+ * @param p an object of $A
+ */
+ public void methodD($A p) {
+ }
+
+ /**
+ * Serial test.
+ * @serialData This is a serial data comment.
+ * @return null
+ */
+ protected Object $readResolve(){return null;}
+
+ /**
+ * Simple method.
+ */
+ public void method() {}
+
+ /**
+ * Generics.
+ */
+ public static <A> void foo(Map<A, Map<A, A>> map) {}
+
+ /**
+ * A nested class.
+ */
+ public class _NestedClas$ {}
+
+ /**
+ * Nested class D.
+ */
+ class D {}
+
+ /**
+ * Nested class $A.
+ */
+ class $A {}
+}
--- a/langtools/test/com/sun/javadoc/testAnnotationOptional/TestAnnotationOptional.java Fri Oct 11 03:09:42 2013 -0700
+++ b/langtools/test/com/sun/javadoc/testAnnotationOptional/TestAnnotationOptional.java Fri Oct 11 23:31:06 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -23,7 +23,8 @@
/*
* @test
- * @summary Make sure that annotations types with optional elements has
+ * @bug 8025633
+ * @summary Make sure that annotations types with optional elements have
* element headers
* @author Mahmood Ali
* @library ../lib/
@@ -45,7 +46,7 @@
//Input for string search tests.
private static final String[][] TEST = {
{BUG_ID + FS + "pkg" + FS + "AnnotationOptional.html",
- "<a name=\"annotation_type_element_detail\">"
+ "<a name=\"annotation.type.element.detail\">"
}
};
--- a/langtools/test/com/sun/javadoc/testAnnotationTypes/TestAnnotationTypes.java Fri Oct 11 03:09:42 2013 -0700
+++ b/langtools/test/com/sun/javadoc/testAnnotationTypes/TestAnnotationTypes.java Fri Oct 11 23:31:06 2013 -0700
@@ -23,7 +23,7 @@
/*
* @test
- * @bug 4973609 8015249
+ * @bug 4973609 8015249 8025633
* @summary Make sure that annotation types with 0 members does not have
* extra HR tags.
* @author jamieh
@@ -45,11 +45,11 @@
//Input for string search tests.
private static final String[][] TEST = {
{BUG_ID + FS + "pkg" + FS + "AnnotationTypeField.html",
- "<li>Summary: </li>" + NL + "<li><a href=\"#annotation_type_" +
- "field_summary\">Field</a> | </li>"},
+ "<li>Summary: </li>" + NL + "<li><a href=\"#annotation.type." +
+ "field.summary\">Field</a> | </li>"},
{BUG_ID + FS + "pkg" + FS + "AnnotationTypeField.html",
- "<li>Detail: </li>" + NL + "<li><a href=\"#annotation_type_" +
- "field_detail\">Field</a> | </li>"},
+ "<li>Detail: </li>" + NL + "<li><a href=\"#annotation.type." +
+ "field.detail\">Field</a> | </li>"},
{BUG_ID + FS + "pkg" + FS + "AnnotationTypeField.html",
"<!-- =========== ANNOTATION TYPE FIELD SUMMARY =========== -->"},
{BUG_ID + FS + "pkg" + FS + "AnnotationTypeField.html",
--- a/langtools/test/com/sun/javadoc/testClassCrossReferences/TestClassCrossReferences.java Fri Oct 11 03:09:42 2013 -0700
+++ b/langtools/test/com/sun/javadoc/testClassCrossReferences/TestClassCrossReferences.java Fri Oct 11 23:31:06 2013 -0700
@@ -23,7 +23,7 @@
/*
* @test
- * @bug 4652655 4857717
+ * @bug 4652655 4857717 8025633
* @summary This test verifies that class cross references work properly.
* @author jamieh
* @library ../lib/
@@ -45,7 +45,7 @@
"<a href=\"http://java.sun.com/j2se/1.4/docs/api/java/math/BigDecimal.html?is-external=true\" " +
"title=\"class or interface in java.math\"><code>Link to external class BigDecimal</code></a>"},
{BUG_ID + FS + "C.html",
- "<a href=\"http://java.sun.com/j2se/1.4/docs/api/java/math/BigInteger.html?is-external=true#gcd(java.math.BigInteger)\" " +
+ "<a href=\"http://java.sun.com/j2se/1.4/docs/api/java/math/BigInteger.html?is-external=true#gcd-java.math.BigInteger-\" " +
"title=\"class or interface in java.math\"><code>Link to external member gcd</code></a>"},
{BUG_ID + FS + "C.html",
"<dl>" + NL + "<dt><span class=\"strong\">Overrides:</span></dt>" + NL +
--- a/langtools/test/com/sun/javadoc/testExternalOverridenMethod/TestExternalOverridenMethod.java Fri Oct 11 03:09:42 2013 -0700
+++ b/langtools/test/com/sun/javadoc/testExternalOverridenMethod/TestExternalOverridenMethod.java Fri Oct 11 23:31:06 2013 -0700
@@ -23,14 +23,13 @@
/*
* @test
- * @bug 4857717
+ * @bug 4857717 8025633
* @summary Test to make sure that externally overriden and implemented methods
* are documented properly. The method should still include "implements" or
* "overrides" documentation even though the method is external.
* @author jamieh
* @library ../lib/
- * @build JavadocTester
- * @build TestExternalOverridenMethod
+ * @build JavadocTester TestExternalOverridenMethod
* @run main TestExternalOverridenMethod
*/
@@ -40,13 +39,13 @@
private static final String[][] TEST = {
{BUG_ID + FS + "pkg" + FS + "XReader.html",
"<dt><span class=\"strong\">Overrides:</span></dt>" + NL +
- "<dd><code><a href=\"http://java.sun.com/j2se/1.4.1/docs/api/java/io/FilterReader.html?is-external=true#read()\" " +
+ "<dd><code><a href=\"http://java.sun.com/j2se/1.4.1/docs/api/java/io/FilterReader.html?is-external=true#read--\" " +
"title=\"class or interface in java.io\">read</a></code> in class <code>" +
"<a href=\"http://java.sun.com/j2se/1.4.1/docs/api/java/io/FilterReader.html?is-external=true\" " +
"title=\"class or interface in java.io\">FilterReader</a></code></dd>"},
{BUG_ID + FS + "pkg" + FS + "XReader.html",
"<dt><span class=\"strong\">Specified by:</span></dt>" + NL +
- "<dd><code><a href=\"http://java.sun.com/j2se/1.4.1/docs/api/java/io/DataInput.html?is-external=true#readInt()\" " +
+ "<dd><code><a href=\"http://java.sun.com/j2se/1.4.1/docs/api/java/io/DataInput.html?is-external=true#readInt--\" " +
"title=\"class or interface in java.io\">readInt</a></code> in interface <code>" +
"<a href=\"http://java.sun.com/j2se/1.4.1/docs/api/java/io/DataInput.html?is-external=true\" " +
"title=\"class or interface in java.io\">DataInput</a></code></dd>"}};
--- a/langtools/test/com/sun/javadoc/testHref/TestHref.java Fri Oct 11 03:09:42 2013 -0700
+++ b/langtools/test/com/sun/javadoc/testHref/TestHref.java Fri Oct 11 23:31:06 2013 -0700
@@ -23,7 +23,7 @@
/*
* @test
- * @bug 4663254 8016328
+ * @bug 4663254 8016328 8025633
* @summary Verify that spaces do not appear in hrefs and anchors.
* @author jamieh
* @library ../lib/
@@ -46,31 +46,31 @@
private static final String[][] TEST = {
//External link.
{BUG_ID + FS + "pkg" + FS + "C1.html",
- "href=\"http://java.sun.com/j2se/1.4/docs/api/java/lang/Object.html?is-external=true#wait(long,%20int)\""
+ "href=\"http://java.sun.com/j2se/1.4/docs/api/java/lang/Object.html?is-external=true#wait-long-int-\""
},
//Member summary table link.
{BUG_ID + FS + "pkg" + FS + "C1.html",
- "href=\"../pkg/C1.html#method(int,%20int,%20java.util.ArrayList)\""
+ "href=\"../pkg/C1.html#method-int-int-java.util.ArrayList-\""
},
//Anchor test.
{BUG_ID + FS + "pkg" + FS + "C1.html",
- "<a name=\"method(int, int, java.util.ArrayList)\">" + NL +
+ "<a name=\"method-int-int-java.util.ArrayList-\">" + NL +
"<!-- -->" + NL +
"</a>"
},
//Backward compatibility anchor test.
{BUG_ID + FS + "pkg" + FS + "C1.html",
- "<a name=\"method(int, int, java.util.ArrayList)\">" + NL +
+ "<a name=\"method-int-int-java.util.ArrayList-\">" + NL +
"<!-- -->" + NL +
"</a>"
},
//{@link} test.
{BUG_ID + FS + "pkg" + FS + "C2.html",
- "Link: <a href=\"../pkg/C1.html#method(int,%20int,%20java.util.ArrayList)\">"
+ "Link: <a href=\"../pkg/C1.html#method-int-int-java.util.ArrayList-\">"
},
//@see test.
{BUG_ID + FS + "pkg" + FS + "C2.html",
- "See Also:</span></dt>" + NL + "<dd><a href=\"../pkg/C1.html#method(int,%20int,%20java.util.ArrayList)\">"
+ "See Also:</span></dt>" + NL + "<dd><a href=\"../pkg/C1.html#method-int-int-java.util.ArrayList-\">"
},
//Header does not link to the page itself.
--- a/langtools/test/com/sun/javadoc/testHtmlDefinitionListTag/TestHtmlDefinitionListTag.java Fri Oct 11 03:09:42 2013 -0700
+++ b/langtools/test/com/sun/javadoc/testHtmlDefinitionListTag/TestHtmlDefinitionListTag.java Fri Oct 11 23:31:06 2013 -0700
@@ -25,7 +25,7 @@
/*
* @test
- * @bug 6786690 6820360
+ * @bug 6786690 6820360 8025633
* @summary This test verifies the nesting of definition list tags.
* @author Bhavesh Patel
* @library ../lib/
@@ -64,7 +64,7 @@
{BUG_ID + FS + "pkg1" + FS + "C1.html", "<dl>" + NL + "<dt><span class=\"strong\">Since:</span></dt>" + NL +
"<dd>1.4</dd>" + NL +
"<dt><span class=\"strong\">See Also:</span></dt>" + NL + "<dd>" +
- "<a href=\"../pkg1/C1.html#setUndecorated(boolean)\">" +
+ "<a href=\"../pkg1/C1.html#setUndecorated-boolean-\">" +
"<code>setUndecorated(boolean)</code></a></dd>" + NL + "</dl>"},
{BUG_ID + FS + "pkg1" + FS + "C1.html", "<dl>"+ NL + "<dt><span class=\"strong\">Parameters:</span></dt>" + NL + "<dd><code>title" +
"</code> - the title</dd>" + NL + "<dd><code>test</code> - boolean value" +
@@ -79,11 +79,11 @@
"if decorations are to be enabled.</dd>" + NL + "<dt><span class=\"strong\">Since:" +
"</span></dt>" + NL + "<dd>1.4</dd>" + NL +
"<dt><span class=\"strong\">See Also:</span></dt>" + NL + "<dd>" +
- "<a href=\"../pkg1/C1.html#readObject()\"><code>readObject()" +
+ "<a href=\"../pkg1/C1.html#readObject--\"><code>readObject()" +
"</code></a></dd>" + NL + "</dl>"},
{BUG_ID + FS + "pkg1" + FS + "C1.html", "<dl>" + NL + "<dt><span class=\"strong\">Throws:</span></dt>" + NL +
"<dd><code>java.io.IOException</code></dd>" + NL + "<dt><span class=\"strong\">See Also:" +
- "</span></dt>" + NL + "<dd><a href=\"../pkg1/C1.html#setUndecorated(boolean)\">" +
+ "</span></dt>" + NL + "<dd><a href=\"../pkg1/C1.html#setUndecorated-boolean-\">" +
"<code>setUndecorated(boolean)</code></a></dd>" + NL + "</dl>"},
{BUG_ID + FS + "pkg1" + FS + "C2.html", "<dl>" + NL + "<dt><span class=\"strong\">Parameters:" +
"</span></dt>" + NL + "<dd><code>set</code> - boolean</dd>" + NL + "<dt><span class=\"strong\">" +
@@ -91,20 +91,20 @@
{BUG_ID + FS + "serialized-form.html", "<dl>" + NL + "<dt><span class=\"strong\">Throws:</span>" +
"</dt>" + NL + "<dd><code>" +
"java.io.IOException</code></dd>" + NL + "<dt><span class=\"strong\">See Also:</span>" +
- "</dt>" + NL + "<dd><a href=\"pkg1/C1.html#setUndecorated(boolean)\">" +
+ "</dt>" + NL + "<dd><a href=\"pkg1/C1.html#setUndecorated-boolean-\">" +
"<code>C1.setUndecorated(boolean)</code></a></dd>" + NL + "</dl>"},
{BUG_ID + FS + "serialized-form.html", "<span class=\"strong\">Deprecated.</span>" +
" <span class=\"italic\">As of JDK version 1.5, replaced by" + NL +
- " <a href=\"pkg1/C1.html#setUndecorated(boolean)\">" +
+ " <a href=\"pkg1/C1.html#setUndecorated-boolean-\">" +
"<code>setUndecorated(boolean)</code></a>.</span></div>" + NL +
"<div class=\"block\">This field indicates whether the C1 is " +
"undecorated.</div>" + NL + " " + NL + "<dl>" + NL + "<dt><span class=\"strong\">Since:</span></dt>" + NL +
"<dd>1.4</dd>" + NL + "<dt><span class=\"strong\">See Also:</span>" +
- "</dt>" + NL + "<dd><a href=\"pkg1/C1.html#setUndecorated(boolean)\">" +
+ "</dt>" + NL + "<dd><a href=\"pkg1/C1.html#setUndecorated-boolean-\">" +
"<code>C1.setUndecorated(boolean)</code></a></dd>" + NL + "</dl>"},
{BUG_ID + FS + "serialized-form.html", "<span class=\"strong\">Deprecated.</span>" +
" <span class=\"italic\">As of JDK version 1.5, replaced by" + NL +
- " <a href=\"pkg1/C1.html#setUndecorated(boolean)\">" +
+ " <a href=\"pkg1/C1.html#setUndecorated-boolean-\">" +
"<code>setUndecorated(boolean)</code></a>.</span></div>" + NL +
"<div class=\"block\">Reads the object stream.</div>" + NL +
"<dl>" + NL + "<dt><span class=\"strong\">Throws:" +
@@ -141,29 +141,29 @@
" if no decorations are" + NL + " to be enabled;" + NL +
" <code>false</code> if decorations are to be enabled." +
"</dd>" + NL + "<dt><span class=\"strong\">Since:</span></dt>" + NL + "<dd>1.4</dd>" + NL +
- "<dt><span class=\"strong\">See Also:</span></dt>" + NL + "<dd><a href=\"../pkg1/C1.html#readObject()\">" +
+ "<dt><span class=\"strong\">See Also:</span></dt>" + NL + "<dd><a href=\"../pkg1/C1.html#readObject--\">" +
"<code>readObject()</code></a></dd>" + NL + "</dl>"},
{BUG_ID + FS + "pkg1" + FS + "C1.html", "<dl>" + NL + "<dt><span class=\"strong\">Throws:</span>" +
"</dt>" + NL + "<dd><code>java.io.IOException</code></dd>" + NL + "<dt>" +
- "<span class=\"strong\">See Also:</span></dt>" + NL + "<dd><a href=\"../pkg1/C1.html#setUndecorated(boolean)\">" +
+ "<span class=\"strong\">See Also:</span></dt>" + NL + "<dd><a href=\"../pkg1/C1.html#setUndecorated-boolean-\">" +
"<code>setUndecorated(boolean)</code></a></dd>" + NL + "</dl>"},
{BUG_ID + FS + "serialized-form.html", "<dl>" + NL + "<dt><span class=\"strong\">Throws:</span>" +
"</dt>" + NL + "<dd><code>" +
"java.io.IOException</code></dd>" + NL + "<dt><span class=\"strong\">See Also:</span>" +
- "</dt>" + NL + "<dd><a href=\"pkg1/C1.html#setUndecorated(boolean)\">" +
+ "</dt>" + NL + "<dd><a href=\"pkg1/C1.html#setUndecorated-boolean-\">" +
"<code>C1.setUndecorated(boolean)</code></a></dd>" + NL + "</dl>"},
{BUG_ID + FS + "serialized-form.html", "<span class=\"strong\">Deprecated.</span>" +
" <span class=\"italic\">As of JDK version 1.5, replaced by" + NL +
- " <a href=\"pkg1/C1.html#setUndecorated(boolean)\">" +
+ " <a href=\"pkg1/C1.html#setUndecorated-boolean-\">" +
"<code>setUndecorated(boolean)</code></a>.</span></div>" + NL +
"<div class=\"block\">This field indicates whether the C1 is " +
"undecorated.</div>" + NL + " " + NL + "<dl>" + NL + "<dt><span class=\"strong\">Since:</span></dt>" + NL +
"<dd>1.4</dd>" + NL + "<dt><span class=\"strong\">See Also:</span>" +
- "</dt>" + NL + "<dd><a href=\"pkg1/C1.html#setUndecorated(boolean)\">" +
+ "</dt>" + NL + "<dd><a href=\"pkg1/C1.html#setUndecorated-boolean-\">" +
"<code>C1.setUndecorated(boolean)</code></a></dd>" + NL + "</dl>"},
{BUG_ID + FS + "serialized-form.html", "<span class=\"strong\">Deprecated.</span>" +
" <span class=\"italic\">As of JDK version 1.5, replaced by" + NL +
- " <a href=\"pkg1/C1.html#setUndecorated(boolean)\">" +
+ " <a href=\"pkg1/C1.html#setUndecorated-boolean-\">" +
"<code>setUndecorated(boolean)</code></a>.</span></div>" + NL +
"<div class=\"block\">Reads the object stream.</div>" + NL +
"<dl>" + NL + "<dt><span class=\"strong\">Throws:" +
@@ -188,12 +188,12 @@
{BUG_ID + FS + "serialized-form.html", "<pre>boolean " +
"undecorated</pre>" + NL + "<div class=\"block\"><span class=\"strong\">" +
"Deprecated.</span> <span class=\"italic\">As of JDK version 1.5, replaced by" + NL +
- " <a href=\"pkg1/C1.html#setUndecorated(boolean)\"><code>" +
+ " <a href=\"pkg1/C1.html#setUndecorated-boolean-\"><code>" +
"setUndecorated(boolean)</code></a>.</span></div>" + NL + "</li>"},
{BUG_ID + FS + "serialized-form.html", "<span class=\"strong\">" +
"Deprecated.</span> <span class=\"italic\">As of JDK version" +
" 1.5, replaced by" + NL +
- " <a href=\"pkg1/C1.html#setUndecorated(boolean)\">" +
+ " <a href=\"pkg1/C1.html#setUndecorated-boolean-\">" +
"<code>setUndecorated(boolean)</code></a>.</span></div>" + NL + "</li>"}};
// Test for valid HTML generation which should not comprise of empty
--- a/langtools/test/com/sun/javadoc/testInterface/TestInterface.java Fri Oct 11 03:09:42 2013 -0700
+++ b/langtools/test/com/sun/javadoc/testInterface/TestInterface.java Fri Oct 11 23:31:06 2013 -0700
@@ -23,7 +23,7 @@
/*
* @test
- * @bug 4682448 4947464 5029946
+ * @bug 4682448 4947464 5029946 8025633
* @summary Verify that the public modifier does not show up in the
* documentation for public methods, as recommended by the JLS.
* If A implements I and B extends A, B should be in the list of
@@ -84,7 +84,7 @@
//Make sure "Specified By" has substituted type parameters.
{BUG_ID + FS + "pkg" + FS + "Child.html",
"<dt><span class=\"strong\">Specified by:</span></dt>" + NL +
- "<dd><code><a href=\"../pkg/Interface.html#method()\">method</a>" +
+ "<dd><code><a href=\"../pkg/Interface.html#method--\">method</a>" +
"</code> in interface <code>" +
"<a href=\"../pkg/Interface.html\" title=\"interface in pkg\">" +
"Interface</a><<a href=\"../pkg/Child.html\" title=\"type parameter in Child\">" +
@@ -93,7 +93,7 @@
//Make sure "Overrides" has substituted type parameters.
{BUG_ID + FS + "pkg" + FS + "Child.html",
"<dt><span class=\"strong\">Overrides:</span></dt>" + NL +
- "<dd><code><a href=\"../pkg/Parent.html#method()\">method</a>" +
+ "<dd><code><a href=\"../pkg/Parent.html#method--\">method</a>" +
"</code> in class <code><a href=\"../pkg/Parent.html\" " +
"title=\"class in pkg\">Parent</a><<a href=\"../pkg/Child.html\" " +
"title=\"type parameter in Child\">T</a>></code></dd>"
--- a/langtools/test/com/sun/javadoc/testJavaFX/TestJavaFX.java Fri Oct 11 03:09:42 2013 -0700
+++ b/langtools/test/com/sun/javadoc/testJavaFX/TestJavaFX.java Fri Oct 11 23:31:06 2013 -0700
@@ -23,7 +23,7 @@
/*
* @test
- * @bug 7112427 8012295
+ * @bug 7112427 8012295 8025633
* @summary Test of the JavaFX doclet features.
* @author jvalenta
* @library ../lib/
@@ -38,8 +38,8 @@
private static final String[][] TEST =
new String[][] {
{"./" + BUG_ID + "/C.html",
- "<dt><span class=\"strong\">See Also:</span></dt>" + NL + "<dd><a href=\"C.html#getRate()\"><code>getRate()</code></a>, " + NL +
- "<a href=\"C.html#setRate(double)\"><code>setRate(double)</code></a></dd>"},
+ "<dt><span class=\"strong\">See Also:</span></dt>" + NL + "<dd><a href=\"C.html#getRate--\"><code>getRate()</code></a>, " + NL +
+ "<a href=\"C.html#setRate-double-\"><code>setRate(double)</code></a></dd>"},
{"./" + BUG_ID + "/C.html",
"<pre>public final void setRate(double value)</pre>" + NL +
"<div class=\"block\">Sets the value of the property rate.</div>" + NL +
@@ -63,7 +63,7 @@
{"./" + BUG_ID + "/C.html",
"<span class=\"strong\">Property description:</span>"},
{"./" + BUG_ID + "/C.html",
- "<td class=\"colLast\"><code><span class=\"strong\"><a href=\"C.html#setTestMethodProperty()\">setTestMethodProperty</a></span>()</code> </td>" },
+ "<td class=\"colLast\"><code><span class=\"strong\"><a href=\"C.html#setTestMethodProperty--\">setTestMethodProperty</a></span>()</code> </td>" },
{"./" + BUG_ID + "/C.html",
"<h4>isPaused</h4>" + NL +
"<pre>public final double isPaused()</pre>" + NL +
--- a/langtools/test/com/sun/javadoc/testLinkTaglet/TestLinkTaglet.java Fri Oct 11 03:09:42 2013 -0700
+++ b/langtools/test/com/sun/javadoc/testLinkTaglet/TestLinkTaglet.java Fri Oct 11 23:31:06 2013 -0700
@@ -23,7 +23,7 @@
/*
* @test
- * @bug 4732864 6280605 7064544 8014636 8016328
+ * @bug 4732864 6280605 7064544 8014636 8016328 8025633
* @summary Make sure that you can link from one member to another using
* non-qualified name, furthermore, ensure the right one is linked.
* @author jamieh
@@ -49,9 +49,9 @@
"Qualified Link: <a href=\"../pkg/C.InnerC.html\" title=\"class in pkg\"><code>C.InnerC</code></a>.<br/>" + NL +
" Unqualified Link1: <a href=\"../pkg/C.InnerC.html\" title=\"class in pkg\"><code>C.InnerC</code></a>.<br/>" + NL +
" Unqualified Link2: <a href=\"../pkg/C.InnerC.html\" title=\"class in pkg\"><code>C.InnerC</code></a>.<br/>" + NL +
- " Qualified Link: <a href=\"../pkg/C.html#method(pkg.C.InnerC,%20pkg.C.InnerC2)\"><code>method(pkg.C.InnerC, pkg.C.InnerC2)</code></a>.<br/>" + NL +
- " Unqualified Link: <a href=\"../pkg/C.html#method(pkg.C.InnerC,%20pkg.C.InnerC2)\"><code>method(C.InnerC, C.InnerC2)</code></a>.<br/>" + NL +
- " Unqualified Link: <a href=\"../pkg/C.html#method(pkg.C.InnerC,%20pkg.C.InnerC2)\"><code>method(InnerC, InnerC2)</code></a>.<br/>"
+ " Qualified Link: <a href=\"../pkg/C.html#method-pkg.C.InnerC-pkg.C.InnerC2-\"><code>method(pkg.C.InnerC, pkg.C.InnerC2)</code></a>.<br/>" + NL +
+ " Unqualified Link: <a href=\"../pkg/C.html#method-pkg.C.InnerC-pkg.C.InnerC2-\"><code>method(C.InnerC, C.InnerC2)</code></a>.<br/>" + NL +
+ " Unqualified Link: <a href=\"../pkg/C.html#method-pkg.C.InnerC-pkg.C.InnerC2-\"><code>method(InnerC, InnerC2)</code></a>.<br/>"
},
{BUG_ID + FS + "pkg" + FS + "C.InnerC.html",
"Link to member in outer class: <a href=\"../pkg/C.html#MEMBER\"><code>C.MEMBER</code></a> <br/>" + NL +
--- a/langtools/test/com/sun/javadoc/testMemberInheritence/TestMemberInheritence.java Fri Oct 11 03:09:42 2013 -0700
+++ b/langtools/test/com/sun/javadoc/testMemberInheritence/TestMemberInheritence.java Fri Oct 11 23:31:06 2013 -0700
@@ -23,7 +23,7 @@
/*
* @test
- * @bug 4638588 4635809 6256068 6270645
+ * @bug 4638588 4635809 6256068 6270645 8025633
* @summary Test to make sure that members are inherited properly in the Javadoc.
* Verify that inheritence labels are correct.
* @author jamieh
@@ -44,7 +44,7 @@
//Public method should be inherited
{BUG_ID + FS + "pkg" + FS + "SubClass.html",
- "<a href=\"../pkg/BaseClass.html#pubMethod()\">"},
+ "<a href=\"../pkg/BaseClass.html#pubMethod--\">"},
//Public inner class should be inherited.
{BUG_ID + FS + "pkg" + FS + "SubClass.html",
@@ -56,7 +56,7 @@
//Protected method should be inherited
{BUG_ID + FS + "pkg" + FS + "SubClass.html",
- "<a href=\"../pkg/BaseClass.html#proMethod()\">"},
+ "<a href=\"../pkg/BaseClass.html#proMethod--\">"},
//Protected inner class should be inherited.
{BUG_ID + FS + "pkg" + FS + "SubClass.html",
@@ -73,14 +73,14 @@
// Test overriding/implementing methods with generic parameters.
{BUG_ID + FS + "pkg" + FS + "BaseClass.html",
"<dl>" + NL + "<dt><span class=\"strong\">Specified by:</span></dt>" + NL +
- "<dd><code><a href=\"../pkg/BaseInterface.html#getAnnotation(java.lang.Class)\">" +
+ "<dd><code><a href=\"../pkg/BaseInterface.html#getAnnotation-java.lang.Class-\">" +
"getAnnotation</a></code> in interface <code>" +
"<a href=\"../pkg/BaseInterface.html\" title=\"interface in pkg\">" +
"BaseInterface</a></code></dd>" + NL + "</dl>"},
// Test diamond inheritence member summary (6256068)
{BUG_ID + FS + "diamond" + FS + "Z.html",
- "<code><a href=\"../diamond/A.html#aMethod()\">aMethod</a></code>"},
+ "<code><a href=\"../diamond/A.html#aMethod--\">aMethod</a></code>"},
// Test that doc is inherited from closed parent (6270645)
{BUG_ID + FS + "inheritDist" + FS + "C.html",
@@ -90,7 +90,7 @@
private static final String[][] NEGATED_TEST = {
{BUG_ID + FS + "pkg" + FS + "SubClass.html",
- "<a href=\"../pkg/BaseClass.html#staticMethod()\">staticMethod</a></code>"},
+ "<a href=\"../pkg/BaseClass.html#staticMethod--\">staticMethod</a></code>"},
};
private static final String[] ARGS =
new String[] {
--- a/langtools/test/com/sun/javadoc/testMemberSummary/TestMemberSummary.java Fri Oct 11 03:09:42 2013 -0700
+++ b/langtools/test/com/sun/javadoc/testMemberSummary/TestMemberSummary.java Fri Oct 11 23:31:06 2013 -0700
@@ -23,7 +23,7 @@
/*
* @test
- * @bug 4951228 6290760
+ * @bug 4951228 6290760 8025633
* @summary Test the case where the overriden method returns a different
* type than the method in the child class. Make sure the
* documentation is inherited but the return type isn't.
@@ -49,7 +49,7 @@
// Check return type in member summary.
{BUG_ID + FS + "pkg" + FS + "PublicChild.html",
"<code><a href=\"../pkg/PublicChild.html\" title=\"class in pkg\">PublicChild</a></code></td>" + NL +
- "<td class=\"colLast\"><code><span class=\"strong\"><a href=\"../pkg/PublicChild.html#returnTypeTest()\">" +
+ "<td class=\"colLast\"><code><span class=\"strong\"><a href=\"../pkg/PublicChild.html#returnTypeTest--\">" +
"returnTypeTest</a></span>()</code>"
},
// Check return type in member detail.
@@ -60,9 +60,9 @@
// Legacy anchor dimensions (6290760)
{BUG_ID + FS + "pkg2" + FS + "A.html",
- "<a name=\"f(java.lang.Object[])\">" + NL +
+ "<a name=\"f-java.lang.Object:A-\">" + NL +
"<!-- -->" + NL +
- "</a><a name=\"f(T[])\">" + NL +
+ "</a><a name=\"f-T:A-\">" + NL +
"<!-- -->" + NL +
"</a>"
},
--- a/langtools/test/com/sun/javadoc/testNavigation/TestNavigation.java Fri Oct 11 03:09:42 2013 -0700
+++ b/langtools/test/com/sun/javadoc/testNavigation/TestNavigation.java Fri Oct 11 23:31:06 2013 -0700
@@ -23,7 +23,7 @@
/*
* @test
- * @bug 4131628 4664607 7025314 8023700 7198273
+ * @bug 4131628 4664607 7025314 8023700 7198273 8025633
* @summary Make sure the Next/Prev Class links iterate through all types.
* Make sure the navagation is 2 columns, not 3.
* @author jamieh
@@ -60,7 +60,7 @@
{BUG_ID + FS + "pkg" + FS + "I.html", "<li>Next Class</li>"},
// Test for 4664607
{BUG_ID + FS + "pkg" + FS + "I.html",
- "<div class=\"skipNav\"><a href=\"#skip-navbar_top\" title=\"Skip navigation links\">Skip navigation links</a></div>" + NL + "<a name=\"navbar_top_firstrow\">" + NL +
+ "<div class=\"skipNav\"><a href=\"#skip.navbar.top\" title=\"Skip navigation links\">Skip navigation links</a></div>" + NL + "<a name=\"navbar.top.firstrow\">" + NL +
"<!-- -->" + NL + "</a>"}
};
private static final String[][] NEGATED_TEST = NO_TEST;
--- a/langtools/test/com/sun/javadoc/testNestedGenerics/TestNestedGenerics.java Fri Oct 11 03:09:42 2013 -0700
+++ b/langtools/test/com/sun/javadoc/testNestedGenerics/TestNestedGenerics.java Fri Oct 11 23:31:06 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -23,7 +23,7 @@
/*
* @test
- * @bug 6758050
+ * @bug 6758050 8025633
* @summary Test HTML output for nested generic types.
* @author bpatel
* @library ../lib/
@@ -46,7 +46,7 @@
private static final String[][] TEST = {
{BUG_ID + FS + "pkg" + FS + "NestedGenerics.html",
"<div class=\"block\">Contains <a " +
- "href=\"../pkg/NestedGenerics.html#foo(java.util.Map)\"><code>foo" +
+ "href=\"../pkg/NestedGenerics.html#foo-java.util.Map-\"><code>foo" +
"(java.util.Map<A, java.util.Map<A, A>>)</code></a></div>"
}
};
--- a/langtools/test/com/sun/javadoc/testNewLanguageFeatures/TestNewLanguageFeatures.java Fri Oct 11 03:09:42 2013 -0700
+++ b/langtools/test/com/sun/javadoc/testNewLanguageFeatures/TestNewLanguageFeatures.java Fri Oct 11 23:31:06 2013 -0700
@@ -23,7 +23,7 @@
/*
* @test
- * @bug 4789689 4905985 4927164 4827184 4993906 5004549 7025314 7010344
+ * @bug 4789689 4905985 4927164 4827184 4993906 5004549 7025314 7010344 8025633
* @summary Run Javadoc on a set of source files that demonstrate new
* language features. Check the output to ensure that the new
* language features are properly documented.
@@ -145,7 +145,7 @@
//=================================
{BUG_ID + FS + "pkg" + FS + "VarArgs.html", "(int... i)"},
{BUG_ID + FS + "pkg" + FS + "VarArgs.html", "(int[][]... i)"},
- {BUG_ID + FS + "pkg" + FS + "VarArgs.html", "(int[]...)"},
+ {BUG_ID + FS + "pkg" + FS + "VarArgs.html", "-int:A...-"},
{BUG_ID + FS + "pkg" + FS + "VarArgs.html",
"<a href=\"../pkg/TypeParameters.html\" title=\"class in pkg\">" +
"TypeParameters</a>... t"},
@@ -156,13 +156,13 @@
//Make sure the summary links are correct.
{BUG_ID + FS + "pkg" + FS + "AnnotationType.html",
"<li>Summary: </li>" + NL + "<li>Field | </li>" + NL +
- "<li><a href=\"#annotation_type_required_element_summary\">" +
+ "<li><a href=\"#annotation.type.required.element.summary\">" +
"Required</a> | </li>" + NL + "<li>" +
- "<a href=\"#annotation_type_optional_element_summary\">Optional</a></li>"},
+ "<a href=\"#annotation.type.optional.element.summary\">Optional</a></li>"},
//Make sure the detail links are correct.
{BUG_ID + FS + "pkg" + FS + "AnnotationType.html",
"<li>Detail: </li>" + NL + "<li>Field | </li>" + NL +
- "<li><a href=\"#annotation_type_element_detail\">Element</a></li>"},
+ "<li><a href=\"#annotation.type.element.detail\">Element</a></li>"},
//Make sure the heading is correct.
{BUG_ID + FS + "pkg" + FS + "AnnotationType.html",
"Annotation Type AnnotationType</h2>"},
@@ -188,16 +188,16 @@
//PACKAGE
{BUG_ID + FS + "pkg" + FS + "package-summary.html",
- "<a href=\"../pkg/AnnotationType.html\" title=\"annotation in pkg\">@AnnotationType</a>(<a href=\"../pkg/AnnotationType.html#optional()\">optional</a>=\"Package Annotation\"," + NL +
- " <a href=\"../pkg/AnnotationType.html#required()\">required</a>=1994)"},
+ "<a href=\"../pkg/AnnotationType.html\" title=\"annotation in pkg\">@AnnotationType</a>(<a href=\"../pkg/AnnotationType.html#optional--\">optional</a>=\"Package Annotation\"," + NL +
+ " <a href=\"../pkg/AnnotationType.html#required--\">required</a>=1994)"},
//CLASS
{BUG_ID + FS + "pkg" + FS + "AnnotationTypeUsage.html",
"<pre><a href=\"../pkg/AnnotationType.html\" " +
"title=\"annotation in pkg\">@AnnotationType</a>(" +
- "<a href=\"../pkg/AnnotationType.html#optional()\">optional</a>" +
+ "<a href=\"../pkg/AnnotationType.html#optional--\">optional</a>" +
"=\"Class Annotation\"," + NL +
- " <a href=\"../pkg/AnnotationType.html#required()\">" +
+ " <a href=\"../pkg/AnnotationType.html#required--\">" +
"required</a>=1994)" + NL + "public class <span class=\"strong\">" +
"AnnotationTypeUsage</span>" + NL + "extends java.lang.Object</pre>"},
@@ -205,36 +205,36 @@
{BUG_ID + FS + "pkg" + FS + "AnnotationTypeUsage.html",
"<pre><a href=\"../pkg/AnnotationType.html\" " +
"title=\"annotation in pkg\">@AnnotationType</a>(" +
- "<a href=\"../pkg/AnnotationType.html#optional()\">optional</a>" +
+ "<a href=\"../pkg/AnnotationType.html#optional--\">optional</a>" +
"=\"Field Annotation\"," + NL +
- " <a href=\"../pkg/AnnotationType.html#required()\">" +
+ " <a href=\"../pkg/AnnotationType.html#required--\">" +
"required</a>=1994)" + NL + "public int field</pre>"},
//CONSTRUCTOR
{BUG_ID + FS + "pkg" + FS + "AnnotationTypeUsage.html",
"<pre><a href=\"../pkg/AnnotationType.html\" " +
"title=\"annotation in pkg\">@AnnotationType</a>(" +
- "<a href=\"../pkg/AnnotationType.html#optional()\">optional</a>" +
+ "<a href=\"../pkg/AnnotationType.html#optional--\">optional</a>" +
"=\"Constructor Annotation\"," + NL +
- " <a href=\"../pkg/AnnotationType.html#required()\">" +
+ " <a href=\"../pkg/AnnotationType.html#required--\">" +
"required</a>=1994)" + NL + "public AnnotationTypeUsage()</pre>"},
//METHOD
{BUG_ID + FS + "pkg" + FS + "AnnotationTypeUsage.html",
"<pre><a href=\"../pkg/AnnotationType.html\" " +
"title=\"annotation in pkg\">@AnnotationType</a>(" +
- "<a href=\"../pkg/AnnotationType.html#optional()\">optional</a>" +
+ "<a href=\"../pkg/AnnotationType.html#optional--\">optional</a>" +
"=\"Method Annotation\"," + NL +
- " <a href=\"../pkg/AnnotationType.html#required()\">" +
+ " <a href=\"../pkg/AnnotationType.html#required--\">" +
"required</a>=1994)" + NL + "public void method()</pre>"},
//METHOD PARAMS
{BUG_ID + FS + "pkg" + FS + "AnnotationTypeUsage.html",
"<pre>public void methodWithParams(" +
"<a href=\"../pkg/AnnotationType.html\" title=\"annotation in pkg\">" +
- "@AnnotationType</a>(<a href=\"../pkg/AnnotationType.html#optional()\">" +
+ "@AnnotationType</a>(<a href=\"../pkg/AnnotationType.html#optional--\">" +
"optional</a>=\"Parameter Annotation\",<a " +
- "href=\"../pkg/AnnotationType.html#required()\">required</a>=1994)" + NL +
+ "href=\"../pkg/AnnotationType.html#required--\">required</a>=1994)" + NL +
" int documented," + NL +
" int undocmented)</pre>"},
@@ -242,9 +242,9 @@
{BUG_ID + FS + "pkg" + FS + "AnnotationTypeUsage.html",
"<pre>public AnnotationTypeUsage(<a " +
"href=\"../pkg/AnnotationType.html\" title=\"annotation in pkg\">" +
- "@AnnotationType</a>(<a href=\"../pkg/AnnotationType.html#optional()\">" +
+ "@AnnotationType</a>(<a href=\"../pkg/AnnotationType.html#optional--\">" +
"optional</a>=\"Constructor Param Annotation\",<a " +
- "href=\"../pkg/AnnotationType.html#required()\">required</a>=1994)" + NL +
+ "href=\"../pkg/AnnotationType.html#required--\">required</a>=1994)" + NL +
" int documented," + NL +
" int undocmented)</pre>"},
@@ -254,43 +254,43 @@
//Integer
{BUG_ID + FS + "pkg1" + FS + "B.html",
- "<a href=\"../pkg1/A.html#d()\">d</a>=3.14,"},
+ "<a href=\"../pkg1/A.html#d--\">d</a>=3.14,"},
//Double
{BUG_ID + FS + "pkg1" + FS + "B.html",
- "<a href=\"../pkg1/A.html#d()\">d</a>=3.14,"},
+ "<a href=\"../pkg1/A.html#d--\">d</a>=3.14,"},
//Boolean
{BUG_ID + FS + "pkg1" + FS + "B.html",
- "<a href=\"../pkg1/A.html#b()\">b</a>=true,"},
+ "<a href=\"../pkg1/A.html#b--\">b</a>=true,"},
//String
{BUG_ID + FS + "pkg1" + FS + "B.html",
- "<a href=\"../pkg1/A.html#s()\">s</a>=\"sigh\","},
+ "<a href=\"../pkg1/A.html#s--\">s</a>=\"sigh\","},
//Class
{BUG_ID + FS + "pkg1" + FS + "B.html",
- "<a href=\"../pkg1/A.html#c()\">c</a>=<a href=\"../pkg2/Foo.html\" title=\"class in pkg2\">Foo.class</a>,"},
+ "<a href=\"../pkg1/A.html#c--\">c</a>=<a href=\"../pkg2/Foo.html\" title=\"class in pkg2\">Foo.class</a>,"},
//Bounded Class
{BUG_ID + FS + "pkg1" + FS + "B.html",
- "<a href=\"../pkg1/A.html#w()\">w</a>=<a href=\"../pkg/TypeParameterSubClass.html\" title=\"class in pkg\">TypeParameterSubClass.class</a>,"},
+ "<a href=\"../pkg1/A.html#w--\">w</a>=<a href=\"../pkg/TypeParameterSubClass.html\" title=\"class in pkg\">TypeParameterSubClass.class</a>,"},
//Enum
{BUG_ID + FS + "pkg1" + FS + "B.html",
- "<a href=\"../pkg1/A.html#e()\">e</a>=<a href=\"../pkg/Coin.html#Penny\">Penny</a>,"},
+ "<a href=\"../pkg1/A.html#e--\">e</a>=<a href=\"../pkg/Coin.html#Penny\">Penny</a>,"},
//Annotation Type
{BUG_ID + FS + "pkg1" + FS + "B.html",
- "<a href=\"../pkg1/A.html#a()\">a</a>=<a href=\"../pkg/AnnotationType.html\" title=\"annotation in pkg\">@AnnotationType</a>(<a href=\"../pkg/AnnotationType.html#optional()\">optional</a>=\"foo\",<a href=\"../pkg/AnnotationType.html#required()\">required</a>=1994),"},
+ "<a href=\"../pkg1/A.html#a--\">a</a>=<a href=\"../pkg/AnnotationType.html\" title=\"annotation in pkg\">@AnnotationType</a>(<a href=\"../pkg/AnnotationType.html#optional--\">optional</a>=\"foo\",<a href=\"../pkg/AnnotationType.html#required--\">required</a>=1994),"},
//String Array
{BUG_ID + FS + "pkg1" + FS + "B.html",
- "<a href=\"../pkg1/A.html#sa()\">sa</a>={\"up\",\"down\"},"},
+ "<a href=\"../pkg1/A.html#sa--\">sa</a>={\"up\",\"down\"},"},
//Primitive
{BUG_ID + FS + "pkg1" + FS + "B.html",
- "<a href=\"../pkg1/A.html#primitiveClassTest()\">primitiveClassTest</a>=boolean.class,"},
+ "<a href=\"../pkg1/A.html#primitiveClassTest--\">primitiveClassTest</a>=boolean.class,"},
//XXX: Add array test case after this if fixed:
//5020899: Incorrect internal representation of class-valued annotation elements
@@ -335,7 +335,7 @@
{BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "Foo.html",
"<td class=\"colLast\"><span class=\"strong\">ClassUseTest1." +
"</span><code><span class=\"strong\"><a href=\"../../pkg2/" +
- "ClassUseTest1.html#method(T)\">method</a></span>" +
+ "ClassUseTest1.html#method-T-\">method</a></span>" +
"(T t)</code> </td>"
},
{BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "Foo.html",
@@ -388,7 +388,7 @@
{BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "Foo2.html",
"<td class=\"colLast\"><span class=\"strong\">" +
"ClassUseTest1.</span><code><span class=\"strong\"><a href=\"../../" +
- "pkg2/ClassUseTest1.html#method(T)\">method</a></span>" +
+ "pkg2/ClassUseTest1.html#method-T-\">method</a></span>" +
"(T t)</code> </td>"
},
@@ -417,7 +417,7 @@
{BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "ParamTest.html",
"<td class=\"colLast\"><span class=\"strong\">ClassUseTest2." +
"</span><code><span class=\"strong\"><a href=\"../../pkg2/" +
- "ClassUseTest2.html#method(T)\">method</a></span>" +
+ "ClassUseTest2.html#method-T-\">method</a></span>" +
"(T t)</code> </td>"
},
{BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "ParamTest.html",
@@ -472,7 +472,7 @@
{BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "Foo3.html",
"<td class=\"colLast\"><span class=\"strong\">ClassUseTest2." +
"</span><code><span class=\"strong\"><a href=\"../../pkg2/" +
- "ClassUseTest2.html#method(T)\">method</a></span>" +
+ "ClassUseTest2.html#method-T-\">method</a></span>" +
"(T t)</code> </td>"
},
{BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "Foo3.html",
@@ -517,7 +517,7 @@
{BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "ParamTest2.html",
"<td class=\"colLast\"><span class=\"strong\">ClassUseTest3" +
".</span><code><span class=\"strong\"><a href=\"../../pkg2/ClassUseTest3." +
- "html#method(T)\">method</a></span>(T t)</code> </td>"
+ "html#method-T-\">method</a></span>(T t)</code> </td>"
},
{BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "ParamTest2.html",
"<td class=\"colFirst\"><code><T extends <a href=\"../" +
@@ -554,7 +554,7 @@
{BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "Foo4.html",
"<td class=\"colLast\"><span class=\"strong\">ClassUseTest3." +
"</span><code><span class=\"strong\"><a href=\"../../pkg2/ClassUseTest3." +
- "html#method(T)\">method</a></span>(T t)</code>" +
+ "html#method-T-\">method</a></span>(T t)</code>" +
" </td>"
},
{BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "Foo4.html",
@@ -588,7 +588,7 @@
"<td class=\"colFirst\"><code>void</code></td>" + NL +
"<td class=\"colLast\"><span class=\"strong\">ClassUseTest3." +
"</span><code><span class=\"strong\"><a href=\"../../pkg2/ClassUseTest3." +
- "html#method(java.util.Set)\">method</a></span>(java." +
+ "html#method-java.util.Set-\">method</a></span>(java." +
"util.Set<<a href=\"../../pkg2/Foo4.html\" title=\"" +
"class in pkg2\">Foo4</a>> p)</code> </td>" + NL +
"</tr>" + NL + "</tbody>"
@@ -663,14 +663,14 @@
// TYPE PARAMETER IN INDEX
//=================================
{BUG_ID + FS + "index-all.html",
- "<span class=\"strong\"><a href=\"pkg2/Foo.html#method(java.util.Vector)\">" +
+ "<span class=\"strong\"><a href=\"pkg2/Foo.html#method-java.util.Vector-\">" +
"method(Vector<Object>)</a></span>"
},
//=================================
// TYPE PARAMETER IN INDEX
//=================================
{BUG_ID + FS + "index-all.html",
- "<span class=\"strong\"><a href=\"pkg2/Foo.html#method(java.util.Vector)\">" +
+ "<span class=\"strong\"><a href=\"pkg2/Foo.html#method-java.util.Vector-\">" +
"method(Vector<Object>)</a></span>"
},
};
--- a/langtools/test/com/sun/javadoc/testOverridenMethods/TestOverridenMethodDocCopy.java Fri Oct 11 03:09:42 2013 -0700
+++ b/langtools/test/com/sun/javadoc/testOverridenMethods/TestOverridenMethodDocCopy.java Fri Oct 11 23:31:06 2013 -0700
@@ -23,7 +23,7 @@
/*
* @test
- * @bug 4368820
+ * @bug 4368820 8025633
* @summary Inherited comment should link directly to member, not just
* class
* @author jamieh
@@ -47,7 +47,7 @@
private static final String[][] TEST = {
{BUG_ID + FS + "pkg1" + FS + "SubClass.html",
"<span class=\"strong\">Description copied from class: <code>" +
- "<a href=\"../pkg1/BaseClass.html#overridenMethodWithDocsToCopy()\">" +
+ "<a href=\"../pkg1/BaseClass.html#overridenMethodWithDocsToCopy--\">" +
"BaseClass</a></code></span>"
}
};
--- a/langtools/test/com/sun/javadoc/testOverridenMethods/TestOverridenPrivateMethodsWithPackageFlag.java Fri Oct 11 03:09:42 2013 -0700
+++ b/langtools/test/com/sun/javadoc/testOverridenMethods/TestOverridenPrivateMethodsWithPackageFlag.java Fri Oct 11 23:31:06 2013 -0700
@@ -23,7 +23,7 @@
/*
* @test
- * @bug 4634891
+ * @bug 4634891 8025633
* @summary Determine if overriden methods are properly documented when
* -protected (default) visibility flag is used.
* @author jamieh
@@ -41,14 +41,14 @@
//The public method should be overriden
{BUG_ID + FS + "pkg1" + FS + "SubClass.html",
"<dt><span class=\"strong\">Overrides:</span></dt>" + NL +
- "<dd><code><a href=\"../pkg1/BaseClass.html#publicMethod()\">" +
+ "<dd><code><a href=\"../pkg1/BaseClass.html#publicMethod--\">" +
"publicMethod</a></code> in class <code>" +
"<a href=\"../pkg1/BaseClass.html\" title=\"class in pkg1\">BaseClass</a></code></dd>"},
//The public method in different package should be overriden
{BUG_ID + FS + "pkg2" + FS + "SubClass.html",
"<dt><span class=\"strong\">Overrides:</span></dt>" + NL +
- "<dd><code><a href=\"../pkg1/BaseClass.html#publicMethod()\">" +
+ "<dd><code><a href=\"../pkg1/BaseClass.html#publicMethod--\">" +
"publicMethod</a></code> in class <code>" +
"<a href=\"../pkg1/BaseClass.html\" title=\"class in pkg1\">BaseClass</a></code></dd>"},
@@ -56,7 +56,7 @@
//package.
{BUG_ID + FS + "pkg1" + FS + "SubClass.html",
"<dt><span class=\"strong\">Overrides:</span></dt>" + NL +
- "<dd><code><a href=\"../pkg1/BaseClass.html#packagePrivateMethod()\">" +
+ "<dd><code><a href=\"../pkg1/BaseClass.html#packagePrivateMethod--\">" +
"packagePrivateMethod</a></code> in class <code>" +
"<a href=\"../pkg1/BaseClass.html\" title=\"class in pkg1\">BaseClass</a></code></dd>"}
};
--- a/langtools/test/com/sun/javadoc/testPrivateClasses/TestPrivateClasses.java Fri Oct 11 03:09:42 2013 -0700
+++ b/langtools/test/com/sun/javadoc/testPrivateClasses/TestPrivateClasses.java Fri Oct 11 23:31:06 2013 -0700
@@ -23,7 +23,7 @@
/*
* @test
- * @bug 4780441 4874845 4978816 8014017 8016328
+ * @bug 4780441 4874845 4978816 8014017 8016328 8025633
* @summary Make sure that when the -private flag is not used, members
* inherited from package private class are documented in the child.
*
@@ -66,7 +66,7 @@
// Method inheritence from non-public superclass.
{BUG_ID + "-1" + FS + "pkg" + FS + "PublicChild.html",
- "<a href=\"../pkg/PublicChild.html#methodInheritedFromParent(int)\">" +
+ "<a href=\"../pkg/PublicChild.html#methodInheritedFromParent-int-\">" +
"methodInheritedFromParent</a>"
},
@@ -78,7 +78,7 @@
// Method inheritence from non-public superinterface.
{BUG_ID + "-1" + FS + "pkg" + FS + "PublicInterface.html",
- "<a href=\"../pkg/PublicInterface.html#methodInterface(int)\">" +
+ "<a href=\"../pkg/PublicInterface.html#methodInterface-int-\">" +
"methodInterface</a>"
},
@@ -139,7 +139,7 @@
//Do not inherit private interface method with generic parameters.
//This method has been implemented.
{BUG_ID + "-1" + FS + "pkg2" + FS + "C.html",
- "<span class=\"strong\"><a href=\"../pkg2/I.html#hello(T)\">hello</a></span>"},
+ "<span class=\"strong\"><a href=\"../pkg2/I.html#hello-T-\">hello</a></span>"},
};
// Test output when -private flag is used.
@@ -171,20 +171,20 @@
"PrivateParent</a>"
},
{BUG_ID + "-2" + FS + "pkg" + FS + "PublicChild.html",
- "<a href=\"../pkg/PrivateParent.html#methodInheritedFromParent(int)\">" +
+ "<a href=\"../pkg/PrivateParent.html#methodInheritedFromParent-int-\">" +
"methodInheritedFromParent</a>"
},
// Should document that a method overrides method from private class.
{BUG_ID + "-2" + FS + "pkg" + FS + "PublicChild.html",
"<dt><span class=\"strong\">Overrides:</span></dt>" + NL +
- "<dd><code><a href=\"../pkg/PrivateParent.html#methodOverridenFromParent(char[],%20int,%20T,%20V,%20java.util.List)\">" +
+ "<dd><code><a href=\"../pkg/PrivateParent.html#methodOverridenFromParent-char:A-int-T-V-java.util.List-\">" +
"methodOverridenFromParent</a></code> in class <code>" +
"<a href=\"../pkg/PrivateParent.html\" title=\"class in pkg\">" +
"PrivateParent</a></code></dd>"},
// Should document that a method is specified by private interface.
{BUG_ID + "-2" + FS + "pkg" + FS + "PublicChild.html",
"<dt><span class=\"strong\">Specified by:</span></dt>" + NL +
- "<dd><code><a href=\"../pkg/PrivateInterface.html#methodInterface(int)\">" +
+ "<dd><code><a href=\"../pkg/PrivateInterface.html#methodInterface-int-\">" +
"methodInterface</a></code> in interface <code>" +
"<a href=\"../pkg/PrivateInterface.html\" title=\"interface in pkg\">" +
"PrivateInterface</a></code></dd>"},
@@ -195,7 +195,7 @@
"PrivateInterface</a>"
},
{BUG_ID + "-2" + FS + "pkg" + FS + "PrivateInterface.html",
- "<a href=\"../pkg/PrivateInterface.html#methodInterface(int)\">" +
+ "<a href=\"../pkg/PrivateInterface.html#methodInterface-int-\">" +
"methodInterface</a>"
},
// Should mention that any documentation was copied.
@@ -228,11 +228,11 @@
//with generic parameters has been implemented.
{BUG_ID + "-2" + FS + "pkg2" + FS + "C.html",
"<span class=\"strong\">Description copied from interface: <code>" +
- "<a href=\"../pkg2/I.html#hello(T)\">I</a></code></span>"},
+ "<a href=\"../pkg2/I.html#hello-T-\">I</a></code></span>"},
{BUG_ID + "-2" + FS + "pkg2" + FS + "C.html",
"<dt><span class=\"strong\">Specified by:</span></dt>" + NL +
- "<dd><code><a href=\"../pkg2/I.html#hello(T)\">hello</a></code>" +
+ "<dd><code><a href=\"../pkg2/I.html#hello-T-\">hello</a></code>" +
" in interface <code>" +
"<a href=\"../pkg2/I.html\" title=\"interface in pkg2\">I</a>" +
"<java.lang.String></code></dd>"},
--- a/langtools/test/com/sun/javadoc/testRepeatedAnnotations/TestRepeatedAnnotations.java Fri Oct 11 03:09:42 2013 -0700
+++ b/langtools/test/com/sun/javadoc/testRepeatedAnnotations/TestRepeatedAnnotations.java Fri Oct 11 23:31:06 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
@@ -56,7 +56,7 @@
{BUG_ID + FS + "pkg" + FS + "C.html",
"<a href=\"../pkg/RegContainerDoc.html\" " +
"title=\"annotation in pkg\">@RegContainerDoc</a>" +
- "(<a href=\"../pkg/RegContainerDoc.html#value()\">value</a>={" +
+ "(<a href=\"../pkg/RegContainerDoc.html#value--\">value</a>={" +
"<a href=\"../pkg/RegContaineeNotDoc.html\" " +
"title=\"annotation in pkg\">@RegContaineeNotDoc</a>," +
"<a href=\"../pkg/RegContaineeNotDoc.html\" " +
@@ -71,7 +71,7 @@
{BUG_ID + FS + "pkg" + FS + "C.html",
"<a href=\"../pkg/ContainerSynthDoc.html\" " +
"title=\"annotation in pkg\">@ContainerSynthDoc</a>(" +
- "<a href=\"../pkg/ContainerSynthDoc.html#value()\">value</a>=" +
+ "<a href=\"../pkg/ContainerSynthDoc.html#value--\">value</a>=" +
"<a href=\"../pkg/ContaineeSynthDoc.html\" " +
"title=\"annotation in pkg\">@ContaineeSynthDoc</a>)"},
{BUG_ID + FS + "pkg" + FS + "C.html",
@@ -82,37 +82,37 @@
{BUG_ID + FS + "pkg" + FS + "D.html",
"<a href=\"../pkg/RegDoc.html\" title=\"annotation in pkg\">@RegDoc</a>" +
- "(<a href=\"../pkg/RegDoc.html#x()\">x</a>=1)"},
+ "(<a href=\"../pkg/RegDoc.html#x--\">x</a>=1)"},
{BUG_ID + FS + "pkg" + FS + "D.html",
"<a href=\"../pkg/RegArryDoc.html\" title=\"annotation in pkg\">@RegArryDoc</a>" +
- "(<a href=\"../pkg/RegArryDoc.html#y()\">y</a>=1)"},
+ "(<a href=\"../pkg/RegArryDoc.html#y--\">y</a>=1)"},
{BUG_ID + FS + "pkg" + FS + "D.html",
"<a href=\"../pkg/RegArryDoc.html\" title=\"annotation in pkg\">@RegArryDoc</a>" +
- "(<a href=\"../pkg/RegArryDoc.html#y()\">y</a>={1,2})"},
+ "(<a href=\"../pkg/RegArryDoc.html#y--\">y</a>={1,2})"},
{BUG_ID + FS + "pkg" + FS + "D.html",
"<a href=\"../pkg/NonSynthDocContainer.html\" " +
"title=\"annotation in pkg\">@NonSynthDocContainer</a>" +
- "(<a href=\"../pkg/NonSynthDocContainer.html#value()\">value</a>=" +
+ "(<a href=\"../pkg/NonSynthDocContainer.html#value--\">value</a>=" +
"<a href=\"../pkg/RegArryDoc.html\" title=\"annotation in pkg\">@RegArryDoc</a>)"},
{BUG_ID + FS + "pkg1" + FS + "C.html",
"<a href=\"../pkg1/RegContainerValDoc.html\" " +
"title=\"annotation in pkg1\">@RegContainerValDoc</a>" +
- "(<a href=\"../pkg1/RegContainerValDoc.html#value()\">value</a>={" +
+ "(<a href=\"../pkg1/RegContainerValDoc.html#value--\">value</a>={" +
"<a href=\"../pkg1/RegContaineeNotDoc.html\" " +
"title=\"annotation in pkg1\">@RegContaineeNotDoc</a>," +
"<a href=\"../pkg1/RegContaineeNotDoc.html\" " +
"title=\"annotation in pkg1\">@RegContaineeNotDoc</a>}," +
- "<a href=\"../pkg1/RegContainerValDoc.html#y()\">y</a>=3)"},
+ "<a href=\"../pkg1/RegContainerValDoc.html#y--\">y</a>=3)"},
{BUG_ID + FS + "pkg1" + FS + "C.html",
"<a href=\"../pkg1/ContainerValDoc.html\" " +
"title=\"annotation in pkg1\">@ContainerValDoc</a>" +
- "(<a href=\"../pkg1/ContainerValDoc.html#value()\">value</a>={" +
+ "(<a href=\"../pkg1/ContainerValDoc.html#value--\">value</a>={" +
"<a href=\"../pkg1/ContaineeNotDoc.html\" " +
"title=\"annotation in pkg1\">@ContaineeNotDoc</a>," +
"<a href=\"../pkg1/ContaineeNotDoc.html\" " +
"title=\"annotation in pkg1\">@ContaineeNotDoc</a>}," +
- "<a href=\"../pkg1/ContainerValDoc.html#x()\">x</a>=1)"}
+ "<a href=\"../pkg1/ContainerValDoc.html#x--\">x</a>=1)"}
};
private static final String[][] NEGATED_TEST = {
@@ -124,7 +124,7 @@
{BUG_ID + FS + "pkg" + FS + "C.html",
"<a href=\"../pkg/RegContainerNotDoc.html\" " +
"title=\"annotation in pkg\">@RegContainerNotDoc</a>" +
- "(<a href=\"../pkg/RegContainerNotDoc.html#value()\">value</a>={" +
+ "(<a href=\"../pkg/RegContainerNotDoc.html#value--\">value</a>={" +
"<a href=\"../pkg/RegContaineeNotDoc.html\" " +
"title=\"annotation in pkg\">@RegContaineeNotDoc</a>," +
"<a href=\"../pkg/RegContaineeNotDoc.html\" " +
@@ -138,25 +138,25 @@
{BUG_ID + FS + "pkg1" + FS + "C.html",
"<a href=\"../pkg1/RegContainerValNotDoc.html\" " +
"title=\"annotation in pkg1\">@RegContainerValNotDoc</a>" +
- "(<a href=\"../pkg1/RegContainerValNotDoc.html#value()\">value</a>={" +
+ "(<a href=\"../pkg1/RegContainerValNotDoc.html#value--\">value</a>={" +
"<a href=\"../pkg1/RegContaineeDoc.html\" " +
"title=\"annotation in pkg1\">@RegContaineeDoc</a>," +
"<a href=\"../pkg1/RegContaineeDoc.html\" " +
"title=\"annotation in pkg1\">@RegContaineeDoc</a>}," +
- "<a href=\"../pkg1/RegContainerValNotDoc.html#y()\">y</a>=4)"},
+ "<a href=\"../pkg1/RegContainerValNotDoc.html#y--\">y</a>=4)"},
{BUG_ID + FS + "pkg1" + FS + "C.html",
"<a href=\"../pkg1/ContainerValNotDoc.html\" " +
"title=\"annotation in pkg1\">@ContainerValNotDoc</a>" +
- "(<a href=\"../pkg1/ContainerValNotDoc.html#value()\">value</a>={" +
+ "(<a href=\"../pkg1/ContainerValNotDoc.html#value--\">value</a>={" +
"<a href=\"../pkg1/ContaineeNotDoc.html\" " +
"title=\"annotation in pkg1\">@ContaineeNotDoc</a>," +
"<a href=\"../pkg1/ContaineeNotDoc.html\" " +
"title=\"annotation in pkg1\">@ContaineeNotDoc</a>}," +
- "<a href=\"../pkg1/ContainerValNotDoc.html#x()\">x</a>=2)"},
+ "<a href=\"../pkg1/ContainerValNotDoc.html#x--\">x</a>=2)"},
{BUG_ID + FS + "pkg1" + FS + "C.html",
"<a href=\"../pkg1/ContainerSynthNotDoc.html\" " +
"title=\"annotation in pkg1\">@ContainerSynthNotDoc</a>(" +
- "<a href=\"../pkg1/ContainerSynthNotDoc.html#value()\">value</a>=" +
+ "<a href=\"../pkg1/ContainerSynthNotDoc.html#value--\">value</a>=" +
"<a href=\"../pkg1/ContaineeSynthDoc.html\" " +
"title=\"annotation in pkg1\">@ContaineeSynthDoc</a>)"}
};
--- a/langtools/test/com/sun/javadoc/testSerializedFormDeprecationInfo/TestSerializedFormDeprecationInfo.java Fri Oct 11 03:09:42 2013 -0700
+++ b/langtools/test/com/sun/javadoc/testSerializedFormDeprecationInfo/TestSerializedFormDeprecationInfo.java Fri Oct 11 23:31:06 2013 -0700
@@ -25,7 +25,7 @@
/*
* @test
- * @bug 6802694
+ * @bug 6802694 8025633
* @summary This test verifies deprecation info in serialized-form.html.
* @author Bhavesh Patel
* @library ../lib/
@@ -44,21 +44,21 @@
{BUG_ID + FS + "serialized-form.html", "<dl>" + NL +
"<dt><span class=\"strong\">Throws:</span></dt>" + NL + "<dd><code>" +
"java.io.IOException</code></dd>"+ NL + "<dt><span class=\"strong\">See Also:</span>" +
- "</dt>" + NL + "<dd><a href=\"pkg1/C1.html#setUndecorated(boolean)\">" +
+ "</dt>" + NL + "<dd><a href=\"pkg1/C1.html#setUndecorated-boolean-\">" +
"<code>C1.setUndecorated(boolean)</code></a></dd>" + NL + "</dl>"},
{BUG_ID + FS + "serialized-form.html", "<span class=\"strong\">Deprecated.</span>" +
" <span class=\"italic\">As of JDK version 1.5, replaced by" + NL +
- " <a href=\"pkg1/C1.html#setUndecorated(boolean)\">" +
+ " <a href=\"pkg1/C1.html#setUndecorated-boolean-\">" +
"<code>setUndecorated(boolean)</code></a>.</span></div>" + NL +
"<div class=\"block\">This field indicates whether the C1 " +
"is undecorated.</div>" + NL + " " + NL +
"<dl>" + NL + "<dt><span class=\"strong\">Since:</span></dt>" + NL +
"<dd>1.4</dd>" + NL + "<dt><span class=\"strong\">See Also:</span>" +
- "</dt>" + NL + "<dd><a href=\"pkg1/C1.html#setUndecorated(boolean)\">" +
+ "</dt>" + NL + "<dd><a href=\"pkg1/C1.html#setUndecorated-boolean-\">" +
"<code>C1.setUndecorated(boolean)</code></a></dd>" + NL + "</dl>"},
{BUG_ID + FS + "serialized-form.html", "<span class=\"strong\">Deprecated.</span>" +
" <span class=\"italic\">As of JDK version 1.5, replaced by" + NL +
- " <a href=\"pkg1/C1.html#setUndecorated(boolean)\">" +
+ " <a href=\"pkg1/C1.html#setUndecorated-boolean-\">" +
"<code>setUndecorated(boolean)</code></a>.</span></div>" + NL +
"<div class=\"block\">Reads the object stream.</div>" + NL +
"<dl>" + NL + "<dt><span class=\"strong\">Throws:</span></dt>" + NL + "<dd><code><code>" +
@@ -75,12 +75,12 @@
{BUG_ID + FS + "serialized-form.html", "<pre>boolean undecorated</pre>" + NL +
"<div class=\"block\"><span class=\"strong\">Deprecated.</span> <span class=\"italic\">" +
"As of JDK version 1.5, replaced by" + NL +
- " <a href=\"pkg1/C1.html#setUndecorated(boolean)\"><code>" +
+ " <a href=\"pkg1/C1.html#setUndecorated-boolean-\"><code>" +
"setUndecorated(boolean)</code></a>.</span></div>" + NL + "</li>"},
{BUG_ID + FS + "serialized-form.html", "<span class=\"strong\">" +
"Deprecated.</span> <span class=\"italic\">As of JDK version" +
" 1.5, replaced by" + NL +
- " <a href=\"pkg1/C1.html#setUndecorated(boolean)\">" +
+ " <a href=\"pkg1/C1.html#setUndecorated-boolean-\">" +
"<code>setUndecorated(boolean)</code></a>.</span></div>" + NL + "</li>"}};
// Test with -nodeprecated option. The serialized-form.html should
--- a/langtools/test/com/sun/javadoc/testTaglets/TestTaglets.java Fri Oct 11 03:09:42 2013 -0700
+++ b/langtools/test/com/sun/javadoc/testTaglets/TestTaglets.java Fri Oct 11 23:31:06 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -23,7 +23,7 @@
/*
* @test
- * @bug 4654308 4767038
+ * @bug 4654308 4767038 8025633
* @summary Use a Taglet and include some inline tags such as {@link}. The
* inline tags should be interpreted properly.
* Run Javadoc on some sample source that uses {@inheritDoc}. Make
@@ -56,7 +56,7 @@
//Input for string search tests.
private static final String[][] TEST_4654308 = new String[][] {
{"4654308" + FS + "C.html", "<span class=\"strong\">Foo:</span></dt>" +
- "<dd>my only method is <a href=\"C.html#method()\"><code>here" +
+ "<dd>my only method is <a href=\"C.html#method--\"><code>here" +
"</code></a></dd></dl>"}
};
private static final String[][] NEGATED_TEST_4654308 = NO_TEST;
--- a/langtools/test/com/sun/javadoc/testTypeAnnotations/TestTypeAnnotations.java Fri Oct 11 03:09:42 2013 -0700
+++ b/langtools/test/com/sun/javadoc/testTypeAnnotations/TestTypeAnnotations.java Fri Oct 11 23:31:06 2013 -0700
@@ -23,7 +23,7 @@
/*
* @test
- * @bug 8005091 8009686
+ * @bug 8005091 8009686 8025633
* @summary Make sure that type annotations are displayed correctly
* @author Bhavesh Patel
* @library ../lib/
@@ -272,13 +272,13 @@
"<pre>void oneException()" + NL +
" throws <a href=\"../typeannos/ThrB.html\" title=\"" +
"annotation in typeannos\">@ThrB</a>(<a href=\"../typeannos/" +
- "ThrB.html#value()\">value</a>=\"m\") java.lang.Exception</pre>"
+ "ThrB.html#value--\">value</a>=\"m\") java.lang.Exception</pre>"
},
{BUG_ID + FS + "typeannos" + FS + "ThrWithValue.html",
"<pre>void twoExceptions()" + NL +
" throws <a href=\"../typeannos/ThrB.html\" title=\"" +
"annotation in typeannos\">@ThrB</a>(<a href=\"../typeannos/" +
- "ThrB.html#value()\">value</a>=\"m\") java.lang.RuntimeException," + NL +
+ "ThrB.html#value--\">value</a>=\"m\") java.lang.RuntimeException," + NL +
" <a href=\"../typeannos/ThrA.html\" title=\"" +
"annotation in typeannos\">@ThrA</a> java.lang.Exception</pre>"
},
@@ -307,14 +307,14 @@
"<pre>void wcSuper(<a href=\"../typeannos/MyList.html\" title=\"" +
"class in typeannos\">MyList</a><? super <a href=\"../typeannos/" +
"WldB.html\" title=\"annotation in typeannos\">@WldB</a>(<a href=\"" +
- "../typeannos/WldB.html#value()\">value</a>=\"m\") java.lang." +
+ "../typeannos/WldB.html#value--\">value</a>=\"m\") java.lang." +
"String> l)</pre>"
},
{BUG_ID + FS + "typeannos" + FS + "BoundWithValue.html",
"<pre><a href=\"../typeannos/MyList.html\" title=\"class in " +
"typeannos\">MyList</a><? extends <a href=\"../typeannos/WldB." +
"html\" title=\"annotation in typeannos\">@WldB</a>(<a href=\"../" +
- "typeannos/WldB.html#value()\">value</a>=\"m\") java.lang.String" +
+ "typeannos/WldB.html#value--\">value</a>=\"m\") java.lang.String" +
"> returnWcExtends()</pre>"
},
@@ -329,7 +329,7 @@
"<pre>java.lang.String nonVoid(<a href=\"../typeannos/RcvrA." +
"html\" title=\"annotation in typeannos\">@RcvrA</a> <a href=\"../" +
"typeannos/RcvrB.html\" title=\"annotation in typeannos\">@RcvrB" +
- "</a>(<a href=\"../typeannos/RcvrB.html#value()\">value</a>=\"m\")" +
+ "</a>(<a href=\"../typeannos/RcvrB.html#value--\">value</a>=\"m\")" +
" DefaultUnmodified this)</pre>"
},
{BUG_ID + FS + "typeannos" + FS + "DefaultUnmodified.html",
@@ -354,7 +354,7 @@
{BUG_ID + FS + "typeannos" + FS + "WithValue.html",
"<pre><T extends java.lang.Runnable> void accept(" +
"<a href=\"../typeannos/RcvrB.html\" title=\"annotation in " +
- "typeannos\">@RcvrB</a>(<a href=\"../typeannos/RcvrB.html#value()\">" +
+ "typeannos\">@RcvrB</a>(<a href=\"../typeannos/RcvrB.html#value--\">" +
"value</a>=\"m\") WithValue this," + NL +
" T r)" + NL +
" throws java.lang.Exception</pre>"
@@ -362,7 +362,7 @@
{BUG_ID + FS + "typeannos" + FS + "WithFinal.html",
"<pre>java.lang.String nonVoid(<a href=\"../typeannos/RcvrB." +
"html\" title=\"annotation in typeannos\">@RcvrB</a>(<a href=\"../" +
- "typeannos/RcvrB.html#value()\">value</a>=\"m\") WithFinal" +
+ "typeannos/RcvrB.html#value--\">value</a>=\"m\") WithFinal" +
" this)</pre>"
},
{BUG_ID + FS + "typeannos" + FS + "WithBody.html",
--- a/langtools/test/com/sun/javadoc/testTypeParams/TestTypeParameters.java Fri Oct 11 03:09:42 2013 -0700
+++ b/langtools/test/com/sun/javadoc/testTypeParams/TestTypeParameters.java Fri Oct 11 23:31:06 2013 -0700
@@ -23,7 +23,7 @@
/*
* @test
- * @bug 4927167 4974929 7010344
+ * @bug 4927167 4974929 7010344 8025633
* @summary When the type parameters are more than 10 characters in length,
* make sure there is a line break between type params and return type
* in member summary. Also, test for type parameter links in package-summary and
@@ -71,7 +71,7 @@
},
//Nested type parameters
{BUG_ID + FS + "pkg" + FS + "C.html",
- "<a name=\"formatDetails(java.util.Collection, java.util.Collection)\">" + NL +
+ "<a name=\"formatDetails-java.util.Collection-java.util.Collection-\">" + NL +
"<!-- -->" + NL +
"</a>"
},
--- a/langtools/test/com/sun/javadoc/testWarnings/TestWarnings.java Fri Oct 11 03:09:42 2013 -0700
+++ b/langtools/test/com/sun/javadoc/testWarnings/TestWarnings.java Fri Oct 11 23:31:06 2013 -0700
@@ -23,7 +23,7 @@
/*
* @test
- * @bug 4515705 4804296 4702454 4697036
+ * @bug 4515705 4804296 4702454 4697036 8025633
* @summary Make sure that first sentence warning only appears once.
* Make sure that only warnings/errors are printed when quiet is used.
* Make sure that links to private/unincluded methods do not cause
@@ -65,8 +65,8 @@
};
private static final String[][] TEST2 = {
- {BUG_ID + FS + "pkg" + FS + "X.html", "<a href=\"../pkg/X.html#m()\"><code>m()</code></a><br/>"},
- {BUG_ID + FS + "pkg" + FS + "X.html", "<a href=\"../pkg/X.html#X()\"><code>X()</code></a><br/>"},
+ {BUG_ID + FS + "pkg" + FS + "X.html", "<a href=\"../pkg/X.html#m--\"><code>m()</code></a><br/>"},
+ {BUG_ID + FS + "pkg" + FS + "X.html", "<a href=\"../pkg/X.html#X--\"><code>X()</code></a><br/>"},
{BUG_ID + FS + "pkg" + FS + "X.html", "<a href=\"../pkg/X.html#f\"><code>f</code></a><br/>"},
};
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/classfile/TestAnonInnerClasses.java Fri Oct 11 23:31:06 2013 -0700
@@ -0,0 +1,439 @@
+/*
+ * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8005085 8008762 8008751 8013065 8015323 8015257
+ * @summary Type annotations on anonymous and inner class.
+ * Six TYPE_USE annotations are repeated(or not); Four combinations create
+ * four test files, and each results in the test class and 2 anonymous classes.
+ * Each element of these three classes is checked for expected number of the
+ * four annotation Attributes. Expected annotation counts depend on type of
+ * annotation place on type of element (a FIELD&TYPE_USE element on a field
+ * results in 2). Elements with no annotations expect 0.
+ * Source template is read in from testanoninner.template
+ *
+ */
+import java.lang.annotation.*;
+import java.io.*;
+import java.util.List;
+import java.util.LinkedList;
+import com.sun.tools.classfile.*;
+import java.nio.file.Files;
+import java.nio.charset.*;
+import java.io.File;
+import java.io.IOException;
+
+
+import java.lang.annotation.*;
+import static java.lang.annotation.RetentionPolicy.*;
+import static java.lang.annotation.ElementType.*;
+
+/*
+ * A source template is read in and testname and annotations are inserted
+ * via replace().
+ */
+public class TestAnonInnerClasses extends ClassfileTestHelper {
+ // tally errors and test cases
+ int errors = 0;
+ int checks = 0;
+ //Note expected test count in case of skips due to bugs.
+ int tc = 0, xtc = 180; // 45 x 4 variations of repeated annotations.
+ File testSrc = new File(System.getProperty("test.src"));
+
+ String[] AnnoAttributes = {
+ Attribute.RuntimeVisibleTypeAnnotations,
+ Attribute.RuntimeInvisibleTypeAnnotations,
+ Attribute.RuntimeVisibleAnnotations,
+ Attribute.RuntimeInvisibleAnnotations
+ };
+
+ // template for source files
+ String srcTemplate = "testanoninner.template";
+
+ // Four test files generated based on combinations of repeating annotations.
+ Boolean As= false, Bs=true, Cs=false, Ds=false, TAs=false,TBs=false;
+ Boolean[][] bRepeat = new Boolean[][]{
+ /* no repeats */ {false, false, false, false, false, false},
+ /* repeat A,C,TA */ {true, false, true, false, true, false},
+ /* repeat B,D,TB */ {false, true, false, true, false, true},
+ /* repeat all */ {true, true, true, true, true, true}
+ };
+ // Save descriptions of failed test case; does not terminate upon a failure.
+ List<String> failed = new LinkedList<>();
+
+ public static void main(String[] args) throws Exception {
+ new TestAnonInnerClasses().run();
+ }
+
+ // Check annotation counts and make reports sufficiently descriptive to
+ // easily diagnose.
+ void check(String testcase, int vtaX, int itaX, int vaX, int iaX,
+ int vtaA, int itaA, int vaA, int iaA) {
+
+ String descr = " checking " + testcase+" _TYPE_, expected: " +
+ vtaX + ", " + itaX + ", " + vaX + ", " + iaX + "; actual: " +
+ vtaA + ", " + itaA + ", " + vaA + ", " + iaA;
+ String description;
+ description=descr.replace("_TYPE_","RuntimeVisibleTypeAnnotations");
+ if (vtaX != vtaA) {
+ errors++;
+ failed.add(++checks + " " + testcase + ": (vtaX) " + vtaX +
+ " != " + vtaA + " (vtaA)");
+ println(checks + " FAIL: " + description);
+ } else {
+ println(++checks + " PASS: " + description);
+ }
+ description=descr.replace("_TYPE_","RuntimeInvisibleTypeAnnotations");
+ if (itaX != itaA) {
+ errors++;
+ failed.add(++checks + " " + testcase + ": (itaX) " + itaX + " != " +
+ itaA + " (itaA)");
+ println(checks + " FAIL: " + description);
+ } else {
+ println(++checks + " PASS: " + description);
+ }
+ description=descr.replace("_TYPE_","RuntimeVisibleAnnotations");
+ if (vaX != vaA) {
+ errors++;
+ failed.add(++checks + " " + testcase + ": (vaX) " + vaX + " != " +
+ vaA + " (vaA)");
+ println(checks + " FAIL: " + description);
+ } else {
+ println(++checks + " PASS: " + description);
+ }
+ description=descr.replace("_TYPE_","RuntimeInvisibleAnnotations");
+ if (iaX != iaA) {
+ errors++;
+ failed.add(++checks + " " + testcase + ": (iaX) " + iaX + " != " +
+ iaA + " (iaA)");
+ println(checks + " FAIL: " + description);
+ } else {
+ println(++checks + " PASS: " + description);
+ }
+ println("");
+ }
+
+ // Print failed cases (if any) and throw exception for fail.
+ void report() {
+ if (errors!=0) {
+ System.err.println("Failed tests: " + errors +
+ "\nfailed test cases:\n");
+ for (String t: failed) System.err.println(" " + t);
+ throw new RuntimeException("FAIL: There were test failures.");
+ } else
+ System.out.println("PASSED all tests.");
+ }
+
+ void test(String ttype, ClassFile cf, Method m, Field f, boolean visible) {
+ int vtaActual = 0,
+ itaActual = 0,
+ vaActual = 0,
+ iaActual = 0,
+ vtaExp = 0,
+ itaExp = 0,
+ vaExp = 0,
+ iaExp = 0,
+ index = 0,
+ index2 = 0;
+ String memberName = null,
+ testcase = "undefined",
+ testClassName = null;
+ Attribute attr = null,
+ cattr = null;
+ Code_attribute CAttr = null;
+ // Get counts of 4 annotation Attributes on element being checked.
+ for (String AnnoType : AnnoAttributes) {
+ try {
+ switch (ttype) {
+ case "METHOD":
+ index = m.attributes.getIndex(cf.constant_pool,
+ AnnoType);
+ memberName = m.getName(cf.constant_pool);
+ if (index != -1)
+ attr = m.attributes.get(index);
+ //fetch index annotations from code attribute.
+ index2 = m.attributes.getIndex(cf.constant_pool,
+ Attribute.Code);
+ if (index2 != -1) {
+ cattr = m.attributes.get(index2);
+ assert cattr instanceof Code_attribute;
+ CAttr = (Code_attribute)cattr;
+ index2 = CAttr.attributes.getIndex(cf.constant_pool,
+ AnnoType);
+ if (index2 != -1)
+ cattr = CAttr.attributes.get(index2);
+ }
+ break;
+ case "FIELD":
+ index = f.attributes.getIndex(cf.constant_pool,
+ AnnoType);
+ memberName = f.getName(cf.constant_pool);
+ if (index != -1)
+ attr = f.attributes.get(index);
+ //fetch index annotations from code attribute.
+ index2 = cf.attributes.getIndex(cf.constant_pool,
+ Attribute.Code);
+ if (index2!= -1) {
+ cattr = cf.attributes.get(index2);
+ assert cattr instanceof Code_attribute;
+ CAttr = (Code_attribute)cattr;
+ index2 = CAttr.attributes.getIndex(cf.constant_pool,
+ AnnoType);
+ if (index2!= -1)
+ cattr = CAttr.attributes.get(index2);
+ }
+ break;
+
+ default:
+ memberName = cf.getName();
+ index = cf.attributes.getIndex(cf.constant_pool,
+ AnnoType);
+ if (index!= -1) attr = cf.attributes.get(index);
+ break;
+ }
+ }
+ catch (ConstantPoolException cpe) { cpe.printStackTrace(); }
+ try {
+ testClassName=cf.getName();
+ testcase = ttype + ": " + testClassName + ": " +
+ memberName + ", ";
+ }
+ catch (ConstantPoolException cpe) { cpe.printStackTrace(); }
+ if (index != -1) {
+ switch (AnnoType) {
+ case Attribute.RuntimeVisibleTypeAnnotations:
+ //count RuntimeVisibleTypeAnnotations
+ RuntimeVisibleTypeAnnotations_attribute RVTAa =
+ (RuntimeVisibleTypeAnnotations_attribute)attr;
+ vtaActual += RVTAa.annotations.length;
+ break;
+ case Attribute.RuntimeVisibleAnnotations:
+ //count RuntimeVisibleAnnotations
+ RuntimeVisibleAnnotations_attribute RVAa =
+ (RuntimeVisibleAnnotations_attribute)attr;
+ vaActual += RVAa.annotations.length;
+ break;
+ case Attribute.RuntimeInvisibleTypeAnnotations:
+ //count RuntimeInvisibleTypeAnnotations
+ RuntimeInvisibleTypeAnnotations_attribute RITAa =
+ (RuntimeInvisibleTypeAnnotations_attribute)attr;
+ itaActual += RITAa.annotations.length;
+ break;
+ case Attribute.RuntimeInvisibleAnnotations:
+ //count RuntimeInvisibleAnnotations
+ RuntimeInvisibleAnnotations_attribute RIAa =
+ (RuntimeInvisibleAnnotations_attribute)attr;
+ iaActual += RIAa.annotations.length;
+ break;
+ }
+ }
+ // annotations from code attribute.
+ if (index2 != -1) {
+ switch (AnnoType) {
+ case Attribute.RuntimeVisibleTypeAnnotations:
+ //count RuntimeVisibleTypeAnnotations
+ RuntimeVisibleTypeAnnotations_attribute RVTAa =
+ (RuntimeVisibleTypeAnnotations_attribute)cattr;
+ vtaActual += RVTAa.annotations.length;
+ break;
+ case Attribute.RuntimeVisibleAnnotations:
+ //count RuntimeVisibleAnnotations
+ RuntimeVisibleAnnotations_attribute RVAa =
+ (RuntimeVisibleAnnotations_attribute)cattr;
+ vaActual += RVAa.annotations.length;
+ break;
+ case Attribute.RuntimeInvisibleTypeAnnotations:
+ //count RuntimeInvisibleTypeAnnotations
+ RuntimeInvisibleTypeAnnotations_attribute RITAa =
+ (RuntimeInvisibleTypeAnnotations_attribute)cattr;
+ itaActual += RITAa.annotations.length;
+ break;
+ case Attribute.RuntimeInvisibleAnnotations:
+ //count RuntimeInvisibleAnnotations
+ RuntimeInvisibleAnnotations_attribute RIAa =
+ (RuntimeInvisibleAnnotations_attribute)cattr;
+ iaActual += RIAa.annotations.length;
+ break;
+ }
+ }
+ }
+
+ switch (memberName) {
+ //METHODs
+ case "test" : vtaExp=4; itaExp=4; vaExp=0; iaExp=0; tc++; break;
+ case "mtest": vtaExp=4; itaExp=4; vaExp=1; iaExp=1; tc++; break;
+ case "m1": vtaExp=2; itaExp=2; vaExp=1; iaExp=1; tc++; break;
+ case "m2": vtaExp=4; itaExp=4; vaExp=1; iaExp=1; tc++; break;
+ case "m3": vtaExp=10; itaExp=10; vaExp=1; iaExp=1; tc++; break;
+ case "tm": vtaExp=6; itaExp=6; vaExp=1; iaExp=1; tc++; break;
+ //inner class
+ case "i_m1": vtaExp=2; itaExp=2; vaExp=1; iaExp=1; tc++; break;
+ case "i_m2": vtaExp=4; itaExp=4; vaExp=1; iaExp=1; tc++; break;
+ case "i_um": vtaExp=6; itaExp=6; vaExp=1; iaExp=1; tc++; break;
+ //local class
+ case "l_m1": vtaExp=2; itaExp=2; vaExp=1; iaExp=1; tc++; break;
+ case "l_m2": vtaExp=4; itaExp=4; vaExp=1; iaExp=1; tc++; break;
+ case "l_um": vtaExp=6; itaExp=6; vaExp=1; iaExp=1; tc++; break;
+ //anon class
+ case "mm_m1": vtaExp=2; itaExp=2; vaExp=1; iaExp=1; tc++; break;
+ case "mm_m2": vtaExp=4; itaExp=4; vaExp=1; iaExp=1; tc++; break;
+ case "mm_m3": vtaExp=10; itaExp=10;vaExp=1; iaExp=1; tc++; break;
+ case "mm_tm": vtaExp=6; itaExp=6; vaExp=1; iaExp=1; tc++; break;
+ //InnerAnon class
+ case "ia_m1": vtaExp=2; itaExp=2; vaExp=1; iaExp=1; tc++; break;
+ case "ia_m2": vtaExp=4; itaExp=4; vaExp=1; iaExp=1; tc++; break;
+ case "ia_um": vtaExp=6; itaExp=6; vaExp=1; iaExp=1; tc++; break;
+ //FIELDs
+ case "data": vtaExp = 2; itaExp=2; vaExp=1; iaExp=1; tc++; break;
+ case "odata1": vtaExp = 2; itaExp=2; vaExp=1; iaExp=1; tc++; break;
+ case "pdata1": vtaExp = 2; itaExp=2; vaExp=1; iaExp=1; tc++; break;
+ case "tdata": vtaExp = 2; itaExp=2; vaExp=1; iaExp=1; tc++; break;
+ case "sa1": vtaExp = 6; itaExp=6; vaExp=1; iaExp=1; tc++; break;
+ //inner class
+ case "i_odata1": vtaExp=2; itaExp=2; vaExp=1; iaExp=1; tc++; break;
+ case "i_pdata1": vtaExp=2; itaExp=2; vaExp=1; iaExp=1; tc++; break;
+ case "i_udata": vtaExp=2; itaExp=2; vaExp=1; iaExp=1; tc++; break;
+ case "i_sa1": vtaExp=6; itaExp=6; vaExp=1; iaExp=1; tc++; break;
+ case "i_tdata": vtaExp=2; itaExp=2; vaExp=1; iaExp=1; tc++; break;
+ //local class
+ case "l_odata1": vtaExp=2; itaExp=2; vaExp=1; iaExp=1; tc++; break;
+ case "l_pdata1": vtaExp=2; itaExp=2; vaExp=1; iaExp=1; tc++; break;
+ case "l_udata": vtaExp=2; itaExp=2; vaExp=1; iaExp=1; tc++; break;
+ case "l_sa1": vtaExp=6; itaExp=6; vaExp=1; iaExp=1; tc++; break;
+ case "l_tdata": vtaExp=2; itaExp=2; vaExp=1; iaExp=1; tc++; break;
+ //anon class
+ case "mm_odata1": vtaExp = 2; itaExp=2; vaExp=1; iaExp=1; tc++; break;
+ case "mm_pdata1": vtaExp = 2; itaExp=2; vaExp=1; iaExp=1; tc++; break;
+ case "mm_sa1": vtaExp = 6; itaExp=6; vaExp=1; iaExp=1; tc++; break;
+ case "mm_tdata": vtaExp = 2; itaExp=2; vaExp=1; iaExp=1; tc++; break;
+ // InnerAnon class
+ case "ia_odata1": vtaExp=2; itaExp=2; vaExp=1; iaExp=1; tc++; break;
+ case "ia_pdata1": vtaExp=2; itaExp=2; vaExp=1; iaExp=1; tc++; break;
+ case "ia_udata": vtaExp=2; itaExp=2; vaExp=1; iaExp=1; tc++; break;
+ case "ia_sa1": vtaExp=6; itaExp=6; vaExp=1; iaExp=1; tc++; break;
+ case "ia_tdata": vtaExp=2; itaExp=2; vaExp=1; iaExp=1; tc++; break;
+ case "IA": vtaExp=4; itaExp=4; vaExp=1; iaExp=1; tc++; break;
+ case "IN": vtaExp=4; itaExp=4; vaExp=1; iaExp=1; tc++; break;
+ // default cases are <init>, this$0, this$1, mmtest, atest
+ default: vtaExp = 0; itaExp=0; vaExp=0; iaExp=0; break;
+ }
+ check(testcase,vtaExp, itaExp, vaExp, iaExp,
+ vtaActual,itaActual,vaActual,iaActual);
+ }
+
+ public void run() {
+ ClassFile cf = null;
+ InputStream in = null;
+ int testcount = 1;
+ File testFile = null;
+ // Generate source, check methods and fields for each combination.
+ for (Boolean[] bCombo : bRepeat) {
+ As=bCombo[0]; Bs=bCombo[1]; Cs=bCombo[2];
+ Ds=bCombo[3]; TAs=bCombo[4]; TBs=bCombo[5];
+ String testname = "Test" + testcount++;
+ println("Combinations: " + As + ", " + Bs + ", " + Cs + ", " + Ds +
+ ", " + TAs + ", " + TBs +
+ "; see " + testname + ".java");
+ String[] classes = {testname + ".class",
+ testname + "$Inner.class",
+ testname + "$1Local1.class",
+ testname + "$1.class",
+ testname + "$1$1.class",
+ testname + "$1$InnerAnon.class"
+ };
+ // Create test source, create and compile File.
+ String sourceString = getSource(srcTemplate, testname,
+ As, Bs, Cs, Ds, TAs, TBs);
+ System.out.println(sourceString);
+ try {
+ testFile = writeTestFile(testname+".java", sourceString);
+ }
+ catch (IOException ioe) { ioe.printStackTrace(); }
+ // Compile test source and read classfile.
+ File classFile = null;
+ try {
+ classFile = compile(testFile);
+ }
+ catch (Error err) {
+ System.err.println("FAILED compile. Source:\n" + sourceString);
+ throw err;
+ }
+ String testloc = classFile.getAbsolutePath().substring(
+ 0,classFile.getAbsolutePath().indexOf(classFile.getPath()));
+ for (String clazz : classes) {
+ try {
+ cf = ClassFile.read(new File(testloc+clazz));
+ }
+ catch (Exception e) { e.printStackTrace(); }
+ // Test for all methods and fields
+ for (Method m: cf.methods) {
+ test("METHOD", cf, m, null, true);
+ }
+ for (Field f: cf.fields) {
+ test("FIELD", cf, null, f, true);
+ }
+ }
+ }
+ report();
+ if (tc!=xtc) System.out.println("Test Count: " + tc + " != " +
+ "expected: " + xtc);
+ }
+
+
+ String getSrcTemplate(String sTemplate) {
+ List<String> tmpl = null;
+ String sTmpl = "";
+ try {
+ tmpl = Files.readAllLines(new File(testSrc,sTemplate).toPath(),
+ Charset.defaultCharset());
+ }
+ catch (IOException ioe) {
+ String error = "FAILED: Test failed to read template" + sTemplate;
+ ioe.printStackTrace();
+ throw new RuntimeException(error);
+ }
+ for (String l : tmpl)
+ sTmpl=sTmpl.concat(l).concat("\n");
+ return sTmpl;
+ }
+
+ // test class template
+ String getSource(String templateName, String testname,
+ Boolean Arepeats, Boolean Brepeats,
+ Boolean Crepeats, Boolean Drepeats,
+ Boolean TArepeats, Boolean TBrepeats) {
+ String As = Arepeats ? "@A @A":"@A",
+ Bs = Brepeats ? "@B @B":"@B",
+ Cs = Crepeats ? "@C @C":"@C",
+ Ds = Drepeats ? "@D @D":"@D",
+ TAs = TArepeats ? "@TA @TA":"@TA",
+ TBs = TBrepeats ? "@TB @TB":"@TB";
+
+ // split up replace() lines for readability
+ String testsource = getSrcTemplate(templateName).replace("testname",testname);
+ testsource = testsource.replace("_As",As).replace("_Bs",Bs).replace("_Cs",Cs);
+ testsource = testsource.replace("_Ds",Ds).replace("_TAs",TAs).replace("_TBs",TBs);
+ return testsource;
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/classfile/testanoninner.template Fri Oct 11 23:31:06 2013 -0700
@@ -0,0 +1,108 @@
+import java.lang.annotation.*;
+import static java.lang.annotation.RetentionPolicy.*;
+import static java.lang.annotation.ElementType.*;
+import java.util.List;
+
+class testname <T> { // TestN.class
+ _As _Bs _Cs _Ds String data = "test";
+ _As _Bs _Cs _Ds Object mtest( _As _Bs _Cs _Ds testname <T> t){ return null; }
+ Object mmtest( testname<T> t){ return null; }
+
+ class Inner<U> { // TestN$1$Inner.class
+ _As _Bs _Cs _Ds String i_odata1 = "test";
+ _As _Bs _Cs _Ds int i_pdata1 = 0;
+ _As _Bs _Cs _Ds U i_udata = null;
+//8015257
+ _As _Bs _Cs _Ds Object _As _Bs _Cs _Ds [] _As _Bs _Cs _Ds [] i_sa1 = null;
+ _As _Bs _Cs _Ds T i_tdata = null;
+ _As _Bs _Cs _Ds String i_m1(){ return null; };
+ _As _Bs _Cs _Ds int i_m2( _As _Bs _Cs _Ds Object o){return 0;}
+ _As _Bs _Cs _Ds
+ <_TAs _TBs _Cs _Ds U> Object i_um( _As _Bs _Cs _Ds U u) { return null; }
+ }
+//8015323
+ _As _Bs _Cs _Ds Inner< _As _Bs _Cs _Ds String> IN = new Inner< String>();
+
+ public void test() {
+
+ class Local1<U> { // TestN$Local1.class
+ _As _Bs _Cs _Ds String l_odata1 = "test";
+ _As _Bs _Cs _Ds int l_pdata1 = 0;
+ _As _Bs _Cs _Ds U l_udata = null;
+//8015257
+ _As _Bs _Cs _Ds Object _As _Bs _Cs _Ds []_As _Bs _Cs _Ds [] l_sa1 = null;
+ _TAs _TBs _Cs _Ds T l_tdata = null;
+ _As _Bs _Cs _Ds String l_m1(){ return null; };
+ _As _Bs _Cs _Ds int l_m2(_As _Bs _Cs _Ds Object o){return 0;}
+ _As _Bs _Cs _Ds
+ <_TAs _TBs _Cs _Ds U> Object l_um(_As _Bs _Cs _Ds U u) { return null; }
+ }
+ // The below, as a local variable, will show up on test()
+ _As _Bs _Cs _Ds Local1<_As _Bs _Cs _Ds String> LC = new Local1<String>();
+
+ mtest( new testname<T>() { // TestN$1
+ class InnerAnon<U> { // TestN$1$InnerAnon.class
+ _As _Bs _Cs _Ds String ia_odata1 = "test";
+ _As _Bs _Cs _Ds int ia_pdata1 = 0;
+ _As _Bs _Cs _Ds U ia_udata = null;
+//8015257
+ _As _Bs _Cs _Ds Object _As _Bs _Cs _Ds []_As _Bs _Cs _Ds [] ia_sa1 = null;
+ _TAs _TBs _Cs _Ds T ia_tdata = null;
+ _As _Bs _Cs _Ds String ia_m1(){ return null; };
+ _As _Bs _Cs _Ds int ia_m2(_As _Bs _Cs _Ds Object o){return 0;}
+ _As _Bs _Cs _Ds
+ <_TAs _TBs _Cs _Ds U> Object ia_um(_As _Bs _Cs _Ds U u) { return null; }
+ }
+//8015257
+ _As _Bs _Cs _Ds InnerAnon<_As _Bs _Cs _Ds String> IA = new InnerAnon< String>();
+
+ _As _Bs _Cs _Ds String odata1 = "test";
+ _As _Bs _Cs _Ds int pdata1 = 0;
+//8015257
+ _As _Bs _Cs _Ds Object _As _Bs _Cs _Ds []_As _Bs _Cs _Ds [] sa1 = null;
+ _As _Bs _Cs _Ds T tdata = null;
+
+ _As _Bs _Cs _Ds String m1(){ return null; };
+ _As _Bs _Cs _Ds int m2(_As _Bs _Cs _Ds Object o){return 0;}
+
+ _As _Bs _Cs _Ds Object _As _Bs _Cs _Ds [] _As _Bs _Cs _Ds []
+ m3(String _As _Bs _Cs _Ds []_As _Bs _Cs _Ds [] sa){ return null; }
+
+ _As _Bs _Cs _Ds
+ <_TAs _TBs _Cs _Ds T> Object tm(_As _Bs _Cs _Ds T t) { return null; }
+
+ public void atest( testname<T> t){
+ t.mmtest( new testname<T>() { // TestN$1$1.class
+ _As _Bs _Cs _Ds String mm_odata1 = "test";
+ _As _Bs _Cs _Ds int mm_pdata1 = 0;
+//8015257
+ _As _Bs _Cs _Ds Object _As _Bs _Cs _Ds []_As _Bs _Cs _Ds [] mm_sa1 = null;
+ _TAs _TBs _Cs _Ds T mm_tdata = null;
+
+ _As _Bs _Cs _Ds String mm_m1(){ return null; };
+ _As _Bs _Cs _Ds int mm_m2(_As _Bs _Cs _Ds Object o){return 0;}
+
+ _As _Bs _Cs _Ds String _As _Bs _Cs _Ds [] _As _Bs _Cs _Ds []
+ mm_m3(String _As _Bs _Cs _Ds []_As _Bs _Cs _Ds [] sa){ return null; }
+
+ _As _Bs _Cs _Ds
+ <_TAs _TBs _Cs _Ds T> Object mm_tm(_As _Bs _Cs _Ds T t) { return null; }
+ });
+ }
+ });
+ }
+}
+@Retention(RUNTIME) @Target({TYPE_USE,FIELD}) @Repeatable( AC.class ) @interface A { }
+@Retention(RUNTIME) @Target({TYPE_USE,METHOD}) @Repeatable( BC.class ) @interface B { }
+@Retention(RUNTIME) @Target({TYPE_USE,FIELD}) @interface AC { A[] value(); }
+@Retention(RUNTIME) @Target({TYPE_USE,METHOD}) @interface BC { B[] value(); }
+
+@Retention(CLASS) @Target({TYPE_USE,FIELD}) @Repeatable( CC.class ) @interface C { }
+@Retention(CLASS) @Target({TYPE_USE,METHOD}) @Repeatable( DC.class ) @interface D { }
+@Retention(CLASS) @Target({TYPE_USE,FIELD}) @interface CC { C[] value(); }
+@Retention(CLASS) @Target({TYPE_USE,METHOD}) @interface DC { D[] value(); }
+
+@Retention(RUNTIME) @Target({TYPE_USE,TYPE_PARAMETER,FIELD}) @Repeatable( TAC.class ) @interface TA { }
+@Retention(RUNTIME) @Target({TYPE_USE,TYPE_PARAMETER,METHOD}) @Repeatable( TBC.class ) @interface TB { }
+@Retention(RUNTIME) @Target({TYPE_USE,TYPE_PARAMETER,FIELD}) @interface TAC { TA[] value(); }
+@Retention(RUNTIME) @Target({TYPE_USE,TYPE_PARAMETER,METHOD}) @interface TBC { TB[] value(); }
--- a/langtools/test/tools/javac/annotations/typeAnnotations/failures/CantAnnotateStaticClass.java Fri Oct 11 03:09:42 2013 -0700
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/failures/CantAnnotateStaticClass.java Fri Oct 11 23:31:06 2013 -0700
@@ -1,7 +1,7 @@
/*
* @test /nodynamiccopyright/
* @bug 8006733 8006775
- * @ignore 8013409: test failures for type annotations
+
* @summary A static outer class cannot be annotated.
* @author Werner Dietl
* @compile/fail/ref=CantAnnotateStaticClass.out -XDrawDiagnostics CantAnnotateStaticClass.java
--- a/langtools/test/tools/javac/annotations/typeAnnotations/failures/CantAnnotateStaticClass.out Fri Oct 11 03:09:42 2013 -0700
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/failures/CantAnnotateStaticClass.out Fri Oct 11 23:31:06 2013 -0700
@@ -1,1 +1,10 @@
-dummy
\ No newline at end of file
+CantAnnotateStaticClass.java:22:20: compiler.err.cant.annotate.static.class
+CantAnnotateStaticClass.java:23:13: compiler.err.cant.annotate.static.class
+CantAnnotateStaticClass.java:24:29: compiler.err.cant.annotate.static.class
+CantAnnotateStaticClass.java:26:29: compiler.err.cant.annotate.static.class
+CantAnnotateStaticClass.java:29:26: compiler.err.cant.annotate.static.class
+CantAnnotateStaticClass.java:30:9: compiler.err.cant.annotate.static.class
+CantAnnotateStaticClass.java:31:35: compiler.err.cant.annotate.static.class
+- compiler.note.unchecked.filename: CantAnnotateStaticClass.java
+- compiler.note.unchecked.recompile
+7 errors
--- a/langtools/test/tools/javac/annotations/typeAnnotations/newlocations/MultiCatch.java Fri Oct 11 03:09:42 2013 -0700
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/newlocations/MultiCatch.java Fri Oct 11 23:31:06 2013 -0700
@@ -25,6 +25,7 @@
/*
* @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/MultiCatch.java Fri Oct 11 03:09:42 2013 -0700
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/referenceinfos/MultiCatch.java Fri Oct 11 23:31:06 2013 -0700
@@ -25,6 +25,7 @@
/*
* @test
+ * @ignore 8008762 Type annotation failures
* @bug 8006732 8006775
* @summary Test population of reference info for multicatch exception parameters
* @author Werner Dietl
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/defaultMethods/Assertions.java Fri Oct 11 23:31:06 2013 -0700
@@ -0,0 +1,102 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package test;
+
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Set;
+
+/*
+ * @test
+ * @bug 8025141
+ * @summary Interfaces must not contain non-public fields, ensure $assertionsDisabled
+ * is not generated into an interface
+ * @compile Assertions.java
+ * @run main/othervm -da test.Assertions
+ * @run main/othervm -ea:test.Assertions test.Assertions Inner
+ * @run main/othervm -ea:test.Outer test.Assertions Outer
+ * @run main/othervm -ea:test.Another test.Assertions Another.Inner
+ * @run main/othervm -ea:test... test.Assertions Inner Outer Another.Inner
+ */
+
+public class Assertions {
+ interface Inner {
+ default void testInner() {
+ assert false;
+ }
+ }
+
+ static class InnerImpl implements Inner {}
+
+ static class OuterImpl implements Outer {}
+
+ static class AnotherInnerImpl implements Another.Inner {}
+
+ public static void main(String... args) {
+ Set<String> shouldThrowAssert = new HashSet<String>(Arrays.asList(args));
+ try {
+ new InnerImpl().testInner();
+ if (shouldThrowAssert.contains("Inner")) {
+ throw new IllegalStateException("AssertionError expected, but not thrown.");
+ }
+ } catch (AssertionError e) {
+ if (!shouldThrowAssert.contains("Inner")) {
+ throw new IllegalStateException("AssertionError not expected, but thrown.");
+ }
+ }
+ try {
+ new OuterImpl().testOuter();
+ if (shouldThrowAssert.contains("Outer")) {
+ throw new IllegalStateException("AssertionError expected, but not thrown.");
+ }
+ } catch (AssertionError e) {
+ if (!shouldThrowAssert.contains("Outer")) {
+ throw new IllegalStateException("AssertionError not expected, but thrown.");
+ }
+ }
+ try {
+ new AnotherInnerImpl().testAnotherInner();
+ if (shouldThrowAssert.contains("Another.Inner")) {
+ throw new IllegalStateException("AssertionError expected, but not thrown.");
+ }
+ } catch (AssertionError e) {
+ if (!shouldThrowAssert.contains("Another.Inner")) {
+ throw new IllegalStateException("AssertionError not expected, but thrown.");
+ }
+ }
+ }
+}
+
+interface Outer {
+ default void testOuter() {
+ assert false;
+ }
+}
+
+@interface Another {
+ interface Inner {
+ default void testAnotherInner() {
+ assert false;
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/defaultMethods/BadClassfile.java Fri Oct 11 23:31:06 2013 -0700
@@ -0,0 +1,89 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8025087
+ * @summary Verify that pre-JDK8 classfiles with default and/or static methods
+ * are refused correctly.
+ * @build BadClassfile
+ * @run main BadClassfile
+ */
+
+import com.sun.tools.classfile.*;
+import com.sun.tools.javac.api.JavacTaskImpl;
+import com.sun.tools.javac.code.Symbol;
+import com.sun.tools.javac.jvm.ClassReader.BadClassFile;
+import com.sun.tools.javac.jvm.Target;
+import com.sun.tools.javac.util.Assert;
+import com.sun.tools.javac.util.JCDiagnostic;
+import java.io.File;
+import java.util.Arrays;
+import java.util.Objects;
+import javax.tools.JavaCompiler;
+import javax.tools.ToolProvider;
+
+public class BadClassfile {
+ public static void main(String... args) throws Exception {
+ test("BadClassfile$DefaultMethodTest", "compiler.misc.invalid.default.interface");
+ test("BadClassfile$StaticMethodTest", "compiler.misc.invalid.static.interface");
+ }
+
+ private static void test(String classname, String expected) throws Exception {
+ File classfile = new File(System.getProperty("test.classes", "."), classname + ".class");
+ ClassFile cf = ClassFile.read(classfile);
+
+ cf = new ClassFile(cf.magic, Target.JDK1_7.minorVersion,
+ Target.JDK1_7.majorVersion, cf.constant_pool, cf.access_flags,
+ cf.this_class, cf.super_class, cf.interfaces, cf.fields,
+ cf.methods, cf.attributes);
+
+ new ClassWriter().write(cf, classfile);
+
+ JavaCompiler c = ToolProvider.getSystemJavaCompiler();
+ JavacTaskImpl task = (JavacTaskImpl) c.getTask(null, null, null, Arrays.asList("-classpath", System.getProperty("test.classes", ".")), null, null);
+
+ try {
+ Symbol clazz = com.sun.tools.javac.main.JavaCompiler.instance(task.getContext()).resolveIdent(classname);
+
+ clazz.complete();
+ } catch (BadClassFile f) {
+ JCDiagnostic embeddedDiag = (JCDiagnostic) f.diag.getArgs()[1];
+ assertEquals(expected, embeddedDiag.getCode());
+ assertEquals(Integer.toString(Target.JDK1_7.majorVersion), embeddedDiag.getArgs()[0]);
+ assertEquals(Integer.toString(Target.JDK1_7.minorVersion), embeddedDiag.getArgs()[1]);
+ }
+ }
+
+ private static void assertEquals(Object expected, Object actual) {
+ Assert.check(Objects.equals(expected, actual),
+ "expected: " + expected + ", but was: " + actual);
+ }
+
+ interface DefaultMethodTest {
+ default void test() { }
+ }
+ interface StaticMethodTest {
+ static void test() { }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/defaultMethods/CannotChangeAssertionsStateAfterInitialized.java Fri Oct 11 23:31:06 2013 -0700
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8025141
+ * @summary Ensure the assertion status cannot be changed once the class is initialized
+ * @compile CannotChangeAssertionsStateAfterInitialized.java
+ * @run main/othervm -da CannotChangeAssertionsStateAfterInitialized
+ */
+
+public interface CannotChangeAssertionsStateAfterInitialized {
+ default void m() {
+ assert false;
+ }
+
+ public static void main(String[] args) {
+ ClassLoader cl = CannotChangeAssertionsStateAfterInitialized.class.getClassLoader();
+ cl.setClassAssertionStatus(CannotChangeAssertionsStateAfterInitialized.class.getName(), true);
+ new CannotChangeAssertionsStateAfterInitialized() {}.m();
+ }
+
+}
--- a/langtools/test/tools/javac/diags/examples.not-yet.txt Fri Oct 11 03:09:42 2013 -0700
+++ b/langtools/test/tools/javac/diags/examples.not-yet.txt Fri Oct 11 23:31:06 2013 -0700
@@ -40,7 +40,6 @@
compiler.err.type.var.more.than.once.in.result # UNUSED
compiler.err.unexpected.type
compiler.err.unsupported.cross.fp.lit # Scanner: host system dependent
-compiler.misc.bad.class.file.header # bad class file
compiler.misc.bad.class.signature # bad class file
compiler.misc.bad.const.pool.tag # bad class file
compiler.misc.bad.const.pool.tag.at # bad class file
--- a/langtools/test/tools/javac/diags/examples/DuplicateAnnotation.java Fri Oct 11 03:09:42 2013 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,32 +0,0 @@
-/*
- * Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-// key: compiler.err.duplicate.annotation
-// key: compiler.warn.source.no.bootclasspath
-// options: -source 7
-
-@interface Anno { }
-
-@Anno
-@Anno
-class DuplicateAnnotation { }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/InterfaceOrArrayExpected.java Fri Oct 11 23:31:06 2013 -0700
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.intf.or.array.expected.here
+
+import java.util.List;
+
+class InterfaceExpected<T extends List & String> { }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/InvalidDefaultInterface/InvalidDefaultInterface.java Fri Oct 11 23:31:06 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.
+ */
+
+// key: compiler.misc.invalid.default.interface
+// key: compiler.misc.bad.class.file.header
+// key: compiler.err.cant.access
+// options: -processor CreateBadClassFile
+
+/* The annotation processor will create an invalid classfile with version 51.0
+ * and a non-abstract method in an interface. Loading the classfile will produce
+ * the diagnostic.
+ */
+class InvalidDefaultInterface { }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/InvalidDefaultInterface/processors/CreateBadClassFile.java Fri Oct 11 23:31:06 2013 -0700
@@ -0,0 +1,85 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import com.sun.tools.classfile.*;
+import com.sun.tools.classfile.ConstantPool.CONSTANT_Class_info;
+import com.sun.tools.classfile.ConstantPool.CONSTANT_Utf8_info;
+import com.sun.tools.classfile.ConstantPool.CPInfo;
+import java.io.*;
+import java.util.*;
+import javax.annotation.processing.*;
+import javax.lang.model.*;
+import javax.lang.model.element.*;
+import javax.tools.*;
+
+/* Create an invalid classfile with version 51.0 and a non-abstract method in an interface.*/
+@SupportedAnnotationTypes("*")
+public class CreateBadClassFile extends AbstractProcessor {
+ public boolean process(Set<? extends TypeElement> elems, RoundEnvironment renv) {
+ if (++round == 1) {
+ ConstantPool cp = new ConstantPool(new CPInfo[] {
+ new CONSTANT_Utf8_info(""), //0
+ new CONSTANT_Utf8_info("Test"), //1
+ new CONSTANT_Class_info(null, 1), //2
+ new CONSTANT_Utf8_info("java/lang/Object"), //3
+ new CONSTANT_Class_info(null, 3), //4
+ new CONSTANT_Utf8_info("test"), //5
+ new CONSTANT_Utf8_info("()V"), //6
+ });
+ ClassFile cf = new ClassFile(0xCAFEBABE,
+ 0,
+ 51,
+ cp,
+ new AccessFlags(AccessFlags.ACC_ABSTRACT |
+ AccessFlags.ACC_INTERFACE |
+ AccessFlags.ACC_PUBLIC),
+ 2,
+ 4,
+ new int[0],
+ new Field[0],
+ new Method[] {
+ //creating non-abstract method in 51.0 classfile:
+ new Method(new AccessFlags(AccessFlags.ACC_PUBLIC),
+ 5,
+ new Descriptor(6),
+ new Attributes(cp, new Attribute[0]))
+ },
+ new Attributes(cp, new Attribute[0]));
+ try {
+ JavaFileObject clazz = processingEnv.getFiler().createClassFile("Test");
+ try (OutputStream out = clazz.openOutputStream()) {
+ new ClassWriter().write(cf, out);
+ }
+ } catch (IOException ex) {
+ ex.printStackTrace();
+ }
+ }
+ return false;
+ }
+
+ public SourceVersion getSupportedSourceVersion() {
+ return SourceVersion.latest();
+ }
+
+ int round = 0;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/InvalidStaticInterface/InvalidStaticInterface.java Fri Oct 11 23:31:06 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.
+ */
+
+// key: compiler.misc.invalid.static.interface
+// key: compiler.misc.bad.class.file.header
+// key: compiler.err.cant.access
+// options: -processor CreateBadClassFile
+
+/* The annotation processor will create an invalid classfile with version 51.0
+ * and a static method in an interface. Loading the classfile will produce
+ * the diagnostic.
+ */
+class InvalidDefaultInterface { }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/InvalidStaticInterface/processors/CreateBadClassFile.java Fri Oct 11 23:31:06 2013 -0700
@@ -0,0 +1,86 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import com.sun.tools.classfile.*;
+import com.sun.tools.classfile.ConstantPool.CONSTANT_Class_info;
+import com.sun.tools.classfile.ConstantPool.CONSTANT_Utf8_info;
+import com.sun.tools.classfile.ConstantPool.CPInfo;
+import java.io.*;
+import java.util.*;
+import javax.annotation.processing.*;
+import javax.lang.model.*;
+import javax.lang.model.element.*;
+import javax.tools.*;
+
+/* Create an invalid classfile with version 51.0 and a static method in an interface.*/
+@SupportedAnnotationTypes("*")
+public class CreateBadClassFile extends AbstractProcessor {
+ public boolean process(Set<? extends TypeElement> elems, RoundEnvironment renv) {
+ if (++round == 1) {
+ ConstantPool cp = new ConstantPool(new CPInfo[] {
+ new CONSTANT_Utf8_info(""), //0
+ new CONSTANT_Utf8_info("Test"), //1
+ new CONSTANT_Class_info(null, 1), //2
+ new CONSTANT_Utf8_info("java/lang/Object"), //3
+ new CONSTANT_Class_info(null, 3), //4
+ new CONSTANT_Utf8_info("test"), //5
+ new CONSTANT_Utf8_info("()V"), //6
+ });
+ ClassFile cf = new ClassFile(0xCAFEBABE,
+ 0,
+ 51,
+ cp,
+ new AccessFlags(AccessFlags.ACC_ABSTRACT |
+ AccessFlags.ACC_INTERFACE |
+ AccessFlags.ACC_PUBLIC),
+ 2,
+ 4,
+ new int[0],
+ new Field[0],
+ new Method[] {
+ //creating static method in 51.0 classfile:
+ new Method(new AccessFlags(AccessFlags.ACC_PUBLIC |
+ AccessFlags.ACC_STATIC),
+ 5,
+ new Descriptor(6),
+ new Attributes(cp, new Attribute[0]))
+ },
+ new Attributes(cp, new Attribute[0]));
+ try {
+ JavaFileObject clazz = processingEnv.getFiler().createClassFile("Test");
+ try (OutputStream out = clazz.openOutputStream()) {
+ new ClassWriter().write(cf, out);
+ }
+ } catch (IOException ex) {
+ ex.printStackTrace();
+ }
+ }
+ return false;
+ }
+
+ public SourceVersion getSupportedSourceVersion() {
+ return SourceVersion.latest();
+ }
+
+ int round = 0;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/RepeatableAnnotationsNotSupported.java Fri Oct 11 23:31:06 2013 -0700
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.repeatable.annotations.not.supported.in.source
+// key: compiler.warn.source.no.bootclasspath
+// options: -source 7
+
+@interface Anno { }
+
+@Anno
+@Anno
+class RepeatableAnnotationsNotSupported { }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/8012557/A.java Fri Oct 11 23:31:06 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.
+ */
+
+interface A {
+ default String u() { return "A"; }
+ default String name() {
+ SAM s = ()->u()+"A";
+ return s.m();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/8012557/B.java Fri Oct 11 23:31:06 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.
+ */
+
+interface B {
+ default String u() { return "B"; }
+ default String name() {
+ SAM s = ()->u()+"B";
+ return s.m();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/8012557/C.java Fri Oct 11 23:31:06 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.
+ */
+
+interface C {
+ default String u() { return "C"; }
+ default String name() {
+ SAM s = ()->u()+"C";
+ return s.m();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/8012557/PrivateLambdas.java Fri Oct 11 23:31:06 2013 -0700
@@ -0,0 +1,88 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8012557
+ * @summary Check that 8012557 is fixed, that interface lambda
+ * methods are private
+ * @author Robert Field
+ * @compile SAM.java
+ * @compile A.java
+ * @compile B.java
+ * @compile C.java
+ * @run main PrivateLambdas
+ *
+ * Unless the lambda methods are private, this will fail with:
+ * AbstractMethodError:
+ * Conflicting default methods: A.lambda$0 B.lambda$0 C.lambda$0
+ */
+
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+
+interface X extends A, B, C {
+ default String u() { return " "; }
+ default String name() {
+ return A.super.name() + B.super.name() + C.super.name();
+ }
+}
+
+public class PrivateLambdas implements X {
+ public static void main(String[] args) throws Exception {
+
+ // Check that all the lambda methods are private instance synthetic
+ for (Class<?> k : new Class<?>[] { A.class, B.class, C.class }) {
+ Method[] methods = k.getDeclaredMethods();
+ int lambdaCount = 0;
+ for(Method m : methods) {
+ if (m.getName().startsWith("lambda$")) {
+ ++lambdaCount;
+ int mod = m.getModifiers();
+ if ((mod & Modifier.PRIVATE) == 0) {
+ throw new Exception("Expected " + m + " to be private");
+ }
+ if (!m.isSynthetic()) {
+ throw new Exception("Expected " + m + " to be synthetic");
+ }
+ if ((mod & Modifier.STATIC) != 0) {
+ throw new Exception("Expected " + m + " to be instance method");
+ }
+ }
+ }
+ if (lambdaCount == 0) {
+ throw new Exception("Expected at least one lambda method");
+ }
+ }
+
+ /*
+ * Unless the lambda methods are private, this will fail with:
+ * AbstractMethodError:
+ * Conflicting default methods: A.lambda$0 B.lambda$0 C.lambda$0
+ */
+ X x = new PrivateLambdas();
+ if (!x.name().equals(" A B C")) {
+ throw new Exception("Expected ' A B C' got: " + x.name());
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/8012557/SAM.java Fri Oct 11 23:31:06 2013 -0700
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+interface SAM {
+ String m();
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/8016320/IllegalBridgeModifier.java Fri Oct 11 23:31:06 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 8016320
+ * @summary Check that 8016320 is fixed,
+ * that bridges have valid modifier bits
+ * @author Robert Field
+ * @run main IllegalBridgeModifier
+ */
+
+interface SAM {
+ int m();
+}
+
+interface SuperI {
+ public default int foo() { return 1234; }
+}
+
+interface I extends SuperI {
+}
+
+interface T extends I {
+ public default SAM boo() { return I.super::foo; }
+}
+
+public class IllegalBridgeModifier {
+ public static void main(String argv[])throws Exception {
+ T t = new T(){};
+ if (t.boo().m() != 1234) {
+ throw new Exception("Failed test");
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/processing/errors/EnsureAnnotationTypeMismatchException/Processor.java Fri Oct 11 23:31:06 2013 -0700
@@ -0,0 +1,102 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.io.IOException;
+import java.io.Writer;
+import java.lang.annotation.*;
+import java.util.Set;
+import javax.annotation.processing.*;
+import javax.lang.model.element.*;
+import javax.lang.model.util.ElementFilter;
+import javax.tools.*;
+import com.sun.tools.javac.util.Assert;
+
+public class Processor extends JavacTestingAbstractProcessor {
+
+ private boolean seenGenerated;
+
+ @Override
+ public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
+ for (Element e : roundEnv.getElementsAnnotatedWith(Gen.class)) {
+ Gen gen = e.getAnnotation(Gen.class);
+ try {
+ JavaFileObject source = processingEnv.getFiler().createSourceFile(gen.fileName());
+
+ try (Writer out = source.openWriter()) {
+ out.write(gen.content());
+ }
+ } catch (IOException ex) {
+ throw new IllegalStateException(ex);
+ }
+ }
+
+ TypeElement generated = processingEnv.getElementUtils().getTypeElement("Generated");
+
+ if (generated != null) {
+ Check check = ElementFilter.methodsIn(generated.getEnclosedElements()).get(0).getAnnotation(Check.class);
+
+ checkCorrectException(check::classValue, "java.lang.Class<java.lang.String>");
+ checkCorrectException(check::intConstValue, "boolean");
+ checkCorrectException(check::enumValue, "java.lang.String");
+ checkCorrectException(check::incorrectAnnotationValue, "java.lang.Deprecated");
+ checkCorrectException(check::incorrectArrayValue, "<any>");
+ checkCorrectException(check::incorrectClassValue, "<any>");
+
+ seenGenerated = true;
+ }
+
+ if (roundEnv.processingOver() && !seenGenerated) {
+ Assert.error("Did not see the generated class!");
+ }
+
+ return true;
+ }
+
+ private static void checkCorrectException(Runnable runCheck, String expectedType) {
+ try {
+ runCheck.run();
+ Assert.check(false); //Should not reach here
+ } catch (AnnotationTypeMismatchException ex) {
+ Assert.check(expectedType.equals(ex.foundType()), ex.foundType());
+ }
+ }
+
+}
+
+@interface Gen {
+ String fileName();
+ String content();
+}
+
+@interface Check {
+ Class<? extends Number> classValue();
+ int intConstValue();
+ E enumValue();
+ int incorrectAnnotationValue();
+ int incorrectArrayValue();
+ Class<?> incorrectClassValue();
+}
+
+enum E {
+ A;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/processing/errors/EnsureAnnotationTypeMismatchException/Source.java Fri Oct 11 23:31:06 2013 -0700
@@ -0,0 +1,25 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 6278240
+ * @summary Ensure AnnotationTypeMismatchException is thrown when appropriate
+ * with reasonable foundType filled.
+ * @library /tools/javac/lib
+ * @build JavacTestingAbstractProcessor Processor
+ * @compile/fail/ref=Source.out -XDrawDiagnostics -processor Processor Source.java
+ */
+
+@Gen(fileName="Generated",
+ content=
+"class Generated {\n" +
+" @Check(classValue=String.class,\n" +
+" intConstValue=false,\n" +
+" enumValue=\"a\",\n" +
+" incorrectAnnotationValue=@Deprecated,\n" +
+" incorrectArrayValue={1, \"a\"},\n" +
+" incorrectClassValue=get())\n" +
+" public static Class<?> get() {\n" +
+" return null;\n" +
+" }\n" +
+"}\n")
+class Source {
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/processing/errors/EnsureAnnotationTypeMismatchException/Source.out Fri Oct 11 23:31:06 2013 -0700
@@ -0,0 +1,7 @@
+Generated.java:2:29: compiler.err.prob.found.req: (compiler.misc.inconvertible.types: java.lang.Class<java.lang.String>, java.lang.Class<? extends java.lang.Number>)
+Generated.java:3:26: compiler.err.prob.found.req: (compiler.misc.inconvertible.types: boolean, int)
+Generated.java:4:22: compiler.err.prob.found.req: (compiler.misc.inconvertible.types: java.lang.String, E)
+Generated.java:5:37: compiler.err.annotation.not.valid.for.type: int
+Generated.java:6:32: compiler.err.annotation.value.not.allowable.type
+Generated.java:7:35: compiler.err.annotation.value.must.be.class.literal
+6 errors
--- a/langtools/test/tools/javac/processing/model/element/TestExecutableElement.java Fri Oct 11 03:09:42 2013 -0700
+++ b/langtools/test/tools/javac/processing/model/element/TestExecutableElement.java Fri Oct 11 23:31:06 2013 -0700
@@ -23,54 +23,57 @@
/*
* @test
- * @bug 8005046 8011052
- * @summary Test basic properties of javax.lang.element.Element
+ * @bug 8005046 8011052 8025087
+ * @summary Test basic properties of javax.lang.element.ExecutableElement
* @author Joseph D. Darcy
* @library /tools/javac/lib
* @build JavacTestingAbstractProcessor TestExecutableElement
- * @compile -processor TestExecutableElement -proc:only TestExecutableElement.java
+ * @compile -processor TestExecutableElement -proc:only -AexpectedMethodCount=7 TestExecutableElement.java
+ * @compile/process -processor TestExecutableElement -proc:only -AexpectedMethodCount=3 ProviderOfDefault
*/
import java.lang.annotation.*;
import java.util.Formatter;
import java.util.Set;
-import java.util.Objects;
import java.util.regex.*;
import javax.annotation.processing.*;
-import javax.lang.model.SourceVersion;
-import static javax.lang.model.SourceVersion.*;
import javax.lang.model.element.*;
-import javax.lang.model.util.*;
import static javax.lang.model.util.ElementFilter.*;
import static javax.tools.Diagnostic.Kind.*;
-import static javax.tools.StandardLocation.*;
/**
* Test some basic workings of javax.lang.element.ExecutableElement
*/
+@SupportedOptions("expectedMethodCount")
public class TestExecutableElement extends JavacTestingAbstractProcessor implements ProviderOfDefault {
+ private int seenMethods = 0;
@IsDefault(false)
public boolean process(Set<? extends TypeElement> annotations,
RoundEnvironment roundEnv) {
- int errors = 0;
if (!roundEnv.processingOver()) {
- boolean hasRun = false;
for (Element element : roundEnv.getRootElements()) {
for (ExecutableElement method : methodsIn(element.getEnclosedElements())) {
- hasRun = true;
- errors += checkIsDefault(method);
+ checkIsDefault(method);
+ seenMethods++;
}
}
+ } else {
+ String expectedMethodCountStr = processingEnv.getOptions().get("expectedMethodCount");
+ if (expectedMethodCountStr == null) {
+ messager.printMessage(ERROR, "No expected method count specified.");
+ } else {
+ int expectedMethodCount = Integer.parseInt(expectedMethodCountStr);
- if (!hasRun) {
- messager.printMessage(ERROR, "No test cases run; test fails.");
+ if (seenMethods != expectedMethodCount) {
+ messager.printMessage(ERROR, "Wrong number of seen methods: " + seenMethods);
+ }
}
}
return true;
}
@IsDefault(false)
- int checkIsDefault(ExecutableElement method) {
+ void checkIsDefault(ExecutableElement method) {
System.out.println("Testing " + method);
IsDefault expectedIsDefault = method.getAnnotation(IsDefault.class);
@@ -116,9 +119,7 @@
expectedDefault,
methodIsDefault).toString(),
method);
- return 1;
}
- return 0;
}
}
@@ -142,4 +143,6 @@
@IsDefault(value=true, expectedTextRegex="\\s*@IsDefault\\(.*\\)\\s*default strictfp void quux\\(\\);\\s*$")
default strictfp void quux() {};
+ @IsDefault(false)
+ static void statik() {}
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/tree/T8024415.java Fri Oct 11 23:31:06 2013 -0700
@@ -0,0 +1,113 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8024415
+ * @summary Pretty printing of JCConditional does not follow the precedence and
+ * associativity rules of JCConditional
+ * @run testng T8024415
+ */
+
+
+import static org.testng.Assert.assertEquals;
+
+import java.io.IOException;
+import java.io.StringWriter;
+
+import org.testng.annotations.Test;
+
+import com.sun.tools.javac.file.JavacFileManager;
+import com.sun.tools.javac.tree.JCTree;
+import com.sun.tools.javac.tree.JCTree.JCExpression;
+import com.sun.tools.javac.tree.Pretty;
+import com.sun.tools.javac.tree.TreeMaker;
+import com.sun.tools.javac.util.Context;
+import com.sun.tools.javac.util.Names;
+
+
+/*
+ * Test verifies that the precedence rules of conditional expressions
+ * (JCConditional) are correct.
+ */
+@Test
+public class T8024415 {
+
+ TreeMaker maker;
+ JCExpression x;
+
+
+ public T8024415() {
+ Context ctx = new Context();
+ JavacFileManager.preRegister(ctx);
+ maker = TreeMaker.instance(ctx);
+ Names names = Names.instance(ctx);
+ x = maker.Ident(names.fromString("x"));
+ }
+
+
+ // JLS 15.25: The conditional operator is syntactically right-associative
+ // (it groups right-to-left). Thus, a?b:c?d:e?f:g means the same as
+ // a?b:(c?d:(e?f:g)).
+ public void testAssociativity() throws IOException {
+
+ JCTree left = maker.Conditional(maker.Conditional(x, x, x), x, x);
+ JCTree right = maker.Conditional(x, x, maker.Conditional(x, x, x));
+
+ String prettyLeft = prettyPrint(left);
+ String prettyRight = prettyPrint(right);
+
+ assertEquals(prettyLeft.replaceAll("\\s", ""), "(x?x:x)?x:x");
+ assertEquals(prettyRight.replaceAll("\\s", ""), "x?x:x?x:x");
+
+ }
+
+
+ // The true-part of of a conditional expression is surrounded by ? and :
+ // and can thus always be parsed unambiguously without surrounding
+ // parentheses.
+ public void testPrecedence() throws IOException {
+
+ JCTree left = maker.Conditional(maker.Assign(x, x), x, x);
+ JCTree middle = maker.Conditional(x, maker.Assign(x, x), x);
+ JCTree right = maker.Conditional(x, x, maker.Assign(x, x));
+
+ String prettyLeft = prettyPrint(left);
+ String prettyMiddle = prettyPrint(middle);
+ String prettyRight = prettyPrint(right);
+
+ assertEquals(prettyLeft.replaceAll("\\s", ""), "(x=x)?x:x");
+ assertEquals(prettyMiddle.replaceAll("\\s", ""), "x?x=x:x");
+ assertEquals(prettyRight.replaceAll("\\s", ""), "x?x:(x=x)");
+
+ }
+
+
+ // Helper method
+ private static String prettyPrint(JCTree tree) throws IOException {
+ StringWriter sw = new StringWriter();
+ new Pretty(sw, true).printExpr(tree);
+ return sw.toString();
+ }
+
+}