summaryrefslogtreecommitdiff
path: root/tools/aapt2/java/ClassDefinition.h
diff options
context:
space:
mode:
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: