< prev index next >

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

Print this page

 436                     }
 437                 }
 438             }
 439         }
 440     }
 441 
 442     /**
 443      * Returns the {@link ClassLoader} to be used by the default implementation of {@link
 444      * #getCommonSuperClass(String, String)}, that of this {@link ClassWriter}'s runtime type by
 445      * default.
 446      *
 447      * @return ClassLoader
 448      */
 449     protected ClassLoader getClassLoader() {
 450         return loader;
 451     }
 452 
 453     /**
 454      * Generate a class file for the proxy class.  This method drives the
 455      * class file generation process.






 456      */
 457     private byte[] generateClassFile() {
 458         visit(CLASSFILE_VERSION, accessFlags, dotToSlash(className), null,
 459                 JLR_PROXY, typeNames(interfaces));
 460 
 461         /*
 462          * Add proxy methods for the hashCode, equals,
 463          * and toString methods of java.lang.Object.  This is done before
 464          * the methods from the proxy interfaces so that the methods from
 465          * java.lang.Object take precedence over duplicate methods in the
 466          * proxy interfaces.
 467          */
 468         addProxyMethod(hashCodeMethod);
 469         addProxyMethod(equalsMethod);
 470         addProxyMethod(toStringMethod);
 471 
 472         /*
 473          * Accumulate all of the methods from the proxy interfaces.
 474          */
 475         for (Class<?> intf : interfaces) {

 436                     }
 437                 }
 438             }
 439         }
 440     }
 441 
 442     /**
 443      * Returns the {@link ClassLoader} to be used by the default implementation of {@link
 444      * #getCommonSuperClass(String, String)}, that of this {@link ClassWriter}'s runtime type by
 445      * default.
 446      *
 447      * @return ClassLoader
 448      */
 449     protected ClassLoader getClassLoader() {
 450         return loader;
 451     }
 452 
 453     /**
 454      * Generate a class file for the proxy class.  This method drives the
 455      * class file generation process.
 456      *
 457      * If a proxy interface references any value classes, the value classes
 458      * are listed in the loadable descriptors attribute of the interface class.  The
 459      * classes that are referenced by the proxy interface have already
 460      * been loaded before the proxy class.  Hence the proxy class is
 461      * generated with no loadable descriptors attributes as it essentially has no effect.
 462      */
 463     private byte[] generateClassFile() {
 464         visit(CLASSFILE_VERSION, accessFlags, dotToSlash(className), null,
 465                 JLR_PROXY, typeNames(interfaces));
 466 
 467         /*
 468          * Add proxy methods for the hashCode, equals,
 469          * and toString methods of java.lang.Object.  This is done before
 470          * the methods from the proxy interfaces so that the methods from
 471          * java.lang.Object take precedence over duplicate methods in the
 472          * proxy interfaces.
 473          */
 474         addProxyMethod(hashCodeMethod);
 475         addProxyMethod(equalsMethod);
 476         addProxyMethod(toStringMethod);
 477 
 478         /*
 479          * Accumulate all of the methods from the proxy interfaces.
 480          */
 481         for (Class<?> intf : interfaces) {
< prev index next >