aconfig: add Java integration tests
Add integration tests for Java. This test setup verifies that
- the build system calls aconfig to generate a Java library
- the Java test compiles against the auto-generated library
- the auto-generated code returns expected values
Similar integration tests for C++ and Rust will be added in follow-up
CLs.
Note: the build does not currently support specifying that
tests/*.values should be applied, so the test flags will all be assigned
the defaults. A later CL will fix this.
Bug: b/283911467
Test: atest aconfig.test aconfig.test.java
Change-Id: Ia365e209261f4935a23e2dac9ef0ab5b60f76e52
diff --git a/tools/aconfig/src/codegen_java.rs b/tools/aconfig/src/codegen_java.rs
index dfd6766..cf025cb 100644
--- a/tools/aconfig/src/codegen_java.rs
+++ b/tools/aconfig/src/codegen_java.rs
@@ -59,7 +59,7 @@
let device_config_flag = codegen::create_device_config_ident(package, &item.name)
.expect("values checked at cache creation time");
ClassElement {
- method_name: item.name.clone(),
+ method_name: item.name.replace('-', "_"),
readwrite: item.permission == Permission::ReadWrite,
default_value: if item.state == FlagState::Enabled {
"true".to_string()