How to handle kotlin together with guava

We have kotlin projects. Most of the time kotlin is enough and we don’t need guava features like ImmutableList or MoreObjects.requireNonNull but there is still a good part of functionality which is very nice in guava like EvictingQueue, Stopwatch, LoadingCache, Graph …

How can i enforce in code that programmers won’t use legacy stuff but still include guava for it’s enhanced functionality?
Did someone have the same challenge? How was it solved?

Is there an option to set up a code check with a configurable whitelist of all guava classes which are permitted and fails when other classes are used?

Stopwatch at least can be already replaced with measureTime() function. I think it should be good enough for most use cases.

Detekt might do for you:
https://detekt.github.io/detekt/style.html

Though I never used it, so I’m not certain.