Lazy Diary @ Hatena Blog

PowerShell / Java / miscellaneous things about software development, Tips & Gochas. CC BY-SA 4.0/Apache License 2.0

Parasoft Jtest can't ignore Lombok-generated methods/fields

Problem:

When you execute static analysis Java sources with Lombok by using Parasoft Jtest, you have to delombok the sources because of Jtest can't handle Lombok's compile-time generated methods/fields.

Additionally, Jtest raise alerts with Lombok-generated methods/fields, like the field logger generated with @Slf4j annotation.

Reason:

It seems to be by design.

Parasoft Jtest can handle generated code with comment like // parasoft-begin-suppress and // parasoft-end-suppress. But this feature is not supported by Lombok*1.

In Lombok side, delombok command can generate @lombok.Generated annotation to identify Lombok-generated methods/fields. But this feature is not supported by Jtest for now *2.

Solution:

Just identify alerts for Lombok-generated codes by hands, and ignore them.

*1:https://github.com/rzwitserloot/lombok/issues/2237

*2:We had send feature request multiple times since 2017, but it is not implemented in 2019