Commit 218e047
feat: codegen typed_object fields as nullable struct fields
JavaWireFormat typed_object fields that correspond to a known parcelable
are now generated as *ParcelableType struct fields with proper nullable
marshal/unmarshal. Previously these fields were opaque (no struct field,
marshal wrote int32(0) null marker). Now:
- spec2go looks up typed_object field names in a parcelable index built
from all loaded specs. If a matching parcelable is found, the AIDL
qualified name is stored in JavaWireField.GoType.
- The codegen generates *Type struct fields from GoType metadata
(not from FieldDecl, to avoid perturbing the import graph's
DFS back-edge selection for cycle breaking).
- Marshal writes int32(1) + MarshalParcel for non-nil, int32(0) for nil.
Unmarshal reads the flag and allocates/unmarshals if non-zero.
- Cross-package imports are handled by the TypeRefResolver. A BFS-based
WouldCreateCycle check redirects to types sub-packages when importing
the target would create a cycle (even for edges not in the import graph).
- ImportGraph gains WouldCreateCycle and SameSCC methods for cycle
detection of edges not captured in the static import graph.
Example: LocationRequest.WorkSource is now *types.WorkSource with proper
nullable serialization instead of a hardcoded null marker.1 parent 0a95cf2 commit 218e047
129 files changed
Lines changed: 3908 additions & 1046 deletions
File tree
- android
- accessibilityservice
- types
- accounts/types
- app
- admin
- people
- prediction
- search
- slice/types
- smartspace
- timedetector
- time
- types
- content
- pm
- types
- res
- types
- types
- credentials
- types
- hardware
- display
- face
- location
- location
- provider
- media
- musicrecognition
- tv
- types
- net
- types
- vcn
- os/types
- printservice
- print
- types
- security
- attestationverification
- keystore/recovery
- service
- assist/classification
- autofill
- contentcapture
- notification
- types
- settings/suggestions
- timezone
- voice
- telecom
- telephony
- data
- types
- ims
- mbms
- satellite
- view
- contentcapture
- inputmethod
- textclassifier
- translation
- types
- webkit
- window
- cmd/bindercli
- com/android
- ims/internal_/uce
- options
- presence
- internal_
- inputmethod
- net
- util
- examples/gps_location
- tools
- cmd/spec2go
- pkg
- codegen
- parser
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 36 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 36 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
0 commit comments