是否可以将 IntelliJ 的 'Analyze Data Flow to Here' 功能与 Java Lombok 一起使用?

Is it possible to use IntelliJ's 'Analyze Data Flow to Here' feature with Java Lombok?

我最近做了一个实验,看看我们如何使用 Lombok 来减少代码中的样板文件。

问题: 通过 Lombok 注释使用构建器创建简单数据时 class,在 IntelliJ IDEA 中,我无法右键单击字段,然后 select 分析数据流到此处。

这是使用最新的 IntelliJ Lombok 插件。 IntelliJ 旗舰版 2019.2.3.

是否有解决此问题的方法,还是根本不受支持?

示例 1 - 没有龙目岛:

public class Person {

    private String name;
    private int age;

    private Person() {

    }

    public Person(Builder builder) {
        name = builder.name;
        age = builder.age;
    }

    public String getName() {
        return name;
    }

    public int getAge() {
        return age;
    }

    public static class Builder {
        private String name;
        private int age;

        public Builder name(String val) {
            this.name = val;
            return this;
        }

        public Builder age(int val) {
            this.age = val;
            return this;
        }

        public Person build() {
            return new Person(this);
        }
    }
}
public class Main {

    public static void main(String[] args) {
        Person person = new Person.Builder().name("tom").age(3).build();
    }
}

使用上面的代码,当我右键单击 "name" 变量并 select 分析到此处的数据流时,我能够看到数据流。如截图所示:

示例 2 - 使用 Lombok:

import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;

@NoArgsConstructor
@Builder
@Getter
public class Person {
    private String name;
    private int age;
}
public class Main {
    public static void main(String[] args) {
        Person person = Person.builder().name("tom").age(3).build();
    }
}

对于上面的代码示例,在名称字段上 selecting 'analyse data flow to here' 将显示变量名称,但没有要展开的树,如屏幕截图所示。

"Analyze data flow to here" 不适用于 Lombok 注释提供的生成代码。