Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ repositories {

dependencies {
ruleApi("com.sonarsource.rule-api:rule-api:2.19.0.5763")
ruleApi("org.slf4j:slf4j-nop:1.7.36") {
ruleApi("org.slf4j:slf4j-nop:2.0.17") {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The because() comment that follows this line tells the whole tale of why this dependency exists: to silence a logging warning by providing a binding. Yet SLF4J v1 and v2 are not the same road β€” they bind their backends through entirely different mechanisms. In v1, the framework searches for org.slf4j.impl.StaticLoggerBinder on the classpath. In v2, it relies upon Java's ServiceLoader via META-INF/services/org.slf4j.spi.SLF4JServiceProvider. A slf4j-nop of version 2.x provides only the v2 service entry β€” it does not conjure up the old v1 binder.

Should com.sonarsource.rule-api:rule-api:2.19.0.5763 still carry a transitive dependency on the SLF4J 1.x API, this upgrade will not silence its warnings as intended. The very reason this dependency was placed here would be undone β€” silently, without error or fanfare. Verify that rule-api's transitive closure has itself crossed into SLF4J 2.x before approving this passage. Running ./gradlew dependencies --configuration ruleApi and inspecting the SLF4J lines in the output will reveal the truth.

  • Mark as noise

because(
"To get rid of a warning. A logging backend is not needed, because the rule API logs everything important to stdout. " +
"Slf4j logs contain only debug information"
Expand Down
Loading