From 1c0b8e55b4b9079563a6d17869f96db710d057b0 Mon Sep 17 00:00:00 2001 From: Vladimir Petko Date: Tue, 10 Feb 2026 13:35:22 +1300 Subject: [PATCH] fix: use equals() instead of == to compare Method Building procyon with Java 25 results in the following failure: com.strobel.reflection.SignatureTests > testSignatureOfGenericMethodInGenericDefinition FAILED org.junit.ComparisonFailure: expected:<[]([TT;)[TT;> but was:<[]([TT;)[TT;> at org.junit.Assert.assertEquals(Assert.java:117) at org.junit.Assert.assertEquals(Assert.java:146) at com.strobel.reflection.SignatureTests.testSignatureOfGenericMethodInGenericDefinition(SignatureTests.java:71) This is caused by == used instead of equals() to compare Method instances. java.lang.reflect does not guarantee that Method instances are singletons. --- .../src/main/java/com/strobel/reflection/MethodInfo.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Procyon.Reflection/src/main/java/com/strobel/reflection/MethodInfo.java b/Procyon.Reflection/src/main/java/com/strobel/reflection/MethodInfo.java index dbe846f5..64755b3d 100644 --- a/Procyon.Reflection/src/main/java/com/strobel/reflection/MethodInfo.java +++ b/Procyon.Reflection/src/main/java/com/strobel/reflection/MethodInfo.java @@ -727,7 +727,7 @@ class ReflectedMethod extends MethodInfo { final GenericParameter gp = (GenericParameter) p; final TypeVariable typeVariable = gp.getRawTypeVariable(); - if (typeVariable.getGenericDeclaration() == rawMethod) { + if (typeVariable.getGenericDeclaration().equals(rawMethod)) { gp.setDeclaringMethod(this); if (genericParameters == null) {