diff options
author | TreeHugger Robot <treehugger-gerrit@google.com> | 2016-05-16 13:21:09 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2016-05-16 13:21:10 +0000 |
commit | c4033e7c668abc1e671a130f70f58f885c63b176 (patch) | |
tree | 21dddaf7b41635d0a4bd98d688855e9373e5c12d /tools/aapt2/java/JavaClassGenerator.cpp | |
parent | 8995b00ce8f68f2a285a97c2ce711bea8c61179e (diff) | |
parent | feaf99fa1b7563f15dbd4211718a6cfb7a3cc3c8 (diff) |
Merge "Stop emitting javadoc for @removed attributes." into nyc-dev
Diffstat (limited to 'tools/aapt2/java/JavaClassGenerator.cpp')
-rw-r--r-- | tools/aapt2/java/JavaClassGenerator.cpp | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/tools/aapt2/java/JavaClassGenerator.cpp b/tools/aapt2/java/JavaClassGenerator.cpp index 24347a1cdc1e..84df0b429fc5 100644 --- a/tools/aapt2/java/JavaClassGenerator.cpp +++ b/tools/aapt2/java/JavaClassGenerator.cpp @@ -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); |