GWTでlombokを使用する

  1. eclipseにlombokをインストール
  2. (lombokを使用してjavaファイルを作成)
  3. GWT Compile Project -> Advanced -> VM arguments: に次の文を追加
  • javaagent:lib/lombok.jar=ECJ (プロジェクトのlibフォルダにlombok.jarを入れているとき)

「(ゲッター名)is undefined for the type」のようなエラーが出たとき

対象のフィールドにいったん @Getterをつけてから再コンパイルすると直ることがある。

参考:
Project Lombok


@Data
@Model(schemaVersion = 1)
public class MyModel implements Serializable {
    private static final long serialVersionUID = 1L;

    @Attribute(primaryKey = true)
    private Key key;
    @Attribute(version = true)
    private Long version;
    
//    @Getter
    private String title;
    @Attribute(unindexed=true)
    private String content; 
    @Attribute(lob=true)
    private String description; 
}