I am seeing class CacheConfig.new CacheLoader() {...} in my jacoco report. Is there a way to exclude it?
To exclude all anonymous classes in CacheConfig, it should work if you exclude CacheConfig$1*.class, CacheConfig$2*.class, CacheConfig$3*.class, CacheConfig$4*.class, CacheConfig$5*.class, CacheConfig$6*.class, CacheConfig$7*.class, CacheConfig$8*.class, CacheConfig$9*.class as anonymous classes are compiled to CacheConfig$1.class, CacheConfig$2.class and so on.
Excluding CacheConfig$*.class will not work, as it would exclude all inner classes, not only anonymous ones. If you want to exclude all inner classes, CacheConfig$*.class is ok to be used.
If you only want to exclude this one anonymous class, you can of course also exclude CacheConfig$1.class or what number it has. You can see this from the link that the label CacheConfig.new CacheLoader() {...} in the report is pointing at. But be aware, if you add another anonymous class before this one in CacheConfig, numbers will shift accordingly.
Adding **/*$*.* in excluded list ignores all anonymous binders and classes in your classes
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With