Skip to content

Conversation

@chubert-ch
Copy link
Contributor

@chubert-ch chubert-ch commented Sep 23, 2025

ClassGraph returns the MethodInfo of some (but not all!) superclass constructors when asked for a Class's constructors.

Particularly confusing for users if there's a non-public constructor with the same signature as a constructor in the superclass and .ignoreMethodVisibility() isn't set. This is the only case where an overridden method is returned from getMethodInfo() and is because constructors are the only case where a method can have the same signature as a superclass method, but have lower visibility.

Issue link

@chubert-ch chubert-ch force-pushed the cxh/method-modifiers-for-overridden-constructors branch from 2e301a2 to b6427d8 Compare September 23, 2025 16:21
@chubert-ch chubert-ch force-pushed the cxh/method-modifiers-for-overridden-constructors branch from b6427d8 to fbe61e0 Compare September 23, 2025 16:53
@chubert-ch chubert-ch changed the title [Issue 920] Fixing getMethodInfo to not get superconstructors [Issue 920] Updating getMethodInfo to not get superconstructors Sep 23, 2025
@lukehutch
Copy link
Member

Good catch, thanks for the fix!

@lukehutch lukehutch merged commit fd0dc9f into classgraph:latest Oct 10, 2025
1 check passed
@chubert-ch chubert-ch deleted the cxh/method-modifiers-for-overridden-constructors branch October 10, 2025 13:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants