Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JavaClass should offer getters for methods and constructors independent of the classpath #236

Closed
codecholeric opened this issue Sep 14, 2019 · 0 comments · Fixed by #246
Closed

Comments

@codecholeric
Copy link
Collaborator

At the moment there are various options

javaClass.getCodeUnitWithParameterTypes(Class<?>...)
javaClass.getCodeUnitWithParameterTypeNames(String...)

but only

javaClass.getMethod(Class<?>...)
javaClass.getConstructor(Class<?>...)

It should be possible to retrieve methods and constructors, even if the parameter types are not in the classpath.

rweisleder added a commit to rweisleder/ArchUnit that referenced this issue Oct 7, 2019
This commit adds the methods
  JavaClass.getConstructor(String... parameters)
  JavaClass.getMethod(String name, String... parameters)
  JavaClass.tryGetMethod(String name, String... parameters)
to retrieve constructors/methods even if a parameter type is not present
on the classpath.

The methods
  JavaClass.getConstructor()
  JavaClass.getMethod(String name)
  JavaClass.tryGetMethod(String name)
to retrieve constructors/methods without parameters where added to avoid
ambiguous method calls.

Resolves TNG#236

Signed-off-by: Roland Weisleder <[email protected]>
codecholeric pushed a commit to rweisleder/ArchUnit that referenced this issue Nov 3, 2019
This commit adds the methods
  JavaClass.getConstructor(String... parameters)
  JavaClass.getMethod(String name, String... parameters)
  JavaClass.tryGetMethod(String name, String... parameters)
to retrieve constructors/methods even if a parameter type is not present
on the classpath.

The methods
  JavaClass.getConstructor()
  JavaClass.getMethod(String name)
  JavaClass.tryGetMethod(String name)
to retrieve constructors/methods without parameters where added to avoid
ambiguous method calls.

Resolves TNG#236

Signed-off-by: Roland Weisleder <[email protected]>
codecholeric added a commit to rweisleder/ArchUnit that referenced this issue Nov 3, 2019
codecholeric added a commit that referenced this issue Nov 3, 2019
Overload JavaClass.getConstructor() and JavaClass.getMethod()
codecholeric pushed a commit that referenced this issue Feb 21, 2021
This commit adds the methods
  JavaClass.getConstructor(String... parameters)
  JavaClass.getMethod(String name, String... parameters)
  JavaClass.tryGetMethod(String name, String... parameters)
to retrieve constructors/methods even if a parameter type is not present
on the classpath.

The methods
  JavaClass.getConstructor()
  JavaClass.getMethod(String name)
  JavaClass.tryGetMethod(String name)
to retrieve constructors/methods without parameters where added to avoid
ambiguous method calls.

Resolves #236

Signed-off-by: Roland Weisleder <[email protected]>
codecholeric added a commit that referenced this issue Feb 21, 2021
codecholeric added a commit that referenced this issue Feb 21, 2021
Overload JavaClass.getConstructor() and JavaClass.getMethod()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant