< prev index next >

src/java.base/share/classes/java/lang/reflect/Executable.java

Print this page

197      * that declares the executable represented by this object.
198      */
199     public abstract Class<?> getDeclaringClass();
200 
201     /**
202      * Returns the name of the executable represented by this object.
203      */
204     public abstract String getName();
205 
206     /**
207      * {@return the Java language {@linkplain Modifier modifiers} for
208      * the executable represented by this object}
209      * @see #accessFlags
210      */
211     public abstract int getModifiers();
212 
213     /**
214      * {@return an unmodifiable set of the {@linkplain AccessFlag
215      * access flags} for the executable represented by this object,
216      * possibly empty}

217      *
218      * @see #getModifiers()
219      * @jvms 4.6 Methods
220      * @since 20
221      */
222     @Override
223     public Set<AccessFlag> accessFlags() {


224         return AccessFlag.maskToAccessFlags(getModifiers(),
225                                             AccessFlag.Location.METHOD);

226     }
227 
228     /**
229      * Returns an array of {@code TypeVariable} objects that represent the
230      * type variables declared by the generic declaration represented by this
231      * {@code GenericDeclaration} object, in declaration order.  Returns an
232      * array of length 0 if the underlying generic declaration declares no type
233      * variables.
234      *
235      * @return an array of {@code TypeVariable} objects that represent
236      *     the type variables declared by this generic declaration
237      * @throws GenericSignatureFormatError if the generic
238      *     signature of this generic declaration does not conform to
239      *     the format specified in
240      *     <cite>The Java Virtual Machine Specification</cite>
241      */
242     public abstract TypeVariable<?>[] getTypeParameters();
243 
244     // returns shared array of parameter types - must never give it out
245     // to the untrusted code...

197      * that declares the executable represented by this object.
198      */
199     public abstract Class<?> getDeclaringClass();
200 
201     /**
202      * Returns the name of the executable represented by this object.
203      */
204     public abstract String getName();
205 
206     /**
207      * {@return the Java language {@linkplain Modifier modifiers} for
208      * the executable represented by this object}
209      * @see #accessFlags
210      */
211     public abstract int getModifiers();
212 
213     /**
214      * {@return an unmodifiable set of the {@linkplain AccessFlag
215      * access flags} for the executable represented by this object,
216      * possibly empty}
217      * The {@code AccessFlags} may depend on the class file format version of the class.
218      *
219      * @see #getModifiers()
220      * @jvms 4.6 Methods
221      * @since 20
222      */
223     @Override
224     public Set<AccessFlag> accessFlags() {
225         int major = SharedSecrets.getJavaLangAccess().classFileFormatVersion(getDeclaringClass()) & 0xffff;
226         var cffv = ClassFileFormatVersion.fromMajor(major);
227         return AccessFlag.maskToAccessFlags(getModifiers(),
228                                             AccessFlag.Location.METHOD,
229                                             cffv);
230     }
231 
232     /**
233      * Returns an array of {@code TypeVariable} objects that represent the
234      * type variables declared by the generic declaration represented by this
235      * {@code GenericDeclaration} object, in declaration order.  Returns an
236      * array of length 0 if the underlying generic declaration declares no type
237      * variables.
238      *
239      * @return an array of {@code TypeVariable} objects that represent
240      *     the type variables declared by this generic declaration
241      * @throws GenericSignatureFormatError if the generic
242      *     signature of this generic declaration does not conform to
243      *     the format specified in
244      *     <cite>The Java Virtual Machine Specification</cite>
245      */
246     public abstract TypeVariable<?>[] getTypeParameters();
247 
248     // returns shared array of parameter types - must never give it out
249     // to the untrusted code...
< prev index next >