Примеры ошибок, обнаруженных с помощью диагностики V6029
V6029. Possible incorrect order of arguments passed to method.
Apache Flink
V6029 Possible incorrect order of arguments passed to method: 'hasBufferForReleasedChannel', 'hasBufferForRemovedChannel'. NettyMessageClientDecoderDelegateTest.java(165), NettyMessageClientDecoderDelegateTest.java(166)
private void testNettyMessageClientDecoding(
boolean hasEmptyBuffer,
boolean hasBufferForReleasedChannel,
boolean hasBufferForRemovedChannel) throws Exception
{
....
List<BufferResponse> messages = createMessageList (
hasEmptyBuffer,
hasBufferForReleasedChannel,
hasBufferForRemovedChannel);
....
}
private List<BufferResponse> createMessageList(
boolean hasEmptyBuffer,
boolean hasBufferForRemovedChannel,
boolean hasBufferForReleasedChannel)
{
....
if (hasBufferForReleasedChannel) {
addBufferResponse(messages,
releasedInputChannelId,
Buffer.DataType.DATA_BUFFER,
BUFFER_SIZE,
seqNumber++);
}
if (hasBufferForRemovedChannel) {
addBufferResponse(messages,
new InputChannelID(),
Buffer.DataType.DATA_BUFFER,
BUFFER_SIZE,
seqNumber++);
}
....
return messages;
}
NGB
V6029 Possible incorrect order of arguments passed to method: 'indexPath', 'name'. TestHttpServer.java(139), TestHttpServer.java(140)
public void addFeatureIndexedFileRegistration(Long refId,
String path,
String indexPath,
String name,
Long fileId,
Long fileBioId,
BiologicalDataItemFormat format,
boolean doIndex,
String prettyName) {
String absolutePath = getNormalizeAndAbsolutePath(path);
onRequest().havingMethodEqualTo(HTTP_POST)
.havingPathEqualTo(....)
.havingBodyEqualTo(TestDataProvider
.getRegistrationJsonWithPrettyName(
refId,
absolutePath,
indexPath,
name,
doIndex,
prettyName))
.respond()
.withBody(....)
.withStatus(HTTP_STATUS_OK);
}
public static String getRegistrationJsonWithPrettyName(
Long referenceID,
String path,
String name,
String indexPath,
boolean doIndex,
String prettyName) {
....
}
Elasticsearch
V6029 Possible incorrect order of arguments passed to method: 'lats', 'lons'. WellKnownBinary.java 370
private static LinearRing parseLinearRing(
ByteBuffer byteBuffer,
boolean hasZ, boolean coerce
) {
....
double[] lons = new double[length];
double[] lats = new double[length];
....
if (linearRingNeedsCoerced(lats, lons, alts, coerce)) { // <=
lons = coerce(lons);
lats = coerce(lats);
if (hasZ) {
alts = coerce(alts);
}
}
....
}
private static boolean linearRingNeedsCoerced(
double[] lons, double[] lats, // <=
double[] alts,
boolean coerce
) {
assert lats.length == lons.length
&& (alts == null || alts.length == lats.length);
assert lats.length > 0;
if (coerce == false) {
return false;
}
final int last = lons.length - 1;
return lons[0] != lons[last]
|| lats[0] != lats[last]
|| (alts != null && alts[0] != alts[last]);
}