< prev index next >

src/java.base/share/classes/jdk/internal/reflect/ReflectionFactory.java

Print this page




 314     /** Makes a copy of the passed field. The returned field is a
 315         "child" of the passed one; see the comments in Field.java for
 316         details. */
 317     public Field copyField(Field arg) {
 318         return langReflectAccess().copyField(arg);
 319     }
 320 
 321     /** Makes a copy of the passed constructor. The returned
 322         constructor is a "child" of the passed one; see the comments
 323         in Constructor.java for details. */
 324     public <T> Constructor<T> copyConstructor(Constructor<T> arg) {
 325         return langReflectAccess().copyConstructor(arg);
 326     }
 327 
 328     /** Gets the byte[] that encodes TypeAnnotations on an executable.
 329      */
 330     public byte[] getExecutableTypeAnnotationBytes(Executable ex) {
 331         return langReflectAccess().getExecutableTypeAnnotationBytes(ex);
 332     }
 333 




 334     //--------------------------------------------------------------------------
 335     //
 336     // Routines used by serialization
 337     //
 338     //
 339 
 340     public Constructor<?> newConstructorForSerialization
 341         (Class<?> classToInstantiate, Constructor<?> constructorToCall)
 342     {
 343         // Fast path
 344         if (constructorToCall.getDeclaringClass() == classToInstantiate) {
 345             return constructorToCall;
 346         }
 347 
 348         ConstructorAccessor acc = new MethodAccessorGenerator().
 349             generateSerializationConstructor(classToInstantiate,
 350                                              constructorToCall.getParameterTypes(),
 351                                              constructorToCall.getExceptionTypes(),
 352                                              constructorToCall.getModifiers(),
 353                                              constructorToCall.getDeclaringClass());




 314     /** Makes a copy of the passed field. The returned field is a
 315         "child" of the passed one; see the comments in Field.java for
 316         details. */
 317     public Field copyField(Field arg) {
 318         return langReflectAccess().copyField(arg);
 319     }
 320 
 321     /** Makes a copy of the passed constructor. The returned
 322         constructor is a "child" of the passed one; see the comments
 323         in Constructor.java for details. */
 324     public <T> Constructor<T> copyConstructor(Constructor<T> arg) {
 325         return langReflectAccess().copyConstructor(arg);
 326     }
 327 
 328     /** Gets the byte[] that encodes TypeAnnotations on an executable.
 329      */
 330     public byte[] getExecutableTypeAnnotationBytes(Executable ex) {
 331         return langReflectAccess().getExecutableTypeAnnotationBytes(ex);
 332     }
 333 
 334     public Class<?>[] getExecutableSharedParameterTypes(Executable ex) {
 335         return langReflectAccess().getExecutableSharedParameterTypes(ex);
 336     }
 337 
 338     //--------------------------------------------------------------------------
 339     //
 340     // Routines used by serialization
 341     //
 342     //
 343 
 344     public Constructor<?> newConstructorForSerialization
 345         (Class<?> classToInstantiate, Constructor<?> constructorToCall)
 346     {
 347         // Fast path
 348         if (constructorToCall.getDeclaringClass() == classToInstantiate) {
 349             return constructorToCall;
 350         }
 351 
 352         ConstructorAccessor acc = new MethodAccessorGenerator().
 353             generateSerializationConstructor(classToInstantiate,
 354                                              constructorToCall.getParameterTypes(),
 355                                              constructorToCall.getExceptionTypes(),
 356                                              constructorToCall.getModifiers(),
 357                                              constructorToCall.getDeclaringClass());


< prev index next >