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