3

次のクラスで groovy-eclipse コンパイラを使用してプロジェクトをコンパイルしようとすると:

 import groovy.transform.builder.Builder

// @author: m on 10.05.16 22:15.
@Builder
class F {

   int a

}

public class B {

   int a;

public static void main(String[] args) {
    F.FBuilder builder = F.builder();

    F build = builder.a(1).build();
  }
}

次のエラーが発生します。

[INFO] Using Groovy-Eclipse compiler to compile both Java and Groovy files
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR : 
[INFO] -------------------------------------------------------------
[ERROR] /Users/m/git_repo/mix/src/main/java/B.java:[7,1] 1. ERROR in /Users/m/git_repo/mix/src/main/java/B.java (at line 7)
    F.FBuilder builder = F.builder();
    ^^^^^^^^^^
F.FBuilder cannot be resolved to a type

[ERROR] /Users/m/git_repo/mix/src/main/java/B.java:[7,24] 2. ERROR in /Users/m/git_repo/mix/src/main/java/B.java (at line 7)
    F.FBuilder builder = F.builder();
                           ^^^^^^^
The method builder() is undefined for the type F
[ERROR] Found 2 errors and 0 warnings.

修正方法は?助けてください

4

4 に答える 4