forbidden-apis
forbidden-apis copied to clipboard
Method whitelist support
Often I find myself in a situation where an update to a library drags in a new evil method, and I only discover it after the fact. It would be nice if new methods were treated as suspicious by default.
The syntax I was thinking of was something like:
@defaultMessage Use `MatcherAssert` from Hamcrest instead.
!org.junit.jupiter.api.Assertions#fail(java.lang.String)
org.junit.jupiter.api.Assertions#*
Allowing people to call fail()
still while also saying that any other calls to Assertions
' static methods are not OK.
This way, when a new method appears, it's automatically blocked, and someone can come and discuss why they think they need it.
I often find myself in a similar situation - I would like to allow only part of the library, a single package, etc...