420 * different interfaces.
421 */
422 private static void collectCompatibleTypes(Class<?>[] from,
423 Class<?>[] with,
424 List<Class<?>> list) {
425 for (Class<?> fc : from) {
426 if (!list.contains(fc)) {
427 for (Class<?> wc : with) {
428 if (wc.isAssignableFrom(fc)) {
429 list.add(fc);
430 break;
431 }
432 }
433 }
434 }
435 }
436
437 /**
438 * Generate a class file for the proxy class. This method drives the
439 * class file generation process.
440 */
441 private byte[] generateClassFile() {
442 /*
443 * Add proxy methods for the hashCode, equals,
444 * and toString methods of java.lang.Object. This is done before
445 * the methods from the proxy interfaces so that the methods from
446 * java.lang.Object take precedence over duplicate methods in the
447 * proxy interfaces.
448 */
449 addProxyMethod(new ProxyMethod(OBJECT_HASH_CODE_METHOD, "m0"));
450 addProxyMethod(new ProxyMethod(OBJECT_EQUALS_METHOD, "m1"));
451 addProxyMethod(new ProxyMethod(OBJECT_TO_STRING_METHOD, "m2"));
452
453 /*
454 * Accumulate all of the methods from the proxy interfaces.
455 */
456 for (Class<?> intf : interfaces) {
457 for (Method m : intf.getMethods()) {
458 if (!Modifier.isStatic(m.getModifiers())) {
459 addProxyMethod(m, intf);
|
420 * different interfaces.
421 */
422 private static void collectCompatibleTypes(Class<?>[] from,
423 Class<?>[] with,
424 List<Class<?>> list) {
425 for (Class<?> fc : from) {
426 if (!list.contains(fc)) {
427 for (Class<?> wc : with) {
428 if (wc.isAssignableFrom(fc)) {
429 list.add(fc);
430 break;
431 }
432 }
433 }
434 }
435 }
436
437 /**
438 * Generate a class file for the proxy class. This method drives the
439 * class file generation process.
440 *
441 * If a proxy interface references any value classes, the value classes
442 * are listed in the loadable descriptors attribute of the interface class. The
443 * classes that are referenced by the proxy interface have already
444 * been loaded before the proxy class. Hence the proxy class is
445 * generated with no loadable descriptors attributes as it essentially has no effect.
446 */
447 private byte[] generateClassFile() {
448 /*
449 * Add proxy methods for the hashCode, equals,
450 * and toString methods of java.lang.Object. This is done before
451 * the methods from the proxy interfaces so that the methods from
452 * java.lang.Object take precedence over duplicate methods in the
453 * proxy interfaces.
454 */
455 addProxyMethod(new ProxyMethod(OBJECT_HASH_CODE_METHOD, "m0"));
456 addProxyMethod(new ProxyMethod(OBJECT_EQUALS_METHOD, "m1"));
457 addProxyMethod(new ProxyMethod(OBJECT_TO_STRING_METHOD, "m2"));
458
459 /*
460 * Accumulate all of the methods from the proxy interfaces.
461 */
462 for (Class<?> intf : interfaces) {
463 for (Method m : intf.getMethods()) {
464 if (!Modifier.isStatic(m.getModifiers())) {
465 addProxyMethod(m, intf);
|