我有这个抽象类:
public abstract class Hotel {
protected List<String> defaultValues() {
return List.of("Geeks", "For", "Geeks");
}
}
这个从抽象类扩展而来的龙目岛类:
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode
public class Hostel extends Hotel {
private List<String> values = defaultValues();
@SuppressWarnings("unused")
public static class HosteBuilder {
public Hostel build() {
this.values.add("ww");
...
}
}
}
但我在行中有一个空指针values.add("ww");