diff --git a/src/java.base/share/classes/java/lang/reflect/Executable.java b/src/java.base/share/classes/java/lang/reflect/Executable.java index b808e052fb2..7416cf1d73e 100644 --- a/src/java.base/share/classes/java/lang/reflect/Executable.java +++ b/src/java.base/share/classes/java/lang/reflect/Executable.java @@ -196,7 +219,9 @@ String sharedToGenericString(int modifierMask, boolean isDefault) { * Returns the {@code Class} object representing the class or interface * that declares the executable represented by this object. */ - public abstract Class getDeclaringClass(); + public Class getDeclaringClass() { + return clazz; + } /** * Returns the name of the executable represented by this object. @@ -208,7 +233,9 @@ String sharedToGenericString(int modifierMask, boolean isDefault) { * the executable represented by this object} * @see #accessFlags */ - public abstract int getModifiers(); + public int getModifiers() { + return modifiers; + } /** * {@return an unmodifiable set of the {@linkplain AccessFlag @@ -266,7 +285,9 @@ public Set accessFlags() { * represents */ @SuppressWarnings("doclint:reference") // cross-module links - public abstract Class[] getParameterTypes(); + public Class[] getParameterTypes() { + return parameterTypes.length == 0 ? parameterTypes : parameterTypes.clone(); + } /** * Returns the number of formal parameters (whether explicitly @@ -276,7 +297,9 @@ public Set accessFlags() { * @return The number of formal parameters for the executable this * object represents */ - public abstract int getParameterCount(); + public int getParameterCount() { + return parameterTypes.length; + } /** * Returns an array of {@code Type} objects that represent the @@ -507,7 +530,9 @@ byte[] getTypeAnnotationBytes() { * @return the exception types declared as being thrown by the * executable this object represents */ - public abstract Class[] getExceptionTypes(); + public Class[] getExceptionTypes() { + return exceptionTypes.length == 0 ? exceptionTypes : exceptionTypes.clone(); + } /** * Returns an array of {@code Type} objects that represent the @@ -598,10 +623,7 @@ public boolean isSynthetic() { * the formal and implicit parameters, in declaration order, of * the executable represented by this object */ - public abstract Annotation[][] getParameterAnnotations(); - - Annotation[][] sharedGetParameterAnnotations(Class[] parameterTypes, - byte[] parameterAnnotations) { + public Annotation[][] getParameterAnnotations() { int numParameters = parameterTypes.length; if (parameterAnnotations == null) return new Annotation[numParameters][0];