Uploaded image for project: 'SLF4J'
  1. SLF4J
  2. SLF4J-372 plan for JDK 9/jigsaw
  3. SLF4J-401

Upgrade SLF4J binding mechanism to use java.util.ServiceLoader

Details

    • Icon: Sub-task Sub-task
    • Resolution: Fixed
    • Icon: Blocker Blocker
    • 1.8.0-alpha0
    • None
    • Core API
    • blocker

    Description

      The org.slf4j.impl.StaticXYZBinder approach has been surprisingly successful for such a crude mechanism. However, with the advent of Java 9/jigsaw/modularisation we need a more standard approach. java.util.ServiceLoader introduced in Java 6 seems to fit the bill.

      Attachments

        Activity

          [SLF4J-401] Upgrade SLF4J binding mechanism to use java.util.ServiceLoader
          Ceki Gülcü made changes -
          Status Original: Resolved [ 5 ] New: Closed [ 6 ]

          Ceki Gülcü added a comment -

          The details are still a bit murky but it seems to work now.

          Ceki Gülcü added a comment - The details are still a bit murky but it seems to work now.
          Ceki Gülcü made changes -
          Resolution New: Fixed [ 1 ]
          Status Original: In Progress [ 3 ] New: Resolved [ 5 ]

          Patrick Reinhart added a comment - - edited

          The additional module-info.class in the root of the JAR want be a problem for an pre JDK 9 because it's not used there anyway.

          If you wanted to use JDK 9 specific stuff for let's say performance improvements, then a multi release JAR comes into play. There you can overwrite/add some classes using the JDK 9 specific stuff and put them into the same JAR. If that is not needed at the moment we do not need a multi release JAR at all.

          Patrick Reinhart added a comment - - edited The additional module-info.class in the root of the JAR want be a problem for an pre JDK 9 because it's not used there anyway. If you wanted to use JDK 9 specific stuff for let's say performance improvements, then a multi release JAR comes into play. There you can overwrite/add some classes using the JDK 9 specific stuff and put them into the same JAR. If that is not needed at the moment we do not need a multi release JAR at all.

          Ceki Gülcü added a comment -

          Thanks for the offer. BTW, the modularizaton part is done.

          To be more precise, I am trying to have a single jar file which will be seen as modular on Java 9 and as a regular jar in older JVMs, with module-info.class ignored.

          Quoting from The State of the Module System:

          A modular JAR file can be used as a module, in which case its
          module-info.class file is taken to contain the module’s
          declaration. It can, alternatively, be placed on the ordinary class
          path, in which case its module-info.class file is ignored. Modular JAR
          files allow the maintainer of a library to ship a single artifact that
          works both as a module, on Java SE 9 and later, and as a regular JAR
          file on the class path, on all releases. We expect that
          implementations of Java SE 9 which include a jar tool will enhance
          that tool to make it easy to create modular JAR files.

          This is the problem I am struggling with.

          Ceki Gülcü added a comment - Thanks for the offer. BTW, the modularizaton part is done . To be more precise, I am trying to have a single jar file which will be seen as modular on Java 9 and as a regular jar in older JVMs, with module-info.class ignored. Quoting from The State of the Module System : A modular JAR file can be used as a module, in which case its module-info.class file is taken to contain the module’s declaration. It can, alternatively, be placed on the ordinary class path, in which case its module-info.class file is ignored. Modular JAR files allow the maintainer of a library to ship a single artifact that works both as a module, on Java SE 9 and later, and as a regular JAR file on the class path, on all releases. We expect that implementations of Java SE 9 which include a jar tool will enhance that tool to make it easy to create modular JAR files. This is the problem I am struggling with.

          I made already made a couple of module info files in the past, there I would be able to help. Since I do not have a lot of experiences with maven itself, there I'm not a big help.

          Patrick Reinhart added a comment - I made already made a couple of module info files in the past, there I would be able to help. Since I do not have a lot of experiences with maven itself, there I'm not a big help.

          Ceki Gülcü added a comment -

          There is seems to be a serious gap between the theory and actual tooling. Frankly, I am quite disgusted with the whole affair.

          Ceki Gülcü added a comment - There is seems to be a serious gap between the theory and actual tooling. Frankly, I am quite disgusted with the whole affair.

          Unfortunately I do not have any bigger experiences with maven but I tried local the approach as David M. Lloyd described here, but with not much success.

          Patrick Reinhart added a comment - Unfortunately I do not have any bigger experiences with maven but I tried local the approach as David M. Lloyd described here , but with not much success.

          Ceki Gülcü added a comment - - edited

          Sounds good. Would you like to take a shot?

          I am having a hard time configuring maven for the build...

          Ceki Gülcü added a comment - - edited Sounds good. Would you like to take a shot? I am having a hard time configuring maven for the build...

          We could basically add a separate source directory to hold the JDK 9 module info and create a Multi-Release JAR. supporting pre Java 9 using old-sytle service files as Java 9 and later as a fully complain module...

          Patrick Reinhart added a comment - We could basically add a separate source directory to hold the JDK 9 module info and create a Multi-Release JAR . supporting pre Java 9 using old-sytle service files as Java 9 and later as a fully complain module...

          People

            ceki Ceki Gülcü
            ceki Ceki Gülcü
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: