SPI service default ClassLoader

XMLWordPrintable

    • Type: Enhancement
    • Resolution: Won't Fix
    • Priority: P5
    • None
    • Affects Version/s: None
    • Component/s: core-libs

      A DESCRIPTION OF THE PROBLEM :
      If you look at the SDK documentation:

      https://docs.oracle.com/javase/8/docs/api/java/util/ServiceLoader.html#load-java.lang.Class-

      You will see that if no ClassLoader is specified, the default ClassLoader used is:

      Thread.currentThread().getContextClassLoader()

      whereas it should be:

      caller.class.getClassLoader()

      This allows:

      - Obtaining an SPI service in the same way you obtain a Class instance with new or Class.forName().

      - No longer requiring the SPI service to be placed in the Java classpath, which allows it to be loaded dynamically (via a URLClassLoader).

      - Ensuring that the use of SPI services follows and benefits from the ClassLoader inheritance logic.




      REGRESSION : Java version that customer using for All



      FREQUENCY :
      ALWAYS

            Assignee:
            Unassigned
            Reporter:
            Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: