summaryrefslogtreecommitdiff
path: root/tools/aapt2/java/ClassDefinition.h
diff options
context:
space:
mode:
authorScott Lobdell <slobdell@google.com>2021-04-08 04:27:11 +0000
committerScott Lobdell <slobdell@google.com>2021-04-09 17:32:37 +0000
commit5f1da148b08c14445ce83ca151a84f75e489d274 (patch)
treedf59b2056d1fe2dbe09f6c85463ddf1769daf4e6 /tools/aapt2/java/ClassDefinition.h
parent702f04add003ce3e490a2f0bdff083a7e6f5979e (diff)
parent851218af5f83cdb89c02d680fb22212318150068 (diff)
Merge SP1A.210407.002
Change-Id: Iaad2b7cc2aeba166f003d0d460bc8ce29d1caab3
Diffstat (limited to 'tools/aapt2/java/ClassDefinition.h')
-rw-r--r--tools/aapt2/java/ClassDefinition.h12
1 files changed, 10 insertions, 2 deletions
diff --git a/tools/aapt2/java/ClassDefinition.h b/tools/aapt2/java/ClassDefinition.h
index d3648c8aae52..2acdadb3c034 100644
--- a/tools/aapt2/java/ClassDefinition.h
+++ b/tools/aapt2/java/ClassDefinition.h
@@ -78,10 +78,18 @@ class PrimitiveMember : public ClassMember {
ClassMember::Print(final, printer, strip_api_annotations);
printer->Print("public static ");
- if (final && !staged_api_) {
+ if (final) {
printer->Print("final ");
}
- printer->Print("int ").Print(name_).Print("=").Print(to_string(val_)).Print(";");
+ printer->Print("int ").Print(name_);
+ if (staged_api_) {
+ // Prevent references to staged apis from being inline by setting their value out-of-line.
+ printer->Print("; static { ").Print(name_);
+ }
+ printer->Print("=").Print(to_string(val_)).Print(";");
+ if (staged_api_) {
+ printer->Print(" }");
+ }
}
private: