You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@iotdb.apache.org by GitBox <gi...@apache.org> on 2020/09/07 12:04:30 UTC

[GitHub] [incubator-iotdb] haimeiguo commented on a change in pull request #1657: Fix for Codesmell check step1

haimeiguo commented on a change in pull request #1657:
URL: https://github.com/apache/incubator-iotdb/pull/1657#discussion_r484389819



##########
File path: flink-iotdb-connector/src/main/java/org/apache/iotdb/flink/Event.java
##########
@@ -32,8 +32,8 @@
   private List<TSDataType> types;
   private List<Object> values;
 
-  public Event(String device, Long timestamp, List<String> measurements, List<TSDataType> types,
-      List<Object> values) {
+  public Event(String device, final Long timestamp, final List<String> measurements, final List<TSDataType> types,

Review comment:
       the code smell doc recommended we should not return or store modifiable object. So I added final keyword to make the object unmodifiable. Following is the detail: 
   
   2.4.13 分类名称:不应该存储或直接返回可变成员.
   可变对象是那些状态可以更改的对象。例如,数组是可变的,但不是字符串。不应该将可变类成员返回给调用者或直接接受和存储。这样做会使您容易受到类状态中意外更改的影响。
   而是使用不可修改的“集合”(通过“集合”)。unmodifiableCollection”、“集合。或复制可变对象,并存储或返回该副本。
   此规则检查数组、集合和日期是否没有直接存储或返回




----------------------------------------------------------------
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:
users@infra.apache.org