Условие, которое всегда оценивается как ложное. это if (значение!= null), согласно Sonar. Но я не думаю, что сонар здесь уместен. Можете ли вы помочь мне решить эту проблему, так как мой эхолот из-за этого выходит из строя?
Пожалуйста, найдите код здесь:
Код: Выделить всё
protected Message generateProtoMessage(Object document, Message.Builder builder) {
Descriptor descriptor = builder.getDescriptorForType();
for (FieldDescriptor protoField : descriptor.getFields()) {
Object value = null;
if (PROTO_JAVA_TYPES.contains(protoField.getJavaType())) {
value = getFieldValueByMethod(document, protoField);
} else if (JavaType.MESSAGE.equals(protoField.getJavaType())) {
if(protoField.isMapField()){
populateValueForMapType(document, protoField, builder);
} else {
value = getValueForMessageType(document, protoField);
}
} else if (JavaType.ENUM.equals(protoField.getJavaType())) {
value = getFieldValueForEnum(document, protoField);
}
if (value != null) builder.setField(protoField, value);
}
return builder.build();
}

Подробнее здесь: https://stackoverflow.com/questions/781 ... -it-is-not