Examples of errors detected by the V6048 diagnostic

V6048. This expression can be simplified. One of the operands in the operation equals NN. Probably it is a mistake.


Ghidra

V6048 This expression can be simplified. Operand 'defaultGroupSizeSpace' in the operation equals 1. ByteViewerLayoutModel.java(66)


void setFactorys(FieldFactory[] fieldFactorys,
                 DataFormatModel dataModel, int margin) {
  factorys = new FieldFactory[fieldFactorys.length];

  int x = margin;
  int defaultGroupSizeSpace = 1;
  for (int i = 0; i < factorys.length; i++) {
    factorys[i] = fieldFactorys[i];
    factorys[i].setStartX(x);
    x += factorys[i].getWidth();
    // add in space between groups
    if (((i + 1) % defaultGroupSizeSpace) == 0) { // <=
      x += margin * dataModel.getUnitDelimiterSize();
    }
  }
  width = x - margin * dataModel.getUnitDelimiterSize() + margin;
  layoutChanged();
}

Apache Flink

V6048 This expression can be simplified. Operand 'index' in the operation equals 0. CollectionUtil.java(76)


public static <T> Collection<List<T>> partition(Collection<T> elements,
                                                int numBuckets)
{
  Map<Integer, List<T>> buckets = new HashMap<>(numBuckets);

  int initialCapacity = elements.size() / numBuckets;

  int index = 0;
  for (T element : elements)
  {
    int bucket = index % numBuckets;                                 // <=
    buckets.computeIfAbsent(bucket,
                            key -> new ArrayList<>(initialCapacity))

           .add(element);
  }

  return buckets.values();
}


Bugs Found

Checked Projects
423
Collected Errors
14 435
This website uses cookies and other technology to provide you a more personalized experience. By continuing the view of our web-pages you accept the terms of using these files. If you don't want your personal data to be processed, please, leave this site. Learn More →
Accept