policeman-tools / forbidden-apis

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

Do not log message about missing classes (while parsing class files; not signatures) multiple times #207

Closed uschindler closed 2 years ago

uschindler commented 2 years ago

When you parse class files where not all dependencies are available, you can optionally set failOnMissingClasses = false, but this prints a message on each occurence of a missing class, so the same message is printed sometimes hundreds of times.

Like for signatures parsing, it should only print a summary at end using WARN.

uschindler commented 2 years ago

PR: #210

uschindler commented 2 years ago

Output with the attached PR now looks like (this example is from checking classes compiled against Java 19 with Java 17):

> Task :lucene:core:forbiddenApisMain19
While scanning classes to check, the following referenced classes were not found on classpath (this may miss some violations):
  java.lang.foreign.MemorySegment, java.lang.foreign.MemorySession, java.lang.foreign.ValueLayout,... (and 5 more).