[JIRA] (SLF4J-407) Jigsaw modules contain clashing package

[ https://jira.qos.ch/browse/SLF4J-407?page=com.atlassian.jira.plugin.system.i... ] Ceki Gülcü commented on SLF4J-407: ---------------------------------- In case there are multiple providers available on the module-path, slf4j-api, more precisely org.slf4j.LoggerFactory emits a warning message and picks up the first provider. Here is an example. {code}
java -p target/classes\;lib/slf4j-api-1.8.0-beta2.jar\;lib/slf4j-simple-1.8.0-beta2.jar\;lib/slf4j-jdk14-1.8.0-beta2.jar -m org.foo/pkg.Main SLF4J: Class path contains multiple SLF4J providers. SLF4J: Found provider [org.slf4j.simple.SimpleServiceProvider@59f99ea] SLF4J: Found provider [org.slf4j.jul.JULServiceProvider@27efef64] SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation. SLF4J: Actual provider is of type [org.slf4j.simple.SimpleServiceProvider@59f99ea] [main] INFO Main - hello {code}
Jigsaw modules contain clashing package ---------------------------------------
Key: SLF4J-407 URL: https://jira.qos.ch/browse/SLF4J-407 Project: SLF4J Issue Type: Bug Components: Implementations Affects Versions: 1.8.0-alpha2 Reporter: Stephen Colebourne Assignee: Ceki Gülcü Fix For: 1.8.0-beta3
Looking at the slf4j-jdk14 and slf4j-nop artifacts, they both appear to contain the package `org.slf4j.impl`. Jigsaw will refuse to load two modules that contain the same package, so this will be a problem. I know that SLF4J does not intend users to load both of these modules at the same time. But the current setup means that it will be the JPMS runtime that rejects it, meaning that there is no chance for SLF4J to output a helpful message (as I believe it does today). The solution to this would appear to be to move the `org.slf4j.impl` package to `org.slf4j.jul.impl` and `org.slf4j.nop.impl`. As the impl package is not exported, this should not affect any user code (except code that would have been affected anyway). I imagine this affects other slf4j artifacts. I also note that [this module-info.java|https://github.com/qos-ch/slf4j/blob/1_8_0-SNAPSHOT/slf4j-jdk14/src/main/jav...] exports the `org.slf4j.jul` package, which seems unnecessary (simple and nop do not export their package). See [here|http://blog.joda.org/2017/04/java-se-9-jpms-module-naming.html] for more information on naming.
-- This message was sent by Atlassian JIRA (v7.3.1#73012)
participants (1)
-
QOS.CH (JIRA)