diff options
author | Eugene Susla <eugenesusla@google.com> | 2019-10-03 17:22:44 -0700 |
---|---|---|
committer | Eugene Susla <eugenesusla@google.com> | 2019-10-04 16:18:48 -0700 |
commit | 8cb1a417142e3694e50b004bcd054abd6ecff541 (patch) | |
tree | 8e6fa1f4a0656be2061ce66d695ea3e0194b60e0 /tests/Codegen/src/com/android/codegentest/SampleWithCustomBuilder.java | |
parent | 2f49522757f6d587bc8fc2b81e60544196f29fec (diff) |
Add inheritance support for parcelable dataclasses
We don't want to recommend this, but some legacy framework classes use
inheritance, and it's easy enough to support
Fixes: 142081378
Test: . frameworks/base/tests/Codegen/runTest.sh
Change-Id: Ifb7f34abf1dfb871ac01b9a9a38dfee144e5f49a
Diffstat (limited to 'tests/Codegen/src/com/android/codegentest/SampleWithCustomBuilder.java')
-rw-r--r-- | tests/Codegen/src/com/android/codegentest/SampleWithCustomBuilder.java | 38 |
1 files changed, 24 insertions, 14 deletions
diff --git a/tests/Codegen/src/com/android/codegentest/SampleWithCustomBuilder.java b/tests/Codegen/src/com/android/codegentest/SampleWithCustomBuilder.java index 0f8c663f5d4b..2efa193e7e2a 100644 --- a/tests/Codegen/src/com/android/codegentest/SampleWithCustomBuilder.java +++ b/tests/Codegen/src/com/android/codegentest/SampleWithCustomBuilder.java @@ -85,7 +85,7 @@ public class SampleWithCustomBuilder implements Parcelable { - // Code below generated by codegen v1.0.4. + // Code below generated by codegen v1.0.5. // // DO NOT MODIFY! // CHECKSTYLE:OFF Generated code @@ -151,6 +151,26 @@ public class SampleWithCustomBuilder implements Parcelable { @DataClass.Generated.Member public int describeContents() { return 0; } + /** @hide */ + @SuppressWarnings({"unchecked", "RedundantCast"}) + @DataClass.Generated.Member + protected SampleWithCustomBuilder(Parcel in) { + // You can override field unparcelling by defining methods like: + // static FieldType unparcelFieldName(Parcel in) { ... } + + long _delayAmount = in.readLong(); + TimeUnit _delayUnit = unparcelDelayUnit(in); + long _creationTimestamp = in.readLong(); + + this.delayAmount = _delayAmount; + this.delayUnit = _delayUnit; + com.android.internal.util.AnnotationValidations.validate( + NonNull.class, null, delayUnit); + this.creationTimestamp = _creationTimestamp; + + // onConstructed(); // You can define this method to get a callback + } + @DataClass.Generated.Member public static final @NonNull Parcelable.Creator<SampleWithCustomBuilder> CREATOR = new Parcelable.Creator<SampleWithCustomBuilder>() { @@ -160,18 +180,8 @@ public class SampleWithCustomBuilder implements Parcelable { } @Override - @SuppressWarnings({"unchecked", "RedundantCast"}) public SampleWithCustomBuilder createFromParcel(Parcel in) { - // You can override field unparcelling by defining methods like: - // static FieldType unparcelFieldName(Parcel in) { ... } - - long _delayAmount = in.readLong(); - TimeUnit _delayUnit = unparcelDelayUnit(in); - long _creationTimestamp = in.readLong(); - return new SampleWithCustomBuilder( - _delayAmount, - _delayUnit, - _creationTimestamp); + return new SampleWithCustomBuilder(in); } }; @@ -239,8 +249,8 @@ public class SampleWithCustomBuilder implements Parcelable { } @DataClass.Generated( - time = 1570139501160L, - codegenVersion = "1.0.4", + time = 1570231098303L, + codegenVersion = "1.0.5", sourceFile = "frameworks/base/tests/Codegen/src/com/android/codegentest/SampleWithCustomBuilder.java", inputSignatures = " long delayAmount\n @android.annotation.NonNull java.util.concurrent.TimeUnit delayUnit\n long creationTimestamp\nprivate static java.util.concurrent.TimeUnit unparcelDelayUnit(android.os.Parcel)\nprivate void parcelDelayUnit(android.os.Parcel,int)\nclass SampleWithCustomBuilder extends java.lang.Object implements [android.os.Parcelable]\n@com.android.internal.util.DataClass(genBuilder=true, genAidl=false, genToString=true)\nabstract com.android.codegentest.SampleWithCustomBuilder.Builder setDelayAmount(long)\npublic abstract com.android.codegentest.SampleWithCustomBuilder.Builder setDelayUnit(java.util.concurrent.TimeUnit)\npublic com.android.codegentest.SampleWithCustomBuilder.Builder setDelay(long,java.util.concurrent.TimeUnit)\nclass BaseBuilder extends java.lang.Object implements []") @Deprecated |