Fork me on GitHub

Home Forums JSweet Discussion Project Lombok and JSweet

This topic contains 2 replies, has 3 voices, and was last updated by Avatar Anonymous 1 year, 10 months ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
  • #1869


    First for all, thank you so much for JSweet, we’re starting using it and it seems awesome.

    Is there a way to use Project Lombok annotated dto classes along with JSweet? I am getting the objects but no methods are generated by JSweet during the transpilation.


    package com.shared;

    public class DTO {
    private String field;

    I expect the JSweet generated code to contain the all args constructor plus the getters/setters, instead, what I get is:

    declare namespace com.shared {
    class DTO {
    field: string;

    Again, thank you so much for your help.


    Renaud Pawlak
    Renaud Pawlak

    Hi. I did not know the Project Lombok and it looks cool. However, I am not sure if JSweet can be plugged to it right away.

    JSweet is a source-to-source compiler (transpiler). It takes valid Java code as an input and produces TypeScript code. However, the Project Lombok defines annotations that enhance the meaning of Java. The set of Lombok annotations is thus similar to a Java library (of a special kind). In theory, this library would need to be supported by JSweet in order to work, however, if Lombok generates intermediate Java source code, you could apply JSweet to that intermediate Java source code and get the expected result. So… two possible ways…

    1. If Lombok generates intermediate Java source code, locate that code and use that code as the JSweet input.
    2. If not, then you need to provide a JSweet implementation for all the Lombok annotations. With JSweet 2, you “just” need to write an extension, which should not be that hard… see here.

    I hope it helps.


    Hi Renauld,

    Project lombok is an annotation processor that generates java classes with additional getters, setters, constructors and other boiler plate code from java annotations. It is very popular and a huge number of projects use it. It would be great if jsweet could work with it and any other preprocessors for that matter and not let that be a barrier to adoption.

    Does jsweet work on java source code or does it work on java class files? If it is the latter then there would be no problems because after compilation is done there is no difference whether preprocessors were used or not. If it operates on Java source files then that is a problem. If so, it would be good to consider changing the implementation to work with java class files instead of source files.

Viewing 3 posts - 1 through 3 (of 3 total)

The forum ‘JSweet Discussion’ is closed to new topics and replies.