Skip to content

Commit f9e64c2

Browse files
fix: skip static writeToParcel overloads in java2spec parser
The parser was picking up static helper methods like ComponentName.writeToParcel(ComponentName c, Parcel out) instead of the instance writeToParcel(Parcel out, int flags). This produced wrong wire formats (delegate with condition instead of actual fields). Added isStaticMethod check to skip static overloads, and prefer-longer merge logic to avoid overwriting good specs with shorter ones. ComponentName now correctly marshals Package and Class as string16 fields instead of writing a bogus null marker.
1 parent fd06bf9 commit f9e64c2

12 files changed

Lines changed: 107 additions & 50 deletions

File tree

android/content/componentname.go

Lines changed: 14 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

android/content/types/componentname.go

Lines changed: 14 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

android/net/types/uri.go

Lines changed: 8 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

android/net/uri.go

Lines changed: 8 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

android/os/parcelableexception.go

Lines changed: 7 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

android/os/types/userhandle.go

Lines changed: 8 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

android/os/userhandle.go

Lines changed: 8 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

specs/android/content/spec.yaml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1183,9 +1183,10 @@ parcelables:
11831183
write_method: bundle
11841184
- name: ComponentName
11851185
java_wire_format:
1186-
- name: c
1187-
write_method: delegate
1188-
condition: c!=null
1186+
- name: Package
1187+
write_method: string16
1188+
- name: Class
1189+
write_method: string16
11891190
- name: ContentCaptureOptions
11901191
java_wire_format:
11911192
- name: Lite

specs/android/net/spec.yaml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1204,10 +1204,6 @@ parcelables:
12041204
- name: Uri
12051205
annotations:
12061206
- JavaOnlyStableParcelable
1207-
java_wire_format:
1208-
- name: NULL_TYPE_ID
1209-
write_method: int32
1210-
condition: uri==null
12111207
- name: VpnProfileState
12121208
java_wire_format:
12131209
- name: State

specs/android/os/spec.yaml

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6157,11 +6157,6 @@ parcelables:
61576157
- name: Uuid.getLeastSignificantBits()
61586158
write_method: int64
61596159
- name: ParcelableException
6160-
java_wire_format:
6161-
- name: T.getClass().getName()
6162-
write_method: string16
6163-
- name: T.getMessage()
6164-
write_method: string16
61656160
- name: ParcelableParcel
61666161
java_wire_format:
61676162
- name: Parcel.dataSize()
@@ -6280,9 +6275,8 @@ parcelables:
62806275
write_method: int32
62816276
- name: UserHandle
62826277
java_wire_format:
6283-
- name: h
6284-
write_method: delegate
6285-
condition: h!=null
6278+
- name: Handle
6279+
write_method: int32
62866280
- name: UserManager.EnforcingUser
62876281
- name: VibrationAttributes
62886282
java_wire_format:

0 commit comments

Comments
 (0)