szetszwo commented on code in PR #9509:
URL: https://github.com/apache/ozone/pull/9509#discussion_r2624366520


##########
hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/helpers/OmDirectoryInfo.java:
##########
@@ -265,27 +240,24 @@ public boolean equals(Object o) {
       return false;
     }
     OmDirectoryInfo omDirInfo = (OmDirectoryInfo) o;
-    return creationTime == omDirInfo.creationTime &&
-            modificationTime == omDirInfo.modificationTime &&
-            name.equals(omDirInfo.name) &&
-            Objects.equals(owner, omDirInfo.owner) &&
-            Objects.equals(getMetadata(), omDirInfo.getMetadata()) &&
-            Objects.equals(acls, omDirInfo.acls) &&
-            getObjectID() == omDirInfo.getObjectID() &&
-            getUpdateID() == omDirInfo.getUpdateID() &&
-            getParentObjectID() == omDirInfo.getParentObjectID();
+    return creationTime == omDirInfo.creationTime
+        && modificationTime == omDirInfo.modificationTime
+        && getObjectID() == omDirInfo.getObjectID()
+        && getUpdateID() == omDirInfo.getUpdateID()
+        && getParentObjectID() == omDirInfo.getParentObjectID()
+        && Objects.equals(name, omDirInfo.name)
+        && Objects.equals(owner, omDirInfo.owner)
+        && Objects.equals(getMetadata(), omDirInfo.getMetadata())
+        && Objects.equals(acls, omDirInfo.acls);
   }
 
   @Override
   public int hashCode() {
     return Objects.hash(getObjectID(), getParentObjectID(), name);
   }
 
-  /**
-   * Return a new copy of the object.
-   */
   @Override
   public OmDirectoryInfo copyObject() {
-    return toBuilder().build();
+    return this;
   }
 }

Review Comment:
   Let's remove the `copyObject()` method and use `CopyType.SHALLOW`.
   ```java
   @@ -34,13 +33,13 @@
     * in the user given path and a pointer to its parent directory element in 
the
     * path. Also, it stores directory node related metdata details.
     */
   -public class OmDirectoryInfo extends WithParentObjectId
   -    implements CopyObject<OmDirectoryInfo> {
   +public class OmDirectoryInfo extends WithParentObjectId {
      private static final Codec<OmDirectoryInfo> CODEC = new DelegatedCodec<>(
          Proto2Codec.get(DirectoryInfo.getDefaultInstance()),
          OmDirectoryInfo::getFromProtobuf,
          OmDirectoryInfo::getProtobuf,
   -      OmDirectoryInfo.class);
   +      OmDirectoryInfo.class,
   +      DelegatedCodec.CopyType.SHALLOW);
    
      private final String name; // directory name
      private String owner;
   @@ -280,12 +279,4 @@ public boolean equals(Object o) {
      public int hashCode() {
        return Objects.hash(getObjectID(), getParentObjectID(), name);
      }
   -
   -  /**
   -   * Return a new copy of the object.
   -   */
   -  @Override
   -  public OmDirectoryInfo copyObject() {
   -    return toBuilder().build();
   -  }
    }
   ```



-- 
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.

To unsubscribe, e-mail: [email protected]

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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to