merlimat commented on a change in pull request #9253:
URL: https://github.com/apache/pulsar/pull/9253#discussion_r561625005



##########
File path: 
pulsar-metadata/src/main/java/org/apache/pulsar/metadata/api/GetResult.java
##########
@@ -26,11 +26,20 @@
 @Data
 public class GetResult {
 
+    public GetResult(byte[] value, Stat stat){
+        this.value = value.clone();

Review comment:
       While I understand the immutability aspect, making 2 extra copies and 
allocations of the value array it's overkill for this scenario.

##########
File path: 
pulsar-metadata/src/main/java/org/apache/pulsar/metadata/api/GetResult.java
##########
@@ -26,11 +26,20 @@
 @Data
 public class GetResult {
 
+    public GetResult(byte[] value, Stat stat){
+        this.value = value.clone();

Review comment:
       I'm not super convinced in making the field public. `GetResult` class is 
part of API so I'd rather keep that behind a getter method. An implementation 
might not store it directly as a `byte[]` but instead convert that on demand. 

##########
File path: 
pulsar-metadata/src/main/java/org/apache/pulsar/metadata/api/GetResult.java
##########
@@ -26,11 +26,20 @@
 @Data
 public class GetResult {
 
+    public GetResult(byte[] value, Stat stat){
+        this.value = value.clone();

Review comment:
       Can we instead ignore the warning for this case?




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to