[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
| Re: [jakartaee-tck-dev] Which JVMs support eager class loading? | 
  
  
    
    
    On 10/7/22 6:33 AM, Scott Marlow wrote:
    
    
      
      Does anyone know which JVMs support eager class
        loading?
        
        
        I like to see what happens when the Java
          Security Manager classes are removed from the JVM and the
          impact on EE 10 applications.  
        
        
        I am pretty sure we will see
          ClassNotFoundException on Security Manager classes but I would
          like to see a test prove it.
      
    For background on eager/lazy class loading look at the JVM SPEC,
      I think section 5.4 `Linking` is worth reading:
    
    From
      https://docs.oracle.com/javase/specs/jvms/se8/html/jvms-5.html
    "
    5.4. Linking 
    Linking a class or
      interface involves verifying and preparing that class or
      interface, its direct superclass, its direct superinterfaces, and
      its element type (if it is an array type), if necessary.
      Resolution of symbolic references in the class or interface is an
      optional part of linking. 
    This specification allows
      an implementation flexibility as to when linking activities (and,
      because of recursion, loading) take place, provided that all of
      the following properties are maintained: 
    
      
        - 
          A class or
            interface is completely loaded before it is linked.  
- 
          A class or
            interface is completely verified and prepared before it is
            initialized.  
- 
          Errors detected
            during linkage are thrown at a point in the program where
            some action is taken by the program that might, directly or
            indirectly, require linkage to the class or interface
            involved in the error.  
 
    For example, a Java
      Virtual Machine implementation may choose to resolve each symbolic
      reference in a class or interface individually when it is used
      ("lazy" or "late" resolution), or to resolve them all at once when
      the class is being verified ("eager" or "static" resolution). This
      means that the resolution process may continue, in some
      implementations, after a class or interface has been initialized.
      Whichever strategy is followed, any error detected during
      resolution must be thrown at a point in the program that (directly
      or indirectly) uses a symbolic reference to the class or
      interface. 
    Because linking
      involves the allocation of new data structures, it may fail with
      an OutOfMemoryError. 
    
    "
    Scott