As reported by Sonar Lint: Array designators should always be located on the type for better code readability. Otherwise, developers must look both at the type and the variable name to know whether or not a variable is an array. Change-Id: If6b41fed3483d0992d402d8680552ab4bef89ffb Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>tags/v5.7.0.202003090808-r
@@ -138,7 +138,7 @@ class RegexPipeline extends UrlPipeline { | |||
// build a request for them so RegexGroupFilter can pick | |||
// a different capture group later. Continue using the | |||
// first capture group as the path info. | |||
WrappedRequest groups[] = new WrappedRequest[cur.groupCount()]; | |||
WrappedRequest[] groups = new WrappedRequest[cur.groupCount()]; | |||
for (int groupId = 1; groupId <= cur.groupCount(); groupId++) { | |||
final int s = cur.start(groupId); | |||
final String path, info; |
@@ -121,7 +121,7 @@ public class CachingKeyPairProvider extends FileKeyPairProvider | |||
if (cache == null) { | |||
return loadKey(session, resource, path, getPasswordFinder()); | |||
} | |||
Throwable t[] = { null }; | |||
Throwable[] t = { null }; | |||
KeyPair key = cache.get(path, p -> { | |||
try { | |||
return loadKey(session, resource, p, getPasswordFinder()); |
@@ -249,7 +249,7 @@ public final class HttpParser { | |||
start = nextStart + 1; | |||
} else { | |||
if (header.charAt(nextStart) == '"') { | |||
int nextEnd[] = { nextStart + 1 }; | |||
int[] nextEnd = { nextStart + 1 }; | |||
String value = scanQuotedString(header, nextStart + 1, | |||
nextEnd); | |||
challenge.addArgument(header.substring(start, end), value); |
@@ -448,7 +448,7 @@ public class RawText extends Sequence { | |||
} | |||
} | |||
byte data[]; | |||
byte[] data; | |||
try { | |||
data = new byte[(int)sz]; | |||
} catch (OutOfMemoryError e) { |
@@ -674,7 +674,7 @@ public class FileReftableStack implements AutoCloseable { | |||
} | |||
} | |||
static List<Segment> segmentSizes(long sizes[]) { | |||
static List<Segment> segmentSizes(long[] sizes) { | |||
List<Segment> segments = new ArrayList<>(); | |||
Segment cur = new Segment(); | |||
for (int i = 0; i < sizes.length; i++) { | |||
@@ -694,7 +694,7 @@ public class FileReftableStack implements AutoCloseable { | |||
return segments; | |||
} | |||
private static Optional<Segment> autoCompactCandidate(long sizes[]) { | |||
private static Optional<Segment> autoCompactCandidate(long[] sizes) { | |||
if (sizes.length == 0) { | |||
return Optional.empty(); | |||
} |
@@ -225,7 +225,7 @@ public class PackWriter implements AutoCloseable { | |||
} | |||
@SuppressWarnings("unchecked") | |||
BlockList<ObjectToPack> objectsLists[] = new BlockList[OBJ_TAG + 1]; | |||
BlockList<ObjectToPack>[] objectsLists = new BlockList[OBJ_TAG + 1]; | |||
{ | |||
objectsLists[OBJ_COMMIT] = new BlockList<>(); | |||
objectsLists[OBJ_TREE] = new BlockList<>(); | |||
@@ -270,7 +270,7 @@ public class PackWriter implements AutoCloseable { | |||
private List<ObjectToPack> sortedByName; | |||
private byte packcsum[]; | |||
private byte[] packcsum; | |||
private boolean deltaBaseAsOffset; | |||
@@ -143,7 +143,7 @@ public class ResolveMerger extends ThreeWayMerger { | |||
* | |||
* @since 3.0 | |||
*/ | |||
protected String commitNames[]; | |||
protected String[] commitNames; | |||
/** | |||
* Index of the base tree within the {@link #tw tree walk}. |
@@ -2411,12 +2411,12 @@ public class UploadPack { | |||
} | |||
@Override | |||
public void write(byte b[]) throws IOException { | |||
public void write(byte[] b) throws IOException { | |||
out.write(b); | |||
} | |||
@Override | |||
public void write(byte b[], int off, int len) throws IOException { | |||
public void write(byte[] b, int off, int len) throws IOException { | |||
out.write(b, off, len); | |||
} | |||
@@ -2270,7 +2270,7 @@ public abstract class FS { | |||
void copy() throws IOException { | |||
boolean writeFailure = false; | |||
byte buffer[] = new byte[4096]; | |||
byte[] buffer = new byte[4096]; | |||
int readBytes; | |||
while ((readBytes = in.read(buffer)) != -1) { | |||
// Do not try to write again after a failure, but keep |
@@ -313,7 +313,7 @@ public class LfsFactory { | |||
} | |||
@Override | |||
public int read(byte b[], int off, int len) throws IOException { | |||
public int read(byte[] b, int off, int len) throws IOException { | |||
return stream.read(b, off, len); | |||
} | |||
@@ -49,7 +49,7 @@ public class Monitoring { | |||
String metricName) { | |||
boolean register = false; | |||
try { | |||
Class<?> interfaces[] = mbean.getClass().getInterfaces(); | |||
Class<?>[] interfaces = mbean.getClass().getInterfaces(); | |||
for (Class<?> i : interfaces) { | |||
register = SystemReader.getInstance().getUserConfig() | |||
.getBoolean( |