diff options
| author | Inseob Kim <inseob@google.com> | 2019-06-24 10:25:56 -0700 |
|---|---|---|
| committer | android-build-merger <android-build-merger@google.com> | 2019-06-24 10:25:56 -0700 |
| commit | 7a88d3d550511fc3609773048da7d7ee623ef128 (patch) | |
| tree | 8cb6a13db228a64ee2ad79dc022d209f828e3f32 | |
| parent | e45713de98b2f82d041e28d4e89b648ba693d051 (diff) | |
| parent | ff02e98e1bef07de8a4ba2bfcea1f56648379674 (diff) | |
| download | platform_system_tools_sysprop-7a88d3d550511fc3609773048da7d7ee623ef128.tar.gz platform_system_tools_sysprop-7a88d3d550511fc3609773048da7d7ee623ef128.tar.bz2 platform_system_tools_sysprop-7a88d3d550511fc3609773048da7d7ee623ef128.zip | |
Merge "Add deprecated field" am: f157a2adb1 am: 6c64bc24e5 am: a88bc8954a
am: ff02e98e1b
Change-Id: I33e7cc2d007a76ae31ed22fb627da4f261c86776
| -rw-r--r-- | CppGen.cpp | 2 | ||||
| -rw-r--r-- | JavaGen.cpp | 6 | ||||
| -rw-r--r-- | tests/CppGenTest.cpp | 16 | ||||
| -rw-r--r-- | tests/JavaGenTest.cpp | 9 |
4 files changed, 21 insertions, 12 deletions
@@ -277,8 +277,10 @@ std::string GenerateHeader(const sysprop::Properties& props, writer.Write("};\n\n"); } + if (prop.deprecated()) writer.Write("[[deprecated]] "); writer.Write("%s %s();\n", prop_type.c_str(), prop_id.c_str()); if (prop.access() != sysprop::Readonly && scope == sysprop::Internal) { + if (prop.deprecated()) writer.Write("[[deprecated]] "); writer.Write("bool %s(const %s& value);\n", prop_id.c_str(), prop_type.c_str()); } diff --git a/JavaGen.cpp b/JavaGen.cpp index 99cb13a..26ebed6 100644 --- a/JavaGen.cpp +++ b/JavaGen.cpp @@ -362,6 +362,9 @@ bool GenerateJavaClass(const sysprop::Properties& props, if (prop.scope() != classScope) { WriteJavaAnnotation(writer, prop.scope()); } + if (prop.deprecated()) { + writer.Write("@Deprecated\n"); + } if (IsListProp(prop)) { writer.Write("public static %s %s() {\n", prop_type.c_str(), @@ -389,6 +392,9 @@ bool GenerateJavaClass(const sysprop::Properties& props, if (classScope != sysprop::Internal) { WriteJavaAnnotation(writer, sysprop::Internal); } + if (prop.deprecated()) { + writer.Write("@Deprecated\n"); + } writer.Write("public static void %s(%s value) {\n", prop_id.c_str(), prop_type.c_str()); writer.Indent(); diff --git a/tests/CppGenTest.cpp b/tests/CppGenTest.cpp index cd9fad7..1f90b37 100644 --- a/tests/CppGenTest.cpp +++ b/tests/CppGenTest.cpp @@ -29,7 +29,6 @@ namespace { constexpr const char* kTestSyspropFile = R"(owner: Platform module: "android.sysprop.PlatformProperties" - prop { api_name: "test_double" type: Double @@ -51,7 +50,6 @@ prop { scope: Public access: ReadWrite } - prop { api_name: "test.enum" type: Enum @@ -73,7 +71,6 @@ prop { scope: Public access: ReadWrite } - prop { api_name: "test_double_list" type: DoubleList @@ -91,14 +88,15 @@ prop { type: StringList scope: Public access: ReadWrite + deprecated: true } - prop { api_name: "el" type: EnumList enum_values: "enu|mva|lue" scope: Internal access: ReadWrite + deprecated: true } )"; @@ -148,8 +146,8 @@ bool test_double_list(const std::vector<std::optional<double>>& value); std::vector<std::optional<std::int32_t>> test_list_int(); bool test_list_int(const std::vector<std::optional<std::int32_t>>& value); -std::vector<std::optional<std::string>> test_strlist(); -bool test_strlist(const std::vector<std::optional<std::string>>& value); +[[deprecated]] std::vector<std::optional<std::string>> test_strlist(); +[[deprecated]] bool test_strlist(const std::vector<std::optional<std::string>>& value); enum class el_values { ENU, @@ -157,8 +155,8 @@ enum class el_values { LUE, }; -std::vector<std::optional<el_values>> el(); -bool el(const std::vector<std::optional<el_values>>& value); +[[deprecated]] std::vector<std::optional<el_values>> el(); +[[deprecated]] bool el(const std::vector<std::optional<el_values>>& value); } // namespace android::sysprop::PlatformProperties )"; @@ -185,7 +183,7 @@ std::optional<std::int64_t> android_os_test_long(); std::vector<std::optional<std::int32_t>> test_list_int(); -std::vector<std::optional<std::string>> test_strlist(); +[[deprecated]] std::vector<std::optional<std::string>> test_strlist(); } // namespace android::sysprop::PlatformProperties )"; diff --git a/tests/JavaGenTest.cpp b/tests/JavaGenTest.cpp index 586d65a..705da5f 100644 --- a/tests/JavaGenTest.cpp +++ b/tests/JavaGenTest.cpp @@ -50,7 +50,6 @@ prop { scope: Public access: ReadWrite } - prop { api_name: "test.enum" type: Enum @@ -72,7 +71,6 @@ prop { scope: Public access: ReadWrite } - prop { api_name: "test_double_list" type: DoubleList @@ -90,14 +88,15 @@ prop { type: StringList scope: Public access: ReadWrite + deprecated: true } - prop { api_name: "el" type: EnumList enum_values: "enu|mva|lue" scope: Internal access: ReadWrite + deprecated: true } )"; @@ -315,12 +314,14 @@ public final class TestProperties { SystemProperties.set("vendor.test_list_int", value == null ? "" : formatList(value)); } + @Deprecated public static List<String> test_strlist() { String value = SystemProperties.get("vendor.test.strlist"); return tryParseList(v -> tryParseString(v), value); } /** @hide */ + @Deprecated public static void test_strlist(List<String> value) { SystemProperties.set("vendor.test.strlist", value == null ? "" : formatList(value)); } @@ -340,12 +341,14 @@ public final class TestProperties { } /** @hide */ + @Deprecated public static List<el_values> el() { String value = SystemProperties.get("vendor.el"); return tryParseEnumList(el_values.class, value); } /** @hide */ + @Deprecated public static void el(List<el_values> value) { SystemProperties.set("vendor.el", value == null ? "" : formatEnumList(value, el_values::getPropValue)); } |
