Skip to content

Missing a common interface between MethodGenericsContext and ConstructorGenericsContext #6

@UnasZole

Description

@UnasZole

java.lang.reflect.Constructor and java.lang.reflect.Method all inherit from java.lang.reflect.Executable, which defines all methods related to inspection of the arguments.
This allows to make some common code for inspecting the parameters of either a constructor or a method.

Generics-Resolver does not currently expose any such common parent between ConstructorGenericsContext and MethodGenericsContext, so it becomes difficult to share this kind of code when working with generics. (I am currently using a wrapper class around both objects, but this is not very nice)

A quick suggestion is to create an ExecutableGenericsContext interface defining the resolveParametersTypes() and parameterType(final int pos) methods, and a few others.
You could probably refactor the lib code a bit to make this a common parent class instead and avoid code duplication, but that's up to you - for the end user, the result will be the same :-)

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions