aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorElie Kheirallah <khei@google.com>2024-01-26 00:03:09 +0000
committerTreehugger Robot <android-test-infra-autosubmit@system.gserviceaccount.com>2024-02-01 01:47:17 +0000
commitf6fb8419b17be5580f0dedb041ef100454af3d13 (patch)
tree6bf1bf975a6b746e43fdeea0e4bd35d7c5b02474
parenta748faddd96e867f3ce21be4354c8b5081573f3b (diff)
downloadaidl-f6fb8419b17be5580f0dedb041ef100454af3d13.tar.gz
Allow for unsigned int and unsigned long constants (u32, u64)
Add support for u32/u64 const expressions. Bug: 225239875 Test: aidl_unittests Change-Id: I39b426ec927b5dc7a41112d3583d35d72f43f994
-rw-r--r--aidl_const_expressions.cpp27
-rw-r--r--aidl_language_l.ll4
-rw-r--r--aidl_unittest.cpp91
-rw-r--r--tests/android/aidl/tests/StructuredParcelable.aidl12
-rw-r--r--tests/golden_output/aidl-test-interface-cpp-source/gen/include/android/aidl/tests/StructuredParcelable.h4
-rw-r--r--tests/golden_output/aidl-test-interface-java-source/gen/android/aidl/tests/StructuredParcelable.java4
-rw-r--r--tests/golden_output/aidl-test-interface-ndk-source/gen/include/aidl/android/aidl/tests/StructuredParcelable.h4
-rw-r--r--tests/golden_output/aidl-test-interface-rust-source/gen/android/aidl/tests/StructuredParcelable.rs4
-rw-r--r--tests/golden_output/frozen/aidl-test-interface-cpp-source/gen/include/android/aidl/tests/StructuredParcelable.h4
-rw-r--r--tests/golden_output/frozen/aidl-test-interface-java-source/gen/android/aidl/tests/StructuredParcelable.java4
-rw-r--r--tests/golden_output/frozen/aidl-test-interface-ndk-source/gen/include/aidl/android/aidl/tests/StructuredParcelable.h4
-rw-r--r--tests/golden_output/frozen/aidl-test-interface-rust-source/gen/android/aidl/tests/StructuredParcelable.rs4
-rw-r--r--tests/java/src/android/aidl/tests/TestServiceClient.java4
13 files changed, 146 insertions, 24 deletions
diff --git a/aidl_const_expressions.cpp b/aidl_const_expressions.cpp
index 0e8d3006..7de68d37 100644
--- a/aidl_const_expressions.cpp
+++ b/aidl_const_expressions.cpp
@@ -477,7 +477,11 @@ bool AidlConstantValue::ParseIntegral(const string& value, int64_t* parsed_value
std::string_view value_view = value;
const bool is_byte = ConsumeSuffix(&value_view, "u8");
+ const bool is_unsigned_int = ConsumeSuffix(&value_view, "u32");
const bool is_long = ConsumeSuffix(&value_view, "l") || ConsumeSuffix(&value_view, "L");
+ const bool is_unsigned_long = ConsumeSuffix(&value_view, "u64");
+
+ if (is_byte + is_long + is_unsigned_int + is_unsigned_long > 1) return false;
const std::string value_substr = ({
std::string raw_value_substr = std::string(value_view);
@@ -493,8 +497,6 @@ bool AidlConstantValue::ParseIntegral(const string& value, int64_t* parsed_value
*parsed_value = 0;
*parsed_type = Type::ERROR;
- if (is_byte && is_long) return false;
-
if (IsHex(value)) {
// AIDL considers 'const int foo = 0xffffffff' as -1, but if we want to
// handle that when computing constant expressions, then we need to
@@ -515,7 +517,8 @@ bool AidlConstantValue::ParseIntegral(const string& value, int64_t* parsed_value
*parsed_value = static_cast<int8_t>(raw_value8);
*parsed_type = Type::INT8;
} else if (uint32_t raw_value32;
- !is_long && android::base::ParseUint<uint32_t>(value_substr, &raw_value32)) {
+ (!is_long || is_unsigned_int) &&
+ android::base::ParseUint<uint32_t>(value_substr, &raw_value32)) {
*parsed_value = static_cast<int32_t>(raw_value32);
*parsed_type = Type::INT32;
} else if (uint64_t raw_value64;
@@ -528,6 +531,15 @@ bool AidlConstantValue::ParseIntegral(const string& value, int64_t* parsed_value
return true;
}
+ if (is_unsigned_long) {
+ if (uint64_t raw_value64; android::base::ParseUint<uint64_t>(value_substr, &raw_value64)) {
+ *parsed_value = static_cast<int64_t>(raw_value64);
+ *parsed_type = Type::INT64;
+ return true;
+ } else {
+ return false;
+ }
+ }
if (!android::base::ParseInt<int64_t>(value_substr, parsed_value)) {
return false;
}
@@ -538,6 +550,12 @@ bool AidlConstantValue::ParseIntegral(const string& value, int64_t* parsed_value
}
*parsed_value = static_cast<int8_t>(*parsed_value);
*parsed_type = Type::INT8;
+ } else if (is_unsigned_int) {
+ if (*parsed_value > UINT32_MAX || *parsed_value < 0) {
+ return false;
+ }
+ *parsed_value = static_cast<int32_t>(*parsed_value);
+ *parsed_type = Type::INT32;
} else if (is_long) {
*parsed_type = Type::INT64;
} else {
@@ -664,6 +682,9 @@ string AidlConstantValue::ValueString(const AidlTypeSpecifier& type,
} else if (type_string == "int") {
if (final_value_ > INT32_MAX || final_value_ < INT32_MIN) {
err = -1;
+ if (final_value_ >= 0 && final_value_ <= UINT32_MAX && IsLiteral()) {
+ alternatives.push_back(value_ + "u32");
+ }
break;
}
return decorator(type, std::to_string(static_cast<int32_t>(final_value_)));
diff --git a/aidl_language_l.ll b/aidl_language_l.ll
index 9d563a1f..2b9f2e6e 100644
--- a/aidl_language_l.ll
+++ b/aidl_language_l.ll
@@ -44,8 +44,8 @@
identifier [_a-zA-Z][_a-zA-Z0-9]*
whitespace ([ \t\r]+)
-intvalue [0-9_]+[lL]?(u8)?
-hexvalue 0[x|X][0-9a-fA-F_]+[lL]?(u8)?
+intvalue [0-9_]+(u8|u32|u64|[lL])*
+hexvalue 0[x|X][0-9a-fA-F_]+(u8|u32|u64|[lL])*
floatvalue [0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?f?
%%
diff --git a/aidl_unittest.cpp b/aidl_unittest.cpp
index cd5ca026..63e14323 100644
--- a/aidl_unittest.cpp
+++ b/aidl_unittest.cpp
@@ -4480,11 +4480,100 @@ TEST_F(AidlOutputPathTest, NoOutDirWithNoOutputFile) {
Test(Options::From("aidl -I sub/dir sub/dir/foo/bar/IFoo.aidl"), "sub/dir/foo/bar/IFoo.java");
}
+TEST_P(AidlTest, PassOnValidUnsignedInt32Int) {
+ EvaluateValidAssignment(
+ R"(package a; interface IFoo { const int UINT32_VALUE = 2147483650u32; })", "", typenames_,
+ GetLanguage());
+}
+
+TEST_P(AidlTest, FailOnOutOfBoundsUInt32MaxConstInt) {
+ AidlError error;
+ const string expected_stderr =
+ "ERROR: p/IFoo.aidl:3.59-73: Could not parse integer: 4294967300u32\n";
+ CaptureStderr();
+ EXPECT_EQ(nullptr, Parse("p/IFoo.aidl",
+ R"(package p;
+ interface IFoo {
+ const int uint32_max_oob = 4294967300u32;
+ }
+ )",
+ typenames_, GetLanguage(), &error));
+ EXPECT_EQ(expected_stderr, GetCapturedStderr());
+ EXPECT_EQ(AidlError::PARSE_ERROR, error);
+}
+
+TEST_P(AidlTest, PassOnValidUnsignedInt64Int) {
+ EvaluateValidAssignment(
+ R"(package a; interface IFoo { const long UINT64_VALUE = 18446744073709551615u64; })", "",
+ typenames_, GetLanguage());
+}
+
+TEST_P(AidlTest, FailOnOutOfBoundsUInt64MaxConstInt) {
+ AidlError error;
+ const string expected_stderr =
+ "ERROR: p/IFoo.aidl:3.60-84: Could not parse integer: 18446744073709551620u64\n";
+ CaptureStderr();
+ EXPECT_EQ(nullptr, Parse("p/IFoo.aidl",
+ R"(package p;
+ interface IFoo {
+ const long uint64_max_oob = 18446744073709551620u64;
+ }
+ )",
+ typenames_, GetLanguage(), &error));
+ EXPECT_EQ(expected_stderr, GetCapturedStderr());
+ EXPECT_EQ(AidlError::PARSE_ERROR, error);
+}
+
+TEST_P(AidlTest, PassOnValidUnsignedInt32Hex) {
+ EvaluateValidAssignment(
+ R"(package a; interface IFoo { const int UINT32_VALUE = 0xffffffffu32; })", "", typenames_,
+ GetLanguage());
+}
+
+TEST_P(AidlTest, FailOnOutOfBoundsUInt32MaxConstHex) {
+ AidlError error;
+ const string expected_stderr =
+ "ERROR: p/IFoo.aidl:3.59-74: Invalid type specifier for an int64 literal: int "
+ "(0xfffffffffu32).\n";
+ CaptureStderr();
+ EXPECT_EQ(nullptr, Parse("p/IFoo.aidl",
+ R"(package p;
+ interface IFoo {
+ const int uint32_max_oob = 0xfffffffffu32;
+ }
+ )",
+ typenames_, GetLanguage(), &error));
+ EXPECT_EQ(expected_stderr, GetCapturedStderr());
+ EXPECT_EQ(AidlError::BAD_TYPE, error);
+}
+
+TEST_P(AidlTest, PassOnValidUnsignedInt64Hex) {
+ EvaluateValidAssignment(
+ R"(package a; interface IFoo { const int UINT64_VALUE = 0xffffffffffffffffu64; })", "",
+ typenames_, GetLanguage());
+}
+
+TEST_P(AidlTest, FailOnOutOfBoundsUInt64MaxConstHex) {
+ AidlError error;
+ const string expected_stderr =
+ "ERROR: p/IFoo.aidl:3.59-82: Could not parse hexvalue: 0xfffffffffffffffffu64\n";
+ CaptureStderr();
+ EXPECT_EQ(nullptr, Parse("p/IFoo.aidl",
+ R"(package p;
+ interface IFoo {
+ const int uint64_max_oob = 0xfffffffffffffffffu64;
+ }
+ )",
+ typenames_, GetLanguage(), &error));
+ EXPECT_EQ(expected_stderr, GetCapturedStderr());
+ EXPECT_EQ(AidlError::PARSE_ERROR, error);
+}
+
TEST_P(AidlTest, FailOnOutOfBoundsInt32MaxConstInt) {
AidlError error;
const string expected_stderr =
"ERROR: p/IFoo.aidl:3.58-69: Invalid type specifier for an int64 literal: int "
- "(2147483650).\n";
+ "(2147483650). Did you mean: 2147483650u32?\n";
CaptureStderr();
EXPECT_EQ(nullptr, Parse("p/IFoo.aidl",
R"(package p;
diff --git a/tests/android/aidl/tests/StructuredParcelable.aidl b/tests/android/aidl/tests/StructuredParcelable.aidl
index e3ebb6b0..157ccb43 100644
--- a/tests/android/aidl/tests/StructuredParcelable.aidl
+++ b/tests/android/aidl/tests/StructuredParcelable.aidl
@@ -152,6 +152,12 @@ parcelable StructuredParcelable {
(2 + 3 - 4 * -7 / (10 % 3)) - 33 == 0,
(2 + (-3 & 4 / 7)) == 2,
(((((1 + 0))))),
+ 100u32 + 100u32 == 200u32,
+ 0x80000000u32 / 2 == -0x40000000u32,
+ 2000000000u32 - 1000000000u32 == 1000000000u32,
+ 0xffffffffu32 + 1 == 0,
+ 4294967295u32 + 1 == 0,
+ 0x80000000u32 == -2147483648,
};
long[] int64_1 = {
@@ -168,6 +174,12 @@ parcelable StructuredParcelable {
(0xfL << 32) == 0xf00000000,
10L == 1_0L,
10_0_0 == 1000L,
+ (8000000000u64 + 8000000000u64) == 16000000000u64,
+ 0x8000000000000000u64 / 2 == -0x4000000000000000u64,
+ 16000000000u64 - 8000000000u64 == 8000000000u64,
+ 0xffffffffffffffffu64 + 1 == 0,
+ 18446744073709551615u64 + 1 == 0,
+ 0x8000000000000000u64 == -9223372036854775807L - 1,
};
int hexInt32_pos_1 = -0xffffffff;
int hexInt64_pos_1 = -0xfffffffffff < 0;
diff --git a/tests/golden_output/aidl-test-interface-cpp-source/gen/include/android/aidl/tests/StructuredParcelable.h b/tests/golden_output/aidl-test-interface-cpp-source/gen/include/android/aidl/tests/StructuredParcelable.h
index d89f4e1a..f43cb4ee 100644
--- a/tests/golden_output/aidl-test-interface-cpp-source/gen/include/android/aidl/tests/StructuredParcelable.h
+++ b/tests/golden_output/aidl-test-interface-cpp-source/gen/include/android/aidl/tests/StructuredParcelable.h
@@ -95,8 +95,8 @@ public:
::android::sp<::android::IBinder> ibinder;
::android::aidl::tests::StructuredParcelable::Empty empty;
::std::vector<uint8_t> int8_1 = {1, 1, 1, 1, 1};
- ::std::vector<int32_t> int32_1 = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1};
- ::std::vector<int64_t> int64_1 = {1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L};
+ ::std::vector<int32_t> int32_1 = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1};
+ ::std::vector<int64_t> int64_1 = {1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L};
int32_t hexInt32_pos_1 = 1;
int32_t hexInt64_pos_1 = 1;
::android::aidl::tests::ConstantExpressionEnum const_exprs_1 = ::android::aidl::tests::ConstantExpressionEnum(0);
diff --git a/tests/golden_output/aidl-test-interface-java-source/gen/android/aidl/tests/StructuredParcelable.java b/tests/golden_output/aidl-test-interface-java-source/gen/android/aidl/tests/StructuredParcelable.java
index e0c8e43b..f69dffda 100644
--- a/tests/golden_output/aidl-test-interface-java-source/gen/android/aidl/tests/StructuredParcelable.java
+++ b/tests/golden_output/aidl-test-interface-java-source/gen/android/aidl/tests/StructuredParcelable.java
@@ -43,8 +43,8 @@ public class StructuredParcelable implements android.os.Parcelable
public android.aidl.tests.StructuredParcelable.Empty empty;
// Constant expressions that evaluate to 1
public byte[] int8_1 = {1, 1, 1, 1, 1};
- public int[] int32_1 = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1};
- public long[] int64_1 = {1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L};
+ public int[] int32_1 = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1};
+ public long[] int64_1 = {1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L};
public int hexInt32_pos_1 = 1;
public int hexInt64_pos_1 = 1;
public int const_exprs_1;
diff --git a/tests/golden_output/aidl-test-interface-ndk-source/gen/include/aidl/android/aidl/tests/StructuredParcelable.h b/tests/golden_output/aidl-test-interface-ndk-source/gen/include/aidl/android/aidl/tests/StructuredParcelable.h
index 23f8f0eb..402c227b 100644
--- a/tests/golden_output/aidl-test-interface-ndk-source/gen/include/aidl/android/aidl/tests/StructuredParcelable.h
+++ b/tests/golden_output/aidl-test-interface-ndk-source/gen/include/aidl/android/aidl/tests/StructuredParcelable.h
@@ -102,8 +102,8 @@ public:
::ndk::SpAIBinder ibinder;
::aidl::android::aidl::tests::StructuredParcelable::Empty empty;
std::vector<uint8_t> int8_1 = {1, 1, 1, 1, 1};
- std::vector<int32_t> int32_1 = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1};
- std::vector<int64_t> int64_1 = {1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L};
+ std::vector<int32_t> int32_1 = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1};
+ std::vector<int64_t> int64_1 = {1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L};
int32_t hexInt32_pos_1 = 1;
int32_t hexInt64_pos_1 = 1;
::aidl::android::aidl::tests::ConstantExpressionEnum const_exprs_1 = ::aidl::android::aidl::tests::ConstantExpressionEnum(0);
diff --git a/tests/golden_output/aidl-test-interface-rust-source/gen/android/aidl/tests/StructuredParcelable.rs b/tests/golden_output/aidl-test-interface-rust-source/gen/android/aidl/tests/StructuredParcelable.rs
index bd076e0a..0ca71cec 100644
--- a/tests/golden_output/aidl-test-interface-rust-source/gen/android/aidl/tests/StructuredParcelable.rs
+++ b/tests/golden_output/aidl-test-interface-rust-source/gen/android/aidl/tests/StructuredParcelable.rs
@@ -103,8 +103,8 @@ impl Default for r#StructuredParcelable {
r#ibinder: Default::default(),
r#empty: Default::default(),
r#int8_1: vec![1, 1, 1, 1, 1],
- r#int32_1: vec![1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
- r#int64_1: vec![1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
+ r#int32_1: vec![1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
+ r#int64_1: vec![1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
r#hexInt32_pos_1: 1,
r#hexInt64_pos_1: 1,
r#const_exprs_1: Default::default(),
diff --git a/tests/golden_output/frozen/aidl-test-interface-cpp-source/gen/include/android/aidl/tests/StructuredParcelable.h b/tests/golden_output/frozen/aidl-test-interface-cpp-source/gen/include/android/aidl/tests/StructuredParcelable.h
index d89f4e1a..f43cb4ee 100644
--- a/tests/golden_output/frozen/aidl-test-interface-cpp-source/gen/include/android/aidl/tests/StructuredParcelable.h
+++ b/tests/golden_output/frozen/aidl-test-interface-cpp-source/gen/include/android/aidl/tests/StructuredParcelable.h
@@ -95,8 +95,8 @@ public:
::android::sp<::android::IBinder> ibinder;
::android::aidl::tests::StructuredParcelable::Empty empty;
::std::vector<uint8_t> int8_1 = {1, 1, 1, 1, 1};
- ::std::vector<int32_t> int32_1 = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1};
- ::std::vector<int64_t> int64_1 = {1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L};
+ ::std::vector<int32_t> int32_1 = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1};
+ ::std::vector<int64_t> int64_1 = {1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L};
int32_t hexInt32_pos_1 = 1;
int32_t hexInt64_pos_1 = 1;
::android::aidl::tests::ConstantExpressionEnum const_exprs_1 = ::android::aidl::tests::ConstantExpressionEnum(0);
diff --git a/tests/golden_output/frozen/aidl-test-interface-java-source/gen/android/aidl/tests/StructuredParcelable.java b/tests/golden_output/frozen/aidl-test-interface-java-source/gen/android/aidl/tests/StructuredParcelable.java
index e0c8e43b..f69dffda 100644
--- a/tests/golden_output/frozen/aidl-test-interface-java-source/gen/android/aidl/tests/StructuredParcelable.java
+++ b/tests/golden_output/frozen/aidl-test-interface-java-source/gen/android/aidl/tests/StructuredParcelable.java
@@ -43,8 +43,8 @@ public class StructuredParcelable implements android.os.Parcelable
public android.aidl.tests.StructuredParcelable.Empty empty;
// Constant expressions that evaluate to 1
public byte[] int8_1 = {1, 1, 1, 1, 1};
- public int[] int32_1 = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1};
- public long[] int64_1 = {1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L};
+ public int[] int32_1 = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1};
+ public long[] int64_1 = {1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L};
public int hexInt32_pos_1 = 1;
public int hexInt64_pos_1 = 1;
public int const_exprs_1;
diff --git a/tests/golden_output/frozen/aidl-test-interface-ndk-source/gen/include/aidl/android/aidl/tests/StructuredParcelable.h b/tests/golden_output/frozen/aidl-test-interface-ndk-source/gen/include/aidl/android/aidl/tests/StructuredParcelable.h
index 23f8f0eb..402c227b 100644
--- a/tests/golden_output/frozen/aidl-test-interface-ndk-source/gen/include/aidl/android/aidl/tests/StructuredParcelable.h
+++ b/tests/golden_output/frozen/aidl-test-interface-ndk-source/gen/include/aidl/android/aidl/tests/StructuredParcelable.h
@@ -102,8 +102,8 @@ public:
::ndk::SpAIBinder ibinder;
::aidl::android::aidl::tests::StructuredParcelable::Empty empty;
std::vector<uint8_t> int8_1 = {1, 1, 1, 1, 1};
- std::vector<int32_t> int32_1 = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1};
- std::vector<int64_t> int64_1 = {1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L};
+ std::vector<int32_t> int32_1 = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1};
+ std::vector<int64_t> int64_1 = {1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L};
int32_t hexInt32_pos_1 = 1;
int32_t hexInt64_pos_1 = 1;
::aidl::android::aidl::tests::ConstantExpressionEnum const_exprs_1 = ::aidl::android::aidl::tests::ConstantExpressionEnum(0);
diff --git a/tests/golden_output/frozen/aidl-test-interface-rust-source/gen/android/aidl/tests/StructuredParcelable.rs b/tests/golden_output/frozen/aidl-test-interface-rust-source/gen/android/aidl/tests/StructuredParcelable.rs
index bd076e0a..0ca71cec 100644
--- a/tests/golden_output/frozen/aidl-test-interface-rust-source/gen/android/aidl/tests/StructuredParcelable.rs
+++ b/tests/golden_output/frozen/aidl-test-interface-rust-source/gen/android/aidl/tests/StructuredParcelable.rs
@@ -103,8 +103,8 @@ impl Default for r#StructuredParcelable {
r#ibinder: Default::default(),
r#empty: Default::default(),
r#int8_1: vec![1, 1, 1, 1, 1],
- r#int32_1: vec![1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
- r#int64_1: vec![1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
+ r#int32_1: vec![1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
+ r#int64_1: vec![1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
r#hexInt32_pos_1: 1,
r#hexInt64_pos_1: 1,
r#const_exprs_1: Default::default(),
diff --git a/tests/java/src/android/aidl/tests/TestServiceClient.java b/tests/java/src/android/aidl/tests/TestServiceClient.java
index 0ae8d84b..4f80a9dd 100644
--- a/tests/java/src/android/aidl/tests/TestServiceClient.java
+++ b/tests/java/src/android/aidl/tests/TestServiceClient.java
@@ -817,8 +817,8 @@ public class TestServiceClient {
+ "int8_1: [1, 1, 1, 1, 1], "
+ "int32_1: [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, "
+ "1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, "
- + "1, 1, 1, 1], "
- + "int64_1: [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], "
+ + "1, 1, 1, 1, 1, 1, 1, 1, 1, 1], "
+ + "int64_1: [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], "
+ "hexInt32_pos_1: 1, "
+ "hexInt64_pos_1: 1, "
+ "const_exprs_1: 1, "