尝试使用 @AutoValue 时嵌套类:
public class Nested {
@AutoValue
public static abstract class Example {
public static Example create(String name, int integer) {
return new AutoValue_Example(name, integer);
}
public abstract String name();
public abstract int integer();
}
}
AutoValue_Example
出现编译器错误找不到符号
。对我做错了什么有什么想法吗?
最佳答案
当您的类像这样嵌套时,生成的 AutoValue 类将被命名为 AutoValue_Nested_Example
。如 docs 中所述:
Nesting
For a nested abstract value type called Foo.Bar.Qux, the generated implementation class is named AutoValue_Foo_Bar_Qux.
关于java - 将@AutoValue 与嵌套类一起使用会产生 "cannot find symbol"错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22669792/