List of usage examples for org.eclipse.jdt.core.dom TagElement TAG_DEPRECATED
String TAG_DEPRECATED
To view the source code for org.eclipse.jdt.core.dom TagElement TAG_DEPRECATED.
Click Source Link
From source file:at.bestsolution.fxide.jdt.text.javadoc.JavadocContentAccess2.java
License:Open Source License
private void elementToHTML() { // After first loop, non-null entries in the following two lists are missing and need to be inherited: List<String> typeParameterNames = initTypeParameterNames(); List<String> parameterNames = initParameterNames(); List<String> exceptionNames = initExceptionNames(); TagElement deprecatedTag = null; TagElement start = null;// w ww . j ava 2s.co m List<TagElement> typeParameters = new ArrayList<>(); List<TagElement> parameters = new ArrayList<>(); TagElement returnTag = null; List<TagElement> exceptions = new ArrayList<>(); List<TagElement> versions = new ArrayList<>(); List<TagElement> authors = new ArrayList<>(); List<TagElement> sees = new ArrayList<>(); List<TagElement> since = new ArrayList<>(); List<TagElement> rest = new ArrayList<>(); List<TagElement> tags = fJavadoc.tags(); for (Iterator<TagElement> iter = tags.iterator(); iter.hasNext();) { TagElement tag = iter.next(); String tagName = tag.getTagName(); if (tagName == null) { start = tag; } else if (TagElement.TAG_PARAM.equals(tagName)) { List<? extends ASTNode> fragments = tag.fragments(); int size = fragments.size(); if (size > 0) { Object first = fragments.get(0); if (first instanceof SimpleName) { String name = ((SimpleName) first).getIdentifier(); int paramIndex = parameterNames.indexOf(name); if (paramIndex != -1) { parameterNames.set(paramIndex, null); } parameters.add(tag); } else if (size > 2 && first instanceof TextElement) { String firstText = ((TextElement) first).getText(); if ("<".equals(firstText)) { //$NON-NLS-1$ Object second = fragments.get(1); Object third = fragments.get(2); if (second instanceof SimpleName && third instanceof TextElement) { String name = ((SimpleName) second).getIdentifier(); String thirdText = ((TextElement) third).getText(); if (">".equals(thirdText)) { //$NON-NLS-1$ int paramIndex = typeParameterNames.indexOf(name); if (paramIndex != -1) { typeParameterNames.set(paramIndex, null); } typeParameters.add(tag); } } } } } } else if (TagElement.TAG_RETURN.equals(tagName)) { if (returnTag == null) returnTag = tag; // the Javadoc tool only shows the first return tag } else if (TagElement.TAG_EXCEPTION.equals(tagName) || TagElement.TAG_THROWS.equals(tagName)) { exceptions.add(tag); List<? extends ASTNode> fragments = tag.fragments(); if (fragments.size() > 0) { Object first = fragments.get(0); if (first instanceof Name) { String name = ASTNodes.getSimpleNameIdentifier((Name) first); int exceptionIndex = exceptionNames.indexOf(name); if (exceptionIndex != -1) { exceptionNames.set(exceptionIndex, null); } } } } else if (TagElement.TAG_SINCE.equals(tagName)) { since.add(tag); } else if (TagElement.TAG_VERSION.equals(tagName)) { versions.add(tag); } else if (TagElement.TAG_AUTHOR.equals(tagName)) { authors.add(tag); } else if (TagElement.TAG_SEE.equals(tagName)) { sees.add(tag); } else if (TagElement.TAG_DEPRECATED.equals(tagName)) { if (deprecatedTag == null) deprecatedTag = tag; // the Javadoc tool only shows the first deprecated tag } else { rest.add(tag); } } //TODO: @Documented annotations before header if (deprecatedTag != null) handleDeprecatedTag(deprecatedTag); if (start != null) handleContentElements(start.fragments()); else if (fMethod != null) { CharSequence inherited = fJavadocLookup.getInheritedMainDescription(fMethod); // The Javadoc tool adds "Description copied from class: ..." (only for the main description). // We don't bother doing that. handleInherited(inherited); } CharSequence[] typeParameterDescriptions = new CharSequence[typeParameterNames.size()]; boolean hasInheritedTypeParameters = inheritTypeParameterDescriptions(typeParameterNames, typeParameterDescriptions); boolean hasTypeParameters = typeParameters.size() > 0 || hasInheritedTypeParameters; CharSequence[] parameterDescriptions = new CharSequence[parameterNames.size()]; boolean hasInheritedParameters = inheritParameterDescriptions(parameterNames, parameterDescriptions); boolean hasParameters = parameters.size() > 0 || hasInheritedParameters; CharSequence returnDescription = null; if (returnTag == null && needsReturnTag()) returnDescription = fJavadocLookup.getInheritedReturnDescription(fMethod); boolean hasReturnTag = returnTag != null || returnDescription != null; CharSequence[] exceptionDescriptions = new CharSequence[exceptionNames.size()]; boolean hasInheritedExceptions = inheritExceptionDescriptions(exceptionNames, exceptionDescriptions); boolean hasExceptions = exceptions.size() > 0 || hasInheritedExceptions; if (hasParameters || hasTypeParameters || hasReturnTag || hasExceptions || versions.size() > 0 || authors.size() > 0 || since.size() > 0 || sees.size() > 0 || rest.size() > 0 || (fBuf.length() > 0 && (parameterDescriptions.length > 0 || exceptionDescriptions.length > 0))) { handleSuperMethodReferences(); fBuf.append(BLOCK_TAG_START); handleParameterTags(typeParameters, typeParameterNames, typeParameterDescriptions, true); handleParameterTags(parameters, parameterNames, parameterDescriptions, false); handleReturnTag(returnTag, returnDescription); handleExceptionTags(exceptions, exceptionNames, exceptionDescriptions); handleBlockTags(JavaDocMessages.JavaDoc2HTMLTextReader_since_section, since); handleBlockTags(JavaDocMessages.JavaDoc2HTMLTextReader_version_section, versions); handleBlockTags(JavaDocMessages.JavaDoc2HTMLTextReader_author_section, authors); handleBlockTags(JavaDocMessages.JavaDoc2HTMLTextReader_see_section, sees); handleBlockTags(rest); fBuf.append(BLOCK_TAG_END); } else if (fBuf.length() > 0) { handleSuperMethodReferences(); } }
From source file:com.codenvy.ide.ext.java.server.javadoc.JavadocContentAccess2.java
License:Open Source License
private String toHTML() { fBuf = new StringBuffer(); fLiteralContent = 0;/*from w ww . j a v a 2 s.c om*/ // After first loop, non-null entries in the following two lists are missing and need to be inherited: List<String> parameterNames = initParameterNames(); List<String> exceptionNames = initExceptionNames(); TagElement deprecatedTag = null; TagElement start = null; List<TagElement> parameters = new ArrayList<TagElement>(); TagElement returnTag = null; List<TagElement> exceptions = new ArrayList<TagElement>(); List<TagElement> versions = new ArrayList<TagElement>(); List<TagElement> authors = new ArrayList<TagElement>(); List<TagElement> sees = new ArrayList<TagElement>(); List<TagElement> since = new ArrayList<TagElement>(); List<TagElement> rest = new ArrayList<TagElement>(); List<TagElement> tags = fJavadoc.tags(); for (Iterator<TagElement> iter = tags.iterator(); iter.hasNext();) { TagElement tag = iter.next(); String tagName = tag.getTagName(); if (tagName == null) { start = tag; } else if (TagElement.TAG_PARAM.equals(tagName)) { parameters.add(tag); List<? extends ASTNode> fragments = tag.fragments(); if (fragments.size() > 0) { Object first = fragments.get(0); if (first instanceof SimpleName) { String name = ((SimpleName) first).getIdentifier(); int paramIndex = parameterNames.indexOf(name); if (paramIndex != -1) { parameterNames.set(paramIndex, null); } } } } else if (TagElement.TAG_RETURN.equals(tagName)) { if (returnTag == null) returnTag = tag; // the Javadoc tool only shows the first return tag } else if (TagElement.TAG_EXCEPTION.equals(tagName) || TagElement.TAG_THROWS.equals(tagName)) { exceptions.add(tag); List<? extends ASTNode> fragments = tag.fragments(); if (fragments.size() > 0) { Object first = fragments.get(0); if (first instanceof Name) { String name = ASTNodes.getSimpleNameIdentifier((Name) first); int exceptionIndex = exceptionNames.indexOf(name); if (exceptionIndex != -1) { exceptionNames.set(exceptionIndex, null); } } } } else if (TagElement.TAG_SINCE.equals(tagName)) { since.add(tag); } else if (TagElement.TAG_VERSION.equals(tagName)) { versions.add(tag); } else if (TagElement.TAG_AUTHOR.equals(tagName)) { authors.add(tag); } else if (TagElement.TAG_SEE.equals(tagName)) { sees.add(tag); } else if (TagElement.TAG_DEPRECATED.equals(tagName)) { if (deprecatedTag == null) deprecatedTag = tag; // the Javadoc tool only shows the first deprecated tag } else { rest.add(tag); } } //TODO: @Documented annotations before header if (deprecatedTag != null) handleDeprecatedTag(deprecatedTag); if (start != null) handleContentElements(start.fragments()); else if (fMethod != null) { CharSequence inherited = fJavadocLookup.getInheritedMainDescription(fMethod); // The Javadoc tool adds "Description copied from class: ..." (only for the main description). // We don't bother doing that. handleInherited(inherited); } CharSequence[] parameterDescriptions = new CharSequence[parameterNames.size()]; boolean hasInheritedParameters = inheritParameterDescriptions(parameterNames, parameterDescriptions); boolean hasParameters = parameters.size() > 0 || hasInheritedParameters; CharSequence returnDescription = null; if (returnTag == null && needsReturnTag()) returnDescription = fJavadocLookup.getInheritedReturnDescription(fMethod); boolean hasReturnTag = returnTag != null || returnDescription != null; CharSequence[] exceptionDescriptions = new CharSequence[exceptionNames.size()]; boolean hasInheritedExceptions = inheritExceptionDescriptions(exceptionNames, exceptionDescriptions); boolean hasExceptions = exceptions.size() > 0 || hasInheritedExceptions; if (hasParameters || hasReturnTag || hasExceptions || versions.size() > 0 || authors.size() > 0 || since.size() > 0 || sees.size() > 0 || rest.size() > 0 || (fBuf.length() > 0 && (parameterDescriptions.length > 0 || exceptionDescriptions.length > 0))) { handleSuperMethodReferences(); fBuf.append(BLOCK_TAG_START); handleParameterTags(parameters, parameterNames, parameterDescriptions); handleReturnTag(returnTag, returnDescription); handleExceptionTags(exceptions, exceptionNames, exceptionDescriptions); handleBlockTags(JavaDocMessages.JavaDoc2HTMLTextReader_since_section, since); handleBlockTags(JavaDocMessages.JavaDoc2HTMLTextReader_version_section, versions); handleBlockTags(JavaDocMessages.JavaDoc2HTMLTextReader_author_section, authors); handleBlockTags(JavaDocMessages.JavaDoc2HTMLTextReader_see_section, sees); handleBlockTags(rest); fBuf.append(BLOCK_TAG_END); } else if (fBuf.length() > 0) { handleSuperMethodReferences(); } String result = fBuf.toString(); fBuf = null; return result; }
From source file:com.servoy.eclipse.docgenerator.generators.DocumentationDataDistilled.java
License:Open Source License
public DocumentationDataDistilled(IMemberMetaModel memberMM, TypeMetaModel typeMM, JavadocMetaModel jdoc, MetaModelHolder holder) {//w w w . ja v a 2 s. co m Set<DocumentationWarning> warnings = memberMM.getWarnings(); String location = memberMM.getFullSignature(); boolean clean = true; ClientSupport typeCsp = typeMM.getServoyClientSupport(holder); ClientSupport csp = typeCsp == null ? ClientSupport.Default : typeCsp; texts = new ArrayList<Pair<ClientSupport, String>>(); summaries = new ArrayList<Pair<ClientSupport, String>>(); String descriptionText = ExtractorUtil.grabExactlyOne(JavadocMetaModel.TEXT_TAG, clean, jdoc, warnings, location); String mobileDescriptionText = ExtractorUtil.grabExactlyOne(TAG_MOBILEDESCRIPTION, clean, jdoc, warnings, location); List<Pair<ClientSupport, String>> txts = new ArrayList<Pair<ClientSupport, String>>(); if (mobileDescriptionText != null && mobileDescriptionText.trim().length() > 0) { txts.add(new Pair<ClientSupport, String>(ClientSupport.mc, mobileDescriptionText.trim())); csp = csp.remove(ClientSupport.mc); } if (descriptionText != null && descriptionText.trim().length() > 0) { txts.add(new Pair<ClientSupport, String>(csp, descriptionText)); } setTexts(txts); String sample = ExtractorUtil.grabExactlyOne(TAG_SAMPLE, clean, jdoc, warnings, location); String mSample = ExtractorUtil.grabExactlyOne(TAG_MOBILESAMPLE, clean, jdoc, warnings, location); ClientSupport aux = typeCsp == null ? ClientSupport.Default : typeCsp; if (mSample != null && mSample.trim().length() > 0) { // add back the "*/" mSample = Pattern.compile("\\*/").matcher(mSample).replaceAll("*/"); addSample(ClientSupport.mc, mSample); aux = aux.remove(ClientSupport.mc); } if (sample != null && sample.trim().length() > 0) { // add back the "*/" sample = Pattern.compile("\\*/").matcher(sample).replaceAll("*/"); addSample(aux, sample); } deprecatedText = ExtractorUtil.grabExactlyOne(TagElement.TAG_DEPRECATED, clean, jdoc, warnings, location); ret = ExtractorUtil.grabExactlyOne(TagElement.TAG_RETURN, clean, jdoc, warnings, location); since = ExtractorUtil.grabExactlyOne(TagElement.TAG_SINCE, clean, jdoc, warnings, location); until = ExtractorUtil.grabExactlyOne(TAG_UNTIL, clean, jdoc, warnings, location); sameAs = ExtractorUtil.grabReference(TAG_SAMEAS, jdoc, warnings, location); if (sameAs != null) { sameAs.setEnclosingType(typeMM.getName().getQualifiedName()); } cloneSample = ExtractorUtil.grabReference(TAG_SAMPLE_AS, jdoc, warnings, location); if (cloneSample != null) { cloneSample.setEnclosingType(typeMM.getName().getQualifiedName()); } cloneDescription = ExtractorUtil.grabReference(TAG_CLONEDESC, jdoc, warnings, location); if (cloneDescription != null) { cloneDescription.setEnclosingType(typeMM.getName().getQualifiedName()); } JavadocTagPart specialTag = ExtractorUtil.grabFirstTag(TAG_SPECIAL, jdoc, true, warnings, location); if (specialTag != null) { special = true; } JavadocTagPart simplifiedSignatureTag = ExtractorUtil.grabFirstTag(TAG_SIMPLIFIEDSIGNATURE, jdoc, true, warnings, location); if (simplifiedSignatureTag != null) { simplifiedSignature = true; } JavadocTagPart staticCallTag = ExtractorUtil.grabFirstTag(TAG_STATICCALL, jdoc, true, warnings, location); if (staticCallTag != null) { staticCall = true; } List<JavadocTagPart> paramTags = jdoc.findTags(TagElement.TAG_PARAM); for (JavadocTagPart paramTag : paramTags) { String paramText = paramTag.getAsString(clean); paramText = paramText.trim(); StringTokenizer st = new StringTokenizer(paramText); if (st.hasMoreTokens()) { String paramName = st.nextToken(); boolean isOptional = false; String paramDescription = null; if (st.hasMoreTokens()) { String maybeOptional = st.nextToken(); if (maybeOptional.equals(FLAG_OPTIONAL)) { isOptional = true; int idx = paramText.indexOf(FLAG_OPTIONAL); paramDescription = paramText.substring(idx + FLAG_OPTIONAL.length()).trim(); } else { paramDescription = paramText.substring(paramName.length()).trim(); } } if (paramDescription == null) { paramDescription = ""; warnings.add(new DocumentationWarning(WarningType.ParamTagWithoutContent, location, TagElement.TAG_PARAM + " tag without text: '" + paramName + "'.")); } DocumentedParameterData parData = new DocumentedParameterData(paramName, isOptional, paramDescription); parameters.add(parData); } else { warnings.add(new DocumentationWarning(WarningType.EmptyTag, location, "Empty " + TagElement.TAG_PARAM + " tag.")); } } List<JavadocTagPart> linkTags = jdoc.findTags(TagElement.TAG_LINK); for (JavadocTagPart linkTag : linkTags) { String linkText = linkTag.getAsString(clean).trim(); int idx = linkText.indexOf(' '); if (idx >= 0) { linkText = linkText.substring(0, idx); } links.add(linkText); } }
From source file:lang.java.jdt.internal.JDTImporter.java
License:Open Source License
private void importTypeInfo(ASTNode n) { ITypeBinding tb = null;/*ww w . j ava 2s .c om*/ if (n instanceof TypeDeclaration) { tb = ((TypeDeclaration) n).resolveBinding(); } if (n instanceof TypeDeclarationStatement) { tb = ((TypeDeclarationStatement) n).getDeclaration().resolveBinding(); } if (n instanceof AnonymousClassDeclaration) { tb = ((AnonymousClassDeclaration) n).resolveBinding(); } if (n instanceof EnumDeclaration) { tb = ((EnumDeclaration) n).resolveBinding(); } if (tb != null) { importTypeInfo(tb); if (tb.isClass()) addBinding(classBindings, n, bindingCache.getEntity(tb)); else if (tb.isInterface()) addBinding(interfaceBindings, n, bindingCache.getEntity(tb)); else if (tb.isEnum()) addBinding(enumBindings, n, bindingCache.getEntity(tb)); } // EnumDeclaration // EnumConstantDeclaration // FieldDeclaration // MethodDeclaration // Initializer if (n instanceof Initializer) { Initializer init = (Initializer) n; ITypeBinding parentType = typeStack.peek(); if (parentType != null) { ITuple tup = VF.tuple(bindingCache.getEntity(parentType), bindingCache.getEntity(init, parentType)); declaredMethods.insert(tup); } else { System.err.println("dangling initializer " + init.toString()); } } if (n instanceof BodyDeclaration) { List<IValue> owners = new ArrayList<IValue>(); if (n instanceof AbstractTypeDeclaration) { owners.add(bindingCache.getEntity(((AbstractTypeDeclaration) n).resolveBinding())); } else if (n instanceof AnnotationTypeMemberDeclaration) { owners.add(bindingCache.getEntity(((AnnotationTypeMemberDeclaration) n).resolveBinding())); } else if (n instanceof Initializer) { owners.add(bindingCache.getEntity((Initializer) n)); } else if (n instanceof MethodDeclaration) { owners.add(bindingCache.getEntity(((MethodDeclaration) n).resolveBinding())); } else if (n instanceof FieldDeclaration) { for (Object fragment : ((FieldDeclaration) n).fragments()) { owners.add(bindingCache.getEntity(((VariableDeclarationFragment) fragment).resolveBinding())); } } else if (n instanceof EnumConstantDeclaration) { owners.add(bindingCache.getEntity(((EnumConstantDeclaration) n).resolveConstructorBinding())); owners.add(bindingCache.getEntity(((EnumConstantDeclaration) n).resolveVariable())); } BodyDeclaration bd = (BodyDeclaration) n; List<IValue> modsForN = bindingCache.getModifiers(bd.modifiers()); Javadoc doc = bd.getJavadoc(); if (doc != null) { for (Object te : doc.tags()) { if (TagElement.TAG_DEPRECATED.equals(((TagElement) te).getTagName())) { modsForN.add(BindingConverter.deprecatedModifier); break; } } } for (IValue owner : owners) { for (IValue modifier : modsForN) { modifiers.insert(VF.tuple(owner, modifier)); } } } // method -> parameters? // method -> local variables? // throws? // modifiers? // scopes? not in JDT :( }
From source file:org.eclipse.xtext.xbase.ui.hover.XbaseHoverDocumentationProvider.java
License:Open Source License
public String computeDocumentation(EObject object) { buffer = new StringBuffer(); context = object;/* w w w .jav a2 s. c o m*/ fLiteralContent = 0; List<String> parameterNames = initParameterNames(); Map<String, URI> exceptionNamesToURI = initExceptionNamesToURI(); addAnnotations(object); getDocumentationWithPrefix(object); Javadoc javadoc = getJavaDoc(); if (javadoc == null) return buffer.toString(); TagElement deprecatedTag = null; TagElement start = null; List<TagElement> parameters = new ArrayList<TagElement>(); TagElement returnTag = null; List<TagElement> exceptions = new ArrayList<TagElement>(); List<TagElement> versions = new ArrayList<TagElement>(); List<TagElement> authors = new ArrayList<TagElement>(); List<TagElement> sees = new ArrayList<TagElement>(); List<TagElement> since = new ArrayList<TagElement>(); List<TagElement> rest = new ArrayList<TagElement>(); @SuppressWarnings("unchecked") List<TagElement> tags = javadoc.tags(); for (Iterator<TagElement> iter = tags.iterator(); iter.hasNext();) { TagElement tag = iter.next(); String tagName = tag.getTagName(); if (tagName == null) { start = tag; } else if (TagElement.TAG_PARAM.equals(tagName)) { parameters.add(tag); @SuppressWarnings("unchecked") List<? extends ASTNode> fragments = tag.fragments(); if (fragments.size() > 0) { Object first = fragments.get(0); if (first instanceof SimpleName) { String name = ((SimpleName) first).getIdentifier(); int paramIndex = parameterNames.indexOf(name); if (paramIndex != -1) { parameterNames.set(paramIndex, null); } } } } else if (TagElement.TAG_RETURN.equals(tagName)) { if (returnTag == null) returnTag = tag; // the Javadoc tool only shows the first return tag } else if (TagElement.TAG_EXCEPTION.equals(tagName) || TagElement.TAG_THROWS.equals(tagName)) { exceptions.add(tag); @SuppressWarnings("unchecked") List<? extends ASTNode> fragments = tag.fragments(); if (fragments.size() > 0) { Object first = fragments.get(0); if (first instanceof Name) { @SuppressWarnings("restriction") String name = org.eclipse.jdt.internal.corext.dom.ASTNodes .getSimpleNameIdentifier((Name) first); if (exceptionNamesToURI.containsKey(name)) { exceptionNamesToURI.put(name, null); } } } } else if (TagElement.TAG_SINCE.equals(tagName)) { since.add(tag); } else if (TagElement.TAG_VERSION.equals(tagName)) { versions.add(tag); } else if (TagElement.TAG_AUTHOR.equals(tagName)) { authors.add(tag); } else if (TagElement.TAG_SEE.equals(tagName)) { sees.add(tag); } else if (TagElement.TAG_DEPRECATED.equals(tagName)) { if (deprecatedTag == null) deprecatedTag = tag; // the Javadoc tool only shows the first deprecated tag } else { rest.add(tag); } } boolean hasParameters = parameters.size() > 0; boolean hasReturnTag = returnTag != null; boolean hasExceptions = exceptions.size() > 0; if (deprecatedTag != null) handleDeprecatedTag(deprecatedTag); if (start != null) { @SuppressWarnings("unchecked") List<ASTNode> fragments = start.fragments(); handleContentElements(fragments); } if (hasParameters || hasReturnTag || hasExceptions || versions.size() > 0 || authors.size() > 0 || since.size() > 0 || sees.size() > 0 || rest.size() > 0 || (buffer.length() > 0) && (parameterNames.size() > 0 || exceptionNamesToURI.size() > 0)) { handleSuperMethodReferences(object); buffer.append(BLOCK_TAG_START); handleParameters(object, parameters, parameterNames); handleReturnTag(returnTag); handleExceptionTags(exceptions, exceptionNamesToURI); handleBlockTags("Since:", since); handleBlockTags("Version:", versions); handleBlockTags("Author:", authors); handleBlockTags("See Also:", sees); handleBlockTags(rest); buffer.append(BLOCK_TAG_END); } else if (buffer.length() > 0) { handleSuperMethodReferences(object); } String result = buffer.toString(); buffer = null; rawJavaDoc = null; context = null; return result; }
From source file:org.summer.dsl.xbase.ui.hover.XbaseHoverDocumentationProvider.java
License:Open Source License
public String computeDocumentation(EObject object) { buffer = new StringBuffer(); context = object;//w w w .ja v a 2 s . c o m fLiteralContent = 0; List<String> parameterNames = initParameterNames(); Map<String, URI> exceptionNamesToURI = initExceptionNamesToURI(); addAnnotations(object); getDocumentationWithPrefix(object); Javadoc javadoc = getJavaDoc(); if (javadoc == null) return ""; TagElement deprecatedTag = null; TagElement start = null; List<TagElement> parameters = new ArrayList<TagElement>(); TagElement returnTag = null; List<TagElement> exceptions = new ArrayList<TagElement>(); List<TagElement> versions = new ArrayList<TagElement>(); List<TagElement> authors = new ArrayList<TagElement>(); List<TagElement> sees = new ArrayList<TagElement>(); List<TagElement> since = new ArrayList<TagElement>(); List<TagElement> rest = new ArrayList<TagElement>(); @SuppressWarnings("unchecked") List<TagElement> tags = javadoc.tags(); for (Iterator<TagElement> iter = tags.iterator(); iter.hasNext();) { TagElement tag = iter.next(); String tagName = tag.getTagName(); if (tagName == null) { start = tag; } else if (TagElement.TAG_PARAM.equals(tagName)) { parameters.add(tag); @SuppressWarnings("unchecked") List<? extends ASTNode> fragments = tag.fragments(); if (fragments.size() > 0) { Object first = fragments.get(0); if (first instanceof SimpleName) { String name = ((SimpleName) first).getIdentifier(); int paramIndex = parameterNames.indexOf(name); if (paramIndex != -1) { parameterNames.set(paramIndex, null); } } } } else if (TagElement.TAG_RETURN.equals(tagName)) { if (returnTag == null) returnTag = tag; // the Javadoc tool only shows the first return tag } else if (TagElement.TAG_EXCEPTION.equals(tagName) || TagElement.TAG_THROWS.equals(tagName)) { exceptions.add(tag); @SuppressWarnings("unchecked") List<? extends ASTNode> fragments = tag.fragments(); if (fragments.size() > 0) { Object first = fragments.get(0); if (first instanceof Name) { String name = ASTNodes.getSimpleNameIdentifier((Name) first); if (exceptionNamesToURI.containsKey(name)) { exceptionNamesToURI.put(name, null); } } } } else if (TagElement.TAG_SINCE.equals(tagName)) { since.add(tag); } else if (TagElement.TAG_VERSION.equals(tagName)) { versions.add(tag); } else if (TagElement.TAG_AUTHOR.equals(tagName)) { authors.add(tag); } else if (TagElement.TAG_SEE.equals(tagName)) { sees.add(tag); } else if (TagElement.TAG_DEPRECATED.equals(tagName)) { if (deprecatedTag == null) deprecatedTag = tag; // the Javadoc tool only shows the first deprecated tag } else { rest.add(tag); } } boolean hasParameters = parameters.size() > 0; boolean hasReturnTag = returnTag != null; boolean hasExceptions = exceptions.size() > 0; if (deprecatedTag != null) handleDeprecatedTag(deprecatedTag); if (start != null) { @SuppressWarnings("unchecked") List<ASTNode> fragments = start.fragments(); handleContentElements(fragments); } if (hasParameters || hasReturnTag || hasExceptions || versions.size() > 0 || authors.size() > 0 || since.size() > 0 || sees.size() > 0 || rest.size() > 0 || (buffer.length() > 0) && (parameterNames.size() > 0 || exceptionNamesToURI.size() > 0)) { handleSuperMethodReferences(object); buffer.append(BLOCK_TAG_START); handleParameters(object, parameters, parameterNames); handleReturnTag(returnTag); handleExceptionTags(exceptions, exceptionNamesToURI); handleBlockTags("Since:", since); handleBlockTags("Version:", versions); handleBlockTags("Author:", authors); handleBlockTags("See Also:", sees); handleBlockTags(rest); buffer.append(BLOCK_TAG_END); } else if (buffer.length() > 0) { handleSuperMethodReferences(object); } String result = buffer.toString(); buffer = null; rawJavaDoc = null; context = null; return result; }