You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Java 14 introduces record keyword which stands for immutable data class.
Records require only the name and types of fields. Java generates some
code to operate on the record's objects - including public getter
methods.
When annotating record with @entity annotation and its field with one
of the exclusive annotations, we get a compilation warning:
@entity
public record FooRecord(
@PartitionKey int fooPK,
@ClusteringColumn String fooCC
) { }
/home/mikolajuzarski/playground/java-driver-test/src/main/java/org/example/FooRecord.java:9:27
java: [FooRecord.fooPK] @PartitionKey should be used either on the field or the getter, but not both. The annotation on this field will be ignored.
/home/mikolajuzarski/playground/java-driver-test/src/main/java/org/example/FooRecord.java:10:34
java: [FooRecord.fooCC] @ClusteringColumn should be used either on the field or the getter, but not both. The annotation on this field will be ignored.
Java duplicates the annotation on the record's field to the corresponding
getter method as well. This results in generating the warning when using
records and exclusive field annotations.
This commit fixes the issue, so the compilation warning message is
not printed for records.
Fixes#246
Copy file name to clipboardExpand all lines: mapper-processor/src/main/java/com/datastax/oss/driver/internal/mapper/processor/entity/DefaultEntityFactory.java
0 commit comments