From 1c1544ff96e7f87154c2eff62c1da3aee46b569f Mon Sep 17 00:00:00 2001 From: Narayan Kamath Date: Thu, 13 Feb 2020 14:33:47 +0000 Subject: aapt2: Preserve annotation parameters for SystemApi. SystemAPI can now be parameterized. Note that this change preserves the content of the annotation params without attempting to interpret them in any way. This means that references to types outside of java.lang must be fully qualified. Test: atest aapt2_tests Bug: 147581540 Change-Id: I0630fb1c7c7a7f5918ff2dca32fb8e078b367751 --- tools/aapt2/java/AnnotationProcessor_test.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'tools/aapt2/java/AnnotationProcessor_test.cpp') diff --git a/tools/aapt2/java/AnnotationProcessor_test.cpp b/tools/aapt2/java/AnnotationProcessor_test.cpp index 69f49c8b97c3..7d0a4e9af632 100644 --- a/tools/aapt2/java/AnnotationProcessor_test.cpp +++ b/tools/aapt2/java/AnnotationProcessor_test.cpp @@ -61,6 +61,21 @@ TEST(AnnotationProcessorTest, EmitsSystemApiAnnotationAndRemovesFromComment) { EXPECT_THAT(annotations, HasSubstr("This is a system API")); } +TEST(AnnotationProcessorTest, EmitsSystemApiAnnotationParamsAndRemovesFromComment) { + AnnotationProcessor processor; + processor.AppendComment("@SystemApi (p1=k1,p2=k2) This is a system API"); + + std::string annotations; + StringOutputStream out(&annotations); + Printer printer(&out); + processor.Print(&printer); + out.Flush(); + + EXPECT_THAT(annotations, HasSubstr("@android.annotation.SystemApi(p1=k1,p2=k2)")); + EXPECT_THAT(annotations, Not(HasSubstr("@SystemApi"))); + EXPECT_THAT(annotations, HasSubstr("This is a system API")); +} + TEST(AnnotationProcessorTest, EmitsTestApiAnnotationAndRemovesFromComment) { AnnotationProcessor processor; processor.AppendComment("@TestApi This is a test API"); -- cgit v1.2.3