This is an automated email from the ASF dual-hosted git repository. ggregory pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/commons-compress.git
commit f4021b0088f978dc728aeabc8566bf88ddeb8b96 Author: Gary Gregory <[email protected]> AuthorDate: Thu Dec 8 11:03:56 2022 -0500 Use Java Objects class --- .../compress/harmony/unpack200/bytecode/Attribute.java | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/src/main/java/org/apache/commons/compress/harmony/unpack200/bytecode/Attribute.java b/src/main/java/org/apache/commons/compress/harmony/unpack200/bytecode/Attribute.java index f8327ba0..af215551 100644 --- a/src/main/java/org/apache/commons/compress/harmony/unpack200/bytecode/Attribute.java +++ b/src/main/java/org/apache/commons/compress/harmony/unpack200/bytecode/Attribute.java @@ -18,6 +18,7 @@ package org.apache.commons.compress.harmony.unpack200.bytecode; import java.io.DataOutputStream; import java.io.IOException; +import java.util.Objects; /** * Abstract superclass for class file attributes @@ -51,11 +52,7 @@ public abstract class Attribute extends ClassFileEntry { return false; } final Attribute other = (Attribute) obj; - if (attributeName == null) { - if (other.attributeName != null) { - return false; - } - } else if (!attributeName.equals(other.attributeName)) { + if (!Objects.equals(attributeName, other.attributeName)) { return false; } return true; @@ -104,10 +101,7 @@ public abstract class Attribute extends ClassFileEntry { @Override public int hashCode() { - final int PRIME = 31; - int result = 1; - result = PRIME * result + ((attributeName == null) ? 0 : attributeName.hashCode()); - return result; + return Objects.hash(attributeName); } @Override
