Stop emitting javadoc for @removed attributes.

We need the attributes to remain public because people might still be
linking against them, but we don't want them showing up in the
documentation any more. Them showing up in the documentation also had
the side effect that it would accidentally mark the parent class of
attributes as @removed, which was not intended.

Bug: 28663748

Change-Id: I2f6eb09455fddf1086e6b24bc3bea5292e8e32b7
This commit is contained in:
Michael Wright
2016-05-06 17:16:06 +01:00
parent 6f9f75e106
commit feaf99fa1b
5 changed files with 108 additions and 6 deletions

View File

@@ -284,6 +284,13 @@ void JavaClassGenerator::addMembersToStyleableClass(const StringPiece16& package
continue;
}
StringPiece16 attrCommentLine = entry.symbol->attribute->getComment();
if (attrCommentLine.contains(StringPiece16(u"@removed"))) {
// Removed attributes are public but hidden from the documentation, so don't emit
// them as part of the class documentation.
continue;
}
const ResourceName& attrName = entry.attrRef->name.value();
styleableComment << "<tr><td>";
styleableComment << "<code>{@link #"
@@ -299,7 +306,6 @@ void JavaClassGenerator::addMembersToStyleableClass(const StringPiece16& package
// Only use the comment up until the first '.'. This is to stay compatible with
// the way old AAPT did it (presumably to keep it short and to avoid including
// annotations like @hide which would affect this Styleable).
StringPiece16 attrCommentLine = entry.symbol->attribute->getComment();
auto iter = std::find(attrCommentLine.begin(), attrCommentLine.end(), u'.');
if (iter != attrCommentLine.end()) {
attrCommentLine = attrCommentLine.substr(
@@ -348,6 +354,17 @@ void JavaClassGenerator::addMembersToStyleableClass(const StringPiece16& package
continue;
}
StringPiece16 comment = styleableAttr.attrRef->getComment();
if (styleableAttr.symbol->attribute && comment.empty()) {
comment = styleableAttr.symbol->attribute->getComment();
}
if (comment.contains(StringPiece16(u"@removed"))) {
// Removed attributes are public but hidden from the documentation, so don't emit them
// as part of the class documentation.
continue;
}
const ResourceName& attrName = styleableAttr.attrRef->name.value();
StringPiece16 packageName = attrName.package;
@@ -360,11 +377,6 @@ void JavaClassGenerator::addMembersToStyleableClass(const StringPiece16& package
AnnotationProcessor* attrProcessor = indexMember->getCommentBuilder();
StringPiece16 comment = styleableAttr.attrRef->getComment();
if (styleableAttr.symbol->attribute && comment.empty()) {
comment = styleableAttr.symbol->attribute->getComment();
}
if (!comment.empty()) {
attrProcessor->appendComment("<p>\n@attr description");
attrProcessor->appendComment(comment);