Bug 82311 [correction] Add '@throws' tag does not insert the exception type name
Version: 3.1.0 Build id: 200412210800 When you have javadoc compiler checks turned on and have a method like the following the quick fix to add a throws tag does not insert the name of the exception. The add all missing tags quick fix does add the exception type so the information should be available. I did figure out that the change was simple, but wasn't really sure how to create a copy of an existing ast node (the name of the exception is in "missingNode"). JavadocTagsSubProcessor.AddMissingJavadocTagProposal#insertMissingJavadocTag: after creating the throws tag ( newTag.setTagName(TagElement.TAG_THROWS) ) a simple name has to be added ( newTag.fragments().add(<SimpleNameNode>) )
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/correction/JavadocTagsSubProcessor.java
rewriter.insertFirst(newElement, groupDescription);
		}
	}
		
	private static boolean isSameTag(String insertedTagName, String tagName) {
		if (insertedTagName.equals(tagName)) {
			return true;
		}
		if (TagElement.TAG_EXCEPTION.equals(tagName)) {
			return TagElement.TAG_THROWS.equals(insertedTagName);
		}
		return false;
	}
	private static boolean isTagLeading(String insertedTagName, String tagName) {
		if (TagElement.TAG_EXCEPTION.equals(insertedTagName) || TagElement.TAG_THROWS.equals(insertedTagName)) {
			return TagElement.TAG_PARAM.equals(tagName) || TagElement.TAG_RETURN.equals(tagName);
		} else if (TagElement.TAG_RETURN.equals(insertedTagName)) {
			return TagElement.TAG_PARAM.equals(tagName);
		}
		return false;
	}
	
	private static String getArgument(TagElement curr) {
		List fragments= curr.fragments();
		if (!fragments.isEmpty()) {
			Object first= fragments.get(0);
			if (first instanceof Name) {
				return ASTNodes.getSimpleNameIdentifier((Name) first);
			} else if (first instanceof TextElement && TagElement.TAG_PARAM.equals(curr.getTagName())) {
				String text= ((TextElement) first).getText();