diff options
author | Michael Wright <michaelwr@google.com> | 2016-05-06 17:16:06 +0100 |
---|---|---|
committer | Michael Wright <michaelwr@google.com> | 2016-05-09 14:51:41 +0100 |
commit | feaf99fa1b7563f15dbd4211718a6cfb7a3cc3c8 (patch) | |
tree | ea11ecd04a1908a46e0039a154f21a84453229b0 /tools/aapt2/java/JavaClassGenerator_test.cpp | |
parent | 6f9f75e1063d282c933ede862fa7ea9371a2f310 (diff) |
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
Diffstat (limited to 'tools/aapt2/java/JavaClassGenerator_test.cpp')
-rw-r--r-- | tools/aapt2/java/JavaClassGenerator_test.cpp | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/tools/aapt2/java/JavaClassGenerator_test.cpp b/tools/aapt2/java/JavaClassGenerator_test.cpp index 7d0aa83a0fb8..46266b3f3e89 100644 --- a/tools/aapt2/java/JavaClassGenerator_test.cpp +++ b/tools/aapt2/java/JavaClassGenerator_test.cpp @@ -289,4 +289,37 @@ TEST(JavaClassGeneratorTest, CommentsForStyleablesAndNestedAttributesArePresent) EXPECT_NE(std::string::npos, actual.find(util::utf16ToUtf8(styleable.getComment()))); } +TEST(JavaClassGeneratorTest, CommentsForRemovedAttributesAreNotPresentInClass) { + Attribute attr(false); + attr.setComment(StringPiece16(u"@removed")); + + + std::unique_ptr<ResourceTable> table = test::ResourceTableBuilder() + .setPackageId(u"android", 0x01) + .addValue(u"@android:attr/one", util::make_unique<Attribute>(attr)) + .build(); + + std::unique_ptr<IAaptContext> context = test::ContextBuilder() + .addSymbolSource(util::make_unique<ResourceTableSymbolSource>(table.get())) + .setNameManglerPolicy(NameManglerPolicy{ u"android" }) + .build(); + JavaClassGeneratorOptions options; + options.useFinal = false; + JavaClassGenerator generator(context.get(), table.get(), options); + std::stringstream out; + ASSERT_TRUE(generator.generate(u"android", &out)); + std::string actual = out.str(); + + std::cout << actual << std::endl; + + EXPECT_EQ(std::string::npos, actual.find("@attr name android:one")); + EXPECT_EQ(std::string::npos, actual.find("@attr description")); + + // We should find @removed only in the attribute javadoc and not anywhere else (i.e. the class + // javadoc). + const size_t pos = actual.find("@removed"); + EXPECT_NE(std::string::npos, pos); + EXPECT_EQ(std::string::npos, actual.find("@removed", pos + 1)); +} + } // namespace aapt |