commons-lang icon indicating copy to clipboard operation
commons-lang copied to clipboard

LANG-1652 - Check whether the given class has a public constructor

Open arturobernalg opened this issue 4 years ago • 4 comments

Determine whether the given class has a public constructor with the given signature, checking accessibility.

arturobernalg avatar Mar 22 '21 06:03 arturobernalg

Coverage Status

Coverage increased (+0.0003%) to 94.952% when pulling 1e1a4b820f184b05b6081c1ad6e2359399c24ed5 on arturobernalg:feature/LANG-1652 into 4ff5e2b9f98e5ca9dd105a2d08477e0371ae8832 on apache:master.

coveralls avatar Mar 23 '21 03:03 coveralls

@arturobernalg I am curious: Can this be used within Commons Lang itself?

garydgregory avatar Oct 08 '21 19:10 garydgregory

@arturobernalg I am curious: Can this be used within Commons Lang itself?

Hi @garydgregory We have a complete class dedicated to manipulate and access to the method of a class through reflections, so, IMO why not.

arturobernalg avatar Oct 09 '21 05:10 arturobernalg

@arturobernalg I am curious: Can this be used within Commons Lang itself?

Hi @garydgregory We have a complete class dedicated to manipulate and access to the method of a class through reflections, so, IMO why not.

Not, because (1) It's not useable within Commons Lang itself, because current callers of getAccessibleConstructor(*) test and use the result of the call. So using this new API internally would cause getAccessibleConstructor() to be called more than once instead of once. And (2) because "why not" is not a use-case, so YAGNI.

garydgregory avatar Nov 17 '21 15:11 garydgregory