From 03a20d46dd211141869c2d15fab7d87745b9fee5 Mon Sep 17 00:00:00 2001 From: Mark Roberts Date: Thu, 8 Feb 2024 11:34:24 -0800 Subject: [PATCH] correct interning changes --- src/main/java/org/apache/bcel/classfile/Constant.java | 3 ++- src/main/java/org/apache/bcel/classfile/Field.java | 3 ++- src/main/java/org/apache/bcel/classfile/JavaClass.java | 3 ++- src/main/java/org/apache/bcel/classfile/Method.java | 3 ++- src/main/java/org/apache/bcel/generic/ClassGen.java | 3 ++- src/main/java/org/apache/bcel/generic/FieldGen.java | 3 ++- src/main/java/org/apache/bcel/generic/MethodGen.java | 3 ++- 7 files changed, 14 insertions(+), 7 deletions(-) diff --git a/src/main/java/org/apache/bcel/classfile/Constant.java b/src/main/java/org/apache/bcel/classfile/Constant.java index 70c4f2e2e1..1d0389ef7e 100644 --- a/src/main/java/org/apache/bcel/classfile/Constant.java +++ b/src/main/java/org/apache/bcel/classfile/Constant.java @@ -36,8 +36,9 @@ public abstract class Constant implements Cloneable, Node { private static BCELComparator bcelComparator = new BCELComparator() { @Override + @SuppressWarnings("interning:not.interned") // we want to do a reference comparison public boolean equals(final Constant a, final Constant b) { - return a.equals(b) || a != null && b != null && Objects.equals(a.toString(), b.toString()); + return a == b || a != null && b != null && Objects.equals(a.toString(), b.toString()); } @Override diff --git a/src/main/java/org/apache/bcel/classfile/Field.java b/src/main/java/org/apache/bcel/classfile/Field.java index 45f86b0b6c..4aceaa6a2a 100644 --- a/src/main/java/org/apache/bcel/classfile/Field.java +++ b/src/main/java/org/apache/bcel/classfile/Field.java @@ -46,8 +46,9 @@ public final class Field extends FieldOrMethod { private static BCELComparator bcelComparator = new BCELComparator() { @Override + @SuppressWarnings("interning:not.interned") // we want to do a reference comparison public boolean equals(final Field a, final Field b) { - return a.equals(b) || a != null && b != null && Objects.equals(a.getName(), b.getName()) && Objects.equals(a.getSignature(), b.getSignature()); + return a == b || a != null && b != null && Objects.equals(a.getName(), b.getName()) && Objects.equals(a.getSignature(), b.getSignature()); } @Override diff --git a/src/main/java/org/apache/bcel/classfile/JavaClass.java b/src/main/java/org/apache/bcel/classfile/JavaClass.java index 9a798a1899..ea8aea57af 100644 --- a/src/main/java/org/apache/bcel/classfile/JavaClass.java +++ b/src/main/java/org/apache/bcel/classfile/JavaClass.java @@ -78,8 +78,9 @@ public class JavaClass extends AccessFlags implements Cloneable, Node, Comparabl private static BCELComparator bcelComparator = new BCELComparator() { @Override + @SuppressWarnings("interning:not.interned") // we want to do a reference comparison public boolean equals(final JavaClass a, final JavaClass b) { - return a.equals(b) || a != null && b != null && Objects.equals(a.getClassName(), b.getClassName()); + return a == b || a != null && b != null && Objects.equals(a.getClassName(), b.getClassName()); } @Override diff --git a/src/main/java/org/apache/bcel/classfile/Method.java b/src/main/java/org/apache/bcel/classfile/Method.java index ef6a06d2a7..a0544236fb 100644 --- a/src/main/java/org/apache/bcel/classfile/Method.java +++ b/src/main/java/org/apache/bcel/classfile/Method.java @@ -45,8 +45,9 @@ public final class Method extends FieldOrMethod { private static BCELComparator bcelComparator = new BCELComparator() { @Override + @SuppressWarnings("interning:not.interned") // we want to do a reference comparison public boolean equals(final Method a, final Method b) { - return a.equals(b) || a != null && b != null && Objects.equals(a.getName(), b.getName()) && Objects.equals(a.getSignature(), b.getSignature()); + return a == b || a != null && b != null && Objects.equals(a.getName(), b.getName()) && Objects.equals(a.getSignature(), b.getSignature()); } @Override diff --git a/src/main/java/org/apache/bcel/generic/ClassGen.java b/src/main/java/org/apache/bcel/generic/ClassGen.java index 809d94e277..004560255f 100644 --- a/src/main/java/org/apache/bcel/generic/ClassGen.java +++ b/src/main/java/org/apache/bcel/generic/ClassGen.java @@ -54,8 +54,9 @@ public class ClassGen extends AccessFlags implements Cloneable { private static BCELComparator bcelComparator = new BCELComparator() { @Override + @SuppressWarnings("interning:not.interned") // we want to do a reference comparison public boolean equals(final ClassGen a, final ClassGen b) { - return a.equals(b) || a != null && b != null && Objects.equals(a.getClassName(), b.getClassName()); + return a == b || a != null && b != null && Objects.equals(a.getClassName(), b.getClassName()); } @Override diff --git a/src/main/java/org/apache/bcel/generic/FieldGen.java b/src/main/java/org/apache/bcel/generic/FieldGen.java index ab615f6248..77168d0228 100644 --- a/src/main/java/org/apache/bcel/generic/FieldGen.java +++ b/src/main/java/org/apache/bcel/generic/FieldGen.java @@ -49,8 +49,9 @@ public class FieldGen extends FieldGenOrMethodGen { private static BCELComparator bcelComparator = new BCELComparator() { @Override + @SuppressWarnings("interning:not.interned") // we want to do a reference comparison public boolean equals(final FieldGen a, final FieldGen b) { - return a.equals(b) || a != null && b != null && Objects.equals(a.getName(), b.getName()) && Objects.equals(a.getSignature(), b.getSignature()); + return a == b || a != null && b != null && Objects.equals(a.getName(), b.getName()) && Objects.equals(a.getSignature(), b.getSignature()); } @Override diff --git a/src/main/java/org/apache/bcel/generic/MethodGen.java b/src/main/java/org/apache/bcel/generic/MethodGen.java index e9412b6cc8..e2e2b7c879 100644 --- a/src/main/java/org/apache/bcel/generic/MethodGen.java +++ b/src/main/java/org/apache/bcel/generic/MethodGen.java @@ -111,8 +111,9 @@ static final class BranchTarget { private static BCELComparator bcelComparator = new BCELComparator() { @Override + @SuppressWarnings("interning:not.interned") // we want to do a reference comparison public boolean equals(final FieldGenOrMethodGen a, final FieldGenOrMethodGen b) { - return a.equals(b) || a != null && b != null && Objects.equals(a.getName(), b.getName()) && Objects.equals(a.getSignature(), b.getSignature()); + return a == b || a != null && b != null && Objects.equals(a.getName(), b.getName()) && Objects.equals(a.getSignature(), b.getSignature()); } @Override