policeman-tools / forbidden-apis

Policeman's Forbidden API Checker
Apache License 2.0
339 stars 34 forks source link

Add new (default) signatures #241

Open rmannibucau opened 11 months ago

rmannibucau commented 11 months ago

Hi,

It would be neat to have some new built-in signature bundles. I identified two needs:

Here is the signatures.txt I'm using right now (covers most of the common patterns I saw even if not 100% complete):

java.lang.Class @ No reflection using class api.
java.lang.invoke.MethodHandle @ No reflection using java.lang.invoke.MethodHandle api.

java.util.concurrent.CompletableFuture#supplyAsync(java.util.function.Supplier) @ No CompletableFuture.supplyAsync without an explicit executor.
java.util.concurrent.CompletableFuture#runAsync(java.lang.Runnable) @ No CompletableFuture.runAsync without an explicit executor.

Indeed I can bundle this as a jar and make it a dependency of the forbidden apis plugin but if it was built-in it would be more convenient to enable (in the same spirit than commons-io I'd say).

Hope it makes sense