-
Enhancement
-
Resolution: Fixed
-
P4
-
7
-
b01
-
x86
-
windows_7
-
Not verified
Please generalize Constructor and Method (using an interface or an abstract class).
Proposed name is CallableMember, but can be otherwise, of course.
Constructor and Method can be generalized without loss of compatibility and without
complex/expensive research, specification and testing process.
These are a lot of common (thus generalizable) methods of these two classes:
* Class<?>[] getExceptionTypes()
* Type[] getGenericExceptionTypes()
* Class<?>[] getParameterTypes()
* Type[] getGenericParameterTypes()
* Annotation[][] getParameterAnnotations()
* TypeVariable<? extends CallableMember>[] getTypeParameters()
* would be overridden by Method to: TypeVariable<Method>[]
* would be overridden by Constructor<?> to: TypeVariable<Constructor<?>>[]
* boolean isSynthetic()
* boolean isVarArgs()
* String toGenericString()
(The generalization of getTypeParameters() can be left out, should it be considered
as not acceptable because of more specific overrides, or for some reasons.)
The generalizing abstract class or interface (CallableMember) should also
implement those interfaces, which are implemented by both Constructor and Method:
* interface AnnotatedElement
* interface GenericDeclaration
* interface Member
* (in case of abstract class:) AccessibleObject
Please comment on the idea.
Best regards,
Ivan G Shevchenko (assembling DOT signals AT yandex DOT ru)
JUSTIFICATION :
Tools which use reflection information could profit from it.
An other reason for this RFE is the fact, that semantically, methods and constructors represent
related concepts, especially from the point of view of language syntax.
- relates to
-
JDK-7073296 (reflect) Generalization of Constructor and Method lead to problems with StandardMBean.invoke
- Closed
-
JDK-7149626 (reflect) Improve javadoc of java.lang.reflect.Executable
- Closed
-
JDK-8004729 Add java.lang.reflect.Parameter and related changes for parameter reflection
- Closed
-
JDK-8028021 @since 1.8 missing for certain methods in java.lang.reflect.Method in generated api docs
- Closed
-
JDK-8336275 Move common Method and Constructor fields to Executable
- Open
-
JDK-8288573 Make Executable.getParameterCount() actually abstract
- Resolved
-
JDK-8004133 Provide javax.lang.model.* implementation backed by core reflection
- Closed
-
JDK-4894447 (reflect) Need To Access Parameter Objects in java.lang.Method
- Closed