New JLBP - Libraries should not expose unnecessary implementations in dependency tree.
Libraries should use API interfaces as much as possible. In terms of logging, depend on Logging API interfaces (e.g., slf4j). However, in order for slf4j to print out the log somewhere, it requires a binding (e.g., slf4j-log4j). The binding (implementation) should not be exposed to library consumer via transitive dependency. Bindings/implementations such as this should be set as optional so that it doesn't expose to the user depending on this library.
I agree. I think it's covered by or close to "[JLBP-1] Minimize dependencies". Especialy this
Use the smallest scope possible https://github.com/GoogleCloudPlatform/cloud-opensource-java/blob/master/library-best-practices/JLBP-1.md
Can you elaborate on this point? As yet I don't understand why a binding should not be a transitive dependency.
these bindings are actual implementations that users will need to choose when they run it. If user's app uses log4j, they will choose log4j - our libraries should not dictate that. If our library has slf4j-log4j binding, it implies using log4j. When multiple of these bindings are present, then slf4j doesn't know which implementation to use, and fails to start.
Probably worth another example in JLBP-1