Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Record annotation warning fix in mapper-processor
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
- Loading branch information