001    package railo.transformer.bytecode.reflection;
002    
003    import java.io.InputStream;
004    import java.lang.reflect.Constructor;
005    import java.lang.reflect.Field;
006    import java.lang.reflect.GenericSignatureFormatError;
007    import java.lang.reflect.MalformedParameterizedTypeException;
008    import java.lang.reflect.Method;
009    import java.lang.reflect.Type;
010    import java.util.Map;
011    
012    public final class ASMClass implements java.io.Serializable {
013        
014    
015        private String name;
016            private Map<String, ASMMethod> methods;
017    
018    
019            public ASMClass(String name, Map<String, ASMMethod> methods) {
020                    this.name=name;
021                    this.methods=methods;
022            }
023    
024            /**
025         * Converts the object to a string. The string representation is the
026         * string "class" or "interface", followed by a space, and then by the
027         * fully qualified name of the class in the format returned by
028         * {@code getName}.  If this {@code Class} object represents a
029         * primitive type, this method returns the name of the primitive type.  If
030         * this {@code Class} object represents void this method returns
031         * "void".
032         *
033         * @return a string representation of this class object.
034         */
035        public String toString() {
036            return (isInterface() ? "interface " : (isPrimitive() ? "" : "class "))
037                + getName();
038        }
039    
040        /**
041         * Creates a new instance of the class represented by this {@code Class}
042         * object.  The class is instantiated as if by a {@code new}
043         * expression with an empty argument list.  The class is initialized if it
044         * has not already been initialized.
045         *
046         * <p>Note that this method propagates any exception thrown by the
047         * nullary constructor, including a checked exception.  Use of
048         * this method effectively bypasses the compile-time exception
049         * checking that would otherwise be performed by the compiler.
050         * The {@link
051         * java.lang.reflect.Constructor#newInstance(java.lang.Object...)
052         * Constructor.newInstance} method avoids this problem by wrapping
053         * any exception thrown by the constructor in a (checked) {@link
054         * java.lang.reflect.InvocationTargetException}.
055         *
056         * @return     a newly allocated instance of the class represented by this
057         *             object.
058         * @exception  IllegalAccessException  if the class or its nullary
059         *               constructor is not accessible.
060         * @exception  InstantiationException
061         *               if this {@code Class} represents an abstract class,
062         *               an interface, an array class, a primitive type, or void;
063         *               or if the class has no nullary constructor;
064         *               or if the instantiation fails for some other reason.
065         * @exception  ExceptionInInitializerError if the initialization
066         *               provoked by this method fails.
067         * @exception  SecurityException
068         *             If a security manager, <i>s</i>, is present and any of the
069         *             following conditions is met:
070         *
071         *             <ul>
072         *
073         *             <li> invocation of
074         *             {@link SecurityManager#checkMemberAccess
075         *             s.checkMemberAccess(this, Member.PUBLIC)} denies
076         *             creation of new instances of this class
077         *
078         *             <li> the caller's class loader is not the same as or an
079         *             ancestor of the class loader for the current class and
080         *             invocation of {@link SecurityManager#checkPackageAccess
081         *             s.checkPackageAccess()} denies access to the package
082         *             of this class
083         *
084         *             </ul>
085         *
086         */
087        public Object newInstance()
088            throws InstantiationException, IllegalAccessException {
089            _throw();
090            return null;
091        }
092    
093        /**
094         * Determines if the specified {@code Class} object represents an
095         * interface type.
096         *
097         * @return  {@code true} if this object represents an interface;
098         *          {@code false} otherwise.
099         */
100        public boolean isInterface(){
101            _throw();
102            return false;
103        }
104    
105    
106        /**
107         * Determines if this {@code Class} object represents an array class.
108         *
109         * @return  {@code true} if this object represents an array class;
110         *          {@code false} otherwise.
111         * @since   JDK1.1
112         */
113        public boolean isArray(){
114            _throw();
115            return false;
116        }
117    
118    
119        /**
120         * Determines if the specified {@code Class} object represents a
121         * primitive type.
122         *
123         * <p> There are nine predefined {@code Class} objects to represent
124         * the eight primitive types and void.  These are created by the Java
125         * Virtual Machine, and have the same names as the primitive types that
126         * they represent, namely {@code boolean}, {@code byte},
127         * {@code char}, {@code short}, {@code int},
128         * {@code long}, {@code float}, and {@code double}.
129         *
130         * <p> These objects may only be accessed via the following public static
131         * final variables, and are the only {@code Class} objects for which
132         * this method returns {@code true}.
133         *
134         * @return true if and only if this class represents a primitive type
135         *
136         * @see     java.lang.Boolean#TYPE
137         * @see     java.lang.Character#TYPE
138         * @see     java.lang.Byte#TYPE
139         * @see     java.lang.Short#TYPE
140         * @see     java.lang.Integer#TYPE
141         * @see     java.lang.Long#TYPE
142         * @see     java.lang.Float#TYPE
143         * @see     java.lang.Double#TYPE
144         * @see     java.lang.Void#TYPE
145         * @since JDK1.1
146         */
147        public boolean isPrimitive(){
148            _throw();
149            return false;
150        }
151    
152        /**
153         * Returns the  name of the entity (class, interface, array class,
154         * primitive type, or void) represented by this {@code Class} object,
155         * as a {@code String}.
156         *
157         * <p> If this class object represents a reference type that is not an
158         * array type then the binary name of the class is returned, as specified
159         * by the Java Language Specification, Second Edition.
160         *
161         * <p> If this class object represents a primitive type or void, then the
162         * name returned is a {@code String} equal to the Java language
163         * keyword corresponding to the primitive type or void.
164         *
165         * <p> If this class object represents a class of arrays, then the internal
166         * form of the name consists of the name of the element type preceded by
167         * one or more '{@code [}' characters representing the depth of the array
168         * nesting.  The encoding of element type names is as follows:
169         *
170         * <blockquote><table summary="Element types and encodings">
171         * <tr><th> Element Type <th> &nbsp;&nbsp;&nbsp; <th> Encoding
172         * <tr><td> boolean      <td> &nbsp;&nbsp;&nbsp; <td align=center> Z
173         * <tr><td> byte         <td> &nbsp;&nbsp;&nbsp; <td align=center> B
174         * <tr><td> char         <td> &nbsp;&nbsp;&nbsp; <td align=center> C
175         * <tr><td> class or interface
176         *                       <td> &nbsp;&nbsp;&nbsp; <td align=center> L<i>classname</i>;
177         * <tr><td> double       <td> &nbsp;&nbsp;&nbsp; <td align=center> D
178         * <tr><td> float        <td> &nbsp;&nbsp;&nbsp; <td align=center> F
179         * <tr><td> int          <td> &nbsp;&nbsp;&nbsp; <td align=center> I
180         * <tr><td> long         <td> &nbsp;&nbsp;&nbsp; <td align=center> J
181         * <tr><td> short        <td> &nbsp;&nbsp;&nbsp; <td align=center> S
182         * </table></blockquote>
183         *
184         * <p> The class or interface name <i>classname</i> is the binary name of
185         * the class specified above.
186         *
187         * <p> Examples:
188         * <blockquote><pre>
189         * String.class.getName()
190         *     returns "java.lang.String"
191         * byte.class.getName()
192         *     returns "byte"
193         * (new Object[3]).getClass().getName()
194         *     returns "[Ljava.lang.Object;"
195         * (new int[3][4][5][6][7][8][9]).getClass().getName()
196         *     returns "[[[[[[[I"
197         * </pre></blockquote>
198         *
199         * @return  the name of the class or interface
200         *          represented by this object.
201         */
202        public String getName() {
203            _throw();
204            return name;
205        }
206    
207        
208        /**
209         * Returns the class loader for the class.  Some implementations may use
210         * null to represent the bootstrap class loader. This method will return
211         * null in such implementations if this class was loaded by the bootstrap
212         * class loader.
213         *
214         * <p> If a security manager is present, and the caller's class loader is
215         * not null and the caller's class loader is not the same as or an ancestor of
216         * the class loader for the class whose class loader is requested, then
217         * this method calls the security manager's {@code checkPermission}
218         * method with a {@code RuntimePermission("getClassLoader")}
219         * permission to ensure it's ok to access the class loader for the class.
220         *
221         * <p>If this object
222         * represents a primitive type or void, null is returned.
223         *
224         * @return  the class loader that loaded the class or interface
225         *          represented by this object.
226         * @throws SecurityException
227         *    if a security manager exists and its
228         *    {@code checkPermission} method denies
229         *    access to the class loader for the class.
230         * @see java.lang.ClassLoader
231         * @see SecurityManager#checkPermission
232         * @see java.lang.RuntimePermission
233         */
234        public ClassLoader getClassLoader() {
235            _throw();
236            return null;
237        }
238    
239    
240        /**
241         * Returns the {@code Class} representing the superclass of the entity
242         * (class, interface, primitive type or void) represented by this
243         * {@code Class}.  If this {@code Class} represents either the
244         * {@code Object} class, an interface, a primitive type, or void, then
245         * null is returned.  If this object represents an array class then the
246         * {@code Class} object representing the {@code Object} class is
247         * returned.
248         *
249         * @return the superclass of the class represented by this object.
250         */
251        public  Class getSuperclass(){
252            _throw();
253            return null;
254        }
255    
256    
257        /**
258         * Returns the {@code Type} representing the direct superclass of
259         * the entity (class, interface, primitive type or void) represented by
260         * this {@code Class}.
261         *
262         * <p>If the superclass is a parameterized type, the {@code Type}
263         * object returned must accurately reflect the actual type
264         * parameters used in the source code. The parameterized type
265         * representing the superclass is created if it had not been
266         * created before. See the declaration of {@link
267         * java.lang.reflect.ParameterizedType ParameterizedType} for the
268         * semantics of the creation process for parameterized types.  If
269         * this {@code Class} represents either the {@code Object}
270         * class, an interface, a primitive type, or void, then null is
271         * returned.  If this object represents an array class then the
272         * {@code Class} object representing the {@code Object} class is
273         * returned.
274         *
275         * @throws GenericSignatureFormatError if the generic
276         *     class signature does not conform to the format specified in the
277         *     Java Virtual Machine Specification, 3rd edition
278         * @throws TypeNotPresentException if the generic superclass
279         *     refers to a non-existent type declaration
280         * @throws MalformedParameterizedTypeException if the
281         *     generic superclass refers to a parameterized type that cannot be
282         *     instantiated  for any reason
283         * @return the superclass of the class represented by this object
284         * @since 1.5
285         */
286        public Type getGenericSuperclass() {
287            _throw();
288            return null;
289        }
290    
291        /**
292         * Gets the package for this class.  The class loader of this class is used
293         * to find the package.  If the class was loaded by the bootstrap class
294         * loader the set of packages loaded from CLASSPATH is searched to find the
295         * package of the class. Null is returned if no package object was created
296         * by the class loader of this class.
297         *
298         * <p> Packages have attributes for versions and specifications only if the
299         * information was defined in the manifests that accompany the classes, and
300         * if the class loader created the package instance with the attributes
301         * from the manifest.
302         *
303         * @return the package of the class, or null if no package
304         *         information is available from the archive or codebase.
305         */
306        public Package getPackage() {
307            _throw();
308            return null;
309        }
310    
311    
312        /**
313         * Determines the interfaces implemented by the class or interface
314         * represented by this object.
315         *
316         * <p> If this object represents a class, the return value is an array
317         * containing objects representing all interfaces implemented by the
318         * class. The order of the interface objects in the array corresponds to
319         * the order of the interface names in the {@code implements} clause
320         * of the declaration of the class represented by this object. For
321         * example, given the declaration:
322         * <blockquote>
323         * {@code class Shimmer implements FloorWax, DessertTopping { ... }}
324         * </blockquote>
325         * suppose the value of {@code s} is an instance of
326         * {@code Shimmer}; the value of the expression:
327         * <blockquote>
328         * {@code s.getClass().getInterfaces()[0]}
329         * </blockquote>
330         * is the {@code Class} object that represents interface
331         * {@code FloorWax}; and the value of:
332         * <blockquote>
333         * {@code s.getClass().getInterfaces()[1]}
334         * </blockquote>
335         * is the {@code Class} object that represents interface
336         * {@code DessertTopping}.
337         *
338         * <p> If this object represents an interface, the array contains objects
339         * representing all interfaces extended by the interface. The order of the
340         * interface objects in the array corresponds to the order of the interface
341         * names in the {@code extends} clause of the declaration of the
342         * interface represented by this object.
343         *
344         * <p> If this object represents a class or interface that implements no
345         * interfaces, the method returns an array of length 0.
346         *
347         * <p> If this object represents a primitive type or void, the method
348         * returns an array of length 0.
349         *
350         * @return an array of interfaces implemented by this class.
351         */
352        public  Class[] getInterfaces(){
353            _throw();
354            return null;
355        }
356    
357        /**
358         * Returns the {@code Class} representing the component type of an
359         * array.  If this class does not represent an array class this method
360         * returns null.
361         *
362         * @return the {@code Class} representing the component type of this
363         * class if this class is an array
364         * @see     java.lang.reflect.Array
365         * @since JDK1.1
366         */
367        public Class getComponentType(){
368            _throw();
369            return null;
370        }
371    
372    
373        /**
374         * Returns the Java language modifiers for this class or interface, encoded
375         * in an integer. The modifiers consist of the Java Virtual Machine's
376         * constants for {@code public}, {@code protected},
377         * {@code private}, {@code final}, {@code static},
378         * {@code abstract} and {@code interface}; they should be decoded
379         * using the methods of class {@code Modifier}.
380         *
381         * <p> If the underlying class is an array class, then its
382         * {@code public}, {@code private} and {@code protected}
383         * modifiers are the same as those of its component type.  If this
384         * {@code Class} represents a primitive type or void, its
385         * {@code public} modifier is always {@code true}, and its
386         * {@code protected} and {@code private} modifiers are always
387         * {@code false}. If this object represents an array class, a
388         * primitive type or void, then its {@code final} modifier is always
389         * {@code true} and its interface modifier is always
390         * {@code false}. The values of its other modifiers are not determined
391         * by this specification.
392         *
393         * <p> The modifier encodings are defined in <em>The Java Virtual Machine
394         * Specification</em>, table 4.1.
395         *
396         * @return the {@code int} representing the modifiers for this class
397         * @see     java.lang.reflect.Modifier
398         * @since JDK1.1
399         */
400        public int getModifiers() {
401            _throw();
402            return 0;
403        }
404    
405    
406        /**
407         * If the class or interface represented by this {@code Class} object
408         * is a member of another class, returns the {@code Class} object
409         * representing the class in which it was declared.  This method returns
410         * null if this class or interface is not a member of any other class.  If
411         * this {@code Class} object represents an array class, a primitive
412         * type, or void,then this method returns null.
413         *
414         * @return the declaring class for this class
415         * @since JDK1.1
416         */
417        public Class getDeclaringClass(){
418            _throw();
419            return null;
420        }
421    
422        /**
423         * Returns an array containing {@code Class} objects representing all
424         * the public classes and interfaces that are members of the class
425         * represented by this {@code Class} object.  This includes public
426         * class and interface members inherited from superclasses and public class
427         * and interface members declared by the class.  This method returns an
428         * array of length 0 if this {@code Class} object has no public member
429         * classes or interfaces.  This method also returns an array of length 0 if
430         * this {@code Class} object represents a primitive type, an array
431         * class, or void.
432         *
433         * @return the array of {@code Class} objects representing the public
434         * members of this class
435         * @exception  SecurityException
436         *             If a security manager, <i>s</i>, is present and any of the
437         *             following conditions is met:
438         *
439         *             <ul>
440         *
441         *             <li> invocation of
442         *             {@link SecurityManager#checkMemberAccess
443         *             s.checkMemberAccess(this, Member.PUBLIC)} method
444         *             denies access to the classes within this class
445         *
446         *             <li> the caller's class loader is not the same as or an
447         *             ancestor of the class loader for the current class and
448         *             invocation of {@link SecurityManager#checkPackageAccess
449         *             s.checkPackageAccess()} denies access to the package
450         *             of this class
451         *
452         *             </ul>
453         *
454         * @since JDK1.1
455         */
456        public Class[] getClasses() {
457            _throw();
458            return null;
459        }
460    
461    
462        /**
463         * Returns an array containing {@code Field} objects reflecting all
464         * the accessible public fields of the class or interface represented by
465         * this {@code Class} object.  The elements in the array returned are
466         * not sorted and are not in any particular order.  This method returns an
467         * array of length 0 if the class or interface has no accessible public
468         * fields, or if it represents an array class, a primitive type, or void.
469         *
470         * <p> Specifically, if this {@code Class} object represents a class,
471         * this method returns the public fields of this class and of all its
472         * superclasses.  If this {@code Class} object represents an
473         * interface, this method returns the fields of this interface and of all
474         * its superinterfaces.
475         *
476         * <p> The implicit length field for array class is not reflected by this
477         * method. User code should use the methods of class {@code Array} to
478         * manipulate arrays.
479         *
480         * <p> See <em>The Java Language Specification</em>, sections 8.2 and 8.3.
481         *
482         * @return the array of {@code Field} objects representing the
483         * public fields
484         * @exception  SecurityException
485         *             If a security manager, <i>s</i>, is present and any of the
486         *             following conditions is met:
487         *
488         *             <ul>
489         *
490         *             <li> invocation of
491         *             {@link SecurityManager#checkMemberAccess
492         *             s.checkMemberAccess(this, Member.PUBLIC)} denies
493         *             access to the fields within this class
494         *
495         *             <li> the caller's class loader is not the same as or an
496         *             ancestor of the class loader for the current class and
497         *             invocation of {@link SecurityManager#checkPackageAccess
498         *             s.checkPackageAccess()} denies access to the package
499         *             of this class
500         *
501         *             </ul>
502         *
503         * @since JDK1.1
504         */
505        public Field[] getFields() throws SecurityException {
506            _throw();
507            return null;
508        }
509    
510    
511        /**
512         * Returns an array containing {@code Method} objects reflecting all
513         * the public <em>member</em> methods of the class or interface represented
514         * by this {@code Class} object, including those declared by the class
515         * or interface and those inherited from superclasses and
516         * superinterfaces.  Array classes return all the (public) member methods
517         * inherited from the {@code Object} class.  The elements in the array
518         * returned are not sorted and are not in any particular order.  This
519         * method returns an array of length 0 if this {@code Class} object
520         * represents a class or interface that has no public member methods, or if
521         * this {@code Class} object represents a primitive type or void.
522         *
523         * <p> The class initialization method {@code <clinit>} is not
524         * included in the returned array. If the class declares multiple public
525         * member methods with the same parameter types, they are all included in
526         * the returned array.
527         *
528         * <p> See <em>The Java Language Specification</em>, sections 8.2 and 8.4.
529         *
530         * @return the array of {@code Method} objects representing the
531         * public methods of this class
532         * @exception  SecurityException
533         *             If a security manager, <i>s</i>, is present and any of the
534         *             following conditions is met:
535         *
536         *             <ul>
537         *
538         *             <li> invocation of
539         *             {@link SecurityManager#checkMemberAccess
540         *             s.checkMemberAccess(this, Member.PUBLIC)} denies
541         *             access to the methods within this class
542         *
543         *             <li> the caller's class loader is not the same as or an
544         *             ancestor of the class loader for the current class and
545         *             invocation of {@link SecurityManager#checkPackageAccess
546         *             s.checkPackageAccess()} denies access to the package
547         *             of this class
548         *
549         *             </ul>
550         *
551         * @since JDK1.1
552         */
553        public ASMMethod[] getMethods() throws SecurityException {
554            _throw();
555            return methods.entrySet().toArray(new ASMMethod[methods.size()]);
556        }
557    
558    
559        /**
560         * Returns an array containing {@code Constructor} objects reflecting
561         * all the public constructors of the class represented by this
562         * {@code Class} object.  An array of length 0 is returned if the
563         * class has no public constructors, or if the class is an array class, or
564         * if the class reflects a primitive type or void.
565         *
566         * Note that while this method returns an array of {@code
567         * Constructor<T>} objects (that is an array of constructors from
568         * this class), the return type of this method is {@code
569         * Constructor<?>[]} and <em>not</em> {@code Constructor<T>[]} as
570         * might be expected.  This less informative return type is
571         * necessary since after being returned from this method, the
572         * array could be modified to hold {@code Constructor} objects for
573         * different classes, which would violate the type guarantees of
574         * {@code Constructor<T>[]}.
575         *
576         * @return the array of {@code Constructor} objects representing the
577         *  public constructors of this class
578         * @exception  SecurityException
579         *             If a security manager, <i>s</i>, is present and any of the
580         *             following conditions is met:
581         *
582         *             <ul>
583         *
584         *             <li> invocation of
585         *             {@link SecurityManager#checkMemberAccess
586         *             s.checkMemberAccess(this, Member.PUBLIC)} denies
587         *             access to the constructors within this class
588         *
589         *             <li> the caller's class loader is not the same as or an
590         *             ancestor of the class loader for the current class and
591         *             invocation of {@link SecurityManager#checkPackageAccess
592         *             s.checkPackageAccess()} denies access to the package
593         *             of this class
594         *
595         *             </ul>
596         *
597         * @since JDK1.1
598         */
599        public Constructor[] getConstructors() throws SecurityException {
600            _throw();
601            return null;
602        }
603    
604    
605        /**
606         * Returns a {@code Field} object that reflects the specified public
607         * member field of the class or interface represented by this
608         * {@code Class} object. The {@code name} parameter is a
609         * {@code String} specifying the simple name of the desired field.
610         *
611         * <p> The field to be reflected is determined by the algorithm that
612         * follows.  Let C be the class represented by this object:
613         * <OL>
614         * <LI> If C declares a public field with the name specified, that is the
615         *      field to be reflected.</LI>
616         * <LI> If no field was found in step 1 above, this algorithm is applied
617         *      recursively to each direct superinterface of C. The direct
618         *      superinterfaces are searched in the order they were declared.</LI>
619         * <LI> If no field was found in steps 1 and 2 above, and C has a
620         *      superclass S, then this algorithm is invoked recursively upon S.
621         *      If C has no superclass, then a {@code NoSuchFieldException}
622         *      is thrown.</LI>
623         * </OL>
624         *
625         * <p> See <em>The Java Language Specification</em>, sections 8.2 and 8.3.
626         *
627         * @param name the field name
628         * @return  the {@code Field} object of this class specified by
629         * {@code name}
630         * @exception NoSuchFieldException if a field with the specified name is
631         *              not found.
632         * @exception NullPointerException if {@code name} is {@code null}
633         * @exception  SecurityException
634         *             If a security manager, <i>s</i>, is present and any of the
635         *             following conditions is met:
636         *
637         *             <ul>
638         *
639         *             <li> invocation of
640         *             {@link SecurityManager#checkMemberAccess
641         *             s.checkMemberAccess(this, Member.PUBLIC)} denies
642         *             access to the field
643         *
644         *             <li> the caller's class loader is not the same as or an
645         *             ancestor of the class loader for the current class and
646         *             invocation of {@link SecurityManager#checkPackageAccess
647         *             s.checkPackageAccess()} denies access to the package
648         *             of this class
649         *
650         *             </ul>
651         *
652         * @since JDK1.1
653         */
654        public Field getField(String name) throws NoSuchFieldException, SecurityException {
655            _throw();
656            return null;
657        }
658    
659    
660        /**
661         * Returns a {@code Method} object that reflects the specified public
662         * member method of the class or interface represented by this
663         * {@code Class} object. The {@code name} parameter is a
664         * {@code String} specifying the simple name of the desired method. The
665         * {@code parameterTypes} parameter is an array of {@code Class}
666         * objects that identify the method's formal parameter types, in declared
667         * order. If {@code parameterTypes} is {@code null}, it is
668         * treated as if it were an empty array.
669         *
670         * <p> If the {@code name} is "{@code <init>};"or "{@code <clinit>}" a
671         * {@code NoSuchMethodException} is raised. Otherwise, the method to
672         * be reflected is determined by the algorithm that follows.  Let C be the
673         * class represented by this object:
674         * <OL>
675         * <LI> C is searched for any <I>matching methods</I>. If no matching
676         *      method is found, the algorithm of step 1 is invoked recursively on
677         *      the superclass of C.</LI>
678         * <LI> If no method was found in step 1 above, the superinterfaces of C
679         *      are searched for a matching method. If any such method is found, it
680         *      is reflected.</LI>
681         * </OL>
682         *
683         * To find a matching method in a class C:&nbsp; If C declares exactly one
684         * public method with the specified name and exactly the same formal
685         * parameter types, that is the method reflected. If more than one such
686         * method is found in C, and one of these methods has a return type that is
687         * more specific than any of the others, that method is reflected;
688         * otherwise one of the methods is chosen arbitrarily.
689         *
690         * <p>Note that there may be more than one matching method in a
691         * class because while the Java language forbids a class to
692         * declare multiple methods with the same signature but different
693         * return types, the Java virtual machine does not.  This
694         * increased flexibility in the virtual machine can be used to
695         * implement various language features.  For example, covariant
696         * returns can be implemented with {@linkplain
697         * java.lang.reflect.Method#isBridge bridge methods}; the bridge
698         * method and the method being overridden would have the same
699         * signature but different return types.
700         *
701         * <p> See <em>The Java Language Specification</em>, sections 8.2 and 8.4.
702         *
703         * @param name the name of the method
704         * @param parameterTypes the list of parameters
705         * @return the {@code Method} object that matches the specified
706         * {@code name} and {@code parameterTypes}
707         * @exception NoSuchMethodException if a matching method is not found
708         *            or if the name is "&lt;init&gt;"or "&lt;clinit&gt;".
709         * @exception NullPointerException if {@code name} is {@code null}
710         * @exception  SecurityException
711         *             If a security manager, <i>s</i>, is present and any of the
712         *             following conditions is met:
713         *
714         *             <ul>
715         *
716         *             <li> invocation of
717         *             {@link SecurityManager#checkMemberAccess
718         *             s.checkMemberAccess(this, Member.PUBLIC)} denies
719         *             access to the method
720         *
721         *             <li> the caller's class loader is not the same as or an
722         *             ancestor of the class loader for the current class and
723         *             invocation of {@link SecurityManager#checkPackageAccess
724         *             s.checkPackageAccess()} denies access to the package
725         *             of this class
726         *
727         *             </ul>
728         *
729         * @since JDK1.1
730         */
731        public Method getMethod(String name, Class... parameterTypes) throws NoSuchMethodException, SecurityException {
732            _throw();
733            return null;
734        }
735    
736    
737        /**
738         * Returns a {@code Constructor} object that reflects the specified
739         * public constructor of the class represented by this {@code Class}
740         * object. The {@code parameterTypes} parameter is an array of
741         * {@code Class} objects that identify the constructor's formal
742         * parameter types, in declared order.
743         *
744         * If this {@code Class} object represents an inner class
745         * declared in a non-static context, the formal parameter types
746         * include the explicit enclosing instance as the first parameter.
747         *
748         * <p> The constructor to reflect is the public constructor of the class
749         * represented by this {@code Class} object whose formal parameter
750         * types match those specified by {@code parameterTypes}.
751         *
752         * @param parameterTypes the parameter array
753         * @return the {@code Constructor} object of the public constructor that
754         * matches the specified {@code parameterTypes}
755         * @exception NoSuchMethodException if a matching method is not found.
756         * @exception  SecurityException
757         *             If a security manager, <i>s</i>, is present and any of the
758         *             following conditions is met:
759         *
760         *             <ul>
761         *
762         *             <li> invocation of
763         *             {@link SecurityManager#checkMemberAccess
764         *             s.checkMemberAccess(this, Member.PUBLIC)} denies
765         *             access to the constructor
766         *
767         *             <li> the caller's class loader is not the same as or an
768         *             ancestor of the class loader for the current class and
769         *             invocation of {@link SecurityManager#checkPackageAccess
770         *             s.checkPackageAccess()} denies access to the package
771         *             of this class
772         *
773         *             </ul>
774         *
775         * @since JDK1.1
776         */
777        public Constructor getConstructor(Class... parameterTypes) throws NoSuchMethodException, SecurityException {
778            _throw();
779            return null;
780        }
781    
782    
783        /**
784         * Returns an array of {@code Class} objects reflecting all the
785         * classes and interfaces declared as members of the class represented by
786         * this {@code Class} object. This includes public, protected, default
787         * (package) access, and private classes and interfaces declared by the
788         * class, but excludes inherited classes and interfaces.  This method
789         * returns an array of length 0 if the class declares no classes or
790         * interfaces as members, or if this {@code Class} object represents a
791         * primitive type, an array class, or void.
792         *
793         * @return the array of {@code Class} objects representing all the
794         * declared members of this class
795         * @exception  SecurityException
796         *             If a security manager, <i>s</i>, is present and any of the
797         *             following conditions is met:
798         *
799         *             <ul>
800         *
801         *             <li> invocation of
802         *             {@link SecurityManager#checkMemberAccess
803         *             s.checkMemberAccess(this, Member.DECLARED)} denies
804         *             access to the declared classes within this class
805         *
806         *             <li> the caller's class loader is not the same as or an
807         *             ancestor of the class loader for the current class and
808         *             invocation of {@link SecurityManager#checkPackageAccess
809         *             s.checkPackageAccess()} denies access to the package
810         *             of this class
811         *
812         *             </ul>
813         *
814         * @since JDK1.1
815         */
816        public Class[] getDeclaredClasses() throws SecurityException {
817            _throw();
818            return null;
819        }
820    
821    
822        /**
823         * Returns an array of {@code Field} objects reflecting all the fields
824         * declared by the class or interface represented by this
825         * {@code Class} object. This includes public, protected, default
826         * (package) access, and private fields, but excludes inherited fields.
827         * The elements in the array returned are not sorted and are not in any
828         * particular order.  This method returns an array of length 0 if the class
829         * or interface declares no fields, or if this {@code Class} object
830         * represents a primitive type, an array class, or void.
831         *
832         * <p> See <em>The Java Language Specification</em>, sections 8.2 and 8.3.
833         *
834         * @return    the array of {@code Field} objects representing all the
835         * declared fields of this class
836         * @exception  SecurityException
837         *             If a security manager, <i>s</i>, is present and any of the
838         *             following conditions is met:
839         *
840         *             <ul>
841         *
842         *             <li> invocation of
843         *             {@link SecurityManager#checkMemberAccess
844         *             s.checkMemberAccess(this, Member.DECLARED)} denies
845         *             access to the declared fields within this class
846         *
847         *             <li> the caller's class loader is not the same as or an
848         *             ancestor of the class loader for the current class and
849         *             invocation of {@link SecurityManager#checkPackageAccess
850         *             s.checkPackageAccess()} denies access to the package
851         *             of this class
852         *
853         *             </ul>
854         *
855         * @since JDK1.1
856         */
857        public Field[] getDeclaredFields() throws SecurityException {
858            _throw();
859            return null;
860        }
861    
862    
863        /**
864         * Returns an array of {@code Method} objects reflecting all the
865         * methods declared by the class or interface represented by this
866         * {@code Class} object. This includes public, protected, default
867         * (package) access, and private methods, but excludes inherited methods.
868         * The elements in the array returned are not sorted and are not in any
869         * particular order.  This method returns an array of length 0 if the class
870         * or interface declares no methods, or if this {@code Class} object
871         * represents a primitive type, an array class, or void.  The class
872         * initialization method {@code <clinit>} is not included in the
873         * returned array. If the class declares multiple public member methods
874         * with the same parameter types, they are all included in the returned
875         * array.
876         *
877         * <p> See <em>The Java Language Specification</em>, section 8.2.
878         *
879         * @return    the array of {@code Method} objects representing all the
880         * declared methods of this class
881         * @exception  SecurityException
882         *             If a security manager, <i>s</i>, is present and any of the
883         *             following conditions is met:
884         *
885         *             <ul>
886         *
887         *             <li> invocation of
888         *             {@link SecurityManager#checkMemberAccess
889         *             s.checkMemberAccess(this, Member.DECLARED)} denies
890         *             access to the declared methods within this class
891         *
892         *             <li> the caller's class loader is not the same as or an
893         *             ancestor of the class loader for the current class and
894         *             invocation of {@link SecurityManager#checkPackageAccess
895         *             s.checkPackageAccess()} denies access to the package
896         *             of this class
897         *
898         *             </ul>
899         *
900         * @since JDK1.1
901         */
902        public Method[] getDeclaredMethods() throws SecurityException {
903            _throw();
904            return null;
905        }
906    
907    
908        /**
909         * Returns an array of {@code Constructor} objects reflecting all the
910         * constructors declared by the class represented by this
911         * {@code Class} object. These are public, protected, default
912         * (package) access, and private constructors.  The elements in the array
913         * returned are not sorted and are not in any particular order.  If the
914         * class has a default constructor, it is included in the returned array.
915         * This method returns an array of length 0 if this {@code Class}
916         * object represents an interface, a primitive type, an array class, or
917         * void.
918         *
919         * <p> See <em>The Java Language Specification</em>, section 8.2.
920         *
921         * @return    the array of {@code Constructor} objects representing all the
922         * declared constructors of this class
923         * @exception  SecurityException
924         *             If a security manager, <i>s</i>, is present and any of the
925         *             following conditions is met:
926         *
927         *             <ul>
928         *
929         *             <li> invocation of
930         *             {@link SecurityManager#checkMemberAccess
931         *             s.checkMemberAccess(this, Member.DECLARED)} denies
932         *             access to the declared constructors within this class
933         *
934         *             <li> the caller's class loader is not the same as or an
935         *             ancestor of the class loader for the current class and
936         *             invocation of {@link SecurityManager#checkPackageAccess
937         *             s.checkPackageAccess()} denies access to the package
938         *             of this class
939         *
940         *             </ul>
941         *
942         * @since JDK1.1
943         */
944        public Constructor[] getDeclaredConstructors() throws SecurityException {
945            _throw();
946            return null;
947        }
948    
949    
950        /**
951         * Returns a {@code Field} object that reflects the specified declared
952         * field of the class or interface represented by this {@code Class}
953         * object. The {@code name} parameter is a {@code String} that
954         * specifies the simple name of the desired field.  Note that this method
955         * will not reflect the {@code length} field of an array class.
956         *
957         * @param name the name of the field
958         * @return the {@code Field} object for the specified field in this
959         * class
960         * @exception NoSuchFieldException if a field with the specified name is
961         *              not found.
962         * @exception NullPointerException if {@code name} is {@code null}
963         * @exception  SecurityException
964         *             If a security manager, <i>s</i>, is present and any of the
965         *             following conditions is met:
966         *
967         *             <ul>
968         *
969         *             <li> invocation of
970         *             {@link SecurityManager#checkMemberAccess
971         *             s.checkMemberAccess(this, Member.DECLARED)} denies
972         *             access to the declared field
973         *
974         *             <li> the caller's class loader is not the same as or an
975         *             ancestor of the class loader for the current class and
976         *             invocation of {@link SecurityManager#checkPackageAccess
977         *             s.checkPackageAccess()} denies access to the package
978         *             of this class
979         *
980         *             </ul>
981         *
982         * @since JDK1.1
983         */
984        public Field getDeclaredField(String name)
985            throws NoSuchFieldException, SecurityException {
986            _throw();
987            return null;
988        }
989    
990    
991        /**
992         * Returns a {@code Method} object that reflects the specified
993         * declared method of the class or interface represented by this
994         * {@code Class} object. The {@code name} parameter is a
995         * {@code String} that specifies the simple name of the desired
996         * method, and the {@code parameterTypes} parameter is an array of
997         * {@code Class} objects that identify the method's formal parameter
998         * types, in declared order.  If more than one method with the same
999         * parameter types is declared in a class, and one of these methods has a
1000         * return type that is more specific than any of the others, that method is
1001         * returned; otherwise one of the methods is chosen arbitrarily.  If the
1002         * name is "&lt;init&gt;"or "&lt;clinit&gt;" a {@code NoSuchMethodException}
1003         * is raised.
1004         *
1005         * @param name the name of the method
1006         * @param parameterTypes the parameter array
1007         * @return    the {@code Method} object for the method of this class
1008         * matching the specified name and parameters
1009         * @exception NoSuchMethodException if a matching method is not found.
1010         * @exception NullPointerException if {@code name} is {@code null}
1011         * @exception  SecurityException
1012         *             If a security manager, <i>s</i>, is present and any of the
1013         *             following conditions is met:
1014         *
1015         *             <ul>
1016         *
1017         *             <li> invocation of
1018         *             {@link SecurityManager#checkMemberAccess
1019         *             s.checkMemberAccess(this, Member.DECLARED)} denies
1020         *             access to the declared method
1021         *
1022         *             <li> the caller's class loader is not the same as or an
1023         *             ancestor of the class loader for the current class and
1024         *             invocation of {@link SecurityManager#checkPackageAccess
1025         *             s.checkPackageAccess()} denies access to the package
1026         *             of this class
1027         *
1028         *             </ul>
1029         *
1030         * @since JDK1.1
1031         */
1032        public Method getDeclaredMethod(String name, Class... parameterTypes)
1033            throws NoSuchMethodException, SecurityException {
1034            _throw();
1035            return null;
1036        }
1037    
1038    
1039        /**
1040         * Returns a {@code Constructor} object that reflects the specified
1041         * constructor of the class or interface represented by this
1042         * {@code Class} object.  The {@code parameterTypes} parameter is
1043         * an array of {@code Class} objects that identify the constructor's
1044         * formal parameter types, in declared order.
1045         *
1046         * If this {@code Class} object represents an inner class
1047         * declared in a non-static context, the formal parameter types
1048         * include the explicit enclosing instance as the first parameter.
1049         *
1050         * @param parameterTypes the parameter array
1051         * @return    The {@code Constructor} object for the constructor with the
1052         * specified parameter list
1053         * @exception NoSuchMethodException if a matching method is not found.
1054         * @exception  SecurityException
1055         *             If a security manager, <i>s</i>, is present and any of the
1056         *             following conditions is met:
1057         *
1058         *             <ul>
1059         *
1060         *             <li> invocation of
1061         *             {@link SecurityManager#checkMemberAccess
1062         *             s.checkMemberAccess(this, Member.DECLARED)} denies
1063         *             access to the declared constructor
1064         *
1065         *             <li> the caller's class loader is not the same as or an
1066         *             ancestor of the class loader for the current class and
1067         *             invocation of {@link SecurityManager#checkPackageAccess
1068         *             s.checkPackageAccess()} denies access to the package
1069         *             of this class
1070         *
1071         *             </ul>
1072         *
1073         * @since JDK1.1
1074         */
1075        public Constructor getDeclaredConstructor(Class... parameterTypes)
1076            throws NoSuchMethodException, SecurityException {
1077            _throw();
1078            return null;
1079        }
1080    
1081        /**
1082         * Finds a resource with a given name.  The rules for searching resources
1083         * associated with a given class are implemented by the defining
1084         * {@linkplain ClassLoader class loader} of the class.  This method
1085         * delegates to this object's class loader.  If this object was loaded by
1086         * the bootstrap class loader, the method delegates to {@link
1087         * ClassLoader#getSystemResourceAsStream}.
1088         *
1089         * <p> Before delegation, an absolute resource name is constructed from the
1090         * given resource name using this algorithm:
1091         *
1092         * <ul>
1093         *
1094         * <li> If the {@code name} begins with a {@code '/'}
1095         * (<tt>'&#92;u002f'</tt>), then the absolute name of the resource is the
1096         * portion of the {@code name} following the {@code '/'}.
1097         *
1098         * <li> Otherwise, the absolute name is of the following form:
1099         *
1100         * <blockquote>
1101         *   {@code modified_package_name/name}
1102         * </blockquote>
1103         *
1104         * <p> Where the {@code modified_package_name} is the package name of this
1105         * object with {@code '/'} substituted for {@code '.'}
1106         * (<tt>'&#92;u002e'</tt>).
1107         *
1108         * </ul>
1109         *
1110         * @param  name name of the desired resource
1111         * @return      A {@link java.io.InputStream} object or {@code null} if
1112         *              no resource with this name is found
1113         * @throws  NullPointerException If {@code name} is {@code null}
1114         * @since  JDK1.1
1115         */
1116         public InputStream getResourceAsStream(String name) {
1117             _throw();
1118            return null;
1119        }
1120    
1121        /**
1122         * Finds a resource with a given name.  The rules for searching resources
1123         * associated with a given class are implemented by the defining
1124         * {@linkplain ClassLoader class loader} of the class.  This method
1125         * delegates to this object's class loader.  If this object was loaded by
1126         * the bootstrap class loader, the method delegates to {@link
1127         * ClassLoader#getSystemResource}.
1128         *
1129         * <p> Before delegation, an absolute resource name is constructed from the
1130         * given resource name using this algorithm:
1131         *
1132         * <ul>
1133         *
1134         * <li> If the {@code name} begins with a {@code '/'}
1135         * (<tt>'&#92;u002f'</tt>), then the absolute name of the resource is the
1136         * portion of the {@code name} following the {@code '/'}.
1137         *
1138         * <li> Otherwise, the absolute name is of the following form:
1139         *
1140         * <blockquote>
1141         *   {@code modified_package_name/name}
1142         * </blockquote>
1143         *
1144         * <p> Where the {@code modified_package_name} is the package name of this
1145         * object with {@code '/'} substituted for {@code '.'}
1146         * (<tt>'&#92;u002e'</tt>).
1147         *
1148         * </ul>
1149         *
1150         * @param  name name of the desired resource
1151         * @return      A  {@link java.net.URL} object or {@code null} if no
1152         *              resource with this name is found
1153         * @since  JDK1.1
1154         */
1155        public java.net.URL getResource(String name) {
1156            _throw();
1157            return null;
1158        }
1159    
1160    
1161        private static void _throw() {
1162                    throw new RuntimeException("not supported!");
1163            }
1164    }