This topic explains how to integrate Jtest with Lombok.
Introduction
Lombok is a library that allows you to reduce the amount of boilerplate code you need to add to a Java project. By using Lombok annotations, you can automatically generate getters and setters for data objects, saving the time and effort of manually writing them from scratch. You can learn more about the Lombok library at https://projectlombok.org.
Integrating Jtest with Lombok allows Jtest to recognize Lombok generated code when you perform analysis and testing from the command line or in the IDE.
Supported Versions
Jtest supports Lombok versions 1.18.4 - 1.18.12 and 1.18.20 - 1.18.32.
Integrating jtestcli with the Lombok Library
To integrate jtestcli with Lombok:
In the command line, go to
<JTEST_INSTALL_DIR>/integration/lombok
.To integrate Jtest with Lombok 1.8.32, execute the following command:
java -jar jtest-integration-lombok.jar
This version of the Lombok library is available at https://projectlombok.org/downloads/lombok-1.18.32.jar.
To integrate Jtest with a different version of the Lombok library, specify the URL or path to your lombok.jar using the
lombokLocation
command line option. For example:java -jar jtest-integration-lombok.jar -lombokLocation <LOMBOK_JAR_LOCATION>/lombok.jar
Known Limitations
- In rare cases, class modifications made by Lombok may prevent static analysis from reporting some rule violations due to a mismatch between the violation and the source code.
- Lombok 1.18.14 is not supported due to a bug in Lombok that prevents installation in Eclipse IDE. See https://github.com/rzwitserloot/lombok/issues/2599 for details.
- Lombok 1.18.16 -18 is not supported due to a bug in Lombok that causes an exception when parsing code. See https://github.com/projectlombok/lombok/issues/2607 for details.
- The following Jtest rules might not work properly when run against code containing Lombok annotations:
CODSTA.READ.AEFS
CODSTA.BP.ARN
CODSTA.READ.CCB
CODSTA.READ.DVCU
EXCEPT.AEFC
EXCEPT.CTE
EXCEPT.TSCE
FORMAT.ASPACE
FORMAT.CBRACE
FORMAT.DOT
FORMAT.FCB
FORMAT.IND
FORMAT.SAP
FORMAT.SAS
FORMAT.SAUOP
FORMAT.SBUOP
FORMAT.SC
FORMAT.SCOP
INIT.AULI
JUNIT.CSUTD
NAMING.NPH
OPT.ANIPW
PB.LOGIC.AOBO
PB.CLOSE
PB.LOGIC.OAMC
PB.CUB.SBC
PB.NUM.UBD
SECURITY.WSC.ARXML
SECURITY.WSC.INIVF
SECURITY.WSC.SCSM
TRS.IASF
UC.AEEO
UC.DIEB
UC.UCIF
UC.UIMPORT
FORMAT.SAC
FORMAT.SAOP
FORMAT.SBOP
FORMAT.SROP
FORMAT.SCOP
FORMAT.SLOP
TRS.ILI
INIT.CLIB