zemiles commented on code in PR #1810:
URL: https://github.com/apache/commons-lang/pull/1810#discussion_r4229945321


##########
src/test/java/org/apache/commons/lang3/AnnotationUtilsTest.java:
##########
@@ -421,6 +467,15 @@ void testEquivalence() {
         
assertTrue(AnnotationUtils.equals(field2.getAnnotation(TestAnnotation.class), 
field1.getAnnotation(TestAnnotation.class)));
     }
 
+    @Test
+    void testEquivalenceWithoutInvokingSupplier() {
+        final ThrowingSupplierAnnotation first = 
AnnotatedClass.class.getAnnotation(ThrowingSupplierAnnotation.class);
+        final ThrowingSupplierAnnotation second = 
EquivalentAnnotatedClass.class.getAnnotation(ThrowingSupplierAnnotation.class);
+
+        assertNotSame(first, second);
+        assertTrue(AnnotationUtils.equals(first, second));

Review Comment:
   Thanks for the suggestion. I replaced the second annotation with a freshly 
created proxy, avoiding reliance on JVM annotation caching. I retained 
assertNotSame to ensure the test exercises member comparison rather than the 
identity shortcut.
   
   The 20 related tests pass on Java 8, 11, 17, 21, 25, and 27. The full 
default Maven build also passes on Java 21.
   
   I confirmed that the updated regression test still fails against the 
original implementation and passes with the fix.



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

Reply via email to