Commit 8fd99b0
[JS] Implement JsInterop support for Java Records.
This change adds support for using JsInterop annotations on Java Records and their components in J2CL.
- Record component fields are implicitly treated as JsProperties.
- Record component accessors inherit their JsInterop configuration from the components and are restricted from having explicit annotations to avoid conflicts.
- Native records are disallowed as they don't have a meaningful representation in this context.
- `@JsOptional` is disallowed on record components. Maybe will be later allowed on explicit canonical constructors.
More details are covered in docs/design/records-jsinterop.md
In particular this CL only includes changes and tests for Java frontend. Kotlin-Java interop on Record with jsinterop is currently blocked due the problem where private fields are hidden. I will include that with a patch to kotlinc in a later iteration.
PiperOrigin-RevId: 9105174091 parent d2d3d14 commit 8fd99b0
2 files changed
Lines changed: 7 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
26 | | - | |
| 26 | + | |
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
43 | 48 | | |
44 | 49 | | |
45 | 50 | | |
46 | | - | |
| 51 | + | |
47 | 52 | | |
48 | 53 | | |
49 | 54 | | |
| |||
0 commit comments