summaryrefslogtreecommitdiff
path: root/tools/codegen/src
diff options
context:
space:
mode:
Diffstat (limited to 'tools/codegen/src')
-rw-r--r--tools/codegen/src/com/android/codegen/Generators.kt9
-rw-r--r--tools/codegen/src/com/android/codegen/SharedConstants.kt2
2 files changed, 7 insertions, 4 deletions
diff --git a/tools/codegen/src/com/android/codegen/Generators.kt b/tools/codegen/src/com/android/codegen/Generators.kt
index 914e475cfe41..865340566019 100644
--- a/tools/codegen/src/com/android/codegen/Generators.kt
+++ b/tools/codegen/src/com/android/codegen/Generators.kt
@@ -341,7 +341,7 @@ private fun ClassPrinter.generateBuilderSetters(visibility: String) {
}
}
- if (Type.contains("Map<")) {
+ if (FieldClass.endsWith("Map") && FieldInnerType != null) {
generateBuilderMethod(
name = adderName,
defVisibility = visibility,
@@ -533,7 +533,7 @@ fun ClassPrinter.generateParcelable() {
} else if (Type !in PRIMITIVE_TYPES + "String" + "Bundle" &&
(!isArray || FieldInnerType !in PRIMITIVE_TYPES + "String") &&
ParcelMethodsSuffix != "Parcelable") {
- !"($Type) "
+ !"($FieldClass) "
}
}
@@ -541,12 +541,15 @@ fun ClassPrinter.generateParcelable() {
when {
ParcelMethodsSuffix == "Parcelable" ->
methodArgs += "$FieldClass.class.getClassLoader()"
+ ParcelMethodsSuffix == "SparseArray" ->
+ methodArgs += "$FieldInnerClass.class.getClassLoader()"
ParcelMethodsSuffix == "TypedObject" ->
methodArgs += "$FieldClass.CREATOR"
ParcelMethodsSuffix == "TypedArray" ->
methodArgs += "$FieldInnerClass.CREATOR"
+ ParcelMethodsSuffix == "Map" ->
+ methodArgs += "${fieldTypeGenegicArgs[1].substringBefore("<")}.class.getClassLoader()"
ParcelMethodsSuffix.startsWith("Parcelable")
- || FieldClass == "Map"
|| (isList || isArray)
&& FieldInnerType !in PRIMITIVE_TYPES + "String" ->
methodArgs += "$FieldInnerClass.class.getClassLoader()"
diff --git a/tools/codegen/src/com/android/codegen/SharedConstants.kt b/tools/codegen/src/com/android/codegen/SharedConstants.kt
index 1e3973eaa022..1cc7ef338cc3 100644
--- a/tools/codegen/src/com/android/codegen/SharedConstants.kt
+++ b/tools/codegen/src/com/android/codegen/SharedConstants.kt
@@ -1,7 +1,7 @@
package com.android.codegen
const val CODEGEN_NAME = "codegen"
-const val CODEGEN_VERSION = "1.0.3"
+const val CODEGEN_VERSION = "1.0.4"
const val CANONICAL_BUILDER_CLASS = "Builder"
const val BASE_BUILDER_CLASS = "BaseBuilder"