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.22.

Integrating Jtest with Lombok

To integrate Jtest with the Lombok library:

  1. Open a command line interface.
  2. Go to <JTEST_INSTALL_DIR>/integration/lombok.
  3. Execute the following command:
    On Windows:

    gradlew installLombok --no-daemon

    On Linux or Mac OS:

    ./gradlew installLombok --no-daemon

    This will integrate Jtest with Lombok 1.18.22 available at https://projectlombok.org/downloads/lombok-1.18.22.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:

On Windows:

gradlew installLombok -PlombokLocation=c:\downloads\lombok.jar --no-daemon

On Linux or Mac OS:

./gradlew installLombok -PlombokLocation=/home/account/downloads/lombok.jar --no-daemon

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




  • No labels