/** * @param member1 the first method to compare. * @param member2 the second method to compare. * @return true if member1 overrides/hides or is overriden/hidden by member2. */ public static boolean executableMembersEqual( ExecutableMemberDoc member1, ExecutableMemberDoc member2) { if (!(member1 instanceof MethodDoc && member2 instanceof MethodDoc)) return false; MethodDoc method1 = (MethodDoc) member1; MethodDoc method2 = (MethodDoc) member2; if (method1.isStatic() && method2.isStatic()) { Parameter[] targetParams = method1.parameters(); Parameter[] currentParams; if (method1.name().equals(method2.name()) && (currentParams = method2.parameters()).length == targetParams.length) { int j; for (j = 0; j < targetParams.length; j++) { if (!(targetParams[j].typeName().equals(currentParams[j].typeName()) || currentParams[j].type() instanceof TypeVariable || targetParams[j].type() instanceof TypeVariable)) { break; } } if (j == targetParams.length) { return true; } } return false; } else { return method1.overrides(method2) || method2.overrides(method1) || member1 == member2; } }
/** * Build the method tags. * * @param node the XML element that specifies which components to document * @param methodsContentTree content tree to which the documentation will be added */ public void buildMethodTags(XMLNode node, Content methodsContentTree) { methodWriter.addMemberTags((MethodDoc) currentMember, methodsContentTree); MethodDoc method = (MethodDoc) currentMember; if (method.name().compareTo("writeExternal") == 0 && method.tags("serialData").length == 0) { if (configuration.serialwarn) { configuration .getDocletSpecificMsg() .warning( currentMember.position(), "doclet.MissingSerialDataTag", method.containingClass().qualifiedName(), method.name()); } } }
/** * Build the comments for the method. Do nothing if {@link Configuration#nocomment} is set to * true. * * @param node the XML element that specifies which components to document * @param methodDocTree the content tree to which the documentation will be added */ public void buildMethodComments(XMLNode node, Content methodDocTree) { if (!configuration.nocomment) { MethodDoc method = (MethodDoc) methods.get(currentMethodIndex); if (method.inlineTags().length == 0) { DocFinder.Output docs = DocFinder.search(configuration, new DocFinder.Input(method)); method = docs.inlineTags != null && docs.inlineTags.length > 0 ? (MethodDoc) docs.holder : method; } // NOTE: When we fix the bug where ClassDoc.interfaceTypes() does // not pass all implemented interfaces, holder will be the // interface type. For now, it is really the erasure. writer.addComments(method.containingClass(), method, methodDocTree); } }
/** The documentation for values() and valueOf() in Enums are set by the doclet. */ public static void setEnumDocumentation(Configuration configuration, ClassDoc classDoc) { MethodDoc[] methods = classDoc.methods(); for (int j = 0; j < methods.length; j++) { MethodDoc currentMethod = methods[j]; if (currentMethod.name().equals("values") && currentMethod.parameters().length == 0) { currentMethod.setRawCommentText( configuration.getText("doclet.enum_values_doc", classDoc.name())); } else if (currentMethod.name().equals("valueOf") && currentMethod.parameters().length == 1) { Type paramType = currentMethod.parameters()[0].type(); if (paramType != null && paramType.qualifiedTypeName().equals(String.class.getName())) { currentMethod.setRawCommentText(configuration.getText("doclet.enum_valueof_doc")); } } } }