Browse Source

Merge branch 'stable-5.6'

* stable-5.6:
  ReftableTest: Clean up boxing warnings on usage of String.format
  MergedReftable: Remove unnecessary semicolon

Change-Id: Id35406acfdd91c3ddf17ce4e1023395f774774f2
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
stable-5.7
David Pursehouse 5 years ago
parent
commit
f350e889d6
  1. 42
      org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/reftable/ReftableTest.java
  2. 2
      org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/reftable/MergedReftable.java

42
org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/reftable/ReftableTest.java

@ -149,12 +149,13 @@ public class ReftableTest {
assertEquals(expBytes, table.length); assertEquals(expBytes, table.length);
} }
@SuppressWarnings("boxing")
@Test @Test
public void estimateCurrentBytesWithIndex() throws IOException { public void estimateCurrentBytesWithIndex() throws IOException {
List<Ref> refs = new ArrayList<>(); List<Ref> refs = new ArrayList<>();
for (int i = 1; i <= 5670; i++) { for (int i = 1; i <= 5670; i++) {
refs.add(ref(String.format("refs/heads/%04d", i), i)); @SuppressWarnings("boxing")
Ref ref = ref(String.format("refs/heads/%04d", i), i);
refs.add(ref);
} }
ReftableConfig cfg = new ReftableConfig(); ReftableConfig cfg = new ReftableConfig();
@ -229,7 +230,9 @@ public class ReftableTest {
// Fill up 5 blocks. // Fill up 5 blocks.
int N = 256 * 5 / 25; int N = 256 * 5 / 25;
for (int i= 0; i < N; i++) { for (int i= 0; i < N; i++) {
refs.add(ref(String.format("%02d/xxxxxxxxxx", i), i)); @SuppressWarnings("boxing")
Ref ref = ref(String.format("%02d/xxxxxxxxxx", i), i);
refs.add(ref);
} }
byte[] table = write(refs, cfg); byte[] table = write(refs, cfg);
@ -425,12 +428,13 @@ public class ReftableTest {
} }
} }
@SuppressWarnings("boxing")
@Test @Test
public void indexScan() throws IOException { public void indexScan() throws IOException {
List<Ref> refs = new ArrayList<>(); List<Ref> refs = new ArrayList<>();
for (int i = 1; i <= 5670; i++) { for (int i = 1; i <= 5670; i++) {
refs.add(ref(String.format("refs/heads/%04d", i), i)); @SuppressWarnings("boxing")
Ref ref = ref(String.format("refs/heads/%04d", i), i);
refs.add(ref);
} }
byte[] table = write(refs); byte[] table = write(refs);
@ -439,12 +443,13 @@ public class ReftableTest {
assertScan(refs, read(table)); assertScan(refs, read(table));
} }
@SuppressWarnings("boxing")
@Test @Test
public void indexSeek() throws IOException { public void indexSeek() throws IOException {
List<Ref> refs = new ArrayList<>(); List<Ref> refs = new ArrayList<>();
for (int i = 1; i <= 5670; i++) { for (int i = 1; i <= 5670; i++) {
refs.add(ref(String.format("refs/heads/%04d", i), i)); @SuppressWarnings("boxing")
Ref ref = ref(String.format("refs/heads/%04d", i), i);
refs.add(ref);
} }
byte[] table = write(refs); byte[] table = write(refs);
@ -453,12 +458,13 @@ public class ReftableTest {
assertSeek(refs, read(table)); assertSeek(refs, read(table));
} }
@SuppressWarnings("boxing")
@Test @Test
public void noIndexScan() throws IOException { public void noIndexScan() throws IOException {
List<Ref> refs = new ArrayList<>(); List<Ref> refs = new ArrayList<>();
for (int i = 1; i <= 567; i++) { for (int i = 1; i <= 567; i++) {
refs.add(ref(String.format("refs/heads/%03d", i), i)); @SuppressWarnings("boxing")
Ref ref = ref(String.format("refs/heads/%03d", i), i);
refs.add(ref);
} }
byte[] table = write(refs); byte[] table = write(refs);
@ -468,12 +474,13 @@ public class ReftableTest {
assertScan(refs, read(table)); assertScan(refs, read(table));
} }
@SuppressWarnings("boxing")
@Test @Test
public void noIndexSeek() throws IOException { public void noIndexSeek() throws IOException {
List<Ref> refs = new ArrayList<>(); List<Ref> refs = new ArrayList<>();
for (int i = 1; i <= 567; i++) { for (int i = 1; i <= 567; i++) {
refs.add(ref(String.format("refs/heads/%03d", i), i)); @SuppressWarnings("boxing")
Ref ref = ref(String.format("refs/heads/%03d", i), i);
refs.add(ref);
} }
byte[] table = write(refs); byte[] table = write(refs);
@ -646,6 +653,7 @@ public class ReftableTest {
// Fill out the 1st ref block. // Fill out the 1st ref block.
List<String> names = new ArrayList<>(); List<String> names = new ArrayList<>();
for (int i = 0; i < 4; i++) { for (int i = 0; i < 4; i++) {
@SuppressWarnings("boxing")
String name = new String(new char[220]).replace("\0", String.format("%c", i + 'a')); String name = new String(new char[220]).replace("\0", String.format("%c", i + 'a'));
names.add(name); names.add(name);
writer.writeRef(ref(name, i)); writer.writeRef(ref(name, i));
@ -785,7 +793,6 @@ public class ReftableTest {
} }
} }
@SuppressWarnings("boxing")
@Test @Test
public void logScan() throws IOException { public void logScan() throws IOException {
ReftableConfig cfg = new ReftableConfig(); ReftableConfig cfg = new ReftableConfig();
@ -798,6 +805,7 @@ public class ReftableTest {
List<Ref> refs = new ArrayList<>(); List<Ref> refs = new ArrayList<>();
for (int i = 1; i <= 5670; i++) { for (int i = 1; i <= 5670; i++) {
@SuppressWarnings("boxing")
Ref ref = ref(String.format("refs/heads/%04d", i), i); Ref ref = ref(String.format("refs/heads/%04d", i), i);
refs.add(ref); refs.add(ref);
writer.writeRef(ref); writer.writeRef(ref);
@ -830,12 +838,13 @@ public class ReftableTest {
} }
} }
@SuppressWarnings("boxing")
@Test @Test
public void byObjectIdOneRefNoIndex() throws IOException { public void byObjectIdOneRefNoIndex() throws IOException {
List<Ref> refs = new ArrayList<>(); List<Ref> refs = new ArrayList<>();
for (int i = 1; i <= 200; i++) { for (int i = 1; i <= 200; i++) {
refs.add(ref(String.format("refs/heads/%02d", i), i)); @SuppressWarnings("boxing")
Ref ref = ref(String.format("refs/heads/%02d", i), i);
refs.add(ref);
} }
refs.add(ref("refs/heads/master", 100)); refs.add(ref("refs/heads/master", 100));
@ -863,12 +872,13 @@ public class ReftableTest {
} }
} }
@SuppressWarnings("boxing")
@Test @Test
public void byObjectIdOneRefWithIndex() throws IOException { public void byObjectIdOneRefWithIndex() throws IOException {
List<Ref> refs = new ArrayList<>(); List<Ref> refs = new ArrayList<>();
for (int i = 1; i <= 5200; i++) { for (int i = 1; i <= 5200; i++) {
refs.add(ref(String.format("refs/heads/%02d", i), i)); @SuppressWarnings("boxing")
Ref ref = ref(String.format("refs/heads/%02d", i), i);
refs.add(ref);
} }
refs.add(ref("refs/heads/master", 100)); refs.add(ref("refs/heads/master", 100));

2
org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/reftable/MergedReftable.java

@ -104,7 +104,7 @@ public class MergedReftable extends Reftable {
boolean has = true; boolean has = true;
for (int i = 0; has && i < tables.length; i++) { for (int i = 0; has && i < tables.length; i++) {
has = has && tables[i].hasObjectMap(); has = has && tables[i].hasObjectMap();
}; }
return has; return has;
} }

Loading…
Cancel
Save