[JAVA-3567] Support Java record types Created: 20/Dec/19 Updated: 28/Oct/23 Resolved: 12/Apr/22 |
|
| Status: | Closed |
| Project: | Java Driver |
| Component/s: | POJO |
| Affects Version/s: | None |
| Fix Version/s: | 4.6.0 |
| Type: | New Feature | Priority: | Major - P3 |
| Reporter: | Jeffrey Yemin | Assignee: | Ross Lawley |
| Resolution: | Fixed | Votes: | 9 |
| Labels: | QP-priority, size-medium | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||||||
| Quarter: | FY22Q4, FY23Q1 | ||||||||||||||||
| Description |
|
Java is adding support for records. See https://openjdk.java.net/jeps/359 for a description. The feature will be in preview in Java 14 and if all goes well will be added to the language. Update: a second preview will be included in Java 15 and is described in https://openjdk.java.net/jeps/384. The PojoCodecProvider does not support records because records don't follow Java Beans conventions. Rather than generating getter methods that are prefixed with "get", the getter names are identical to the property names, e.g. a record like
will generate a JVM class like:
|
| Comments |
| Comment by Githook User [ 12/Apr/22 ] |
|
Author: {'name': 'Ross Lawley', 'email': 'ross.lawley@gmail.com', 'username': 'rozza'}Message: Add Java record support to the default registry Add dependency in core to bson-record-codec Wrap the RecordCodecProvider with a canary check so support is
|
| Comment by Githook User [ 08/Apr/22 ] |
|
Author: {'name': 'jyemin', 'email': 'jeff.yemin@mongodb.com', 'username': 'jyemin'}Message: Fix up @since and remove TODO
|
| Comment by Githook User [ 08/Apr/22 ] |
|
Author: {'name': 'Ross Lawley', 'email': 'ross.lawley@gmail.com', 'username': 'rozza'}Message: Support codec for Java records
|
| Comment by Jeffrey Yemin [ 20/Apr/21 ] |
|
Hi chen@spotible.com, not yet. We still have some issues to work out with our build and release process in order to be able to use Java 16. |
| Comment by Chen Levy [ 20/Apr/21 ] |
|
Is this included in 4.3.0-SNAPSHOT ? |
| Comment by Jeffrey Yemin [ 16/Mar/21 ] |
|
Java 16 was released today! Moving this from Blocked back to Scheduled. |
| Comment by Brian DeLeonardis (Inactive) [ 08/Oct/20 ] |
|
An implementation for this is on the 3567 branch. We will merge it once Java 16 is released. |