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