Browse Source

Enable and fix warnings about redundant specification of type arguments

Since the introduction of generic type parameter inference in Java 7,
it's not necessary to explicitly specify the type of generic parameters.

Enable the warning in Eclipse, and fix all occurrences.

Change-Id: I9158caf1beca5e4980b6240ac401f3868520aad0
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
stable-4.7
David Pursehouse 8 years ago committed by Matthias Sohn
parent
commit
3b4448637f
  1. 2
      org.eclipse.jgit.ant.test/.settings/org.eclipse.jdt.core.prefs
  2. 2
      org.eclipse.jgit.ant/.settings/org.eclipse.jdt.core.prefs
  3. 2
      org.eclipse.jgit.archive/.settings/org.eclipse.jdt.core.prefs
  4. 2
      org.eclipse.jgit.archive/src/org/eclipse/jgit/archive/ArchiveFormats.java
  5. 2
      org.eclipse.jgit.http.apache/.settings/org.eclipse.jdt.core.prefs
  6. 4
      org.eclipse.jgit.http.apache/src/org/eclipse/jgit/transport/http/apache/HttpClientConnection.java
  7. 2
      org.eclipse.jgit.http.server/.settings/org.eclipse.jdt.core.prefs
  8. 4
      org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/GitFilter.java
  9. 4
      org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/glue/MetaFilter.java
  10. 2
      org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/glue/ServletBinderImpl.java
  11. 2
      org.eclipse.jgit.http.test/.settings/org.eclipse.jdt.core.prefs
  12. 2
      org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/DumbClientDumbServerTest.java
  13. 2
      org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/DumbClientSmartServerTest.java
  14. 10
      org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/FileResolverTest.java
  15. 2
      org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/SetAdditionalHeadersTest.java
  16. 6
      org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/SmartClientSmartServerTest.java
  17. 2
      org.eclipse.jgit.junit.http/.settings/org.eclipse.jdt.core.prefs
  18. 4
      org.eclipse.jgit.junit.http/src/org/eclipse/jgit/junit/http/AccessEvent.java
  19. 4
      org.eclipse.jgit.junit.http/src/org/eclipse/jgit/junit/http/AppServer.java
  20. 6
      org.eclipse.jgit.junit.http/src/org/eclipse/jgit/junit/http/HttpTestCase.java
  21. 2
      org.eclipse.jgit.junit.http/src/org/eclipse/jgit/junit/http/MockServletConfig.java
  22. 4
      org.eclipse.jgit.junit.http/src/org/eclipse/jgit/junit/http/RecordingLogger.java
  23. 2
      org.eclipse.jgit.junit.http/src/org/eclipse/jgit/junit/http/TestRequestLog.java
  24. 2
      org.eclipse.jgit.junit/.settings/org.eclipse.jdt.core.prefs
  25. 6
      org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/LocalDiskRepositoryTestCase.java
  26. 2
      org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/MockSystemReader.java
  27. 4
      org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/TestRepository.java
  28. 2
      org.eclipse.jgit.lfs.server.test/.settings/org.eclipse.jdt.core.prefs
  29. 2
      org.eclipse.jgit.lfs.server/.settings/org.eclipse.jdt.core.prefs
  30. 10
      org.eclipse.jgit.lfs.server/src/org/eclipse/jgit/lfs/server/s3/S3Repository.java
  31. 6
      org.eclipse.jgit.lfs.server/src/org/eclipse/jgit/lfs/server/s3/SignerV4.java
  32. 2
      org.eclipse.jgit.lfs.test/.settings/org.eclipse.jdt.core.prefs
  33. 2
      org.eclipse.jgit.lfs/.settings/org.eclipse.jdt.core.prefs
  34. 2
      org.eclipse.jgit.pgm.test/.settings/org.eclipse.jdt.core.prefs
  35. 4
      org.eclipse.jgit.pgm.test/src/org/eclipse/jgit/lib/CLIRepositoryTestCase.java
  36. 2
      org.eclipse.jgit.pgm.test/src/org/eclipse/jgit/pgm/CLIGitCommand.java
  37. 12
      org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit/pgm/ArchiveTest.java
  38. 2
      org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit/pgm/ConfigTest.java
  39. 2
      org.eclipse.jgit.pgm/.settings/org.eclipse.jdt.core.prefs
  40. 2
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Add.java
  41. 6
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Blame.java
  42. 2
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Branch.java
  43. 2
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Checkout.java
  44. 4
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/CommandCatalog.java
  45. 2
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Commit.java
  46. 12
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Daemon.java
  47. 2
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/DiffTree.java
  48. 4
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Log.java
  49. 2
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/LsRemote.java
  50. 2
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/LsTree.java
  51. 2
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Main.java
  52. 2
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/MergeBase.java
  53. 2
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Push.java
  54. 2
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/RevParse.java
  55. 4
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/RevWalkTextBuiltin.java
  56. 2
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Rm.java
  57. 14
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Status.java
  58. 6
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/DiffAlgorithms.java
  59. 10
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/RebuildCommitGraph.java
  60. 14
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/TextHashFunctions.java
  61. 2
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/opt/CmdLineParser.java
  62. 2
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/opt/PathTreeFilterHandler.java
  63. 2
      org.eclipse.jgit.test/.settings/org.eclipse.jdt.core.prefs
  64. 6
      org.eclipse.jgit.test/exttst/org/eclipse/jgit/patch/EGitPatchHistoryTest.java
  65. 2
      org.eclipse.jgit.test/src/org/eclipse/jgit/lib/Sets.java
  66. 2
      org.eclipse.jgit.test/tst/org/eclipse/jgit/api/ArchiveCommandTest.java
  67. 2
      org.eclipse.jgit.test/tst/org/eclipse/jgit/api/CleanCommandTest.java
  68. 2
      org.eclipse.jgit.test/tst/org/eclipse/jgit/api/CloneCommandTest.java
  69. 6
      org.eclipse.jgit.test/tst/org/eclipse/jgit/api/LogCommandTest.java
  70. 2
      org.eclipse.jgit.test/tst/org/eclipse/jgit/api/MergeCommandTest.java
  71. 2
      org.eclipse.jgit.test/tst/org/eclipse/jgit/api/NameRevCommandTest.java
  72. 6
      org.eclipse.jgit.test/tst/org/eclipse/jgit/attributes/TreeWalkAttributeTest.java
  73. 2
      org.eclipse.jgit.test/tst/org/eclipse/jgit/diff/DiffFormatterTest.java
  74. 2
      org.eclipse.jgit.test/tst/org/eclipse/jgit/diff/RenameDetectorTest.java
  75. 6
      org.eclipse.jgit.test/tst/org/eclipse/jgit/dircache/DirCacheCGitCompatabilityTest.java
  76. 2
      org.eclipse.jgit.test/tst/org/eclipse/jgit/dircache/DirCachePathEditTest.java
  77. 2
      org.eclipse.jgit.test/tst/org/eclipse/jgit/gitrepo/ManifestParserTest.java
  78. 2
      org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/dfs/DfsInserterTest.java
  79. 4
      org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/AbbreviationTest.java
  80. 2
      org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/FileSnapshotTest.java
  81. 2
      org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/GcTestCase.java
  82. 4
      org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/PackFileTest.java
  83. 18
      org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/PackWriterTest.java
  84. 8
      org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/RefDirectoryTest.java
  85. 2
      org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/WindowCacheGetTest.java
  86. 2
      org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/BranchTrackingStatusTest.java
  87. 2
      org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ConfigTest.java
  88. 12
      org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/DirCacheCheckoutTest.java
  89. 16
      org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/IndexDiffTest.java
  90. 14
      org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ObjectIdOwnerMapTest.java
  91. 14
      org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ObjectIdSubclassMapTest.java
  92. 4
      org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/RacyGitTests.java
  93. 6
      org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/RefDatabaseConflictingNamesTest.java
  94. 2
      org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/RefTest.java
  95. 6
      org.eclipse.jgit.test/tst/org/eclipse/jgit/merge/RecursiveMergerTest.java
  96. 2
      org.eclipse.jgit.test/tst/org/eclipse/jgit/notes/DefaultNoteMergerTest.java
  97. 2
      org.eclipse.jgit.test/tst/org/eclipse/jgit/notes/NoteMapMergerTest.java
  98. 2
      org.eclipse.jgit.test/tst/org/eclipse/jgit/notes/NoteMapTest.java
  99. 4
      org.eclipse.jgit.test/tst/org/eclipse/jgit/revplot/AbstractPlotRendererTest.java
  100. 32
      org.eclipse.jgit.test/tst/org/eclipse/jgit/revplot/PlotCommitListTest.java
  101. Some files were not shown because too many files have changed in this diff Show More

2
org.eclipse.jgit.ant.test/.settings/org.eclipse.jdt.core.prefs

@ -76,7 +76,7 @@ org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore
org.eclipse.jdt.core.compiler.problem.rawTypeReference=ignore
org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning
org.eclipse.jdt.core.compiler.problem.redundantNullCheck=warning
org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=ignore
org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=warning
org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=error
org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore

2
org.eclipse.jgit.ant/.settings/org.eclipse.jdt.core.prefs

@ -76,7 +76,7 @@ org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore
org.eclipse.jdt.core.compiler.problem.rawTypeReference=ignore
org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning
org.eclipse.jdt.core.compiler.problem.redundantNullCheck=warning
org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=ignore
org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=warning
org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=error
org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore

2
org.eclipse.jgit.archive/.settings/org.eclipse.jdt.core.prefs

@ -76,7 +76,7 @@ org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore
org.eclipse.jdt.core.compiler.problem.rawTypeReference=ignore
org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning
org.eclipse.jdt.core.compiler.problem.redundantNullCheck=warning
org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=ignore
org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=warning
org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=error
org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore

2
org.eclipse.jgit.archive/src/org/eclipse/jgit/archive/ArchiveFormats.java

@ -55,7 +55,7 @@ import org.eclipse.jgit.api.ArchiveCommand;
* that performs the same registration automatically.
*/
public class ArchiveFormats {
private static final List<String> myFormats = new ArrayList<String>();
private static final List<String> myFormats = new ArrayList<>();
private static final void register(String name, ArchiveCommand.Format<?> fmt) {
myFormats.add(name);

2
org.eclipse.jgit.http.apache/.settings/org.eclipse.jdt.core.prefs

@ -76,7 +76,7 @@ org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore
org.eclipse.jdt.core.compiler.problem.rawTypeReference=ignore
org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning
org.eclipse.jdt.core.compiler.problem.redundantNullCheck=warning
org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=ignore
org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=warning
org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=error
org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore

4
org.eclipse.jgit.http.apache/src/org/eclipse/jgit/transport/http/apache/HttpClientConnection.java

@ -264,9 +264,9 @@ public class HttpClientConnection implements HttpConnection {
@Override
public Map<String, List<String>> getHeaderFields() {
Map<String, List<String>> ret = new HashMap<String, List<String>>();
Map<String, List<String>> ret = new HashMap<>();
for (Header hdr : resp.getAllHeaders()) {
List<String> list = new LinkedList<String>();
List<String> list = new LinkedList<>();
for (HeaderElement hdrElem : hdr.getElements())
list.add(hdrElem.toString());
ret.put(hdr.getName(), list);

2
org.eclipse.jgit.http.server/.settings/org.eclipse.jdt.core.prefs

@ -76,7 +76,7 @@ org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore
org.eclipse.jdt.core.compiler.problem.rawTypeReference=ignore
org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning
org.eclipse.jdt.core.compiler.problem.redundantNullCheck=warning
org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=ignore
org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=warning
org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=error
org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore

4
org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/GitFilter.java

@ -95,9 +95,9 @@ public class GitFilter extends MetaFilter {
private ReceivePackFactory<HttpServletRequest> receivePackFactory = new DefaultReceivePackFactory();
private final List<Filter> uploadPackFilters = new LinkedList<Filter>();
private final List<Filter> uploadPackFilters = new LinkedList<>();
private final List<Filter> receivePackFilters = new LinkedList<Filter>();
private final List<Filter> receivePackFilters = new LinkedList<>();
/**
* New servlet that will load its base directory from {@code web.xml}.

4
org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/glue/MetaFilter.java

@ -89,7 +89,7 @@ public class MetaFilter implements Filter {
/** Empty filter with no bindings. */
public MetaFilter() {
this.bindings = new ArrayList<ServletBinderImpl>();
this.bindings = new ArrayList<>();
}
/**
@ -144,7 +144,7 @@ public class MetaFilter implements Filter {
}
private static Set<Object> newIdentitySet() {
final Map<Object, Object> m = new IdentityHashMap<Object, Object>();
final Map<Object, Object> m = new IdentityHashMap<>();
return new AbstractSet<Object>() {
@Override
public boolean add(Object o) {

2
org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/glue/ServletBinderImpl.java

@ -58,7 +58,7 @@ abstract class ServletBinderImpl implements ServletBinder {
private HttpServlet httpServlet;
ServletBinderImpl() {
this.filters = new ArrayList<Filter>();
this.filters = new ArrayList<>();
}
@Override

2
org.eclipse.jgit.http.test/.settings/org.eclipse.jdt.core.prefs

@ -76,7 +76,7 @@ org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore
org.eclipse.jdt.core.compiler.problem.rawTypeReference=ignore
org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning
org.eclipse.jdt.core.compiler.problem.redundantNullCheck=warning
org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=ignore
org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=warning
org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=error
org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore

2
org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/DumbClientDumbServerTest.java

@ -213,7 +213,7 @@ public class DumbClientDumbServerTest extends HttpTestCase {
@Test
public void testInitialClone_Packed() throws Exception {
new TestRepository<Repository>(remoteRepository).packAndPrune();
new TestRepository<>(remoteRepository).packAndPrune();
Repository dst = createBareRepository();
assertFalse(dst.hasObject(A_txt));

2
org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/DumbClientSmartServerTest.java

@ -241,7 +241,7 @@ public class DumbClientSmartServerTest extends HttpTestCase {
@Test
public void testInitialClone_Packed() throws Exception {
new TestRepository<Repository>(remoteRepository).packAndPrune();
new TestRepository<>(remoteRepository).packAndPrune();
Repository dst = createBareRepository();
assertFalse(dst.hasObject(A_txt));

10
org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/FileResolverTest.java

@ -83,7 +83,7 @@ public class FileResolverTest extends LocalDiskRepositoryTestCase {
private static void assertUnreasonable(String name)
throws ServiceNotEnabledException {
FileResolver<RepositoryResolver> r = new FileResolver<RepositoryResolver>(
FileResolver<RepositoryResolver> r = new FileResolver<>(
new File("."), false);
try {
r.open(null, name);
@ -103,7 +103,7 @@ public class FileResolverTest extends LocalDiskRepositoryTestCase {
FileResolver<RepositoryResolver> resolver;
assertFalse("no git-daemon-export-ok", export.exists());
resolver = new FileResolver<RepositoryResolver>(base, false /*
resolver = new FileResolver<>(base, false /*
* require
* flag
*/);
@ -114,7 +114,7 @@ public class FileResolverTest extends LocalDiskRepositoryTestCase {
assertEquals("Service not enabled", e.getMessage());
}
resolver = new FileResolver<RepositoryResolver>(base, true /*
resolver = new FileResolver<>(base, true /*
* export
* all
*/);
@ -125,7 +125,7 @@ public class FileResolverTest extends LocalDiskRepositoryTestCase {
}
FileUtils.createNewFile(export);
resolver = new FileResolver<RepositoryResolver>(base, false /*
resolver = new FileResolver<>(base, false /*
* require
* flag
*/);
@ -142,7 +142,7 @@ public class FileResolverTest extends LocalDiskRepositoryTestCase {
final Repository a = createBareRepository();
final String name = a.getDirectory().getName() + "-not-a-git";
final File base = a.getDirectory().getParentFile();
FileResolver<RepositoryResolver> resolver = new FileResolver<RepositoryResolver>(
FileResolver<RepositoryResolver> resolver = new FileResolver<>(
base, false);
try {

2
org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/SetAdditionalHeadersTest.java

@ -112,7 +112,7 @@ public class SetAdditionalHeadersTest extends HttpTestCase {
assertTrue("isa TransportHttp", t instanceof TransportHttp);
assertTrue("isa HttpTransport", t instanceof HttpTransport);
HashMap<String, String> headers = new HashMap<String, String>();
HashMap<String, String> headers = new HashMap<>();
headers.put("Cookie", "someTokenValue=23gBog34");
headers.put("AnotherKey", "someValue");
((TransportHttp) t).setAdditionalHeaders(headers);

6
org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/SmartClientSmartServerTest.java

@ -437,7 +437,7 @@ public class SmartClientSmartServerTest extends HttpTestCase {
// Create a new commit on the remote.
//
b = new TestRepository<Repository>(remoteRepository).branch(master);
b = new TestRepository<>(remoteRepository).branch(master);
RevCommit Z = b.commit().message("Z").create();
// Now incrementally update.
@ -497,7 +497,7 @@ public class SmartClientSmartServerTest extends HttpTestCase {
// Create a new commit on the remote.
//
b = new TestRepository<Repository>(remoteRepository).branch(master);
b = new TestRepository<>(remoteRepository).branch(master);
RevCommit Z = b.commit().message("Z").create();
// Now incrementally update.
@ -614,7 +614,7 @@ public class SmartClientSmartServerTest extends HttpTestCase {
final String repoName = "refs-unreadable";
RefsUnreadableInMemoryRepository badRefsRepo = new RefsUnreadableInMemoryRepository(
new DfsRepositoryDescription(repoName));
final TestRepository<Repository> repo = new TestRepository<Repository>(
final TestRepository<Repository> repo = new TestRepository<>(
badRefsRepo);
ServletContextHandler app = noRefServer.addContext("/git");

2
org.eclipse.jgit.junit.http/.settings/org.eclipse.jdt.core.prefs

@ -76,7 +76,7 @@ org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore
org.eclipse.jdt.core.compiler.problem.rawTypeReference=ignore
org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning
org.eclipse.jdt.core.compiler.problem.redundantNullCheck=warning
org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=ignore
org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=warning
org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=error
org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore

4
org.eclipse.jgit.junit.http/src/org/eclipse/jgit/junit/http/AccessEvent.java

@ -76,7 +76,7 @@ public class AccessEvent {
}
private static Map<String, String> cloneHeaders(final Request req) {
Map<String, String> r = new TreeMap<String, String>();
Map<String, String> r = new TreeMap<>();
Enumeration hn = req.getHeaderNames();
while (hn.hasMoreElements()) {
String key = (String) hn.nextElement();
@ -88,7 +88,7 @@ public class AccessEvent {
}
private static Map<String, String> cloneHeaders(final Response rsp) {
Map<String, String> r = new TreeMap<String, String>();
Map<String, String> r = new TreeMap<>();
Enumeration<String> hn = rsp.getHttpFields().getFieldNames();
while (hn.hasMoreElements()) {
String key = hn.nextElement();

4
org.eclipse.jgit.junit.http/src/org/eclipse/jgit/junit/http/AppServer.java

@ -262,7 +262,7 @@ public class AppServer {
/** @return all requests since the server was started. */
public List<AccessEvent> getRequests() {
return new ArrayList<AccessEvent>(log.getEvents());
return new ArrayList<>(log.getEvents());
}
/**
@ -282,7 +282,7 @@ public class AppServer {
* @return all requests which match the given path.
*/
public List<AccessEvent> getRequests(String path) {
ArrayList<AccessEvent> r = new ArrayList<AccessEvent>();
ArrayList<AccessEvent> r = new ArrayList<>();
for (AccessEvent event : log.getEvents()) {
if (event.getPath().equals(path)) {
r.add(event);

6
org.eclipse.jgit.junit.http/src/org/eclipse/jgit/junit/http/HttpTestCase.java

@ -88,7 +88,7 @@ public abstract class HttpTestCase extends LocalDiskRepositoryTestCase {
protected TestRepository<Repository> createTestRepository()
throws IOException {
return new TestRepository<Repository>(createBareRepository());
return new TestRepository<>(createBareRepository());
}
protected URIish toURIish(String path) throws URISyntaxException {
@ -120,12 +120,12 @@ public abstract class HttpTestCase extends LocalDiskRepositoryTestCase {
protected static void fsck(Repository db, RevObject... tips)
throws Exception {
TestRepository<? extends Repository> tr =
new TestRepository<Repository>(db);
new TestRepository<>(db);
tr.fsck(tips);
}
protected static Set<RefSpec> mirror(String... refs) {
HashSet<RefSpec> r = new HashSet<RefSpec>();
HashSet<RefSpec> r = new HashSet<>();
for (String name : refs) {
RefSpec rs = new RefSpec(name);
rs = rs.setDestination(name);

2
org.eclipse.jgit.junit.http/src/org/eclipse/jgit/junit/http/MockServletConfig.java

@ -52,7 +52,7 @@ import javax.servlet.ServletConfig;
import javax.servlet.ServletContext;
public class MockServletConfig implements ServletConfig {
private final Map<String, String> parameters = new HashMap<String, String>();
private final Map<String, String> parameters = new HashMap<>();
public void setInitParameter(String name, String value) {
parameters.put(name, value);

4
org.eclipse.jgit.junit.http/src/org/eclipse/jgit/junit/http/RecordingLogger.java

@ -53,7 +53,7 @@ import org.slf4j.helpers.MessageFormatter;
/** Logs warnings into an array for later inspection. */
public class RecordingLogger implements Logger {
private static List<Warning> warnings = new ArrayList<Warning>();
private static List<Warning> warnings = new ArrayList<>();
/** Clear the warnings, automatically done by {@link AppServer#setUp()} */
public static void clear() {
@ -65,7 +65,7 @@ public class RecordingLogger implements Logger {
/** @return the warnings (if any) from the last execution */
public static List<Warning> getWarnings() {
synchronized (warnings) {
ArrayList<Warning> copy = new ArrayList<Warning>(warnings);
ArrayList<Warning> copy = new ArrayList<>(warnings);
return Collections.unmodifiableList(copy);
}
}

2
org.eclipse.jgit.junit.http/src/org/eclipse/jgit/junit/http/TestRequestLog.java

@ -61,7 +61,7 @@ import org.eclipse.jetty.server.handler.HandlerWrapper;
class TestRequestLog extends HandlerWrapper {
private static final int MAX = 16;
private final List<AccessEvent> events = new ArrayList<AccessEvent>();
private final List<AccessEvent> events = new ArrayList<>();
private final Semaphore active = new Semaphore(MAX);

2
org.eclipse.jgit.junit/.settings/org.eclipse.jdt.core.prefs

@ -76,7 +76,7 @@ org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore
org.eclipse.jdt.core.compiler.problem.rawTypeReference=ignore
org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning
org.eclipse.jdt.core.compiler.problem.redundantNullCheck=warning
org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=ignore
org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=warning
org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=error
org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore

6
org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/LocalDiskRepositoryTestCase.java

@ -286,7 +286,7 @@ public abstract class LocalDiskRepositoryTestCase {
throws IllegalStateException, IOException {
DirCache dc = repo.readDirCache();
StringBuilder sb = new StringBuilder();
TreeSet<Long> timeStamps = new TreeSet<Long>();
TreeSet<Long> timeStamps = new TreeSet<>();
// iterate once over the dircache just to collect all time stamps
if (0 != (includedOptions & MOD_TIME)) {
@ -552,7 +552,7 @@ public abstract class LocalDiskRepositoryTestCase {
}
private static HashMap<String, String> cloneEnv() {
return new HashMap<String, String>(System.getenv());
return new HashMap<>(System.getenv());
}
private static final class CleanupThread extends Thread {
@ -574,7 +574,7 @@ public abstract class LocalDiskRepositoryTestCase {
}
}
private final List<File> toDelete = new ArrayList<File>();
private final List<File> toDelete = new ArrayList<>();
@Override
public void run() {

2
org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/MockSystemReader.java

@ -88,7 +88,7 @@ public class MockSystemReader extends SystemReader {
long now = 1250379778668L; // Sat Aug 15 20:12:58 GMT-03:30 2009
final Map<String, String> values = new HashMap<String, String>();
final Map<String, String> values = new HashMap<>();
FileBasedConfig userGitConfig;

4
org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/TestRepository.java

@ -876,7 +876,7 @@ public class TestRepository<R extends Repository> {
final File pack, idx;
try (PackWriter pw = new PackWriter(db)) {
Set<ObjectId> all = new HashSet<ObjectId>();
Set<ObjectId> all = new HashSet<>();
for (Ref r : db.getAllRefs().values())
all.add(r.getObjectId());
pw.preparePack(m, all, PackWriter.NONE);
@ -992,7 +992,7 @@ public class TestRepository<R extends Repository> {
private ObjectId topLevelTree;
private final List<RevCommit> parents = new ArrayList<RevCommit>(2);
private final List<RevCommit> parents = new ArrayList<>(2);
private int tick = 1;

2
org.eclipse.jgit.lfs.server.test/.settings/org.eclipse.jdt.core.prefs

@ -76,7 +76,7 @@ org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore
org.eclipse.jdt.core.compiler.problem.rawTypeReference=ignore
org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning
org.eclipse.jdt.core.compiler.problem.redundantNullCheck=warning
org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=ignore
org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=warning
org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=error
org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore

2
org.eclipse.jgit.lfs.server/.settings/org.eclipse.jdt.core.prefs

@ -76,7 +76,7 @@ org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore
org.eclipse.jdt.core.compiler.problem.rawTypeReference=ignore
org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning
org.eclipse.jdt.core.compiler.problem.redundantNullCheck=warning
org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=ignore
org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=warning
org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=error
org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore

10
org.eclipse.jgit.lfs.server/src/org/eclipse/jgit/lfs/server/s3/S3Repository.java

@ -94,10 +94,10 @@ public class S3Repository implements LargeFileRepository {
@Override
public Response.Action getDownloadAction(AnyLongObjectId oid) {
URL endpointUrl = getObjectUrl(oid);
Map<String, String> queryParams = new HashMap<String, String>();
Map<String, String> queryParams = new HashMap<>();
queryParams.put(X_AMZ_EXPIRES,
Integer.toString(s3Config.getExpirationSeconds()));
Map<String, String> headers = new HashMap<String, String>();
Map<String, String> headers = new HashMap<>();
String authorizationQueryParameters = SignerV4.createAuthorizationQuery(
s3Config, endpointUrl, METHOD_GET, headers, queryParams,
UNSIGNED_PAYLOAD);
@ -111,7 +111,7 @@ public class S3Repository implements LargeFileRepository {
public Response.Action getUploadAction(AnyLongObjectId oid, long size) {
cacheObjectMetaData(oid, size);
URL objectUrl = getObjectUrl(oid);
Map<String, String> headers = new HashMap<String, String>();
Map<String, String> headers = new HashMap<>();
headers.put(X_AMZ_CONTENT_SHA256, oid.getName());
headers.put(HDR_CONTENT_LENGTH, Long.toString(size));
headers.put(X_AMZ_STORAGE_CLASS, s3Config.getStorageClass());
@ -134,10 +134,10 @@ public class S3Repository implements LargeFileRepository {
@Override
public long getSize(AnyLongObjectId oid) throws IOException {
URL endpointUrl = getObjectUrl(oid);
Map<String, String> queryParams = new HashMap<String, String>();
Map<String, String> queryParams = new HashMap<>();
queryParams.put(X_AMZ_EXPIRES,
Integer.toString(s3Config.getExpirationSeconds()));
Map<String, String> headers = new HashMap<String, String>();
Map<String, String> headers = new HashMap<>();
String authorizationQueryParameters = SignerV4.createAuthorizationQuery(
s3Config, endpointUrl, METHOD_HEAD, headers, queryParams,

6
org.eclipse.jgit.lfs.server/src/org/eclipse/jgit/lfs/server/s3/SignerV4.java

@ -240,7 +240,7 @@ class SignerV4 {
private static String canonicalizeHeaderNames(
Map<String, String> headers) {
List<String> sortedHeaders = new ArrayList<String>();
List<String> sortedHeaders = new ArrayList<>();
sortedHeaders.addAll(headers.keySet());
Collections.sort(sortedHeaders, String.CASE_INSENSITIVE_ORDER);
@ -260,7 +260,7 @@ class SignerV4 {
return ""; //$NON-NLS-1$
}
List<String> sortedHeaders = new ArrayList<String>();
List<String> sortedHeaders = new ArrayList<>();
sortedHeaders.addAll(headers.keySet());
Collections.sort(sortedHeaders, String.CASE_INSENSITIVE_ORDER);
@ -305,7 +305,7 @@ class SignerV4 {
return ""; //$NON-NLS-1$
}
SortedMap<String, String> sorted = new TreeMap<String, String>();
SortedMap<String, String> sorted = new TreeMap<>();
Iterator<Map.Entry<String, String>> pairs = parameters.entrySet()
.iterator();

2
org.eclipse.jgit.lfs.test/.settings/org.eclipse.jdt.core.prefs

@ -76,7 +76,7 @@ org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore
org.eclipse.jdt.core.compiler.problem.rawTypeReference=ignore
org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning
org.eclipse.jdt.core.compiler.problem.redundantNullCheck=warning
org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=ignore
org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=warning
org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=error
org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore

2
org.eclipse.jgit.lfs/.settings/org.eclipse.jdt.core.prefs

@ -76,7 +76,7 @@ org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore
org.eclipse.jdt.core.compiler.problem.rawTypeReference=ignore
org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning
org.eclipse.jdt.core.compiler.problem.redundantNullCheck=warning
org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=ignore
org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=warning
org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=error
org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore

2
org.eclipse.jgit.pgm.test/.settings/org.eclipse.jdt.core.prefs

@ -76,7 +76,7 @@ org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore
org.eclipse.jdt.core.compiler.problem.rawTypeReference=ignore
org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning
org.eclipse.jdt.core.compiler.problem.redundantNullCheck=warning
org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=ignore
org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=warning
org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=error
org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore

4
org.eclipse.jgit.pgm.test/src/org/eclipse/jgit/lib/CLIRepositoryTestCase.java

@ -79,7 +79,7 @@ public class CLIRepositoryTestCase extends LocalDiskRepositoryTestCase {
* @throws Exception
*/
protected String[] executeUnchecked(String... cmds) throws Exception {
List<String> result = new ArrayList<String>(cmds.length);
List<String> result = new ArrayList<>(cmds.length);
for (String cmd : cmds) {
result.addAll(CLIGitCommand.executeUnchecked(cmd, db));
}
@ -97,7 +97,7 @@ public class CLIRepositoryTestCase extends LocalDiskRepositoryTestCase {
* @throws Exception
*/
protected String[] execute(String... cmds) throws Exception {
List<String> result = new ArrayList<String>(cmds.length);
List<String> result = new ArrayList<>(cmds.length);
for (String cmd : cmds) {
Result r = CLIGitCommand.executeRaw(cmd, db);
if (r.ex instanceof TerminatedByHelpException) {

2
org.eclipse.jgit.pgm.test/src/org/eclipse/jgit/pgm/CLIGitCommand.java

@ -189,7 +189,7 @@ public class CLIGitCommand extends Main {
* @return the array
*/
static String[] split(String commandLine) {
final List<String> list = new ArrayList<String>();
final List<String> list = new ArrayList<>();
boolean inquote = false;
boolean inDblQuote = false;
StringBuilder r = new StringBuilder();

12
org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit/pgm/ArchiveTest.java

@ -529,7 +529,7 @@ public class ArchiveTest extends CLIRepositoryTestCase {
@Test
public void testArchiveWithLongFilename() throws Exception {
StringBuilder filename = new StringBuilder();
List<String> l = new ArrayList<String>();
List<String> l = new ArrayList<>();
for (int i = 0; i < 20; i++) {
filename.append("1234567890/");
l.add(filename.toString());
@ -549,7 +549,7 @@ public class ArchiveTest extends CLIRepositoryTestCase {
@Test
public void testTarWithLongFilename() throws Exception {
StringBuilder filename = new StringBuilder();
List<String> l = new ArrayList<String>();
List<String> l = new ArrayList<>();
for (int i = 0; i < 20; i++) {
filename.append("1234567890/");
l.add(filename.toString());
@ -691,7 +691,7 @@ public class ArchiveTest extends CLIRepositoryTestCase {
}
private static String[] listZipEntries(byte[] zipData) throws IOException {
List<String> l = new ArrayList<String>();
List<String> l = new ArrayList<>();
ZipInputStream in = new ZipInputStream(
new ByteArrayInputStream(zipData));
@ -719,7 +719,7 @@ public class ArchiveTest extends CLIRepositoryTestCase {
}
private String[] listTarEntries(byte[] tarData) throws Exception {
List<String> l = new ArrayList<String>();
List<String> l = new ArrayList<>();
Process proc = spawnAssumingCommandPresent("tar", "tf", "-");
BufferedReader reader = readFromProcess(proc);
OutputStream out = proc.getOutputStream();
@ -750,7 +750,7 @@ public class ArchiveTest extends CLIRepositoryTestCase {
continue;
// found!
List<String> l = new ArrayList<String>();
List<String> l = new ArrayList<>();
BufferedReader reader = new BufferedReader(
new InputStreamReader(in, "UTF-8"));
String line;
@ -765,7 +765,7 @@ public class ArchiveTest extends CLIRepositoryTestCase {
private String[] tarEntryContent(byte[] tarData, String path)
throws Exception {
List<String> l = new ArrayList<String>();
List<String> l = new ArrayList<>();
Process proc = spawnAssumingCommandPresent("tar", "Oxf", "-", path);
BufferedReader reader = readFromProcess(proc);
OutputStream out = proc.getOutputStream();

2
org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit/pgm/ConfigTest.java

@ -73,7 +73,7 @@ public class ConfigTest extends CLIRepositoryTestCase {
.equals("Mac OS X");
String[] output = execute("git config --list");
List<String> expect = new ArrayList<String>();
List<String> expect = new ArrayList<>();
expect.add("core.filemode=" + !isWindows);
expect.add("core.logallrefupdates=true");
if (isMac)

2
org.eclipse.jgit.pgm/.settings/org.eclipse.jdt.core.prefs

@ -76,7 +76,7 @@ org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore
org.eclipse.jdt.core.compiler.problem.rawTypeReference=ignore
org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning
org.eclipse.jdt.core.compiler.problem.redundantNullCheck=warning
org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=ignore
org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=warning
org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=error
org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore

2
org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Add.java

@ -58,7 +58,7 @@ class Add extends TextBuiltin {
private boolean update = false;
@Argument(required = true, metaVar = "metaVar_filepattern", usage = "usage_filesToAddContentFrom")
private List<String> filepatterns = new ArrayList<String>();
private List<String> filepatterns = new ArrayList<>();
@Override
protected void run() throws Exception {

6
org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Blame.java

@ -114,7 +114,7 @@ class Blame extends TextBuiltin {
private String rangeString;
@Option(name = "--reverse", metaVar = "metaVar_blameReverse", usage = "usage_blameReverse")
private List<RevCommit> reverseRange = new ArrayList<RevCommit>(2);
private List<RevCommit> reverseRange = new ArrayList<>(2);
@Argument(index = 0, required = false, metaVar = "metaVar_revision")
private String revision;
@ -124,7 +124,7 @@ class Blame extends TextBuiltin {
private ObjectReader reader;
private final Map<RevCommit, String> abbreviatedCommits = new HashMap<RevCommit, String>();
private final Map<RevCommit, String> abbreviatedCommits = new HashMap<>();
private SimpleDateFormat dateFmt;
@ -163,7 +163,7 @@ class Blame extends TextBuiltin {
if (!reverseRange.isEmpty()) {
RevCommit rangeStart = null;
List<RevCommit> rangeEnd = new ArrayList<RevCommit>(2);
List<RevCommit> rangeEnd = new ArrayList<>(2);
for (RevCommit c : reverseRange) {
if (c.has(RevFlag.UNINTERESTING))
rangeStart = c;

2
org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Branch.java

@ -149,7 +149,7 @@ class Branch extends TextBuiltin {
@Argument(metaVar = "metaVar_name")
private String branch;
private final Map<String, Ref> printRefs = new LinkedHashMap<String, Ref>();
private final Map<String, Ref> printRefs = new LinkedHashMap<>();
/** Only set for verbose branch listing at-the-moment */
private RevWalk rw;

2
org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Checkout.java

@ -78,7 +78,7 @@ class Checkout extends TextBuiltin {
private String name;
@Option(name = "--", metaVar = "metaVar_paths", multiValued = true, handler = RestOfArgumentsHandler.class)
private List<String> paths = new ArrayList<String>();
private List<String> paths = new ArrayList<>();
@Override
protected void run() throws Exception {

4
org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/CommandCatalog.java

@ -100,7 +100,7 @@ public class CommandCatalog {
* @return all common commands, sorted by command name.
*/
public static CommandRef[] common() {
final ArrayList<CommandRef> common = new ArrayList<CommandRef>();
final ArrayList<CommandRef> common = new ArrayList<>();
for (final CommandRef c : INSTANCE.commands.values())
if (c.isCommon())
common.add(c);
@ -124,7 +124,7 @@ public class CommandCatalog {
private CommandCatalog() {
ldr = Thread.currentThread().getContextClassLoader();
commands = new HashMap<String, CommandRef>();
commands = new HashMap<>();
final Enumeration<URL> catalogs = catalogs();
while (catalogs.hasMoreElements())

2
org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Commit.java

@ -75,7 +75,7 @@ class Commit extends TextBuiltin {
private boolean amend;
@Argument(metaVar = "metaVar_commitPaths", usage = "usage_CommitPaths")
private List<String> paths = new ArrayList<String>();
private List<String> paths = new ArrayList<>();
@Override
protected void run() throws NoHeadException, NoMessageException,

12
org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Daemon.java

@ -87,16 +87,16 @@ class Daemon extends TextBuiltin {
int timeout = -1;
@Option(name = "--enable", metaVar = "metaVar_service", usage = "usage_enableTheServiceInAllRepositories", multiValued = true)
final List<String> enable = new ArrayList<String>();
final List<String> enable = new ArrayList<>();
@Option(name = "--disable", metaVar = "metaVar_service", usage = "usage_disableTheServiceInAllRepositories", multiValued = true)
final List<String> disable = new ArrayList<String>();
final List<String> disable = new ArrayList<>();
@Option(name = "--allow-override", metaVar = "metaVar_service", usage = "usage_configureTheServiceInDaemonServicename", multiValued = true)
final List<String> canOverride = new ArrayList<String>();
final List<String> canOverride = new ArrayList<>();
@Option(name = "--forbid-override", metaVar = "metaVar_service", usage = "usage_configureTheServiceInDaemonServicename", multiValued = true)
final List<String> forbidOverride = new ArrayList<String>();
final List<String> forbidOverride = new ArrayList<>();
@Option(name = "--export-all", usage = "usage_exportWithoutGitDaemonExportOk")
boolean exportAll;
@ -109,7 +109,7 @@ class Daemon extends TextBuiltin {
}
@Argument(required = true, metaVar = "metaVar_directory", usage = "usage_directoriesToExport")
final List<File> directory = new ArrayList<File>();
final List<File> directory = new ArrayList<>();
@Override
protected boolean requiresRepository() {
@ -139,7 +139,7 @@ class Daemon extends TextBuiltin {
if (1 < threads)
packConfig.setExecutor(Executors.newFixedThreadPool(threads));
final FileResolver<DaemonClient> resolver = new FileResolver<DaemonClient>();
final FileResolver<DaemonClient> resolver = new FileResolver<>();
for (final File f : directory) {
outw.println(MessageFormat.format(CLIText.get().exporting, f.getAbsolutePath()));
resolver.exportDirectory(f);

2
org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/DiffTree.java

@ -67,7 +67,7 @@ class DiffTree extends TextBuiltin {
}
@Argument(index = 1, metaVar = "metaVar_treeish", required = true)
private final List<AbstractTreeIterator> trees = new ArrayList<AbstractTreeIterator>();
private final List<AbstractTreeIterator> trees = new ArrayList<>();
@Option(name = "--", metaVar = "metaVar_path", multiValued = true, handler = PathTreeFilterHandler.class)
private TreeFilter pathFilter = TreeFilter.ALL;

4
org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Log.java

@ -94,7 +94,7 @@ class Log extends RevWalkTextBuiltin {
@Option(name = "--no-standard-notes", usage = "usage_noShowStandardNotes")
private boolean noStandardNotes;
private List<String> additionalNoteRefs = new ArrayList<String>();
private List<String> additionalNoteRefs = new ArrayList<>();
@Option(name = "--show-notes", usage = "usage_showNotes", metaVar = "metaVar_ref")
void addAdditionalNoteRef(String notesRef) {
@ -204,7 +204,7 @@ class Log extends RevWalkTextBuiltin {
if (!noStandardNotes || !additionalNoteRefs.isEmpty()) {
createWalk();
noteMaps = new LinkedHashMap<String, NoteMap>();
noteMaps = new LinkedHashMap<>();
if (!noStandardNotes) {
addNoteMap(Constants.R_NOTES_COMMITS);
}

2
org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/LsRemote.java

@ -74,7 +74,7 @@ class LsRemote extends TextBuiltin {
protected void run() throws Exception {
LsRemoteCommand command = Git.lsRemoteRepository().setRemote(remote)
.setTimeout(timeout).setHeads(heads).setTags(tags);
TreeSet<Ref> refs = new TreeSet<Ref>(new Comparator<Ref>() {
TreeSet<Ref> refs = new TreeSet<>(new Comparator<Ref>() {
@Override
public int compare(Ref r1, Ref r2) {

2
org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/LsTree.java

@ -68,7 +68,7 @@ class LsTree extends TextBuiltin {
@Argument(index = 1)
@Option(name = "--", metaVar = "metaVar_paths", multiValued = true, handler = StopOptionHandler.class)
private List<String> paths = new ArrayList<String>();
private List<String> paths = new ArrayList<>();
@Override
protected void run() throws Exception {

2
org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Main.java

@ -91,7 +91,7 @@ public class Main {
private TextBuiltin subcommand;
@Argument(index = 1, metaVar = "metaVar_arg")
private List<String> arguments = new ArrayList<String>();
private List<String> arguments = new ArrayList<>();
PrintWriter writer;

2
org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/MergeBase.java

@ -63,7 +63,7 @@ class MergeBase extends TextBuiltin {
}
@Argument(index = 1, metaVar = "metaVar_commitish", required = true)
private final List<RevCommit> commits = new ArrayList<RevCommit>();
private final List<RevCommit> commits = new ArrayList<>();
@Override
protected void run() throws Exception {

2
org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Push.java

@ -77,7 +77,7 @@ class Push extends TextBuiltin {
private String remote = Constants.DEFAULT_REMOTE_NAME;
@Argument(index = 1, metaVar = "metaVar_refspec")
private final List<RefSpec> refSpecs = new ArrayList<RefSpec>();
private final List<RefSpec> refSpecs = new ArrayList<>();
@Option(name = "--all")
private boolean all;

2
org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/RevParse.java

@ -68,7 +68,7 @@ class RevParse extends TextBuiltin {
boolean verify;
@Argument(index = 0, metaVar = "metaVar_commitish")
private final List<ObjectId> commits = new ArrayList<ObjectId>();
private final List<ObjectId> commits = new ArrayList<>();
@Override
protected void run() throws Exception {

4
org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/RevWalkTextBuiltin.java

@ -124,12 +124,12 @@ abstract class RevWalkTextBuiltin extends TextBuiltin {
private String followPath;
@Argument(index = 0, metaVar = "metaVar_commitish")
private final List<RevCommit> commits = new ArrayList<RevCommit>();
private final List<RevCommit> commits = new ArrayList<>();
@Option(name = "--", metaVar = "metaVar_path", multiValued = true, handler = PathTreeFilterHandler.class)
protected TreeFilter pathFilter = TreeFilter.ALL;
private final List<RevFilter> revLimiter = new ArrayList<RevFilter>();
private final List<RevFilter> revLimiter = new ArrayList<>();
@Option(name = "--author")
void addAuthorRevFilter(final String who) {

2
org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Rm.java

@ -58,7 +58,7 @@ class Rm extends TextBuiltin {
@Argument(metaVar = "metaVar_path", usage = "usage_path", multiValued = true, required = true)
@Option(name = "--", handler = StopOptionHandler.class)
private List<String> paths = new ArrayList<String>();
private List<String> paths = new ArrayList<>();
@Override

14
org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Status.java

@ -117,7 +117,7 @@ class Status extends TextBuiltin {
Map<String, StageState> conflicting = status.getConflictingStageState();
// build a sorted list of all paths except untracked and ignored
TreeSet<String> sorted = new TreeSet<String>();
TreeSet<String> sorted = new TreeSet<>();
sorted.addAll(added);
sorted.addAll(changed);
sorted.addAll(removed);
@ -185,7 +185,7 @@ class Status extends TextBuiltin {
// untracked are always at the end of the list
if ("all".equals(untrackedFilesMode)) { //$NON-NLS-1$
TreeSet<String> untracked = new TreeSet<String>(
TreeSet<String> untracked = new TreeSet<>(
status.getUntracked());
for (String path : untracked)
printPorcelainLine('?', '?', path);
@ -221,7 +221,7 @@ class Status extends TextBuiltin {
Collection<String> untracked = status.getUntracked();
Map<String, StageState> unmergedStates = status
.getConflictingStageState();
Collection<String> toBeCommitted = new ArrayList<String>(added);
Collection<String> toBeCommitted = new ArrayList<>(added);
toBeCommitted.addAll(changed);
toBeCommitted.addAll(removed);
int nbToBeCommitted = toBeCommitted.size();
@ -232,7 +232,7 @@ class Status extends TextBuiltin {
toBeCommitted, added, changed, removed);
firstHeader = false;
}
Collection<String> notStagedForCommit = new ArrayList<String>(modified);
Collection<String> notStagedForCommit = new ArrayList<>(modified);
notStagedForCommit.addAll(missing);
int nbNotStagedForCommit = notStagedForCommit.size();
if (nbNotStagedForCommit > 0) {
@ -274,7 +274,7 @@ class Status extends TextBuiltin {
protected int printList(Collection<String> list) throws IOException {
if (!list.isEmpty()) {
List<String> sortedList = new ArrayList<String>(list);
List<String> sortedList = new ArrayList<>(list);
java.util.Collections.sort(sortedList);
for (String filename : sortedList) {
outw.println(CLIText.formatLine(String.format(
@ -291,7 +291,7 @@ class Status extends TextBuiltin {
Collection<String> set2,
@SuppressWarnings("unused") Collection<String> set3)
throws IOException {
List<String> sortedList = new ArrayList<String>(list);
List<String> sortedList = new ArrayList<>(list);
java.util.Collections.sort(sortedList);
for (String filename : sortedList) {
String prefix;
@ -311,7 +311,7 @@ class Status extends TextBuiltin {
private void printUnmerged(Map<String, StageState> unmergedStates)
throws IOException {
List<String> paths = new ArrayList<String>(unmergedStates.keySet());
List<String> paths = new ArrayList<>(unmergedStates.keySet());
Collections.sort(paths);
for (String path : paths) {
StageState state = unmergedStates.get(path);

6
org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/DiffAlgorithms.java

@ -115,13 +115,13 @@ class DiffAlgorithms extends TextBuiltin {
//
@Option(name = "--algorithm", multiValued = true, metaVar = "NAME", usage = "Enable algorithm(s)")
List<String> algorithms = new ArrayList<String>();
List<String> algorithms = new ArrayList<>();
@Option(name = "--text-limit", metaVar = "LIMIT", usage = "Maximum size in KiB to scan per file revision")
int textLimit = 15 * 1024; // 15 MiB as later we do * 1024.
@Option(name = "--repository", aliases = { "-r" }, multiValued = true, metaVar = "GIT_DIR", usage = "Repository to scan")
List<File> gitDirs = new ArrayList<File>();
List<File> gitDirs = new ArrayList<>();
@Option(name = "--count", metaVar = "LIMIT", usage = "Number of file revisions to be compared")
int count = 0; // unlimited
@ -324,7 +324,7 @@ class DiffAlgorithms extends TextBuiltin {
}
private List<Test> init() {
List<Test> all = new ArrayList<Test>();
List<Test> all = new ArrayList<>();
try {
for (Field f : DiffAlgorithms.class.getDeclaredFields()) {

10
org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/RebuildCommitGraph.java

@ -112,7 +112,7 @@ class RebuildCommitGraph extends TextBuiltin {
private final ProgressMonitor pm = new TextProgressMonitor(errw);
private Map<ObjectId, ObjectId> rewrites = new HashMap<ObjectId, ObjectId>();
private Map<ObjectId, ObjectId> rewrites = new HashMap<>();
@Override
protected void run() throws Exception {
@ -137,8 +137,8 @@ class RebuildCommitGraph extends TextBuiltin {
}
private void recreateCommitGraph() throws IOException {
final Map<ObjectId, ToRewrite> toRewrite = new HashMap<ObjectId, ToRewrite>();
List<ToRewrite> queue = new ArrayList<ToRewrite>();
final Map<ObjectId, ToRewrite> toRewrite = new HashMap<>();
List<ToRewrite> queue = new ArrayList<>();
try (RevWalk rw = new RevWalk(db);
final BufferedReader br = new BufferedReader(
new InputStreamReader(new FileInputStream(graph),
@ -176,7 +176,7 @@ class RebuildCommitGraph extends TextBuiltin {
while (!queue.isEmpty()) {
final ListIterator<ToRewrite> itr = queue
.listIterator(queue.size());
queue = new ArrayList<ToRewrite>();
queue = new ArrayList<>();
REWRITE: while (itr.hasPrevious()) {
final ToRewrite t = itr.previous();
final ObjectId[] newParents = new ObjectId[t.oldParents.length];
@ -278,7 +278,7 @@ class RebuildCommitGraph extends TextBuiltin {
}
private Map<String, Ref> computeNewRefs() throws IOException {
final Map<String, Ref> refs = new HashMap<String, Ref>();
final Map<String, Ref> refs = new HashMap<>();
try (RevWalk rw = new RevWalk(db);
BufferedReader br = new BufferedReader(
new InputStreamReader(new FileInputStream(refList),

14
org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/TextHashFunctions.java

@ -251,16 +251,16 @@ class TextHashFunctions extends TextBuiltin {
//
@Option(name = "--hash", multiValued = true, metaVar = "NAME", usage = "Enable hash function(s)")
List<String> hashFunctions = new ArrayList<String>();
List<String> hashFunctions = new ArrayList<>();
@Option(name = "--fold", multiValued = true, metaVar = "NAME", usage = "Enable fold function(s)")
List<String> foldFunctions = new ArrayList<String>();
List<String> foldFunctions = new ArrayList<>();
@Option(name = "--text-limit", metaVar = "LIMIT", usage = "Maximum size in KiB to scan")
int textLimit = 15 * 1024; // 15 MiB as later we do * 1024.
@Option(name = "--repository", aliases = { "-r" }, multiValued = true, metaVar = "GIT_DIR", usage = "Repository to scan")
List<File> gitDirs = new ArrayList<File>();
List<File> gitDirs = new ArrayList<>();
@Override
protected boolean requiresRepository() {
@ -327,7 +327,7 @@ class TextHashFunctions extends TextBuiltin {
RawText txt = new RawText(raw);
int[] lines = new int[txt.size()];
int cnt = 0;
HashSet<Line> u = new HashSet<Line>();
HashSet<Line> u = new HashSet<>();
for (int i = 0; i < txt.size(); i++) {
if (u.add(new Line(txt, i)))
lines[cnt++] = i;
@ -386,8 +386,8 @@ class TextHashFunctions extends TextBuiltin {
}
private List<Function> init() {
List<Hash> hashes = new ArrayList<Hash>();
List<Fold> folds = new ArrayList<Fold>();
List<Hash> hashes = new ArrayList<>();
List<Fold> folds = new ArrayList<>();
try {
for (Field f : TextHashFunctions.class.getDeclaredFields()) {
@ -410,7 +410,7 @@ class TextHashFunctions extends TextBuiltin {
throw new RuntimeException("Cannot determine names", e); //$NON-NLS-1$
}
List<Function> all = new ArrayList<Function>();
List<Function> all = new ArrayList<>();
for (Hash cmp : hashes) {
if (include(cmp.name, hashFunctions)) {
for (Fold f : folds) {

2
org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/opt/CmdLineParser.java

@ -141,7 +141,7 @@ public class CmdLineParser extends org.kohsuke.args4j.CmdLineParser {
@Override
public void parseArgument(final String... args) throws CmdLineException {
final ArrayList<String> tmp = new ArrayList<String>(args.length);
final ArrayList<String> tmp = new ArrayList<>(args.length);
for (int argi = 0; argi < args.length; argi++) {
final String str = args[argi];
if (str.equals("--")) { //$NON-NLS-1$

2
org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/opt/PathTreeFilterHandler.java

@ -81,7 +81,7 @@ public class PathTreeFilterHandler extends OptionHandler<TreeFilter> {
@Override
public int parseArguments(final Parameters params) throws CmdLineException {
final List<PathFilter> filters = new ArrayList<PathFilter>();
final List<PathFilter> filters = new ArrayList<>();
for (int idx = 0;; idx++) {
final String path;
try {

2
org.eclipse.jgit.test/.settings/org.eclipse.jdt.core.prefs

@ -76,7 +76,7 @@ org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore
org.eclipse.jdt.core.compiler.problem.rawTypeReference=ignore
org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning
org.eclipse.jdt.core.compiler.problem.redundantNullCheck=warning
org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=ignore
org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=warning
org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=error
org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore

6
org.eclipse.jgit.test/exttst/org/eclipse/jgit/patch/EGitPatchHistoryTest.java

@ -89,7 +89,7 @@ public class EGitPatchHistoryTest {
super(new String[] { "-p" });
stats = s;
offBy1 = new HashSet<String>();
offBy1 = new HashSet<>();
offBy1.add("9bda5ece6806cd797416eaa47c7b927cc6e9c3b2");
}
@ -158,7 +158,7 @@ public class EGitPatchHistoryTest {
}
static class NumStatReader extends CommitReader {
final HashMap<String, HashMap<String, StatInfo>> stats = new HashMap<String, HashMap<String, StatInfo>>();
final HashMap<String, HashMap<String, StatInfo>> stats = new HashMap<>();
NumStatReader() throws IOException {
super(new String[] { "--numstat" });
@ -166,7 +166,7 @@ public class EGitPatchHistoryTest {
@Override
void onCommit(String commitId, byte[] buf) {
final HashMap<String, StatInfo> files = new HashMap<String, StatInfo>();
final HashMap<String, StatInfo> files = new HashMap<>();
final MutableInteger ptr = new MutableInteger();
while (ptr.value < buf.length) {
if (buf[ptr.value] == '\n')

2
org.eclipse.jgit.test/src/org/eclipse/jgit/lib/Sets.java

@ -49,7 +49,7 @@ import java.util.Set;
public class Sets {
@SafeVarargs
public static <T> Set<T> of(T... elements) {
Set<T> ret = new HashSet<T>();
Set<T> ret = new HashSet<>();
for (T element : elements)
ret.add(element);
return ret;

2
org.eclipse.jgit.test/tst/org/eclipse/jgit/api/ArchiveCommandTest.java

@ -192,7 +192,7 @@ public class ArchiveCommandTest extends RepositoryTestCase {
private class MockFormat implements ArchiveCommand.Format<MockOutputStream> {
private Map<String, String> entries = new HashMap<String, String>();
private Map<String, String> entries = new HashMap<>();
private int size() {
return entries.size();

2
org.eclipse.jgit.test/tst/org/eclipse/jgit/api/CleanCommandTest.java

@ -144,7 +144,7 @@ public class CleanCommandTest extends RepositoryTestCase {
assertTrue(files.size() > 0);
// run clean with setPaths
Set<String> paths = new TreeSet<String>();
Set<String> paths = new TreeSet<>();
paths.add("File3.txt");
Set<String> cleanedFiles = git.clean().setPaths(paths).call();

2
org.eclipse.jgit.test/tst/org/eclipse/jgit/api/CloneCommandTest.java

@ -88,7 +88,7 @@ public class CloneCommandTest extends RepositoryTestCase {
@Override
public void setUp() throws Exception {
super.setUp();
tr = new TestRepository<Repository>(db);
tr = new TestRepository<>(db);
git = new Git(db);
// commit something

6
org.eclipse.jgit.test/tst/org/eclipse/jgit/api/LogCommandTest.java

@ -62,7 +62,7 @@ public class LogCommandTest extends RepositoryTestCase {
@Test
public void logAllCommits() throws Exception {
List<RevCommit> commits = new ArrayList<RevCommit>();
List<RevCommit> commits = new ArrayList<>();
Git git = Git.wrap(db);
writeTrashFile("Test.txt", "Hello world");
@ -94,7 +94,7 @@ public class LogCommandTest extends RepositoryTestCase {
@Test
public void logAllCommitsWithTag() throws Exception {
List<RevCommit> commits = new ArrayList<RevCommit>();
List<RevCommit> commits = new ArrayList<>();
Git git = Git.wrap(db);
writeTrashFile("Test.txt", "Hello world");
@ -123,7 +123,7 @@ public class LogCommandTest extends RepositoryTestCase {
}
private List<RevCommit> createCommits(Git git) throws Exception {
List<RevCommit> commits = new ArrayList<RevCommit>();
List<RevCommit> commits = new ArrayList<>();
writeTrashFile("Test.txt", "Hello world");
git.add().addFilepattern("Test.txt").call();
commits.add(git.commit().setMessage("commit#1").call());

2
org.eclipse.jgit.test/tst/org/eclipse/jgit/api/MergeCommandTest.java

@ -1556,7 +1556,7 @@ public class MergeCommandTest extends RepositoryTestCase {
@Test
public void testRecursiveMergeWithConflict() throws Exception {
TestRepository<Repository> db_t = new TestRepository<Repository>(db);
TestRepository<Repository> db_t = new TestRepository<>(db);
BranchBuilder master = db_t.branch("master");
RevCommit m0 = master.commit().add("f", "1\n2\n3\n4\n5\n6\n7\n8\n9\n")
.message("m0").create();

2
org.eclipse.jgit.test/tst/org/eclipse/jgit/api/NameRevCommandTest.java

@ -64,7 +64,7 @@ public class NameRevCommandTest extends RepositoryTestCase {
@Before
public void setUp() throws Exception {
super.setUp();
tr = new TestRepository<Repository>(db);
tr = new TestRepository<>(db);
git = new Git(db);
}

6
org.eclipse.jgit.test/tst/org/eclipse/jgit/attributes/TreeWalkAttributeTest.java

@ -204,7 +204,7 @@ public class TreeWalkAttributeTest extends RepositoryTestCase {
@Test
public void testIndexOnly() throws IOException, NoFilepatternException,
GitAPIException {
List<File> attrFiles = new ArrayList<File>();
List<File> attrFiles = new ArrayList<>();
attrFiles.add(writeGlobalAttributeFile("globalAttributesFile",
"*.txt -custom2"));
attrFiles.add(writeAttributesFile(".git/info/attributes",
@ -813,7 +813,7 @@ public class TreeWalkAttributeTest extends RepositoryTestCase {
}
private static Set<Attribute> asSet(Collection<Attribute> attributes) {
Set<Attribute> ret = new HashSet<Attribute>();
Set<Attribute> ret = new HashSet<>();
for (Attribute a : attributes) {
ret.add(a);
}
@ -853,7 +853,7 @@ public class TreeWalkAttributeTest extends RepositoryTestCase {
}
static Set<Attribute> asSet(Attribute... attrs) {
HashSet<Attribute> result = new HashSet<Attribute>();
HashSet<Attribute> result = new HashSet<>();
for (Attribute attr : attrs)
result.add(attr);
return result;

2
org.eclipse.jgit.test/tst/org/eclipse/jgit/diff/DiffFormatterTest.java

@ -89,7 +89,7 @@ public class DiffFormatterTest extends RepositoryTestCase {
@Before
public void setUp() throws Exception {
super.setUp();
testDb = new TestRepository<Repository>(db);
testDb = new TestRepository<>(db);
df = new DiffFormatter(DisabledOutputStream.INSTANCE);
df.setRepository(db);
df.setAbbreviationLength(8);

2
org.eclipse.jgit.test/tst/org/eclipse/jgit/diff/RenameDetectorTest.java

@ -75,7 +75,7 @@ public class RenameDetectorTest extends RepositoryTestCase {
@Before
public void setUp() throws Exception {
super.setUp();
testDb = new TestRepository<Repository>(db);
testDb = new TestRepository<>(db);
rd = new RenameDetector(db);
}

6
org.eclipse.jgit.test/tst/org/eclipse/jgit/dircache/DirCacheCGitCompatabilityTest.java vendored

@ -178,7 +178,7 @@ public class DirCacheCGitCompatabilityTest extends LocalDiskRepositoryTestCase {
.getObjectId());
assertEquals(cList.size(), jTree.getEntrySpan());
final ArrayList<CGitLsTreeRecord> subtrees = new ArrayList<CGitLsTreeRecord>();
final ArrayList<CGitLsTreeRecord> subtrees = new ArrayList<>();
for (final CGitLsTreeRecord r : cTree.values()) {
if (FileMode.TREE.equals(r.mode))
subtrees.add(r);
@ -233,7 +233,7 @@ public class DirCacheCGitCompatabilityTest extends LocalDiskRepositoryTestCase {
}
private static Map<String, CGitIndexRecord> readLsFiles() throws Exception {
final LinkedHashMap<String, CGitIndexRecord> r = new LinkedHashMap<String, CGitIndexRecord>();
final LinkedHashMap<String, CGitIndexRecord> r = new LinkedHashMap<>();
final BufferedReader br = new BufferedReader(new InputStreamReader(
new FileInputStream(pathOf("gitgit.lsfiles")), "UTF-8"));
try {
@ -249,7 +249,7 @@ public class DirCacheCGitCompatabilityTest extends LocalDiskRepositoryTestCase {
}
private static Map<String, CGitLsTreeRecord> readLsTree() throws Exception {
final LinkedHashMap<String, CGitLsTreeRecord> r = new LinkedHashMap<String, CGitLsTreeRecord>();
final LinkedHashMap<String, CGitLsTreeRecord> r = new LinkedHashMap<>();
final BufferedReader br = new BufferedReader(new InputStreamReader(
new FileInputStream(pathOf("gitgit.lstree")), "UTF-8"));
try {

2
org.eclipse.jgit.test/tst/org/eclipse/jgit/dircache/DirCachePathEditTest.java vendored

@ -72,7 +72,7 @@ public class DirCachePathEditTest {
}
private static final class RecordingEdit extends PathEdit {
final List<DirCacheEntry> entries = new ArrayList<DirCacheEntry>();
final List<DirCacheEntry> entries = new ArrayList<>();
public RecordingEdit(String entryPath) {
super(entryPath);

2
org.eclipse.jgit.test/tst/org/eclipse/jgit/gitrepo/ManifestParserTest.java

@ -57,7 +57,7 @@ public class ManifestParserTest {
public void testManifestParser() throws Exception {
String baseUrl = "https://git.google.com/";
StringBuilder xmlContent = new StringBuilder();
Set<String> results = new HashSet<String>();
Set<String> results = new HashSet<>();
xmlContent.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n")
.append("<manifest>")
.append("<remote name=\"remote1\" fetch=\".\" />")

2
org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/dfs/DfsInserterTest.java

@ -206,7 +206,7 @@ public class DfsInserterTest {
// Verify that we have a foo in both packs, and 1 of them is garbage.
DfsReader reader = new DfsReader(db.getObjectDatabase());
DfsPackFile packs[] = db.getObjectDatabase().getPacks();
Set<PackSource> pack_sources = new HashSet<PackSource>();
Set<PackSource> pack_sources = new HashSet<>();
assertEquals(2, packs.length);

4
org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/AbbreviationTest.java

@ -87,7 +87,7 @@ public class AbbreviationTest extends LocalDiskRepositoryTestCase {
super.setUp();
db = createBareRepository();
reader = db.newObjectReader();
test = new TestRepository<Repository>(db);
test = new TestRepository<>(db);
}
@Override
@ -171,7 +171,7 @@ public class AbbreviationTest extends LocalDiskRepositoryTestCase {
ObjectId id = id("9d5b926ed164e8ee88d3b8b1e525d699adda01ba");
byte[] idBuf = toByteArray(id);
List<PackedObjectInfo> objects = new ArrayList<PackedObjectInfo>();
List<PackedObjectInfo> objects = new ArrayList<>();
for (int i = 0; i < 256; i++) {
idBuf[9] = (byte) i;
objects.add(new PackedObjectInfo(ObjectId.fromRaw(idBuf)));

2
org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/FileSnapshotTest.java

@ -57,7 +57,7 @@ import org.junit.Test;
public class FileSnapshotTest {
private List<File> files = new ArrayList<File>();
private List<File> files = new ArrayList<>();
private File trash;

2
org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/GcTestCase.java

@ -67,7 +67,7 @@ public abstract class GcTestCase extends LocalDiskRepositoryTestCase {
public void setUp() throws Exception {
super.setUp();
repo = createWorkRepository();
tr = new TestRepository<FileRepository>(repo, new RevWalk(repo),
tr = new TestRepository<>(repo, new RevWalk(repo),
mockSystemReader);
gc = new GC(repo);
}

4
org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/PackFileTest.java

@ -117,7 +117,7 @@ public class PackFileTest extends LocalDiskRepositoryTestCase {
cfg.install();
repo = createBareRepository();
tr = new TestRepository<Repository>(repo);
tr = new TestRepository<>(repo);
wc = (WindowCursor) repo.newObjectReader();
}
@ -291,7 +291,7 @@ public class PackFileTest extends LocalDiskRepositoryTestCase {
f = new FileOutputStream(idxName);
try {
List<PackedObjectInfo> list = new ArrayList<PackedObjectInfo>();
List<PackedObjectInfo> list = new ArrayList<>();
list.add(a);
list.add(b);
Collections.sort(list);

18
org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/PackWriterTest.java

@ -469,7 +469,7 @@ public class PackWriterTest extends SampleDataRepositoryTestCase {
public void testDeltaStatistics() throws Exception {
config.setDeltaCompress(true);
FileRepository repo = createBareRepository();
TestRepository<FileRepository> testRepo = new TestRepository<FileRepository>(repo);
TestRepository<FileRepository> testRepo = new TestRepository<>(repo);
ArrayList<RevObject> blobs = new ArrayList<>();
blobs.add(testRepo.blob(genDeltableData(1000)));
blobs.add(testRepo.blob(genDeltableData(1005)));
@ -538,7 +538,7 @@ public class PackWriterTest extends SampleDataRepositoryTestCase {
public void testExclude() throws Exception {
FileRepository repo = createBareRepository();
TestRepository<FileRepository> testRepo = new TestRepository<FileRepository>(
TestRepository<FileRepository> testRepo = new TestRepository<>(
repo);
BranchBuilder bb = testRepo.branch("refs/heads/master");
contentA = testRepo.blob("A");
@ -663,7 +663,7 @@ public class PackWriterTest extends SampleDataRepositoryTestCase {
private FileRepository setupRepoForShallowFetch() throws Exception {
FileRepository repo = createBareRepository();
TestRepository<Repository> r = new TestRepository<Repository>(repo);
TestRepository<Repository> r = new TestRepository<>(repo);
BranchBuilder bb = r.branch("refs/heads/master");
contentA = r.blob("A");
contentB = r.blob("B");
@ -731,7 +731,7 @@ public class PackWriterTest extends SampleDataRepositoryTestCase {
// TODO: testWritePackDeltasDepth()
private void writeVerifyPack1() throws IOException {
final HashSet<ObjectId> interestings = new HashSet<ObjectId>();
final HashSet<ObjectId> interestings = new HashSet<>();
interestings.add(ObjectId
.fromString("82c6b885ff600be425b4ea96dee75dca255b69e7"));
createVerifyOpenPack(interestings, NONE, false, false);
@ -754,10 +754,10 @@ public class PackWriterTest extends SampleDataRepositoryTestCase {
private void writeVerifyPack2(boolean deltaReuse) throws IOException {
config.setReuseDeltas(deltaReuse);
final HashSet<ObjectId> interestings = new HashSet<ObjectId>();
final HashSet<ObjectId> interestings = new HashSet<>();
interestings.add(ObjectId
.fromString("82c6b885ff600be425b4ea96dee75dca255b69e7"));
final HashSet<ObjectId> uninterestings = new HashSet<ObjectId>();
final HashSet<ObjectId> uninterestings = new HashSet<>();
uninterestings.add(ObjectId
.fromString("540a36d136cf413e4b064c2b0e0a4db60f77feab"));
createVerifyOpenPack(interestings, uninterestings, false, false);
@ -786,10 +786,10 @@ public class PackWriterTest extends SampleDataRepositoryTestCase {
}
private void writeVerifyPack4(final boolean thin) throws IOException {
final HashSet<ObjectId> interestings = new HashSet<ObjectId>();
final HashSet<ObjectId> interestings = new HashSet<>();
interestings.add(ObjectId
.fromString("82c6b885ff600be425b4ea96dee75dca255b69e7"));
final HashSet<ObjectId> uninterestings = new HashSet<ObjectId>();
final HashSet<ObjectId> uninterestings = new HashSet<>();
uninterestings.add(ObjectId
.fromString("c59759f143fb1fe21c197981df75a7ee00290799"));
createVerifyOpenPack(interestings, uninterestings, thin, false);
@ -878,7 +878,7 @@ public class PackWriterTest extends SampleDataRepositoryTestCase {
}
private void verifyObjectsOrder(final ObjectId objectsOrder[]) {
final List<PackIndex.MutableEntry> entries = new ArrayList<PackIndex.MutableEntry>();
final List<PackIndex.MutableEntry> entries = new ArrayList<>();
for (MutableEntry me : pack) {
entries.add(me.cloneEntry());

8
org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/RefDirectoryTest.java

@ -108,7 +108,7 @@ public class RefDirectoryTest extends LocalDiskRepositoryTestCase {
diskRepo = createBareRepository();
refdir = (RefDirectory) diskRepo.getRefDatabase();
repo = new TestRepository<Repository>(diskRepo);
repo = new TestRepository<>(diskRepo);
A = repo.commit().create();
B = repo.commit(repo.getRevWalk().parseCommit(A));
v1_0 = repo.tag("v1_0", B);
@ -1023,7 +1023,7 @@ public class RefDirectoryTest extends LocalDiskRepositoryTestCase {
assertEquals(v0_1.getId(), all.get("refs/tags/v0.1").getObjectId());
all = refdir.getRefs(RefDatabase.ALL);
refdir.pack(new ArrayList<String>(all.keySet()));
refdir.pack(new ArrayList<>(all.keySet()));
all = refdir.getRefs(RefDatabase.ALL);
assertEquals(5, all.size());
@ -1267,8 +1267,8 @@ public class RefDirectoryTest extends LocalDiskRepositoryTestCase {
final RefDatabase refDb = newRepo.getRefDatabase();
File packedRefs = new File(newRepo.getDirectory(), "packed-refs");
assertTrue(packedRefs.createNewFile());
final AtomicReference<StackOverflowError> error = new AtomicReference<StackOverflowError>();
final AtomicReference<IOException> exception = new AtomicReference<IOException>();
final AtomicReference<StackOverflowError> error = new AtomicReference<>();
final AtomicReference<IOException> exception = new AtomicReference<>();
final AtomicInteger changeCount = new AtomicInteger();
newRepo.getListenerList().addRefsChangedListener(
new RefsChangedListener() {

2
org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/WindowCacheGetTest.java

@ -73,7 +73,7 @@ public class WindowCacheGetTest extends SampleDataRepositoryTestCase {
public void setUp() throws Exception {
super.setUp();
toLoad = new ArrayList<TestObject>();
toLoad = new ArrayList<>();
final BufferedReader br = new BufferedReader(new InputStreamReader(
new FileInputStream(JGitTestUtil
.getTestResourceFile("all_packed_objects.txt")),

2
org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/BranchTrackingStatusTest.java

@ -60,7 +60,7 @@ public class BranchTrackingStatusTest extends RepositoryTestCase {
@Override
public void setUp() throws Exception {
super.setUp();
util = new TestRepository<Repository>(db);
util = new TestRepository<>(db);
StoredConfig config = util.getRepository().getConfig();
config.setString(ConfigConstants.CONFIG_BRANCH_SECTION, "master",
ConfigConstants.CONFIG_KEY_REMOTE, "origin");

2
org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ConfigTest.java

@ -139,7 +139,7 @@ public class ConfigTest {
@Test
public void test005_PutGetStringList() {
Config c = new Config();
final LinkedList<String> values = new LinkedList<String>();
final LinkedList<String> values = new LinkedList<>();
values.add("value1");
values.add("value2");
c.setStringList("my", null, "somename", values);

12
org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/DirCacheCheckoutTest.java

@ -130,7 +130,7 @@ public class DirCacheCheckoutTest extends RepositoryTestCase {
if ((args.length % 2) > 0)
throw new IllegalArgumentException("needs to be pairs");
HashMap<String, String> map = new HashMap<String, String>();
HashMap<String, String> map = new HashMap<>();
for (int i = 0; i < args.length; i += 2) {
map.put(args[i], args[i + 1]);
}
@ -228,7 +228,7 @@ public class DirCacheCheckoutTest extends RepositoryTestCase {
@Test
public void testInitialCheckout() throws Exception {
try (Git git = new Git(db)) {
TestRepository<Repository> db_t = new TestRepository<Repository>(db);
TestRepository<Repository> db_t = new TestRepository<>(db);
BranchBuilder master = db_t.branch("master");
master.commit().add("f", "1").message("m0").create();
assertFalse(new File(db.getWorkTree(), "f").exists());
@ -377,7 +377,7 @@ public class DirCacheCheckoutTest extends RepositoryTestCase {
// rules 4 and 5
HashMap<String, String> idxMap;
idxMap = new HashMap<String, String>();
idxMap = new HashMap<>();
idxMap.put("foo", "foo");
setupCase(null, null, idxMap);
go();
@ -387,7 +387,7 @@ public class DirCacheCheckoutTest extends RepositoryTestCase {
assertTrue(getConflicts().isEmpty());
// rules 6 and 7
idxMap = new HashMap<String, String>();
idxMap = new HashMap<>();
idxMap.put("foo", "foo");
setupCase(null, idxMap, idxMap);
go();
@ -396,7 +396,7 @@ public class DirCacheCheckoutTest extends RepositoryTestCase {
// rules 8 and 9
HashMap<String, String> mergeMap;
mergeMap = new HashMap<String, String>();
mergeMap = new HashMap<>();
mergeMap.put("foo", "merge");
setupCase(null, mergeMap, idxMap);
@ -408,7 +408,7 @@ public class DirCacheCheckoutTest extends RepositoryTestCase {
// rule 10
HashMap<String, String> headMap = new HashMap<String, String>();
HashMap<String, String> headMap = new HashMap<>();
headMap.put("foo", "foo");
setupCase(headMap, null, idxMap);
go();

16
org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/IndexDiffTest.java

@ -210,7 +210,7 @@ public class IndexDiffTest extends RepositoryTestCase {
diff.diff();
assertEquals("[b]",
new TreeSet<String>(diff.getChanged()).toString());
new TreeSet<>(diff.getChanged()).toString());
assertEquals("[]", diff.getAdded().toString());
assertEquals("[]", diff.getRemoved().toString());
assertEquals("[]", diff.getMissing().toString());
@ -251,7 +251,7 @@ public class IndexDiffTest extends RepositoryTestCase {
IndexDiff diff = new IndexDiff(db, Constants.HEAD, iterator);
diff.diff();
assertEquals("[]", new TreeSet<String>(diff.getChanged()).toString());
assertEquals("[]", new TreeSet<>(diff.getChanged()).toString());
assertEquals("[]", diff.getAdded().toString());
assertEquals("[]", diff.getRemoved().toString());
assertEquals("[]", diff.getMissing().toString());
@ -291,7 +291,7 @@ public class IndexDiffTest extends RepositoryTestCase {
IndexDiff diff = new IndexDiff(db, Constants.HEAD, iterator);
diff.diff();
assertEquals("[]", new TreeSet<String>(diff.getChanged()).toString());
assertEquals("[]", new TreeSet<>(diff.getChanged()).toString());
assertEquals("[]", diff.getAdded().toString());
assertEquals("[]", diff.getRemoved().toString());
assertEquals("[]", diff.getMissing().toString());
@ -444,7 +444,7 @@ public class IndexDiffTest extends RepositoryTestCase {
diff = new IndexDiff(db, Constants.HEAD,
new FileTreeIterator(db));
diff.diff();
assertEquals(new HashSet<String>(Arrays.asList("target")),
assertEquals(new HashSet<>(Arrays.asList("target")),
diff.getUntrackedFolders());
writeTrashFile("src/tst/A.java", "");
@ -452,7 +452,7 @@ public class IndexDiffTest extends RepositoryTestCase {
diff = new IndexDiff(db, Constants.HEAD, new FileTreeIterator(db));
diff.diff();
assertEquals(new HashSet<String>(Arrays.asList("target", "src/tst")),
assertEquals(new HashSet<>(Arrays.asList("target", "src/tst")),
diff.getUntrackedFolders());
git.rm().addFilepattern("src/com/B.java").addFilepattern("src/org")
@ -463,7 +463,7 @@ public class IndexDiffTest extends RepositoryTestCase {
diff = new IndexDiff(db, Constants.HEAD, new FileTreeIterator(db));
diff.diff();
assertEquals(
new HashSet<String>(Arrays.asList("src/org", "src/tst",
new HashSet<>(Arrays.asList("src/org", "src/tst",
"target")),
diff.getUntrackedFolders());
}
@ -497,7 +497,7 @@ public class IndexDiffTest extends RepositoryTestCase {
diff = new IndexDiff(db, Constants.HEAD, new FileTreeIterator(db));
diff.diff();
assertEquals(new HashSet<String>(Arrays.asList("src")),
assertEquals(new HashSet<>(Arrays.asList("src")),
diff.getUntrackedFolders());
git.add().addFilepattern("src").call();
@ -510,7 +510,7 @@ public class IndexDiffTest extends RepositoryTestCase {
diff = new IndexDiff(db, Constants.HEAD, new FileTreeIterator(db));
diff.diff();
assertEquals(
new HashSet<String>(Arrays.asList("srcs/com", "sr", "src/tst",
new HashSet<>(Arrays.asList("srcs/com", "sr", "src/tst",
"target")),
diff.getUntrackedFolders());
}

14
org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ObjectIdOwnerMapTest.java

@ -73,7 +73,7 @@ public class ObjectIdOwnerMapTest {
@Test
public void testEmptyMap() {
ObjectIdOwnerMap<SubId> m = new ObjectIdOwnerMap<SubId>();
ObjectIdOwnerMap<SubId> m = new ObjectIdOwnerMap<>();
assertTrue(m.isEmpty());
assertEquals(0, m.size());
@ -86,7 +86,7 @@ public class ObjectIdOwnerMapTest {
@Test
public void testAddGetAndContains() {
ObjectIdOwnerMap<SubId> m = new ObjectIdOwnerMap<SubId>();
ObjectIdOwnerMap<SubId> m = new ObjectIdOwnerMap<>();
m.add(id_1);
m.add(id_2);
m.add(id_3);
@ -108,7 +108,7 @@ public class ObjectIdOwnerMapTest {
@Test
public void testClear() {
ObjectIdOwnerMap<SubId> m = new ObjectIdOwnerMap<SubId>();
ObjectIdOwnerMap<SubId> m = new ObjectIdOwnerMap<>();
m.add(id_1);
assertSame(id_1, m.get(id_1));
@ -126,7 +126,7 @@ public class ObjectIdOwnerMapTest {
@Test
public void testAddIfAbsent() {
ObjectIdOwnerMap<SubId> m = new ObjectIdOwnerMap<SubId>();
ObjectIdOwnerMap<SubId> m = new ObjectIdOwnerMap<>();
m.add(id_1);
assertSame(id_1, m.addIfAbsent(new SubId(id_1)));
@ -145,7 +145,7 @@ public class ObjectIdOwnerMapTest {
@Test
public void testAddGrowsWithObjects() {
int n = 16384;
ObjectIdOwnerMap<SubId> m = new ObjectIdOwnerMap<SubId>();
ObjectIdOwnerMap<SubId> m = new ObjectIdOwnerMap<>();
m.add(id_1);
for (int i = 32; i < n; i++)
m.add(new SubId(id(i)));
@ -159,7 +159,7 @@ public class ObjectIdOwnerMapTest {
@Test
public void testAddIfAbsentGrowsWithObjects() {
int n = 16384;
ObjectIdOwnerMap<SubId> m = new ObjectIdOwnerMap<SubId>();
ObjectIdOwnerMap<SubId> m = new ObjectIdOwnerMap<>();
m.add(id_1);
for (int i = 32; i < n; i++)
m.addIfAbsent(new SubId(id(i)));
@ -172,7 +172,7 @@ public class ObjectIdOwnerMapTest {
@Test
public void testIterator() {
ObjectIdOwnerMap<SubId> m = new ObjectIdOwnerMap<SubId>();
ObjectIdOwnerMap<SubId> m = new ObjectIdOwnerMap<>();
m.add(id_1);
m.add(id_2);
m.add(id_3);

14
org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ObjectIdSubclassMapTest.java

@ -73,7 +73,7 @@ public class ObjectIdSubclassMapTest {
@Test
public void testEmptyMap() {
ObjectIdSubclassMap<SubId> m = new ObjectIdSubclassMap<SubId>();
ObjectIdSubclassMap<SubId> m = new ObjectIdSubclassMap<>();
assertTrue(m.isEmpty());
assertEquals(0, m.size());
@ -86,7 +86,7 @@ public class ObjectIdSubclassMapTest {
@Test
public void testAddGetAndContains() {
ObjectIdSubclassMap<SubId> m = new ObjectIdSubclassMap<SubId>();
ObjectIdSubclassMap<SubId> m = new ObjectIdSubclassMap<>();
m.add(id_1);
m.add(id_2);
m.add(id_3);
@ -108,7 +108,7 @@ public class ObjectIdSubclassMapTest {
@Test
public void testClear() {
ObjectIdSubclassMap<SubId> m = new ObjectIdSubclassMap<SubId>();
ObjectIdSubclassMap<SubId> m = new ObjectIdSubclassMap<>();
m.add(id_1);
assertSame(id_1, m.get(id_1));
@ -126,7 +126,7 @@ public class ObjectIdSubclassMapTest {
@Test
public void testAddIfAbsent() {
ObjectIdSubclassMap<SubId> m = new ObjectIdSubclassMap<SubId>();
ObjectIdSubclassMap<SubId> m = new ObjectIdSubclassMap<>();
m.add(id_1);
assertSame(id_1, m.addIfAbsent(new SubId(id_1)));
@ -144,7 +144,7 @@ public class ObjectIdSubclassMapTest {
@Test
public void testAddGrowsWithObjects() {
ObjectIdSubclassMap<SubId> m = new ObjectIdSubclassMap<SubId>();
ObjectIdSubclassMap<SubId> m = new ObjectIdSubclassMap<>();
m.add(id_1);
for (int i = 32; i < 8000; i++)
m.add(new SubId(id(i)));
@ -157,7 +157,7 @@ public class ObjectIdSubclassMapTest {
@Test
public void testAddIfAbsentGrowsWithObjects() {
ObjectIdSubclassMap<SubId> m = new ObjectIdSubclassMap<SubId>();
ObjectIdSubclassMap<SubId> m = new ObjectIdSubclassMap<>();
m.add(id_1);
for (int i = 32; i < 8000; i++)
m.addIfAbsent(new SubId(id(i)));
@ -170,7 +170,7 @@ public class ObjectIdSubclassMapTest {
@Test
public void testIterator() {
ObjectIdSubclassMap<SubId> m = new ObjectIdSubclassMap<SubId>();
ObjectIdSubclassMap<SubId> m = new ObjectIdSubclassMap<>();
m.add(id_1);
m.add(id_2);
m.add(id_3);

4
org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/RacyGitTests.java

@ -60,7 +60,7 @@ import org.eclipse.jgit.util.FileUtils;
public class RacyGitTests extends RepositoryTestCase {
public void testIterator() throws IllegalStateException, IOException,
InterruptedException {
TreeSet<Long> modTimes = new TreeSet<Long>();
TreeSet<Long> modTimes = new TreeSet<>();
File lastFile = null;
for (int i = 0; i < 10; i++) {
lastFile = new File(db.getWorkTree(), "0." + i);
@ -123,7 +123,7 @@ public class RacyGitTests extends RepositoryTestCase {
public void testRacyGitDetection() throws IOException,
IllegalStateException, InterruptedException {
TreeSet<Long> modTimes = new TreeSet<Long>();
TreeSet<Long> modTimes = new TreeSet<>();
File lastFile;
// wait to ensure that modtimes of the file doesn't match last index

6
org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/RefDatabaseConflictingNamesTest.java

@ -63,7 +63,7 @@ public class RefDatabaseConflictingNamesTest {
@Override
public Map<String, Ref> getRefs(String prefix) throws IOException {
if (ALL.equals(prefix)) {
Map<String, Ref> existing = new HashMap<String, Ref>();
Map<String, Ref> existing = new HashMap<>();
existing.put("refs/heads/a/b", null /* not used */);
existing.put("refs/heads/q", null /* not used */);
return existing;
@ -141,8 +141,8 @@ public class RefDatabaseConflictingNamesTest {
private void assertConflictingNames(String proposed, String... conflicts)
throws IOException {
Set<String> expected = new HashSet<String>(Arrays.asList(conflicts));
Set<String> expected = new HashSet<>(Arrays.asList(conflicts));
assertEquals(expected,
new HashSet<String>(refDatabase.getConflictingNames(proposed)));
new HashSet<>(refDatabase.getConflictingNames(proposed)));
}
}

2
org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/RefTest.java

@ -99,7 +99,7 @@ public class RefTest extends SampleDataRepositoryTestCase {
"ab/c", "dummy", true);
config.save();
assertEquals("[ab/c, origin]",
new TreeSet<String>(db.getRemoteNames()).toString());
new TreeSet<>(db.getRemoteNames()).toString());
// one-level deep remote branch
assertEquals("master",

6
org.eclipse.jgit.test/tst/org/eclipse/jgit/merge/RecursiveMergerTest.java

@ -110,7 +110,7 @@ public class RecursiveMergerTest extends RepositoryTestCase {
@Before
public void setUp() throws Exception {
super.setUp();
db_t = new TestRepository<FileRepository>(db);
db_t = new TestRepository<>(db);
}
@Theory
@ -778,7 +778,7 @@ public class RecursiveMergerTest extends RepositoryTestCase {
db.close();
file.delete();
db = new FileRepository(db.getDirectory());
db_t = new TestRepository<FileRepository>(db);
db_t = new TestRepository<>(db);
break;
}
}
@ -846,7 +846,7 @@ public class RecursiveMergerTest extends RepositoryTestCase {
db.getConfig().setBoolean("core", null, "bare", true);
db.getDirectory().renameTo(new File(workTreeFile, "test.git"));
db = new FileRepository(new File(workTreeFile, "test.git"));
db_t = new TestRepository<FileRepository>(db);
db_t = new TestRepository<>(db);
}
} finally {
if (fos != null)

2
org.eclipse.jgit.test/tst/org/eclipse/jgit/notes/DefaultNoteMergerTest.java

@ -75,7 +75,7 @@ public class DefaultNoteMergerTest extends RepositoryTestCase {
@Before
public void setUp() throws Exception {
super.setUp();
tr = new TestRepository<Repository>(db);
tr = new TestRepository<>(db);
reader = db.newObjectReader();
inserter = db.newObjectInserter();
merger = new DefaultNoteMerger();

2
org.eclipse.jgit.test/tst/org/eclipse/jgit/notes/NoteMapMergerTest.java

@ -97,7 +97,7 @@ public class NoteMapMergerTest extends RepositoryTestCase {
@Before
public void setUp() throws Exception {
super.setUp();
tr = new TestRepository<Repository>(db);
tr = new TestRepository<>(db);
reader = db.newObjectReader();
inserter = db.newObjectInserter();

2
org.eclipse.jgit.test/tst/org/eclipse/jgit/notes/NoteMapTest.java

@ -83,7 +83,7 @@ public class NoteMapTest extends RepositoryTestCase {
public void setUp() throws Exception {
super.setUp();
tr = new TestRepository<Repository>(db);
tr = new TestRepository<>(db);
reader = db.newObjectReader();
inserter = db.newObjectInserter();
}

4
org.eclipse.jgit.test/tst/org/eclipse/jgit/revplot/AbstractPlotRendererTest.java

@ -96,7 +96,7 @@ public class AbstractPlotRendererTest extends RepositoryTestCase {
throws IOException {
TestPlotWalk walk = new TestPlotWalk(db);
walk.markStart(walk.parseCommit(start));
PlotCommitList<PlotLane> commitList = new PlotCommitList<PlotLane>();
PlotCommitList<PlotLane> commitList = new PlotCommitList<>();
commitList.source(walk);
commitList.fillTo(1000);
return commitList;
@ -116,7 +116,7 @@ public class AbstractPlotRendererTest extends RepositoryTestCase {
private static class TestPlotRenderer extends
AbstractPlotRenderer<PlotLane, Object> {
List<Integer> indentations = new LinkedList<Integer>();
List<Integer> indentations = new LinkedList<>();
@Override
protected int drawLabel(int x, int y, Ref ref) {

32
org.eclipse.jgit.test/tst/org/eclipse/jgit/revplot/PlotCommitListTest.java

@ -123,7 +123,7 @@ public class PlotCommitListTest extends RevWalkTestCase {
}
private static Set<Integer> asSet(int... numbers) {
Set<Integer> result = new HashSet<Integer>();
Set<Integer> result = new HashSet<>();
for (int n : numbers)
result.add(Integer.valueOf(n));
return result;
@ -138,7 +138,7 @@ public class PlotCommitListTest extends RevWalkTestCase {
PlotWalk pw = new PlotWalk(db);
pw.markStart(pw.lookupCommit(c.getId()));
PlotCommitList<PlotLane> pcl = new PlotCommitList<PlotLane>();
PlotCommitList<PlotLane> pcl = new PlotCommitList<>();
pcl.source(pw);
pcl.fillTo(Integer.MAX_VALUE);
@ -159,7 +159,7 @@ public class PlotCommitListTest extends RevWalkTestCase {
PlotWalk pw = new PlotWalk(db);
pw.markStart(pw.lookupCommit(d.getId()));
PlotCommitList<PlotLane> pcl = new PlotCommitList<PlotLane>();
PlotCommitList<PlotLane> pcl = new PlotCommitList<>();
pcl.source(pw);
pcl.fillTo(Integer.MAX_VALUE);
@ -181,7 +181,7 @@ public class PlotCommitListTest extends RevWalkTestCase {
pw.markStart(pw.lookupCommit(b.getId()));
pw.markStart(pw.lookupCommit(c.getId()));
PlotCommitList<PlotLane> pcl = new PlotCommitList<PlotLane>();
PlotCommitList<PlotLane> pcl = new PlotCommitList<>();
pcl.source(pw);
pcl.fillTo(Integer.MAX_VALUE);
@ -205,7 +205,7 @@ public class PlotCommitListTest extends RevWalkTestCase {
pw.markStart(pw.lookupCommit(c.getId()));
pw.markStart(pw.lookupCommit(d.getId()));
PlotCommitList<PlotLane> pcl = new PlotCommitList<PlotLane>();
PlotCommitList<PlotLane> pcl = new PlotCommitList<>();
pcl.source(pw);
pcl.fillTo(Integer.MAX_VALUE);
@ -240,7 +240,7 @@ public class PlotCommitListTest extends RevWalkTestCase {
// pw.markStart(pw.lookupCommit(f.getId()));
pw.markStart(pw.lookupCommit(g.getId()));
PlotCommitList<PlotLane> pcl = new PlotCommitList<PlotLane>();
PlotCommitList<PlotLane> pcl = new PlotCommitList<>();
pcl.source(pw);
pcl.fillTo(Integer.MAX_VALUE);
@ -274,7 +274,7 @@ public class PlotCommitListTest extends RevWalkTestCase {
pw.markStart(pw.lookupCommit(i.getId()));
pw.markStart(pw.lookupCommit(g.getId()));
PlotCommitList<PlotLane> pcl = new PlotCommitList<PlotLane>();
PlotCommitList<PlotLane> pcl = new PlotCommitList<>();
pcl.source(pw);
pcl.fillTo(Integer.MAX_VALUE);
Set<Integer> childPositions = asSet(0, 1);
@ -333,7 +333,7 @@ public class PlotCommitListTest extends RevWalkTestCase {
PlotWalk pw = new PlotWalk(db);
pw.markStart(pw.lookupCommit(merge_fixed_logged_npe.getId()));
PlotCommitList<PlotLane> pcl = new PlotCommitList<PlotLane>();
PlotCommitList<PlotLane> pcl = new PlotCommitList<>();
pcl.source(pw);
pcl.fillTo(Integer.MAX_VALUE);
@ -406,7 +406,7 @@ public class PlotCommitListTest extends RevWalkTestCase {
PlotWalk pw = new PlotWalk(db);
pw.markStart(pw.lookupCommit(m3));
pw.markStart(pw.lookupCommit(s2));
PlotCommitList<PlotLane> pcl = new PlotCommitList<PlotLane>();
PlotCommitList<PlotLane> pcl = new PlotCommitList<>();
pcl.source(pw);
pcl.fillTo(Integer.MAX_VALUE);
@ -471,7 +471,7 @@ public class PlotCommitListTest extends RevWalkTestCase {
pw.markStart(pw.lookupCommit(e.getId()));
pw.markStart(pw.lookupCommit(a5.getId()));
PlotCommitList<PlotLane> pcl = new PlotCommitList<PlotLane>();
PlotCommitList<PlotLane> pcl = new PlotCommitList<>();
pcl.source(pw);
pcl.fillTo(Integer.MAX_VALUE);
@ -520,7 +520,7 @@ public class PlotCommitListTest extends RevWalkTestCase {
PlotWalk pw = new PlotWalk(db);
pw.markStart(pw.lookupCommit(a4));
pw.markStart(pw.lookupCommit(b3));
PlotCommitList<PlotLane> pcl = new PlotCommitList<PlotLane>();
PlotCommitList<PlotLane> pcl = new PlotCommitList<>();
pcl.source(pw);
pcl.fillTo(Integer.MAX_VALUE);
@ -565,7 +565,7 @@ public class PlotCommitListTest extends RevWalkTestCase {
PlotWalk pw = new PlotWalk(db);
pw.markStart(pw.lookupCommit(a4));
pw.markStart(pw.lookupCommit(b3));
PlotCommitList<PlotLane> pcl = new PlotCommitList<PlotLane>();
PlotCommitList<PlotLane> pcl = new PlotCommitList<>();
pcl.source(pw);
pcl.fillTo(Integer.MAX_VALUE);
@ -615,7 +615,7 @@ public class PlotCommitListTest extends RevWalkTestCase {
pw.markStart(pw.lookupCommit(a4));
pw.markStart(pw.lookupCommit(b2));
pw.markStart(pw.lookupCommit(c));
PlotCommitList<PlotLane> pcl = new PlotCommitList<PlotLane>();
PlotCommitList<PlotLane> pcl = new PlotCommitList<>();
pcl.source(pw);
pcl.fillTo(Integer.MAX_VALUE);
@ -654,7 +654,7 @@ public class PlotCommitListTest extends RevWalkTestCase {
PlotWalk pw = new PlotWalk(db);
pw.markStart(pw.lookupCommit(a3));
pw.markStart(pw.lookupCommit(b1));
PlotCommitList<PlotLane> pcl = new PlotCommitList<PlotLane>();
PlotCommitList<PlotLane> pcl = new PlotCommitList<>();
pcl.source(pw);
pcl.fillTo(2); // don't process a1
@ -677,7 +677,7 @@ public class PlotCommitListTest extends RevWalkTestCase {
PlotWalk pw = new PlotWalk(db);
pw.markStart(pw.lookupCommit(a));
pw.markStart(pw.lookupCommit(b));
PlotCommitList<PlotLane> pcl = new PlotCommitList<PlotLane>();
PlotCommitList<PlotLane> pcl = new PlotCommitList<>();
pcl.source(pw);
pcl.fillTo(Integer.MAX_VALUE);
@ -696,7 +696,7 @@ public class PlotCommitListTest extends RevWalkTestCase {
PlotWalk pw = new PlotWalk(db);
pw.markStart(pw.lookupCommit(a));
pw.markStart(pw.lookupCommit(b2));
PlotCommitList<PlotLane> pcl = new PlotCommitList<PlotLane>();
PlotCommitList<PlotLane> pcl = new PlotCommitList<>();
pcl.source(pw);
pcl.fillTo(Integer.MAX_VALUE);

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save