Findbugs 对以下代码段发出警告。似乎是一个简单的Builder
类,可以在最后添加项目和构造。这里有什么问题?
public static Set<Entity> convert(@NonNull final String id,
@NonNull final Collection<SomeEntity> list) {
Builder<Entity> builder = new ImmutableSet.Builder<>();
final Entity entityOfType1 = createEntity(..);
// Bug type RV_RETURN_VALUE_IGNORED
builder.add(entityOfType1);
final Set<Entity> entitiesOfType2 = createEntity(..);
// Bug type RV_RETURN_VALUE_IGNORED
builder.addAll(entitiesOfType2);
final Set<Entity> entitiesOfType3 = createEntity(..);
// Bug type RV_RETURN_VALUE_IGNORED
builder.addAll(entitiesOfType3);
return builder.build();
}