From 2746ad4094bd68ed441592ddbcb3df1921398969 Mon Sep 17 00:00:00 2001 From: Eric Bruneton Date: Sun, 4 Sep 2022 08:46:14 +0200 Subject: [PATCH 1/2] Add a getDelegate() method to all visitors. Also make the delegate field protected in all cases. --- .../org/objectweb/asm/AnnotationVisitor.java | 11 ++++ .../java/org/objectweb/asm/ClassVisitor.java | 9 +++ .../java/org/objectweb/asm/FieldVisitor.java | 9 +++ .../java/org/objectweb/asm/MethodVisitor.java | 10 +++ .../java/org/objectweb/asm/ModuleVisitor.java | 10 +++ .../objectweb/asm/RecordComponentVisitor.java | 5 +- .../objectweb/asm/AnnotationVisitorTest.java | 8 +++ .../org/objectweb/asm/ClassVisitorTest.java | 8 +++ .../org/objectweb/asm/ClassWriterTest.java | 6 +- .../org/objectweb/asm/FieldVisitorTest.java | 8 +++ .../org/objectweb/asm/MethodVisitorTest.java | 8 +++ .../org/objectweb/asm/ModuleVisitorTest.java | 66 +++++++++++++++++++ .../asm/RecordComponentVisitorTest.java | 66 +++++++++++++++++++ 13 files changed, 220 insertions(+), 4 deletions(-) create mode 100644 asm/src/test/java/org/objectweb/asm/ModuleVisitorTest.java create mode 100644 asm/src/test/java/org/objectweb/asm/RecordComponentVisitorTest.java diff --git a/asm/src/main/java/org/objectweb/asm/AnnotationVisitor.java b/asm/src/main/java/org/objectweb/asm/AnnotationVisitor.java index 0c696844..ad5e9634 100644 --- a/asm/src/main/java/org/objectweb/asm/AnnotationVisitor.java +++ b/asm/src/main/java/org/objectweb/asm/AnnotationVisitor.java @@ -84,6 +84,17 @@ public abstract class AnnotationVisitor { this.av = annotationVisitor; } + /** + * The annotation visitor to which this visitor must delegate method calls. May be {@literal + * null}. + * + * @return the annotation visitor to which this visitor must delegate method calls, or {@literal + * null}. + */ + public AnnotationVisitor getDelegate() { + return av; + } + /** * Visits a primitive value of the annotation. * diff --git a/asm/src/main/java/org/objectweb/asm/ClassVisitor.java b/asm/src/main/java/org/objectweb/asm/ClassVisitor.java index a557f9e4..6adf6d23 100644 --- a/asm/src/main/java/org/objectweb/asm/ClassVisitor.java +++ b/asm/src/main/java/org/objectweb/asm/ClassVisitor.java @@ -83,6 +83,15 @@ public abstract class ClassVisitor { this.cv = classVisitor; } + /** + * The class visitor to which this visitor must delegate method calls. May be {@literal null}. + * + * @return the class visitor to which this visitor must delegate method calls, or {@literal null}. + */ + public ClassVisitor getDelegate() { + return cv; + } + /** * Visits the header of the class. * diff --git a/asm/src/main/java/org/objectweb/asm/FieldVisitor.java b/asm/src/main/java/org/objectweb/asm/FieldVisitor.java index fc271156..2893d9f5 100644 --- a/asm/src/main/java/org/objectweb/asm/FieldVisitor.java +++ b/asm/src/main/java/org/objectweb/asm/FieldVisitor.java @@ -80,6 +80,15 @@ public abstract class FieldVisitor { this.fv = fieldVisitor; } + /** + * The field visitor to which this visitor must delegate method calls. May be {@literal null}. + * + * @return the field visitor to which this visitor must delegate method calls, or {@literal null}. + */ + public FieldVisitor getDelegate() { + return fv; + } + /** * Visits an annotation of the field. * diff --git a/asm/src/main/java/org/objectweb/asm/MethodVisitor.java b/asm/src/main/java/org/objectweb/asm/MethodVisitor.java index 92068e86..7211e656 100644 --- a/asm/src/main/java/org/objectweb/asm/MethodVisitor.java +++ b/asm/src/main/java/org/objectweb/asm/MethodVisitor.java @@ -96,6 +96,16 @@ public abstract class MethodVisitor { this.mv = methodVisitor; } + /** + * The method visitor to which this visitor must delegate method calls. May be {@literal null}. + * + * @return the method visitor to which this visitor must delegate method calls, or {@literal + * null}. + */ + public MethodVisitor getDelegate() { + return mv; + } + // ----------------------------------------------------------------------------------------------- // Parameters, annotations and non standard attributes // ----------------------------------------------------------------------------------------------- diff --git a/asm/src/main/java/org/objectweb/asm/ModuleVisitor.java b/asm/src/main/java/org/objectweb/asm/ModuleVisitor.java index 6ef58e71..2dd0a4c3 100644 --- a/asm/src/main/java/org/objectweb/asm/ModuleVisitor.java +++ b/asm/src/main/java/org/objectweb/asm/ModuleVisitor.java @@ -82,6 +82,16 @@ public abstract class ModuleVisitor { this.mv = moduleVisitor; } + /** + * The module visitor to which this visitor must delegate method calls. May be {@literal null}. + * + * @return the module visitor to which this visitor must delegate method calls, or {@literal + * null}. + */ + public ModuleVisitor getDelegate() { + return mv; + } + /** * Visit the main class of the current module. * diff --git a/asm/src/main/java/org/objectweb/asm/RecordComponentVisitor.java b/asm/src/main/java/org/objectweb/asm/RecordComponentVisitor.java index 3f040819..32784e2a 100644 --- a/asm/src/main/java/org/objectweb/asm/RecordComponentVisitor.java +++ b/asm/src/main/java/org/objectweb/asm/RecordComponentVisitor.java @@ -45,7 +45,7 @@ public abstract class RecordComponentVisitor { /** * The record visitor to which this visitor must delegate method calls. May be {@literal null}. */ - /*package-private*/ RecordComponentVisitor delegate; + protected RecordComponentVisitor delegate; /** * Constructs a new {@link RecordComponentVisitor}. @@ -85,7 +85,8 @@ public abstract class RecordComponentVisitor { /** * The record visitor to which this visitor must delegate method calls. May be {@literal null}. * - * @return the record visitor to which this visitor must delegate method calls or {@literal null}. + * @return the record visitor to which this visitor must delegate method calls, or {@literal + * null}. */ public RecordComponentVisitor getDelegate() { return delegate; diff --git a/asm/src/test/java/org/objectweb/asm/AnnotationVisitorTest.java b/asm/src/test/java/org/objectweb/asm/AnnotationVisitorTest.java index fc4d7634..ea8ee40a 100644 --- a/asm/src/test/java/org/objectweb/asm/AnnotationVisitorTest.java +++ b/asm/src/test/java/org/objectweb/asm/AnnotationVisitorTest.java @@ -61,6 +61,14 @@ class AnnotationVisitorTest extends AsmTest { assertEquals("Unsupported api 0", exception.getMessage()); } + @Test + void testGetDelegate() { + AnnotationVisitor delegate = new AnnotationVisitor(Opcodes.ASM4) {}; + AnnotationVisitor visitor = new AnnotationVisitor(Opcodes.ASM4, delegate) {}; + + assertEquals(delegate, visitor.getDelegate()); + } + /** * Tests that ClassReader accepts visitor which return null AnnotationVisitor, and that returning * null AnnotationVisitor is equivalent to returning an EmptyAnnotationVisitor. diff --git a/asm/src/test/java/org/objectweb/asm/ClassVisitorTest.java b/asm/src/test/java/org/objectweb/asm/ClassVisitorTest.java index fb6e7115..80510433 100644 --- a/asm/src/test/java/org/objectweb/asm/ClassVisitorTest.java +++ b/asm/src/test/java/org/objectweb/asm/ClassVisitorTest.java @@ -68,6 +68,14 @@ class ClassVisitorTest extends AsmTest { assertEquals("Unsupported api 0", exception.getMessage()); } + @Test + void testGetDelegate() { + ClassVisitor delegate = new ClassVisitor(Opcodes.ASM4) {}; + ClassVisitor visitor = new ClassVisitor(Opcodes.ASM4, delegate) {}; + + assertEquals(delegate, visitor.getDelegate()); + } + /** * Tests that classes are unchanged when transformed with a ClassReader -> class adapter -> * ClassWriter chain, where "class adapter" is a ClassVisitor which returns FieldVisitor, diff --git a/asm/src/test/java/org/objectweb/asm/ClassWriterTest.java b/asm/src/test/java/org/objectweb/asm/ClassWriterTest.java index 0871e90c..fb9034ed 100644 --- a/asm/src/test/java/org/objectweb/asm/ClassWriterTest.java +++ b/asm/src/test/java/org/objectweb/asm/ClassWriterTest.java @@ -141,8 +141,10 @@ class ClassWriterTest extends AsmTest { Method classWriterMethod = ClassWriter.class.getMethod( classVisitorMethod.getName(), classVisitorMethod.getParameterTypes()); - assertTrue( - Modifier.isFinal(classWriterMethod.getModifiers()), classWriterMethod + " is final"); + if (!classWriterMethod.getName().equals("getDelegate")) { + assertTrue( + Modifier.isFinal(classWriterMethod.getModifiers()), classWriterMethod + " is final"); + } } catch (NoSuchMethodException e) { fail("ClassWriter must override " + classVisitorMethod); } diff --git a/asm/src/test/java/org/objectweb/asm/FieldVisitorTest.java b/asm/src/test/java/org/objectweb/asm/FieldVisitorTest.java index 0473a0cb..1079638d 100644 --- a/asm/src/test/java/org/objectweb/asm/FieldVisitorTest.java +++ b/asm/src/test/java/org/objectweb/asm/FieldVisitorTest.java @@ -55,4 +55,12 @@ class FieldVisitorTest { Exception exception = assertThrows(IllegalArgumentException.class, constructor); assertEquals("Unsupported api 0", exception.getMessage()); } + + @Test + void testGetDelegate() { + FieldVisitor delegate = new FieldVisitor(Opcodes.ASM4) {}; + FieldVisitor visitor = new FieldVisitor(Opcodes.ASM4, delegate) {}; + + assertEquals(delegate, visitor.getDelegate()); + } } diff --git a/asm/src/test/java/org/objectweb/asm/MethodVisitorTest.java b/asm/src/test/java/org/objectweb/asm/MethodVisitorTest.java index 2a205122..03829fdb 100644 --- a/asm/src/test/java/org/objectweb/asm/MethodVisitorTest.java +++ b/asm/src/test/java/org/objectweb/asm/MethodVisitorTest.java @@ -59,6 +59,14 @@ class MethodVisitorTest extends AsmTest { assertEquals("Unsupported api 0", exception.getMessage()); } + @Test + void testGetDelegate() { + MethodVisitor delegate = new MethodVisitor(Opcodes.ASM4) {}; + MethodVisitor visitor = new MethodVisitor(Opcodes.ASM4, delegate) {}; + + assertEquals(delegate, visitor.getDelegate()); + } + @Test void testVisitParameter_asm4Visitor() { MethodVisitor methodVisitor = new MethodVisitor(Opcodes.ASM4, null) {}; diff --git a/asm/src/test/java/org/objectweb/asm/ModuleVisitorTest.java b/asm/src/test/java/org/objectweb/asm/ModuleVisitorTest.java new file mode 100644 index 00000000..c3563942 --- /dev/null +++ b/asm/src/test/java/org/objectweb/asm/ModuleVisitorTest.java @@ -0,0 +1,66 @@ +// ASM: a very small and fast Java bytecode manipulation framework +// Copyright (c) 2000-2011 INRIA, France Telecom +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the copyright holders nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF +// THE POSSIBILITY OF SUCH DAMAGE. +package org.objectweb.asm; + +import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertThrows; + +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.function.Executable; + +/** + * Unit tests for {@link ModuleVisitor}. + * + * @author Eric Bruneton + */ +class ModuleVisitorTest { + + @Test + void testConstructor_validApi() { + Executable constructor = () -> new ModuleVisitor(Opcodes.ASM4) {}; + + assertDoesNotThrow(constructor); + } + + @Test + void testConstructor_invalidApi() { + Executable constructor = () -> new ModuleVisitor(0) {}; + + Exception exception = assertThrows(IllegalArgumentException.class, constructor); + assertEquals("Unsupported api 0", exception.getMessage()); + } + + @Test + void testGetDelegate() { + ModuleVisitor delegate = new ModuleVisitor(Opcodes.ASM4) {}; + ModuleVisitor visitor = new ModuleVisitor(Opcodes.ASM4, delegate) {}; + + assertEquals(delegate, visitor.getDelegate()); + } +} diff --git a/asm/src/test/java/org/objectweb/asm/RecordComponentVisitorTest.java b/asm/src/test/java/org/objectweb/asm/RecordComponentVisitorTest.java new file mode 100644 index 00000000..da191c49 --- /dev/null +++ b/asm/src/test/java/org/objectweb/asm/RecordComponentVisitorTest.java @@ -0,0 +1,66 @@ +// ASM: a very small and fast Java bytecode manipulation framework +// Copyright (c) 2000-2011 INRIA, France Telecom +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. Neither the name of the copyright holders nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF +// THE POSSIBILITY OF SUCH DAMAGE. +package org.objectweb.asm; + +import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertThrows; + +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.function.Executable; + +/** + * Unit tests for {@link RecordComponentVisitor}. + * + * @author Eric Bruneton + */ +class RecordComponentVisitorTest { + + @Test + void testConstructor_validApi() { + Executable constructor = () -> new RecordComponentVisitor(Opcodes.ASM4) {}; + + assertDoesNotThrow(constructor); + } + + @Test + void testConstructor_invalidApi() { + Executable constructor = () -> new RecordComponentVisitor(0) {}; + + Exception exception = assertThrows(IllegalArgumentException.class, constructor); + assertEquals("Unsupported api 0", exception.getMessage()); + } + + @Test + void testGetDelegate() { + RecordComponentVisitor delegate = new RecordComponentVisitor(Opcodes.ASM4) {}; + RecordComponentVisitor visitor = new RecordComponentVisitor(Opcodes.ASM4, delegate) {}; + + assertEquals(delegate, visitor.getDelegate()); + } +} -- GitLab From e758984e3b4e2819697f284872dc706cc1638bb3 Mon Sep 17 00:00:00 2001 From: Eric Bruneton Date: Sat, 1 Oct 2022 17:39:46 +0200 Subject: [PATCH 2/2] Address code review comments. --- asm/src/test/java/org/objectweb/asm/AnnotationVisitorTest.java | 3 ++- asm/src/test/java/org/objectweb/asm/ClassVisitorTest.java | 3 ++- asm/src/test/java/org/objectweb/asm/FieldVisitorTest.java | 3 ++- asm/src/test/java/org/objectweb/asm/MethodVisitorTest.java | 3 ++- asm/src/test/java/org/objectweb/asm/ModuleVisitorTest.java | 3 ++- .../java/org/objectweb/asm/RecordComponentVisitorTest.java | 3 ++- 6 files changed, 12 insertions(+), 6 deletions(-) diff --git a/asm/src/test/java/org/objectweb/asm/AnnotationVisitorTest.java b/asm/src/test/java/org/objectweb/asm/AnnotationVisitorTest.java index ea8ee40a..6b06d081 100644 --- a/asm/src/test/java/org/objectweb/asm/AnnotationVisitorTest.java +++ b/asm/src/test/java/org/objectweb/asm/AnnotationVisitorTest.java @@ -29,6 +29,7 @@ package org.objectweb.asm; import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertSame; import static org.junit.jupiter.api.Assertions.assertThrows; import static org.junit.jupiter.api.Assertions.assertTrue; @@ -66,7 +67,7 @@ class AnnotationVisitorTest extends AsmTest { AnnotationVisitor delegate = new AnnotationVisitor(Opcodes.ASM4) {}; AnnotationVisitor visitor = new AnnotationVisitor(Opcodes.ASM4, delegate) {}; - assertEquals(delegate, visitor.getDelegate()); + assertSame(delegate, visitor.getDelegate()); } /** diff --git a/asm/src/test/java/org/objectweb/asm/ClassVisitorTest.java b/asm/src/test/java/org/objectweb/asm/ClassVisitorTest.java index 80510433..5c04868f 100644 --- a/asm/src/test/java/org/objectweb/asm/ClassVisitorTest.java +++ b/asm/src/test/java/org/objectweb/asm/ClassVisitorTest.java @@ -30,6 +30,7 @@ package org.objectweb.asm; import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertSame; import static org.junit.jupiter.api.Assertions.assertThrows; import static org.junit.jupiter.api.Assertions.assertTrue; @@ -73,7 +74,7 @@ class ClassVisitorTest extends AsmTest { ClassVisitor delegate = new ClassVisitor(Opcodes.ASM4) {}; ClassVisitor visitor = new ClassVisitor(Opcodes.ASM4, delegate) {}; - assertEquals(delegate, visitor.getDelegate()); + assertSame(delegate, visitor.getDelegate()); } /** diff --git a/asm/src/test/java/org/objectweb/asm/FieldVisitorTest.java b/asm/src/test/java/org/objectweb/asm/FieldVisitorTest.java index 1079638d..b7f37cd7 100644 --- a/asm/src/test/java/org/objectweb/asm/FieldVisitorTest.java +++ b/asm/src/test/java/org/objectweb/asm/FieldVisitorTest.java @@ -29,6 +29,7 @@ package org.objectweb.asm; import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertSame; import static org.junit.jupiter.api.Assertions.assertThrows; import org.junit.jupiter.api.Test; @@ -61,6 +62,6 @@ class FieldVisitorTest { FieldVisitor delegate = new FieldVisitor(Opcodes.ASM4) {}; FieldVisitor visitor = new FieldVisitor(Opcodes.ASM4, delegate) {}; - assertEquals(delegate, visitor.getDelegate()); + assertSame(delegate, visitor.getDelegate()); } } diff --git a/asm/src/test/java/org/objectweb/asm/MethodVisitorTest.java b/asm/src/test/java/org/objectweb/asm/MethodVisitorTest.java index 03829fdb..915b1b4d 100644 --- a/asm/src/test/java/org/objectweb/asm/MethodVisitorTest.java +++ b/asm/src/test/java/org/objectweb/asm/MethodVisitorTest.java @@ -29,6 +29,7 @@ package org.objectweb.asm; import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertSame; import static org.junit.jupiter.api.Assertions.assertThrows; import static org.junit.jupiter.api.Assertions.assertTrue; @@ -64,7 +65,7 @@ class MethodVisitorTest extends AsmTest { MethodVisitor delegate = new MethodVisitor(Opcodes.ASM4) {}; MethodVisitor visitor = new MethodVisitor(Opcodes.ASM4, delegate) {}; - assertEquals(delegate, visitor.getDelegate()); + assertSame(delegate, visitor.getDelegate()); } @Test diff --git a/asm/src/test/java/org/objectweb/asm/ModuleVisitorTest.java b/asm/src/test/java/org/objectweb/asm/ModuleVisitorTest.java index c3563942..c9eb3382 100644 --- a/asm/src/test/java/org/objectweb/asm/ModuleVisitorTest.java +++ b/asm/src/test/java/org/objectweb/asm/ModuleVisitorTest.java @@ -29,6 +29,7 @@ package org.objectweb.asm; import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertSame; import static org.junit.jupiter.api.Assertions.assertThrows; import org.junit.jupiter.api.Test; @@ -61,6 +62,6 @@ class ModuleVisitorTest { ModuleVisitor delegate = new ModuleVisitor(Opcodes.ASM4) {}; ModuleVisitor visitor = new ModuleVisitor(Opcodes.ASM4, delegate) {}; - assertEquals(delegate, visitor.getDelegate()); + assertSame(delegate, visitor.getDelegate()); } } diff --git a/asm/src/test/java/org/objectweb/asm/RecordComponentVisitorTest.java b/asm/src/test/java/org/objectweb/asm/RecordComponentVisitorTest.java index da191c49..0e3ef7a3 100644 --- a/asm/src/test/java/org/objectweb/asm/RecordComponentVisitorTest.java +++ b/asm/src/test/java/org/objectweb/asm/RecordComponentVisitorTest.java @@ -29,6 +29,7 @@ package org.objectweb.asm; import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertSame; import static org.junit.jupiter.api.Assertions.assertThrows; import org.junit.jupiter.api.Test; @@ -61,6 +62,6 @@ class RecordComponentVisitorTest { RecordComponentVisitor delegate = new RecordComponentVisitor(Opcodes.ASM4) {}; RecordComponentVisitor visitor = new RecordComponentVisitor(Opcodes.ASM4, delegate) {}; - assertEquals(delegate, visitor.getDelegate()); + assertSame(delegate, visitor.getDelegate()); } } -- GitLab