Another note: It seems `Rule(id: String)` has been...
# ktlint
n
Another note: It seems
Rule(id: String)
has been removed at some point (though I do see the second parameter has a default). If I try to load a pre-0.44 ruleset JAR into 0.44-0.47, it complains of:
Copy code
java.lang.NoSuchMethodError: 'void com.pinterest.ktlint.core.Rule. (java.lang.String)'
Perhaps it requires a
@JvmOverloads
annotation?
An "older" ruleset with a
no-var
rule for testing, built with 0.39
s
ah your ruleset is in java?
n
not exactly: for example if a ruleset was coded in kotlin, but compiled into a jar against ktlint 0.43, it has bytecode to call
Rule(String)
because
Rule
in 0.44 doesn't have
JvmOverloads
that method doesn't exist anymore in the bytecode. Newer kotlin rules that use
Rule("example")
get compiled to call
Rule(string, Set)
due to how defaults work
0.44+ has been out for a year though, so I guess nobody is really complaining about it though 😛
p
Hi @nbadal, Back then I have not realised this was a breaking change which should have been documented explicitly in the release notes. In later releases you see that breaking API changes and Rule provider changes are documented more extensively. You’re the first to make a remark about this issue though. I hope that users of custom rulesets have been complaining to the maintainers of those rulesets and that they have fixed the issue by recompiling the ruleset with a newer ktlint version.