< prev index next >

src/java.base/share/classes/java/lang/reflect/ProxyGenerator.java

Print this page

429             }
430         }
431     }
432 
433     /**
434      * Returns the {@link ClassLoader} to be used by the default implementation of {@link
435      * #getCommonSuperClass(String, String)}, that of this {@link ClassWriter}'s runtime type by
436      * default.
437      *
438      * @return ClassLoader
439      */
440     protected ClassLoader getClassLoader() {
441         return loader;
442     }
443 
444     /**
445      * Generate a class file for the proxy class.  This method drives the
446      * class file generation process.
447      */
448     private byte[] generateClassFile() {
449         visit(V14, accessFlags, dotToSlash(className), null,
450                 JLR_PROXY, typeNames(interfaces));
451 
452         /*
453          * Add proxy methods for the hashCode, equals,
454          * and toString methods of java.lang.Object.  This is done before
455          * the methods from the proxy interfaces so that the methods from
456          * java.lang.Object take precedence over duplicate methods in the
457          * proxy interfaces.
458          */
459         addProxyMethod(hashCodeMethod);
460         addProxyMethod(equalsMethod);
461         addProxyMethod(toStringMethod);
462 
463         /*
464          * Accumulate all of the methods from the proxy interfaces.
465          */
466         for (Class<?> intf : interfaces) {
467             for (Method m : intf.getMethods()) {
468                 if (!Modifier.isStatic(m.getModifiers())) {
469                     addProxyMethod(m, intf);

429             }
430         }
431     }
432 
433     /**
434      * Returns the {@link ClassLoader} to be used by the default implementation of {@link
435      * #getCommonSuperClass(String, String)}, that of this {@link ClassWriter}'s runtime type by
436      * default.
437      *
438      * @return ClassLoader
439      */
440     protected ClassLoader getClassLoader() {
441         return loader;
442     }
443 
444     /**
445      * Generate a class file for the proxy class.  This method drives the
446      * class file generation process.
447      */
448     private byte[] generateClassFile() {
449         visit(V15, accessFlags, dotToSlash(className), null,
450                 JLR_PROXY, typeNames(interfaces));
451 
452         /*
453          * Add proxy methods for the hashCode, equals,
454          * and toString methods of java.lang.Object.  This is done before
455          * the methods from the proxy interfaces so that the methods from
456          * java.lang.Object take precedence over duplicate methods in the
457          * proxy interfaces.
458          */
459         addProxyMethod(hashCodeMethod);
460         addProxyMethod(equalsMethod);
461         addProxyMethod(toStringMethod);
462 
463         /*
464          * Accumulate all of the methods from the proxy interfaces.
465          */
466         for (Class<?> intf : interfaces) {
467             for (Method m : intf.getMethods()) {
468                 if (!Modifier.isStatic(m.getModifiers())) {
469                     addProxyMethod(m, intf);
< prev index next >