8167967: javadoc should identify the ordinal value of enum constants

Reviewed-by: jjg
This commit is contained in:
Kumar Srinivasan 2016-11-14 16:33:48 -08:00
parent 95d99302d8
commit 9b43eda24c
26 changed files with 990 additions and 757 deletions

View file

@ -535,7 +535,7 @@ public abstract class AbstractMemberWriter {
TypeElement superClass = utils.getSuperClass(typeElement); TypeElement superClass = utils.getSuperClass(typeElement);
while (superClass != null) { while (superClass != null) {
if (visibleMemberMap.hasMembersFor(superClass)) { if (visibleMemberMap.hasMembers(superClass)) {
liNav.addContent(getNavSummaryLink(superClass, true)); liNav.addContent(getNavSummaryLink(superClass, true));
return; return;
} }

View file

@ -135,8 +135,6 @@ public class ConfigurationImpl extends Configuration {
*/ */
public String docrootparent = ""; public String docrootparent = "";
public boolean sortedMethodDetails = false;
/** /**
* True if command line option "-nohelp" is used. Default value is false. * True if command line option "-nohelp" is used. Default value is false.
*/ */

View file

@ -72,7 +72,7 @@ public class ConstructorWriterImpl extends AbstractExecutableMemberWriter
VisibleMemberMap visibleMemberMap = new VisibleMemberMap( VisibleMemberMap visibleMemberMap = new VisibleMemberMap(
typeElement, typeElement,
VisibleMemberMap.Kind.CONSTRUCTORS, configuration); VisibleMemberMap.Kind.CONSTRUCTORS, configuration);
SortedSet<Element> constructors = visibleMemberMap.getMembersFor(typeElement); List<Element> constructors = visibleMemberMap.getMembers(typeElement);
for (Element constructor : constructors) { for (Element constructor : constructors) {
if (utils.isProtected(constructor) || utils.isPrivate(constructor)) { if (utils.isProtected(constructor) || utils.isPrivate(constructor)) {
setFoundNonPubConstructor(true); setFoundNonPubConstructor(true);

View file

@ -25,6 +25,15 @@
package jdk.javadoc.internal.doclets.toolkit.builders; package jdk.javadoc.internal.doclets.toolkit.builders;
import java.util.Collection;
import java.util.Comparator;
import java.util.Iterator;
import java.util.SortedSet;
import java.util.TreeSet;
import javax.lang.model.element.Element;
import jdk.javadoc.internal.doclets.formats.html.ConfigurationImpl;
import jdk.javadoc.internal.doclets.toolkit.Content; import jdk.javadoc.internal.doclets.toolkit.Content;
import jdk.javadoc.internal.doclets.toolkit.DocletException; import jdk.javadoc.internal.doclets.toolkit.DocletException;
@ -42,6 +51,7 @@ import jdk.javadoc.internal.doclets.toolkit.DocletException;
*/ */
public abstract class AbstractMemberBuilder extends AbstractBuilder { public abstract class AbstractMemberBuilder extends AbstractBuilder {
public final Comparator<Element> comparator;
/** /**
* Construct a SubBuilder. * Construct a SubBuilder.
* @param context a context object, providing information used in this run * @param context a context object, providing information used in this run
@ -49,6 +59,7 @@ public abstract class AbstractMemberBuilder extends AbstractBuilder {
*/ */
public AbstractMemberBuilder(Context context) { public AbstractMemberBuilder(Context context) {
super(context); super(context);
comparator = utils.makeGeneralPurposeComparator();
} }
/** /**
@ -83,4 +94,10 @@ public abstract class AbstractMemberBuilder extends AbstractBuilder {
* @return true if this subbuilder has anything to document * @return true if this subbuilder has anything to document
*/ */
public abstract boolean hasMembersToDocument(); public abstract boolean hasMembersToDocument();
public SortedSet<Element> asSortedSet(Collection<Element> members) {
SortedSet<Element> out = new TreeSet<>(comparator);
out.addAll(members);
return out;
}
} }

View file

@ -67,7 +67,7 @@ public class AnnotationTypeFieldBuilder extends AbstractMemberBuilder {
/** /**
* The list of members being documented. * The list of members being documented.
*/ */
protected SortedSet<Element> members; protected List<Element> members;
/** /**
* The index of the current member that is being documented at this point * The index of the current member that is being documented at this point
@ -91,7 +91,7 @@ public class AnnotationTypeFieldBuilder extends AbstractMemberBuilder {
this.typeElement = typeElement; this.typeElement = typeElement;
this.writer = writer; this.writer = writer;
this.visibleMemberMap = new VisibleMemberMap(typeElement, memberType, configuration); this.visibleMemberMap = new VisibleMemberMap(typeElement, memberType, configuration);
this.members = this.visibleMemberMap.getMembersFor(typeElement); this.members = this.visibleMemberMap.getMembers(typeElement);
} }
@ -118,26 +118,6 @@ public class AnnotationTypeFieldBuilder extends AbstractMemberBuilder {
return "AnnotationTypeFieldDetails"; return "AnnotationTypeFieldDetails";
} }
/**
* Returns a list of members that will be documented for the given class.
* This information can be used for doclet specific documentation
* generation.
*
* @param typeElement the TypeElement we want to check.
* @return a list of members that will be documented.
*/
public SortedSet<Element> members(TypeElement typeElement) {
return visibleMemberMap.getMembersFor(typeElement);
}
/**
* Returns the visible member map for the members of this class.
*
* @return the visible member map for the members of this class.
*/
public VisibleMemberMap getVisibleMemberMap() {
return visibleMemberMap;
}
/** /**
* Returns whether or not there are members to document. * Returns whether or not there are members to document.
@ -145,7 +125,7 @@ public class AnnotationTypeFieldBuilder extends AbstractMemberBuilder {
*/ */
@Override @Override
public boolean hasMembersToDocument() { public boolean hasMembersToDocument() {
return members.size() > 0; return !members.isEmpty();
} }
/** /**
@ -172,16 +152,19 @@ public class AnnotationTypeFieldBuilder extends AbstractMemberBuilder {
if (writer == null) { if (writer == null) {
return; return;
} }
if (!members.isEmpty()) { if (hasMembersToDocument()) {
writer.addAnnotationFieldDetailsMarker(memberDetailsTree); writer.addAnnotationFieldDetailsMarker(memberDetailsTree);
for (Element element : members) {
currentMember = element; Element lastElement = members.get(members.size() - 1);
for (Element member : members) {
currentMember = member;
Content detailsTree = writer.getMemberTreeHeader(); Content detailsTree = writer.getMemberTreeHeader();
writer.addAnnotationDetailsTreeHeader(typeElement, detailsTree); writer.addAnnotationDetailsTreeHeader(typeElement, detailsTree);
Content annotationDocTree = writer.getAnnotationDocTreeHeader(element, detailsTree); Content annotationDocTree = writer.getAnnotationDocTreeHeader(currentMember,
detailsTree);
buildChildren(node, annotationDocTree); buildChildren(node, annotationDocTree);
detailsTree.addContent(writer.getAnnotationDoc( detailsTree.addContent(writer.getAnnotationDoc(
annotationDocTree, currentMember == members.last())); annotationDocTree, currentMember == lastElement));
memberDetailsTree.addContent(writer.getAnnotationDetails(detailsTree)); memberDetailsTree.addContent(writer.getAnnotationDetails(detailsTree));
} }
} }

View file

@ -68,7 +68,7 @@ public class AnnotationTypeRequiredMemberBuilder extends AbstractMemberBuilder {
/** /**
* The list of members being documented. * The list of members being documented.
*/ */
protected SortedSet<Element> members; protected List<Element> members;
/** /**
* The index of the current member that is being documented at this point * The index of the current member that is being documented at this point
@ -82,6 +82,7 @@ public class AnnotationTypeRequiredMemberBuilder extends AbstractMemberBuilder {
* @param context the build context. * @param context the build context.
* @param typeElement the class whose members are being documented. * @param typeElement the class whose members are being documented.
* @param writer the doclet specific writer. * @param writer the doclet specific writer.
* @param memberType the kind of member this builder processes.
*/ */
protected AnnotationTypeRequiredMemberBuilder(Context context, protected AnnotationTypeRequiredMemberBuilder(Context context,
TypeElement typeElement, TypeElement typeElement,
@ -91,7 +92,7 @@ public class AnnotationTypeRequiredMemberBuilder extends AbstractMemberBuilder {
this.typeElement = typeElement; this.typeElement = typeElement;
this.writer = writer; this.writer = writer;
this.visibleMemberMap = new VisibleMemberMap(typeElement, memberType, configuration); this.visibleMemberMap = new VisibleMemberMap(typeElement, memberType, configuration);
this.members = this.visibleMemberMap.getMembersFor(typeElement); this.members = this.visibleMemberMap.getMembers(typeElement);
} }
@ -101,6 +102,7 @@ public class AnnotationTypeRequiredMemberBuilder extends AbstractMemberBuilder {
* @param context the build context. * @param context the build context.
* @param typeElement the class whose members are being documented. * @param typeElement the class whose members are being documented.
* @param writer the doclet specific writer. * @param writer the doclet specific writer.
* @return an instance of this object
*/ */
public static AnnotationTypeRequiredMemberBuilder getInstance( public static AnnotationTypeRequiredMemberBuilder getInstance(
Context context, TypeElement typeElement, Context context, TypeElement typeElement,
@ -118,34 +120,13 @@ public class AnnotationTypeRequiredMemberBuilder extends AbstractMemberBuilder {
return "AnnotationTypeRequiredMemberDetails"; return "AnnotationTypeRequiredMemberDetails";
} }
/**
* Returns a list of members that will be documented for the given class.
* This information can be used for doclet specific documentation
* generation.
*
* @param typeElement the {@link TypeElement} we want to check.
* @return a list of members that will be documented.
*/
public SortedSet<Element> members(TypeElement typeElement) {
return visibleMemberMap.getMembersFor(typeElement);
}
/**
* Returns the visible member map for the members of this class.
*
* @return the visible member map for the members of this class.
*/
public VisibleMemberMap getVisibleMemberMap() {
return visibleMemberMap;
}
/** /**
* Returns whether or not there are members to document. * Returns whether or not there are members to document.
* @return whether or not there are members to document * @return whether or not there are members to document
*/ */
@Override @Override
public boolean hasMembersToDocument() { public boolean hasMembersToDocument() {
return members.size() > 0; return !members.isEmpty();
} }
/** /**
@ -165,24 +146,25 @@ public class AnnotationTypeRequiredMemberBuilder extends AbstractMemberBuilder {
* *
* @param node the XML element that specifies which components to document * @param node the XML element that specifies which components to document
* @param memberDetailsTree the content tree to which the documentation will be added * @param memberDetailsTree the content tree to which the documentation will be added
* @throws DocletException if an error occurs
*/ */
public void buildAnnotationTypeMember(XMLNode node, Content memberDetailsTree) public void buildAnnotationTypeMember(XMLNode node, Content memberDetailsTree)
throws DocletException { throws DocletException {
if (writer == null) { if (writer == null) {
return; return;
} }
int size = members.size(); if (hasMembersToDocument()) {
if (size > 0) {
writer.addAnnotationDetailsMarker(memberDetailsTree); writer.addAnnotationDetailsMarker(memberDetailsTree);
for (Element element : members) { Element lastMember = members.get((members.size() - 1));
currentMember = element; for (Element member : members) {
currentMember = member;
Content detailsTree = writer.getMemberTreeHeader(); Content detailsTree = writer.getMemberTreeHeader();
writer.addAnnotationDetailsTreeHeader(typeElement, detailsTree); writer.addAnnotationDetailsTreeHeader(typeElement, detailsTree);
Content annotationDocTree = writer.getAnnotationDocTreeHeader( Content annotationDocTree = writer.getAnnotationDocTreeHeader(
element, detailsTree); currentMember, detailsTree);
buildChildren(node, annotationDocTree); buildChildren(node, annotationDocTree);
detailsTree.addContent(writer.getAnnotationDoc( detailsTree.addContent(writer.getAnnotationDoc(
annotationDocTree, currentMember == members.last())); annotationDocTree, currentMember == lastMember));
memberDetailsTree.addContent(writer.getAnnotationDetails(detailsTree)); memberDetailsTree.addContent(writer.getAnnotationDetails(detailsTree));
} }
} }

View file

@ -275,7 +275,7 @@ public class ConstantsSummaryBuilder extends AbstractBuilder {
private boolean hasConstantField (TypeElement typeElement) { private boolean hasConstantField (TypeElement typeElement) {
VisibleMemberMap visibleMemberMapFields = new VisibleMemberMap(typeElement, VisibleMemberMap visibleMemberMapFields = new VisibleMemberMap(typeElement,
VisibleMemberMap.Kind.FIELDS, configuration); VisibleMemberMap.Kind.FIELDS, configuration);
SortedSet<Element> fields = visibleMemberMapFields.getLeafClassMembers(); List<Element> fields = visibleMemberMapFields.getLeafMembers();
for (Element f : fields) { for (Element f : fields) {
VariableElement field = (VariableElement)f; VariableElement field = (VariableElement)f;
if (field.getConstantValue() != null) { if (field.getConstantValue() != null) {
@ -350,21 +350,21 @@ public class ConstantsSummaryBuilder extends AbstractBuilder {
} }
/** /**
* Return the list of visible constant fields for the given TypeElement. * Returns a set of visible constant fields for the given type.
* @return the list of visible constant fields for the given TypeElement. * @return the set of visible constant fields for the given type.
*/ */
protected SortedSet<VariableElement> members() { protected SortedSet<VariableElement> members() {
SortedSet<Element> list = visibleMemberMapFields.getLeafClassMembers(); List<Element> members = visibleMemberMapFields.getLeafMembers();
list.addAll(visibleMemberMapEnumConst.getLeafClassMembers()); members.addAll(visibleMemberMapEnumConst.getLeafMembers());
SortedSet<VariableElement> inclList = SortedSet<VariableElement> includes =
new TreeSet<>(utils.makeGeneralPurposeComparator()); new TreeSet<>(utils.makeGeneralPurposeComparator());
for (Element element : list) { for (Element element : members) {
VariableElement member = (VariableElement)element; VariableElement member = (VariableElement)element;
if (member.getConstantValue() != null) { if (member.getConstantValue() != null) {
inclList.add(member); includes.add(member);
} }
} }
return inclList; return includes;
} }
} }
} }

View file

@ -59,7 +59,7 @@ public class ConstructorBuilder extends AbstractMemberBuilder {
/** /**
* The current constructor that is being documented at this point in time. * The current constructor that is being documented at this point in time.
*/ */
private ExecutableElement constructor; private ExecutableElement currentConstructor;
/** /**
* The class whose constructors are being documented. * The class whose constructors are being documented.
@ -79,7 +79,7 @@ public class ConstructorBuilder extends AbstractMemberBuilder {
/** /**
* The constructors being documented. * The constructors being documented.
*/ */
private final SortedSet<Element> constructors; private final List<Element> constructors;
/** /**
* Construct a new ConstructorBuilder. * Construct a new ConstructorBuilder.
@ -99,7 +99,7 @@ public class ConstructorBuilder extends AbstractMemberBuilder {
typeElement, typeElement,
VisibleMemberMap.Kind.CONSTRUCTORS, VisibleMemberMap.Kind.CONSTRUCTORS,
configuration); configuration);
constructors = visibleMemberMap.getMembersFor(typeElement); constructors = visibleMemberMap.getMembers(typeElement);
for (Element ctor : constructors) { for (Element ctor : constructors) {
if (utils.isProtected(ctor) || utils.isPrivate(ctor)) { if (utils.isProtected(ctor) || utils.isPrivate(ctor)) {
writer.setFoundNonPubConstructor(true); writer.setFoundNonPubConstructor(true);
@ -136,18 +136,6 @@ public class ConstructorBuilder extends AbstractMemberBuilder {
return !constructors.isEmpty(); return !constructors.isEmpty();
} }
/**
* Returns a list of constructors that will be documented for the given class.
* This information can be used for doclet specific documentation
* generation.
*
* @param typeElement the class
* @return a list of constructors that will be documented.
*/
public SortedSet<Element> members(TypeElement typeElement) {
return visibleMemberMap.getMembersFor(typeElement);
}
/** /**
* Return the constructor writer for this builder. * Return the constructor writer for this builder.
* *
@ -168,17 +156,17 @@ public class ConstructorBuilder extends AbstractMemberBuilder {
if (writer == null) { if (writer == null) {
return; return;
} }
int size = constructors.size(); if (hasMembersToDocument()) {
if (size > 0) {
Content constructorDetailsTree = writer.getConstructorDetailsTreeHeader(typeElement, Content constructorDetailsTree = writer.getConstructorDetailsTreeHeader(typeElement,
memberDetailsTree); memberDetailsTree);
for (Element ctor : constructors) {
constructor = (ExecutableElement)ctor; Element lastElement = constructors.get(constructors.size() - 1);
Content constructorDocTree = writer.getConstructorDocTreeHeader( for (Element contructor : constructors) {
constructor, constructorDetailsTree); currentConstructor = (ExecutableElement)contructor;
Content constructorDocTree = writer.getConstructorDocTreeHeader(currentConstructor, constructorDetailsTree);
buildChildren(node, constructorDocTree); buildChildren(node, constructorDocTree);
constructorDetailsTree.addContent(writer.getConstructorDoc(constructorDocTree, constructorDetailsTree.addContent(writer.getConstructorDoc(constructorDocTree,
constructors.last().equals(constructor))); currentConstructor == lastElement));
} }
memberDetailsTree.addContent( memberDetailsTree.addContent(
writer.getConstructorDetails(constructorDetailsTree)); writer.getConstructorDetails(constructorDetailsTree));
@ -192,7 +180,7 @@ public class ConstructorBuilder extends AbstractMemberBuilder {
* @param constructorDocTree the content tree to which the documentation will be added * @param constructorDocTree the content tree to which the documentation will be added
*/ */
public void buildSignature(XMLNode node, Content constructorDocTree) { public void buildSignature(XMLNode node, Content constructorDocTree) {
constructorDocTree.addContent(writer.getSignature(constructor)); constructorDocTree.addContent(writer.getSignature(currentConstructor));
} }
/** /**
@ -202,7 +190,7 @@ public class ConstructorBuilder extends AbstractMemberBuilder {
* @param constructorDocTree the content tree to which the documentation will be added * @param constructorDocTree the content tree to which the documentation will be added
*/ */
public void buildDeprecationInfo(XMLNode node, Content constructorDocTree) { public void buildDeprecationInfo(XMLNode node, Content constructorDocTree) {
writer.addDeprecated(constructor, constructorDocTree); writer.addDeprecated(currentConstructor, constructorDocTree);
} }
/** /**
@ -214,7 +202,7 @@ public class ConstructorBuilder extends AbstractMemberBuilder {
*/ */
public void buildConstructorComments(XMLNode node, Content constructorDocTree) { public void buildConstructorComments(XMLNode node, Content constructorDocTree) {
if (!configuration.nocomment) { if (!configuration.nocomment) {
writer.addComments(constructor, constructorDocTree); writer.addComments(currentConstructor, constructorDocTree);
} }
} }
@ -225,6 +213,6 @@ public class ConstructorBuilder extends AbstractMemberBuilder {
* @param constructorDocTree the content tree to which the documentation will be added * @param constructorDocTree the content tree to which the documentation will be added
*/ */
public void buildTagInfo(XMLNode node, Content constructorDocTree) { public void buildTagInfo(XMLNode node, Content constructorDocTree) {
writer.addTags(constructor, constructorDocTree); writer.addTags(currentConstructor, constructorDocTree);
} }
} }

View file

@ -67,9 +67,9 @@ public class EnumConstantBuilder extends AbstractMemberBuilder {
private final EnumConstantWriter writer; private final EnumConstantWriter writer;
/** /**
* The list of enum constants being documented. * The set of enum constants being documented.
*/ */
private final SortedSet<Element> enumConstants; private final List<Element> enumConstants;
/** /**
* The current enum constant that is being documented at this point * The current enum constant that is being documented at this point
@ -94,7 +94,7 @@ public class EnumConstantBuilder extends AbstractMemberBuilder {
typeElement, typeElement,
VisibleMemberMap.Kind.ENUM_CONSTANTS, VisibleMemberMap.Kind.ENUM_CONSTANTS,
configuration); configuration);
enumConstants = visibleMemberMap.getMembersFor(typeElement); enumConstants = visibleMemberMap.getMembers(typeElement);
} }
/** /**
@ -118,27 +118,6 @@ public class EnumConstantBuilder extends AbstractMemberBuilder {
return "EnumConstantDetails"; return "EnumConstantDetails";
} }
/**
* Returns a list of enum constants that will be documented for the given class.
* This information can be used for doclet specific documentation
* generation.
*
* @param typeElement the {@link TypeElement} we want to check.
* @return a list of enum constants that will be documented.
*/
public SortedSet<Element> members(TypeElement typeElement) {
return visibleMemberMap.getMembersFor(typeElement);
}
/**
* Returns the visible member map for the enum constants of this class.
*
* @return the visible member map for the enum constants of this class.
*/
public VisibleMemberMap getVisibleMemberMap() {
return visibleMemberMap;
}
/** /**
* Returns whether or not there are members to document. * Returns whether or not there are members to document.
* *
@ -146,7 +125,7 @@ public class EnumConstantBuilder extends AbstractMemberBuilder {
*/ */
@Override @Override
public boolean hasMembersToDocument() { public boolean hasMembersToDocument() {
return enumConstants.size() > 0; return !enumConstants.isEmpty();
} }
/** /**
@ -160,16 +139,17 @@ public class EnumConstantBuilder extends AbstractMemberBuilder {
if (writer == null) { if (writer == null) {
return; return;
} }
if (!enumConstants.isEmpty()) { if (hasMembersToDocument()) {
Content enumConstantsDetailsTree = writer.getEnumConstantsDetailsTreeHeader(typeElement, Content enumConstantsDetailsTree = writer.getEnumConstantsDetailsTreeHeader(typeElement,
memberDetailsTree); memberDetailsTree);
for (Element element : enumConstants) { Element lastElement = enumConstants.get(enumConstants.size() - 1);
currentElement = (VariableElement)element; for (Element enumConstant : enumConstants) {
currentElement = (VariableElement)enumConstant;
Content enumConstantsTree = writer.getEnumConstantsTreeHeader(currentElement, Content enumConstantsTree = writer.getEnumConstantsTreeHeader(currentElement,
enumConstantsDetailsTree); enumConstantsDetailsTree);
buildChildren(node, enumConstantsTree); buildChildren(node, enumConstantsTree);
enumConstantsDetailsTree.addContent(writer.getEnumConstants( enumConstantsDetailsTree.addContent(writer.getEnumConstants(
enumConstantsTree, currentElement.equals(enumConstants.last()))); enumConstantsTree, currentElement == lastElement));
} }
memberDetailsTree.addContent( memberDetailsTree.addContent(
writer.getEnumConstantsDetails(enumConstantsDetailsTree)); writer.getEnumConstantsDetails(enumConstantsDetailsTree));

View file

@ -69,7 +69,7 @@ public class FieldBuilder extends AbstractMemberBuilder {
/** /**
* The list of fields being documented. * The list of fields being documented.
*/ */
private final SortedSet<Element> fields; private final List<Element> fields;
/** /**
* The index of the current field that is being documented at this point * The index of the current field that is being documented at this point
@ -95,7 +95,7 @@ public class FieldBuilder extends AbstractMemberBuilder {
typeElement, typeElement,
VisibleMemberMap.Kind.FIELDS, VisibleMemberMap.Kind.FIELDS,
configuration); configuration);
fields = visibleMemberMap.getLeafClassMembers(); fields = visibleMemberMap.getLeafMembers();
} }
/** /**
@ -120,27 +120,6 @@ public class FieldBuilder extends AbstractMemberBuilder {
return "FieldDetails"; return "FieldDetails";
} }
/**
* Returns a list of fields that will be documented for the given class.
* This information can be used for doclet specific documentation
* generation.
*
* @param typeElement the {@link TypeElement} we want to check.
* @return a list of fields that will be documented.
*/
public SortedSet<Element> members(TypeElement typeElement) {
return visibleMemberMap.getMembersFor(typeElement);
}
/**
* Returns the visible member map for the fields of this class.
*
* @return the visible member map for the fields of this class.
*/
public VisibleMemberMap getVisibleMemberMap() {
return visibleMemberMap;
}
/** /**
* Returns whether or not there are members to document. * Returns whether or not there are members to document.
* *
@ -164,12 +143,14 @@ public class FieldBuilder extends AbstractMemberBuilder {
} }
if (!fields.isEmpty()) { if (!fields.isEmpty()) {
Content fieldDetailsTree = writer.getFieldDetailsTreeHeader(typeElement, memberDetailsTree); Content fieldDetailsTree = writer.getFieldDetailsTreeHeader(typeElement, memberDetailsTree);
Element lastElement = fields.get(fields.size() - 1);
for (Element element : fields) { for (Element element : fields) {
currentElement = (VariableElement)element; currentElement = (VariableElement)element;
Content fieldDocTree = writer.getFieldDocTreeHeader(currentElement, fieldDetailsTree); Content fieldDocTree = writer.getFieldDocTreeHeader(currentElement, fieldDetailsTree);
buildChildren(node, fieldDocTree); buildChildren(node, fieldDocTree);
fieldDetailsTree.addContent(writer.getFieldDoc( fieldDetailsTree.addContent(writer.getFieldDoc(
fieldDocTree, currentElement.equals(fields.last()))); fieldDocTree, currentElement == lastElement));
} }
memberDetailsTree.addContent( memberDetailsTree.addContent(
writer.getFieldDetails(fieldDetailsTree)); writer.getFieldDetails(fieldDetailsTree));

View file

@ -182,7 +182,9 @@ public class MemberSummaryBuilder extends AbstractMemberBuilder {
* @see VisibleMemberMap * @see VisibleMemberMap
*/ */
public SortedSet<Element> members(VisibleMemberMap.Kind type) { public SortedSet<Element> members(VisibleMemberMap.Kind type) {
return visibleMemberMaps.get(type).getLeafClassMembers(); TreeSet<Element> out = new TreeSet<>(comparator);
out.addAll(visibleMemberMaps.get(type).getLeafMembers());
return out;
} }
/** /**
@ -336,7 +338,7 @@ public class MemberSummaryBuilder extends AbstractMemberBuilder {
*/ */
private void buildSummary(MemberSummaryWriter writer, private void buildSummary(MemberSummaryWriter writer,
VisibleMemberMap visibleMemberMap, LinkedList<Content> summaryTreeList) { VisibleMemberMap visibleMemberMap, LinkedList<Content> summaryTreeList) {
SortedSet<Element> members = visibleMemberMap.getLeafClassMembers(); SortedSet<Element> members = asSortedSet(visibleMemberMap.getLeafMembers());
if (!members.isEmpty()) { if (!members.isEmpty()) {
List<Content> tableContents = new LinkedList<>(); List<Content> tableContents = new LinkedList<>();
int counter = 0; int counter = 0;
@ -492,7 +494,7 @@ public class MemberSummaryBuilder extends AbstractMemberBuilder {
if (inhclass == typeElement) { if (inhclass == typeElement) {
continue; continue;
} }
SortedSet<Element> inhmembers = visibleMemberMap.getMembersFor(inhclass); SortedSet<Element> inhmembers = asSortedSet(visibleMemberMap.getMembers(inhclass));
if (!inhmembers.isEmpty()) { if (!inhmembers.isEmpty()) {
Content inheritedTree = writer.getInheritedSummaryHeader(inhclass); Content inheritedTree = writer.getInheritedSummaryHeader(inhclass);
Content linksTree = writer.getInheritedSummaryLinksTree(); Content linksTree = writer.getInheritedSummaryLinksTree();

View file

@ -78,7 +78,7 @@ public class MethodBuilder extends AbstractMemberBuilder {
/** /**
* The methods being documented. * The methods being documented.
*/ */
private final SortedSet<Element> methods; private final List<Element> methods;
/** /**
@ -98,7 +98,7 @@ public class MethodBuilder extends AbstractMemberBuilder {
typeElement, typeElement,
VisibleMemberMap.Kind.METHODS, VisibleMemberMap.Kind.METHODS,
configuration); configuration);
methods = visibleMemberMap.getLeafClassMembers(); methods = visibleMemberMap.getLeafMembers();
} }
/** /**
@ -123,27 +123,6 @@ public class MethodBuilder extends AbstractMemberBuilder {
return "MethodDetails"; return "MethodDetails";
} }
/**
* Returns a list of methods that will be documented for the given class.
* This information can be used for doclet specific documentation
* generation.
*
* @param typeElement the {@link TypeElement} we want to check.
* @return a list of methods that will be documented.
*/
public SortedSet<Element> members(TypeElement typeElement) {
return visibleMemberMap.getMembersFor(typeElement);
}
/**
* Returns the visible member map for the methods of this class.
*
* @return the visible member map for the methods of this class.
*/
public VisibleMemberMap getVisibleMemberMap() {
return visibleMemberMap;
}
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
@ -163,18 +142,17 @@ public class MethodBuilder extends AbstractMemberBuilder {
if (writer == null) { if (writer == null) {
return; return;
} }
if (!methods.isEmpty()) { if (hasMembersToDocument()) {
Content methodDetailsTree = writer.getMethodDetailsTreeHeader(typeElement, Content methodDetailsTree = writer.getMethodDetailsTreeHeader(typeElement,
memberDetailsTree); memberDetailsTree);
Set<Element> methodDetailSet = ((ConfigurationImpl)configuration).sortedMethodDetails
? methods Element lastElement = methods.get(methods.size() - 1);
: visibleMemberMap.getLeafClassMembersSourceOrder(); for (Element method : methods) {
for (Element e : methodDetailSet) { currentMethod = (ExecutableElement)method;
currentMethod = (ExecutableElement) e;
Content methodDocTree = writer.getMethodDocTreeHeader(currentMethod, methodDetailsTree); Content methodDocTree = writer.getMethodDocTreeHeader(currentMethod, methodDetailsTree);
buildChildren(node, methodDocTree); buildChildren(node, methodDocTree);
methodDetailsTree.addContent(writer.getMethodDoc( methodDetailsTree.addContent(writer.getMethodDoc(
methodDocTree, currentMethod == methods.last())); methodDocTree, currentMethod == lastElement));
} }
memberDetailsTree.addContent(writer.getMethodDetails(methodDetailsTree)); memberDetailsTree.addContent(writer.getMethodDetails(methodDetailsTree));
} }

View file

@ -69,7 +69,7 @@ public class PropertyBuilder extends AbstractMemberBuilder {
/** /**
* The list of properties being documented. * The list of properties being documented.
*/ */
private final SortedSet<Element> properties; private final List<Element> properties;
/** /**
* The index of the current property that is being documented at this point * The index of the current property that is being documented at this point
@ -95,7 +95,7 @@ public class PropertyBuilder extends AbstractMemberBuilder {
typeElement, typeElement,
VisibleMemberMap.Kind.PROPERTIES, VisibleMemberMap.Kind.PROPERTIES,
configuration); configuration);
properties = visibleMemberMap.getMembersFor(typeElement); properties = visibleMemberMap.getMembers(typeElement);
} }
/** /**
@ -120,27 +120,6 @@ public class PropertyBuilder extends AbstractMemberBuilder {
return "PropertyDetails"; return "PropertyDetails";
} }
/**
* Returns a list of properties that will be documented for the given class.
* This information can be used for doclet specific documentation
* generation.
*
* @param typeElement the {@link TypeElement} we want to check.
* @return a list of properties that will be documented.
*/
public SortedSet<Element> members(TypeElement typeElement) {
return visibleMemberMap.getMembersFor(typeElement);
}
/**
* Returns the visible member map for the properties of this class.
*
* @return the visible member map for the properties of this class.
*/
public VisibleMemberMap getVisibleMemberMap() {
return visibleMemberMap;
}
/** /**
* Returns whether or not there are members to document. * Returns whether or not there are members to document.
* *
@ -162,17 +141,17 @@ public class PropertyBuilder extends AbstractMemberBuilder {
if (writer == null) { if (writer == null) {
return; return;
} }
int size = properties.size(); if (hasMembersToDocument()) {
if (size > 0) {
Content propertyDetailsTree = writer.getPropertyDetailsTreeHeader(typeElement, Content propertyDetailsTree = writer.getPropertyDetailsTreeHeader(typeElement,
memberDetailsTree); memberDetailsTree);
for (Element e : properties) { Element lastElement = properties.get(properties.size() - 1);
currentProperty = (ExecutableElement) e; for (Element property : properties) {
currentProperty = (ExecutableElement)property;
Content propertyDocTree = writer.getPropertyDocTreeHeader(currentProperty, Content propertyDocTree = writer.getPropertyDocTreeHeader(currentProperty,
propertyDetailsTree); propertyDetailsTree);
buildChildren(node, propertyDocTree); buildChildren(node, propertyDocTree);
propertyDetailsTree.addContent(writer.getPropertyDoc( propertyDetailsTree.addContent(writer.getPropertyDoc(
propertyDocTree, currentProperty == properties.last())); propertyDocTree, currentProperty == lastElement));
} }
memberDetailsTree.addContent( memberDetailsTree.addContent(
writer.getPropertyDetails(propertyDetailsTree)); writer.getPropertyDetails(propertyDetailsTree));

View file

@ -25,7 +25,6 @@
package jdk.javadoc.internal.doclets.toolkit.util; package jdk.javadoc.internal.doclets.toolkit.util;
import java.io.IOException;
import java.lang.annotation.Documented; import java.lang.annotation.Documented;
import java.lang.ref.SoftReference; import java.lang.ref.SoftReference;
import java.text.CollationKey; import java.text.CollationKey;
@ -77,9 +76,7 @@ import com.sun.source.util.DocTrees;
import com.sun.source.util.TreePath; import com.sun.source.util.TreePath;
import jdk.javadoc.internal.doclets.toolkit.CommentUtils.DocCommentDuo; import jdk.javadoc.internal.doclets.toolkit.CommentUtils.DocCommentDuo;
import jdk.javadoc.internal.doclets.toolkit.Configuration; import jdk.javadoc.internal.doclets.toolkit.Configuration;
import jdk.javadoc.internal.doclets.toolkit.DocletException;
import jdk.javadoc.internal.doclets.toolkit.Messages; import jdk.javadoc.internal.doclets.toolkit.Messages;
import jdk.javadoc.internal.doclets.toolkit.Resources;
import jdk.javadoc.internal.doclets.toolkit.WorkArounds; import jdk.javadoc.internal.doclets.toolkit.WorkArounds;
import static javax.lang.model.element.ElementKind.*; import static javax.lang.model.element.ElementKind.*;
@ -258,14 +255,6 @@ public class Utils {
return getEnclosingTypeElement(e) == null || isStatic(e); return getEnclosingTypeElement(e) == null || isStatic(e);
} }
public boolean matches(Element e1, Element e2) {
if (isExecutableElement(e1) && isExecutableElement(e1)) {
return executableMembersEqual((ExecutableElement)e1, (ExecutableElement)e2);
} else {
return e1.getSimpleName().equals(e2.getSimpleName());
}
}
/** /**
* Copy doc-files directory and its contents from the source * Copy doc-files directory and its contents from the source
* package directory to the generated documentation directory. * package directory to the generated documentation directory.
@ -2161,6 +2150,13 @@ public class Utils {
return convertToExecutableElement(getItems(e, false, METHOD)); return convertToExecutableElement(getItems(e, false, METHOD));
} }
public int getOrdinalValue(VariableElement member) {
if (member == null || member.getKind() != ENUM_CONSTANT) {
throw new IllegalArgumentException("must be an enum constant: " + member);
}
return member.getEnclosingElement().getEnclosedElements().indexOf(member);
}
public long getLineNumber(Element e) { public long getLineNumber(Element e) {
TreePath path = getTreePath(e); TreePath path = getTreePath(e);
if (path == null) { // maybe null if synthesized if (path == null) { // maybe null if synthesized

View file

@ -220,48 +220,36 @@ public class VisibleMemberMap {
} }
/** /**
* Return the visible members of the class being mapped. Also append at the * Returns a list of visible enclosed members of the type being mapped.
* end of the list members that are inherited by inaccessible parents. We * This list may also contain appended members, inherited by inaccessible
* document these members in the child because the parent is not documented. * super types. These members are documented in the subtype when the
* super type is not documented.
* *
* @param configuration the current configuration of the doclet. * @return a list of visible enclosed members
*/ */
public SortedSet<Element> getLeafClassMembers() {
SortedSet<Element> result = getMembersFor(typeElement);
result.addAll(getInheritedPackagePrivateMethods());
return result;
}
public Set<Element> getLeafClassMembersSourceOrder() { public List<Element> getLeafMembers() {
Set<Element> result = new LinkedHashSet<>(classMap.get(typeElement).members); List<Element> result = new ArrayList<>();
result.addAll(classMap.get(typeElement).members);
result.addAll(getInheritedPackagePrivateMethods()); result.addAll(getInheritedPackagePrivateMethods());
return result; return result;
} }
/** /**
* Retrn the list of members for the given class. * Returns a list of enclosed members for the given type.
* *
* @param typeElement the class to retrieve the list of visible members for. * @param typeElement the given type
* *
* @return the list of members for the given class. * @return a list of enclosed members
*/ */
public SortedSet<Element> getMembersFor(TypeElement typeElement) { public List<Element> getMembers(TypeElement typeElement) {
return asSortedSet(classMap.get(typeElement).members); return classMap.get(typeElement).members;
} }
public boolean hasMembersFor(TypeElement typeElement) { public boolean hasMembers(TypeElement typeElement) {
return !classMap.get(typeElement).members.isEmpty(); return !classMap.get(typeElement).members.isEmpty();
} }
private SortedSet<Element> asSortedSet(Collection<Element> in) {
if (in == null) {
return Collections.emptySortedSet();
}
TreeSet<Element> out = new TreeSet<>(comparator);
out.addAll(in);
return out;
}
private void fillMemberLevelMap(List<? extends Element> list, String level) { private void fillMemberLevelMap(List<? extends Element> list, String level) {
for (Element element : list) { for (Element element : list) {
Object key = getMemberKey(element); Object key = getMemberKey(element);
@ -318,9 +306,9 @@ public class VisibleMemberMap {
private final TypeElement typeElement; private final TypeElement typeElement;
/** /**
* List of inherited members from the mapping class. * List of members from the mapping class.
*/ */
private Set<Element> members = new LinkedHashSet<>(); private List<Element> members = null;
/** /**
* Level/Depth of inheritance. * Level/Depth of inheritance.
@ -379,23 +367,23 @@ public class VisibleMemberMap {
* Adjust member-level-map, class-map. * Adjust member-level-map, class-map.
*/ */
private void addMembers(TypeElement fromClass) { private void addMembers(TypeElement fromClass) {
List<? extends Element> classMembers = getClassMembers(fromClass, true); List<Element> result = new ArrayList<>();
List<Element> incllist = new ArrayList<>(); for (Element element : getClassMembers(fromClass, true)) {
for (Element element : classMembers) { if (memberIsVisible(element)) {
if (!found(members, element)) { if (!isOverridden(element, level)) {
if (memberIsVisible(element)) { if (!utils.isHidden(element)) {
if (!isOverridden(element, level)) { result.add(element);
if (!utils.isHidden(element)) {
incllist.add(element);
}
} }
} }
} }
} }
if (!incllist.isEmpty()) { if (members != null) {
throw new AssertionError("members should not be null");
}
members = Collections.unmodifiableList(result);
if (!members.isEmpty()) {
noVisibleMembers = false; noVisibleMembers = false;
} }
members.addAll(incllist);
fillMemberLevelMap(getClassMembers(fromClass, false), level); fillMemberLevelMap(getClassMembers(fromClass, false), level);
} }
@ -513,16 +501,6 @@ public class VisibleMemberMap {
return targetMembers; return targetMembers;
} }
private boolean found(Iterable<Element> list, Element elem) {
for (Element pgmelem : list) {
if (utils.matches(pgmelem, elem)) {
return true;
}
}
return false;
}
/** /**
* Is member overridden? The member is overridden if it is found in the * Is member overridden? The member is overridden if it is found in the
* same level hierarchy e.g. member at level "11" overrides member at * same level hierarchy e.g. member at level "11" overrides member at

View file

@ -23,7 +23,7 @@
/* /*
* @test * @test
* @bug 7112427 8012295 8025633 8026567 8061305 8081854 8150130 8162363 * @bug 7112427 8012295 8025633 8026567 8061305 8081854 8150130 8162363 8167967
* @summary Test of the JavaFX doclet features. * @summary Test of the JavaFX doclet features.
* @author jvalenta * @author jvalenta
* @library ../lib * @library ../lib
@ -163,10 +163,7 @@ public class TestJavaFX extends JavadocTester {
"pkg2"); "pkg2");
checkExit(Exit.OK); checkExit(Exit.OK);
checkOutput("pkg2/Test.html", true, checkOutput("pkg2/Test.html", true,
"<li class=\"blockList\"><a name=\"property.detail\">\n" "<h3>Property Detail</h3>\n"
+ "<!-- -->\n"
+ "</a>\n"
+ "<h3>Property Detail</h3>\n"
+ "<a name=\"betaProperty\">\n" + "<a name=\"betaProperty\">\n"
+ "<!-- -->\n" + "<!-- -->\n"
+ "</a>\n" + "</a>\n"
@ -176,27 +173,27 @@ public class TestJavaFX extends JavadocTester {
+ "<pre>public&nbsp;java.lang.Object betaProperty</pre>\n" + "<pre>public&nbsp;java.lang.Object betaProperty</pre>\n"
+ "</li>\n" + "</li>\n"
+ "</ul>\n" + "</ul>\n"
+ "<a name=\"deltaProperty\">\n" + "<a name=\"gammaProperty\">\n"
+ "<!-- -->\n" + "<!-- -->\n"
+ "</a>\n" + "</a>\n"
+ "<ul class=\"blockList\">\n" + "<ul class=\"blockList\">\n"
+ "<li class=\"blockList\">\n" + "<li class=\"blockList\">\n"
+ "<h4>gamma</h4>\n"
+ "<pre>public final&nbsp;java.util.List&lt;java.lang.String&gt; gammaProperty</pre>\n"
+ "</li>\n"
+ "</ul>\n"
+ "<a name=\"deltaProperty\">\n"
+ "<!-- -->\n"
+ "</a>\n"
+ "<ul class=\"blockListLast\">\n"
+ "<li class=\"blockList\">\n"
+ "<h4>delta</h4>\n" + "<h4>delta</h4>\n"
+ "<pre>public final&nbsp;java.util.List&lt;" + "<pre>public final&nbsp;java.util.List&lt;"
+ "java.util.Set&lt;? super java.lang.Object&gt;&gt; deltaProperty</pre>\n" + "java.util.Set&lt;? super java.lang.Object&gt;&gt; deltaProperty</pre>\n"
+ "</li>\n" + "</li>\n"
+ "</ul>\n" + "</ul>\n"
+ "<a name=\"gammaProperty\">\n"
+ "<!-- -->\n"
+ "</a>\n"
+ "<ul class=\"blockListLast\">\n"
+ "<li class=\"blockList\">\n"
+ "<h4>gamma</h4>\n"
+ "<pre>public final&nbsp;java.util.List&lt;"
+ "java.lang.String&gt; gammaProperty</pre>\n"
+ "</li>\n" + "</li>\n"
+ "</ul>\n" + "</ul>");
+ "</li>");
} }
/* /*

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -21,32 +21,11 @@
* questions. * questions.
*/ */
package order; package pkg5;
/** public @interface AnnoFieldTest {
* This class ensures the method detail section contains the methods public int one = 1;
* in the order as it appears in the source. public int two = 2;
* @author kumasrin public int three = 3;
*/ public int four = 4;
public class MethodOrder {
/**
* Method d.
* Second line.
*/
public void d(){}
/**
* Method b.
* Second line.
*/
public void b() {}
/**
* Method c.
* Second line.
*/
public void c() {}
/**
* Method a.
* Second line.
*/
public void a() {}
} }

View file

@ -0,0 +1,31 @@
/*
* Copyright (c) 2016, 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 pkg5;
public @interface AnnoOptionalTest {
int one() default 1;
int two() default 2;
int three() default 3;
int four() default 4;
}

View file

@ -0,0 +1,31 @@
/*
* Copyright (c) 2016, 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 pkg5;
public @interface AnnoRequiredTest {
int one();
int two();
int three();
int four();
}

View file

@ -0,0 +1,31 @@
/*
* Copyright (c) 2016, 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 pkg5;
public class CtorTest {
public CtorTest(int one, int two, int three, int four) {}
public CtorTest(int one, int two, int three) {}
public CtorTest(int one, int two) {}
public CtorTest(int one) {}
}

View file

@ -0,0 +1,31 @@
/*
* Copyright (c) 2016, 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 pkg5;
public enum EnumTest {
ONE,
TWO,
THREE,
FOUR
}

View file

@ -0,0 +1,31 @@
/*
* Copyright (c) 2016, 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 pkg5;
public class FieldTest {
public int one;
public int two;
public int three;
public int four;
}

View file

@ -0,0 +1,31 @@
/*
* Copyright (c) 2016, 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 pkg5;
public interface IntfTest {
void one();
void two();
void three();
void four();
}

View file

@ -0,0 +1,31 @@
/*
* Copyright (c) 2016, 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 pkg5;
public class MethodTest {
public void one(){}
public void two(){}
public void three(){}
public void four(){}
}

View file

@ -0,0 +1,31 @@
/*
* Copyright (c) 2016, 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 pkg5;
public class PropertyTest {
public int oneProperty() { return 1; }
public int twoProperty() { return 2; }
public int threeProperty() { return 3; }
public int fourProperty() { return 4; }
}