gaul / modernizer-maven-plugin

Detect uses of legacy Java APIs
Apache License 2.0
367 stars 53 forks source link

Error message shows inner class name instead of file name #217

Open archiecobbs opened 11 months ago

archiecobbs commented 11 months ago

I got an error report that looked like this (slightly cleaned up):

[INFO] --- modernizer:2.7.0:modernizer (modernizer) @ permazen-kv-simple ---
[ERROR] .../io/permazen/kv/simple/SimpleKVDatabase$1.java:269: Prefer Stream.filter(type::isInstance).map(type::cast)
[ERROR] .../io/permazen/kv/simple/SimpleKVDatabase$1.java:273: Prefer Stream.filter(type::isInstance).map(type::cast)
[ERROR] .../io/permazen/kv/simple/SimpleKVDatabase$1.java:273: Prefer Stream.map(java.util.function.Function<? super T, ? extends R>)

Notice that the error message shows the inner class name instead of the source file name, then a line number.

Obviously there is no file named SimpleKVDatabase$1.java .. It should just be SimpleKVDatabase.java.

gaul commented 11 months ago

ModernizerMojo.recurseFiles looks like it does some string munging on the name local variable. Could you investigate stripping the trailing inner class designation?