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>
This commit is contained in:
David Pursehouse 2017-02-20 13:17:27 +09:00 committed by Matthias Sohn
parent 43eb8511f5
commit 3b4448637f
289 changed files with 765 additions and 765 deletions

View File

@ -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.rawTypeReference=ignore
org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning
org.eclipse.jdt.core.compiler.problem.redundantNullCheck=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.redundantSuperinterface=error
org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore

View File

@ -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.rawTypeReference=ignore
org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning
org.eclipse.jdt.core.compiler.problem.redundantNullCheck=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.redundantSuperinterface=error
org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore

View File

@ -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.rawTypeReference=ignore
org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning
org.eclipse.jdt.core.compiler.problem.redundantNullCheck=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.redundantSuperinterface=error
org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore

View File

@ -55,7 +55,7 @@
* that performs the same registration automatically. * that performs the same registration automatically.
*/ */
public class ArchiveFormats { 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) { private static final void register(String name, ArchiveCommand.Format<?> fmt) {
myFormats.add(name); myFormats.add(name);

View File

@ -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.rawTypeReference=ignore
org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning
org.eclipse.jdt.core.compiler.problem.redundantNullCheck=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.redundantSuperinterface=error
org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore

View File

@ -264,9 +264,9 @@ private void execute() throws IOException, ClientProtocolException {
@Override @Override
public Map<String, List<String>> getHeaderFields() { 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()) { for (Header hdr : resp.getAllHeaders()) {
List<String> list = new LinkedList<String>(); List<String> list = new LinkedList<>();
for (HeaderElement hdrElem : hdr.getElements()) for (HeaderElement hdrElem : hdr.getElements())
list.add(hdrElem.toString()); list.add(hdrElem.toString());
ret.put(hdr.getName(), list); ret.put(hdr.getName(), list);

View File

@ -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.rawTypeReference=ignore
org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning
org.eclipse.jdt.core.compiler.problem.redundantNullCheck=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.redundantSuperinterface=error
org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore

View File

@ -95,9 +95,9 @@ public class GitFilter extends MetaFilter {
private ReceivePackFactory<HttpServletRequest> receivePackFactory = new DefaultReceivePackFactory(); 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}. * New servlet that will load its base directory from {@code web.xml}.

View File

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

View File

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

View File

@ -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.rawTypeReference=ignore
org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning
org.eclipse.jdt.core.compiler.problem.redundantNullCheck=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.redundantSuperinterface=error
org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore

View File

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

View File

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

View File

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

View File

@ -112,7 +112,7 @@ public void testSetHeaders() throws IOException {
assertTrue("isa TransportHttp", t instanceof TransportHttp); assertTrue("isa TransportHttp", t instanceof TransportHttp);
assertTrue("isa HttpTransport", t instanceof HttpTransport); 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("Cookie", "someTokenValue=23gBog34");
headers.put("AnotherKey", "someValue"); headers.put("AnotherKey", "someValue");
((TransportHttp) t).setAdditionalHeaders(headers); ((TransportHttp) t).setAdditionalHeaders(headers);

View File

@ -437,7 +437,7 @@ public void testFetch_FewLocalCommits() throws Exception {
// Create a new commit on the remote. // 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(); RevCommit Z = b.commit().message("Z").create();
// Now incrementally update. // Now incrementally update.
@ -497,7 +497,7 @@ public void testFetch_TooManyLocalCommits() throws Exception {
// Create a new commit on the remote. // 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(); RevCommit Z = b.commit().message("Z").create();
// Now incrementally update. // Now incrementally update.
@ -614,7 +614,7 @@ public void testFetch_RefsUnreadableOnUpload() throws Exception {
final String repoName = "refs-unreadable"; final String repoName = "refs-unreadable";
RefsUnreadableInMemoryRepository badRefsRepo = new RefsUnreadableInMemoryRepository( RefsUnreadableInMemoryRepository badRefsRepo = new RefsUnreadableInMemoryRepository(
new DfsRepositoryDescription(repoName)); new DfsRepositoryDescription(repoName));
final TestRepository<Repository> repo = new TestRepository<Repository>( final TestRepository<Repository> repo = new TestRepository<>(
badRefsRepo); badRefsRepo);
ServletContextHandler app = noRefServer.addContext("/git"); ServletContextHandler app = noRefServer.addContext("/git");

View File

@ -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.rawTypeReference=ignore
org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning
org.eclipse.jdt.core.compiler.problem.redundantNullCheck=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.redundantSuperinterface=error
org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore

View File

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

View File

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

View File

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

View File

@ -52,7 +52,7 @@
import javax.servlet.ServletContext; import javax.servlet.ServletContext;
public class MockServletConfig implements ServletConfig { 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) { public void setInitParameter(String name, String value) {
parameters.put(name, value); parameters.put(name, value);

View File

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

View File

@ -61,7 +61,7 @@
class TestRequestLog extends HandlerWrapper { class TestRequestLog extends HandlerWrapper {
private static final int MAX = 16; 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); private final Semaphore active = new Semaphore(MAX);

View File

@ -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.rawTypeReference=ignore
org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning
org.eclipse.jdt.core.compiler.problem.redundantNullCheck=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.redundantSuperinterface=error
org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore

View File

@ -286,7 +286,7 @@ public static String indexState(Repository repo, int includedOptions)
throws IllegalStateException, IOException { throws IllegalStateException, IOException {
DirCache dc = repo.readDirCache(); DirCache dc = repo.readDirCache();
StringBuilder sb = new StringBuilder(); 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 // iterate once over the dircache just to collect all time stamps
if (0 != (includedOptions & MOD_TIME)) { if (0 != (includedOptions & MOD_TIME)) {
@ -552,7 +552,7 @@ private static String[] toEnvArray(final Map<String, String> env) {
} }
private static HashMap<String, String> cloneEnv() { 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 { private static final class CleanupThread extends Thread {
@ -574,7 +574,7 @@ static void removed(File tmp) {
} }
} }
private final List<File> toDelete = new ArrayList<File>(); private final List<File> toDelete = new ArrayList<>();
@Override @Override
public void run() { public void run() {

View File

@ -88,7 +88,7 @@ public boolean isOutdated() {
long now = 1250379778668L; // Sat Aug 15 20:12:58 GMT-03:30 2009 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; FileBasedConfig userGitConfig;

View File

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

View File

@ -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.rawTypeReference=ignore
org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning
org.eclipse.jdt.core.compiler.problem.redundantNullCheck=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.redundantSuperinterface=error
org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore

View File

@ -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.rawTypeReference=ignore
org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning
org.eclipse.jdt.core.compiler.problem.redundantNullCheck=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.redundantSuperinterface=error
org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore

View File

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

View File

@ -240,7 +240,7 @@ private static void addHostHeader(URL url,
private static String canonicalizeHeaderNames( private static String canonicalizeHeaderNames(
Map<String, String> headers) { Map<String, String> headers) {
List<String> sortedHeaders = new ArrayList<String>(); List<String> sortedHeaders = new ArrayList<>();
sortedHeaders.addAll(headers.keySet()); sortedHeaders.addAll(headers.keySet());
Collections.sort(sortedHeaders, String.CASE_INSENSITIVE_ORDER); Collections.sort(sortedHeaders, String.CASE_INSENSITIVE_ORDER);
@ -260,7 +260,7 @@ private static String canonicalizeHeaderString(
return ""; //$NON-NLS-1$ return ""; //$NON-NLS-1$
} }
List<String> sortedHeaders = new ArrayList<String>(); List<String> sortedHeaders = new ArrayList<>();
sortedHeaders.addAll(headers.keySet()); sortedHeaders.addAll(headers.keySet());
Collections.sort(sortedHeaders, String.CASE_INSENSITIVE_ORDER); Collections.sort(sortedHeaders, String.CASE_INSENSITIVE_ORDER);
@ -305,7 +305,7 @@ private static String canonicalizeQueryString(
return ""; //$NON-NLS-1$ 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<Map.Entry<String, String>> pairs = parameters.entrySet()
.iterator(); .iterator();

View File

@ -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.rawTypeReference=ignore
org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning
org.eclipse.jdt.core.compiler.problem.redundantNullCheck=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.redundantSuperinterface=error
org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore

View File

@ -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.rawTypeReference=ignore
org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning
org.eclipse.jdt.core.compiler.problem.redundantNullCheck=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.redundantSuperinterface=error
org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore

View File

@ -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.rawTypeReference=ignore
org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning
org.eclipse.jdt.core.compiler.problem.redundantNullCheck=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.redundantSuperinterface=error
org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore

View File

@ -79,7 +79,7 @@ public void setUp() throws Exception {
* @throws Exception * @throws Exception
*/ */
protected String[] executeUnchecked(String... cmds) 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) { for (String cmd : cmds) {
result.addAll(CLIGitCommand.executeUnchecked(cmd, db)); result.addAll(CLIGitCommand.executeUnchecked(cmd, db));
} }
@ -97,7 +97,7 @@ protected String[] executeUnchecked(String... cmds) throws Exception {
* @throws Exception * @throws Exception
*/ */
protected String[] execute(String... cmds) 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) { for (String cmd : cmds) {
Result r = CLIGitCommand.executeRaw(cmd, db); Result r = CLIGitCommand.executeRaw(cmd, db);
if (r.ex instanceof TerminatedByHelpException) { if (r.ex instanceof TerminatedByHelpException) {

View File

@ -189,7 +189,7 @@ void exit(int status, Exception t) throws Exception {
* @return the array * @return the array
*/ */
static String[] split(String commandLine) { static String[] split(String commandLine) {
final List<String> list = new ArrayList<String>(); final List<String> list = new ArrayList<>();
boolean inquote = false; boolean inquote = false;
boolean inDblQuote = false; boolean inDblQuote = false;
StringBuilder r = new StringBuilder(); StringBuilder r = new StringBuilder();

View File

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

View File

@ -73,7 +73,7 @@ public void testListConfig() throws Exception {
.equals("Mac OS X"); .equals("Mac OS X");
String[] output = execute("git config --list"); 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.filemode=" + !isWindows);
expect.add("core.logallrefupdates=true"); expect.add("core.logallrefupdates=true");
if (isMac) if (isMac)

View File

@ -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.rawTypeReference=ignore
org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning
org.eclipse.jdt.core.compiler.problem.redundantNullCheck=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.redundantSuperinterface=error
org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore

View File

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

View File

@ -114,7 +114,7 @@ void ignoreAllSpace(@SuppressWarnings("unused") boolean on) {
private String rangeString; private String rangeString;
@Option(name = "--reverse", metaVar = "metaVar_blameReverse", usage = "usage_blameReverse") @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") @Argument(index = 0, required = false, metaVar = "metaVar_revision")
private String revision; private String revision;
@ -124,7 +124,7 @@ void ignoreAllSpace(@SuppressWarnings("unused") boolean on) {
private ObjectReader reader; private ObjectReader reader;
private final Map<RevCommit, String> abbreviatedCommits = new HashMap<RevCommit, String>(); private final Map<RevCommit, String> abbreviatedCommits = new HashMap<>();
private SimpleDateFormat dateFmt; private SimpleDateFormat dateFmt;
@ -163,7 +163,7 @@ protected void run() throws Exception {
if (!reverseRange.isEmpty()) { if (!reverseRange.isEmpty()) {
RevCommit rangeStart = null; RevCommit rangeStart = null;
List<RevCommit> rangeEnd = new ArrayList<RevCommit>(2); List<RevCommit> rangeEnd = new ArrayList<>(2);
for (RevCommit c : reverseRange) { for (RevCommit c : reverseRange) {
if (c.has(RevFlag.UNINTERESTING)) if (c.has(RevFlag.UNINTERESTING))
rangeStart = c; rangeStart = c;

View File

@ -149,7 +149,7 @@ public void moveRename(List<String> currentAndNew) {
@Argument(metaVar = "metaVar_name") @Argument(metaVar = "metaVar_name")
private String branch; 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 */ /** Only set for verbose branch listing at-the-moment */
private RevWalk rw; private RevWalk rw;

View File

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

View File

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

View File

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

View File

@ -87,16 +87,16 @@ class Daemon extends TextBuiltin {
int timeout = -1; int timeout = -1;
@Option(name = "--enable", metaVar = "metaVar_service", usage = "usage_enableTheServiceInAllRepositories", multiValued = true) @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) @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) @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) @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") @Option(name = "--export-all", usage = "usage_exportWithoutGitDaemonExportOk")
boolean exportAll; boolean exportAll;
@ -109,7 +109,7 @@ enum KetchServerType {
} }
@Argument(required = true, metaVar = "metaVar_directory", usage = "usage_directoriesToExport") @Argument(required = true, metaVar = "metaVar_directory", usage = "usage_directoriesToExport")
final List<File> directory = new ArrayList<File>(); final List<File> directory = new ArrayList<>();
@Override @Override
protected boolean requiresRepository() { protected boolean requiresRepository() {
@ -139,7 +139,7 @@ protected void run() throws Exception {
if (1 < threads) if (1 < threads)
packConfig.setExecutor(Executors.newFixedThreadPool(threads)); packConfig.setExecutor(Executors.newFixedThreadPool(threads));
final FileResolver<DaemonClient> resolver = new FileResolver<DaemonClient>(); final FileResolver<DaemonClient> resolver = new FileResolver<>();
for (final File f : directory) { for (final File f : directory) {
outw.println(MessageFormat.format(CLIText.get().exporting, f.getAbsolutePath())); outw.println(MessageFormat.format(CLIText.get().exporting, f.getAbsolutePath()));
resolver.exportDirectory(f); resolver.exportDirectory(f);

View File

@ -67,7 +67,7 @@ void tree_0(final AbstractTreeIterator c) {
} }
@Argument(index = 1, metaVar = "metaVar_treeish", required = true) @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) @Option(name = "--", metaVar = "metaVar_path", multiValued = true, handler = PathTreeFilterHandler.class)
private TreeFilter pathFilter = TreeFilter.ALL; private TreeFilter pathFilter = TreeFilter.ALL;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -124,12 +124,12 @@ void enableBoundary(final boolean on) {
private String followPath; private String followPath;
@Argument(index = 0, metaVar = "metaVar_commitish") @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) @Option(name = "--", metaVar = "metaVar_path", multiValued = true, handler = PathTreeFilterHandler.class)
protected TreeFilter pathFilter = TreeFilter.ALL; protected TreeFilter pathFilter = TreeFilter.ALL;
private final List<RevFilter> revLimiter = new ArrayList<RevFilter>(); private final List<RevFilter> revLimiter = new ArrayList<>();
@Option(name = "--author") @Option(name = "--author")
void addAuthorRevFilter(final String who) { void addAuthorRevFilter(final String who) {

View File

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

View File

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

View File

@ -115,13 +115,13 @@ DiffAlgorithm create() {
// //
@Option(name = "--algorithm", multiValued = true, metaVar = "NAME", usage = "Enable algorithm(s)") @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") @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. 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") @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") @Option(name = "--count", metaVar = "LIMIT", usage = "Number of file revisions to be compared")
int count = 0; // unlimited int count = 0; // unlimited
@ -324,7 +324,7 @@ private void testOne(Test test, RawText a, RawText b) {
} }
private List<Test> init() { private List<Test> init() {
List<Test> all = new ArrayList<Test>(); List<Test> all = new ArrayList<>();
try { try {
for (Field f : DiffAlgorithms.class.getDeclaredFields()) { for (Field f : DiffAlgorithms.class.getDeclaredFields()) {

View File

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

View File

@ -251,16 +251,16 @@ public int fold(int hash, int bits) {
// //
@Option(name = "--hash", multiValued = true, metaVar = "NAME", usage = "Enable hash function(s)") @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)") @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") @Option(name = "--text-limit", metaVar = "LIMIT", usage = "Maximum size in KiB to scan")
int textLimit = 15 * 1024; // 15 MiB as later we do * 1024. 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") @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 @Override
protected boolean requiresRepository() { protected boolean requiresRepository() {
@ -327,7 +327,7 @@ private void run(Repository repo) throws Exception {
RawText txt = new RawText(raw); RawText txt = new RawText(raw);
int[] lines = new int[txt.size()]; int[] lines = new int[txt.size()];
int cnt = 0; int cnt = 0;
HashSet<Line> u = new HashSet<Line>(); HashSet<Line> u = new HashSet<>();
for (int i = 0; i < txt.size(); i++) { for (int i = 0; i < txt.size(); i++) {
if (u.add(new Line(txt, i))) if (u.add(new Line(txt, i)))
lines[cnt++] = i; lines[cnt++] = i;
@ -386,8 +386,8 @@ private static void testOne(Function fun, RawText txt, int[] elements,
} }
private List<Function> init() { private List<Function> init() {
List<Hash> hashes = new ArrayList<Hash>(); List<Hash> hashes = new ArrayList<>();
List<Fold> folds = new ArrayList<Fold>(); List<Fold> folds = new ArrayList<>();
try { try {
for (Field f : TextHashFunctions.class.getDeclaredFields()) { for (Field f : TextHashFunctions.class.getDeclaredFields()) {
@ -410,7 +410,7 @@ private List<Function> init() {
throw new RuntimeException("Cannot determine names", e); //$NON-NLS-1$ 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) { for (Hash cmp : hashes) {
if (include(cmp.name, hashFunctions)) { if (include(cmp.name, hashFunctions)) {
for (Fold f : folds) { for (Fold f : folds) {

View File

@ -141,7 +141,7 @@ public CmdLineParser(final Object bean, Repository repo) {
@Override @Override
public void parseArgument(final String... args) throws CmdLineException { 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++) { for (int argi = 0; argi < args.length; argi++) {
final String str = args[argi]; final String str = args[argi];
if (str.equals("--")) { //$NON-NLS-1$ if (str.equals("--")) { //$NON-NLS-1$

View File

@ -81,7 +81,7 @@ public PathTreeFilterHandler(final CmdLineParser parser,
@Override @Override
public int parseArguments(final Parameters params) throws CmdLineException { 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++) { for (int idx = 0;; idx++) {
final String path; final String path;
try { try {

View File

@ -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.rawTypeReference=ignore
org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning
org.eclipse.jdt.core.compiler.problem.redundantNullCheck=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.redundantSuperinterface=error
org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore

View File

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

View File

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

View File

@ -192,7 +192,7 @@ public void archiveByDirectoryPath() throws GitAPIException, IOException {
private class MockFormat implements ArchiveCommand.Format<MockOutputStream> { 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() { private int size() {
return entries.size(); return entries.size();

View File

@ -144,7 +144,7 @@ public void testCleanWithPaths() throws NoWorkTreeException,
assertTrue(files.size() > 0); assertTrue(files.size() > 0);
// run clean with setPaths // run clean with setPaths
Set<String> paths = new TreeSet<String>(); Set<String> paths = new TreeSet<>();
paths.add("File3.txt"); paths.add("File3.txt");
Set<String> cleanedFiles = git.clean().setPaths(paths).call(); Set<String> cleanedFiles = git.clean().setPaths(paths).call();

View File

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

View File

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

View File

@ -1556,7 +1556,7 @@ public void testFastForwardOnlyNotPossible() throws Exception {
@Test @Test
public void testRecursiveMergeWithConflict() throws Exception { 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"); BranchBuilder master = db_t.branch("master");
RevCommit m0 = master.commit().add("f", "1\n2\n3\n4\n5\n6\n7\n8\n9\n") RevCommit m0 = master.commit().add("f", "1\n2\n3\n4\n5\n6\n7\n8\n9\n")
.message("m0").create(); .message("m0").create();

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -469,7 +469,7 @@ public void testWritePack4SizeThinVsNoThin() throws Exception {
public void testDeltaStatistics() throws Exception { public void testDeltaStatistics() throws Exception {
config.setDeltaCompress(true); config.setDeltaCompress(true);
FileRepository repo = createBareRepository(); FileRepository repo = createBareRepository();
TestRepository<FileRepository> testRepo = new TestRepository<FileRepository>(repo); TestRepository<FileRepository> testRepo = new TestRepository<>(repo);
ArrayList<RevObject> blobs = new ArrayList<>(); ArrayList<RevObject> blobs = new ArrayList<>();
blobs.add(testRepo.blob(genDeltableData(1000))); blobs.add(testRepo.blob(genDeltableData(1000)));
blobs.add(testRepo.blob(genDeltableData(1005))); blobs.add(testRepo.blob(genDeltableData(1005)));
@ -538,7 +538,7 @@ public void testWriteIndex() throws Exception {
public void testExclude() throws Exception { public void testExclude() throws Exception {
FileRepository repo = createBareRepository(); FileRepository repo = createBareRepository();
TestRepository<FileRepository> testRepo = new TestRepository<FileRepository>( TestRepository<FileRepository> testRepo = new TestRepository<>(
repo); repo);
BranchBuilder bb = testRepo.branch("refs/heads/master"); BranchBuilder bb = testRepo.branch("refs/heads/master");
contentA = testRepo.blob("A"); contentA = testRepo.blob("A");
@ -663,7 +663,7 @@ public void testShallowFetchShallowAncestorDepth2() throws Exception {
private FileRepository setupRepoForShallowFetch() throws Exception { private FileRepository setupRepoForShallowFetch() throws Exception {
FileRepository repo = createBareRepository(); FileRepository repo = createBareRepository();
TestRepository<Repository> r = new TestRepository<Repository>(repo); TestRepository<Repository> r = new TestRepository<>(repo);
BranchBuilder bb = r.branch("refs/heads/master"); BranchBuilder bb = r.branch("refs/heads/master");
contentA = r.blob("A"); contentA = r.blob("A");
contentB = r.blob("B"); contentB = r.blob("B");
@ -731,7 +731,7 @@ private static PackIndex writePack(FileRepository repo, RevWalk walk,
// TODO: testWritePackDeltasDepth() // TODO: testWritePackDeltasDepth()
private void writeVerifyPack1() throws IOException { private void writeVerifyPack1() throws IOException {
final HashSet<ObjectId> interestings = new HashSet<ObjectId>(); final HashSet<ObjectId> interestings = new HashSet<>();
interestings.add(ObjectId interestings.add(ObjectId
.fromString("82c6b885ff600be425b4ea96dee75dca255b69e7")); .fromString("82c6b885ff600be425b4ea96dee75dca255b69e7"));
createVerifyOpenPack(interestings, NONE, false, false); createVerifyOpenPack(interestings, NONE, false, false);
@ -754,10 +754,10 @@ private void writeVerifyPack1() throws IOException {
private void writeVerifyPack2(boolean deltaReuse) throws IOException { private void writeVerifyPack2(boolean deltaReuse) throws IOException {
config.setReuseDeltas(deltaReuse); config.setReuseDeltas(deltaReuse);
final HashSet<ObjectId> interestings = new HashSet<ObjectId>(); final HashSet<ObjectId> interestings = new HashSet<>();
interestings.add(ObjectId interestings.add(ObjectId
.fromString("82c6b885ff600be425b4ea96dee75dca255b69e7")); .fromString("82c6b885ff600be425b4ea96dee75dca255b69e7"));
final HashSet<ObjectId> uninterestings = new HashSet<ObjectId>(); final HashSet<ObjectId> uninterestings = new HashSet<>();
uninterestings.add(ObjectId uninterestings.add(ObjectId
.fromString("540a36d136cf413e4b064c2b0e0a4db60f77feab")); .fromString("540a36d136cf413e4b064c2b0e0a4db60f77feab"));
createVerifyOpenPack(interestings, uninterestings, false, false); createVerifyOpenPack(interestings, uninterestings, false, false);
@ -786,10 +786,10 @@ private static void swap(ObjectId[] arr, int a, int b) {
} }
private void writeVerifyPack4(final boolean thin) throws IOException { private void writeVerifyPack4(final boolean thin) throws IOException {
final HashSet<ObjectId> interestings = new HashSet<ObjectId>(); final HashSet<ObjectId> interestings = new HashSet<>();
interestings.add(ObjectId interestings.add(ObjectId
.fromString("82c6b885ff600be425b4ea96dee75dca255b69e7")); .fromString("82c6b885ff600be425b4ea96dee75dca255b69e7"));
final HashSet<ObjectId> uninterestings = new HashSet<ObjectId>(); final HashSet<ObjectId> uninterestings = new HashSet<>();
uninterestings.add(ObjectId uninterestings.add(ObjectId
.fromString("c59759f143fb1fe21c197981df75a7ee00290799")); .fromString("c59759f143fb1fe21c197981df75a7ee00290799"));
createVerifyOpenPack(interestings, uninterestings, thin, false); createVerifyOpenPack(interestings, uninterestings, thin, false);
@ -878,7 +878,7 @@ private PackParser index(final byte[] packData) throws IOException {
} }
private void verifyObjectsOrder(final ObjectId objectsOrder[]) { 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) { for (MutableEntry me : pack) {
entries.add(me.cloneEntry()); entries.add(me.cloneEntry());

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -110,7 +110,7 @@ public enum WorktreeState {
@Before @Before
public void setUp() throws Exception { public void setUp() throws Exception {
super.setUp(); super.setUp();
db_t = new TestRepository<FileRepository>(db); db_t = new TestRepository<>(db);
} }
@Theory @Theory
@ -778,7 +778,7 @@ void modifyIndex(IndexState indexState, String path, String other)
db.close(); db.close();
file.delete(); file.delete();
db = new FileRepository(db.getDirectory()); db = new FileRepository(db.getDirectory());
db_t = new TestRepository<FileRepository>(db); db_t = new TestRepository<>(db);
break; break;
} }
} }
@ -846,7 +846,7 @@ void modifyWorktree(WorktreeState worktreeState, String path, String other)
db.getConfig().setBoolean("core", null, "bare", true); db.getConfig().setBoolean("core", null, "bare", true);
db.getDirectory().renameTo(new File(workTreeFile, "test.git")); db.getDirectory().renameTo(new File(workTreeFile, "test.git"));
db = new FileRepository(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 { } finally {
if (fos != null) if (fos != null)

View File

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

View File

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

View File

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

View File

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

View File

@ -123,7 +123,7 @@ public CommitListAssert noMoreCommits() {
} }
private static Set<Integer> asSet(int... numbers) { private static Set<Integer> asSet(int... numbers) {
Set<Integer> result = new HashSet<Integer>(); Set<Integer> result = new HashSet<>();
for (int n : numbers) for (int n : numbers)
result.add(Integer.valueOf(n)); result.add(Integer.valueOf(n));
return result; return result;
@ -138,7 +138,7 @@ public void testLinear() throws Exception {
PlotWalk pw = new PlotWalk(db); PlotWalk pw = new PlotWalk(db);
pw.markStart(pw.lookupCommit(c.getId())); pw.markStart(pw.lookupCommit(c.getId()));
PlotCommitList<PlotLane> pcl = new PlotCommitList<PlotLane>(); PlotCommitList<PlotLane> pcl = new PlotCommitList<>();
pcl.source(pw); pcl.source(pw);
pcl.fillTo(Integer.MAX_VALUE); pcl.fillTo(Integer.MAX_VALUE);
@ -159,7 +159,7 @@ public void testMerged() throws Exception {
PlotWalk pw = new PlotWalk(db); PlotWalk pw = new PlotWalk(db);
pw.markStart(pw.lookupCommit(d.getId())); pw.markStart(pw.lookupCommit(d.getId()));
PlotCommitList<PlotLane> pcl = new PlotCommitList<PlotLane>(); PlotCommitList<PlotLane> pcl = new PlotCommitList<>();
pcl.source(pw); pcl.source(pw);
pcl.fillTo(Integer.MAX_VALUE); pcl.fillTo(Integer.MAX_VALUE);
@ -181,7 +181,7 @@ public void testSideBranch() throws Exception {
pw.markStart(pw.lookupCommit(b.getId())); pw.markStart(pw.lookupCommit(b.getId()));
pw.markStart(pw.lookupCommit(c.getId())); pw.markStart(pw.lookupCommit(c.getId()));
PlotCommitList<PlotLane> pcl = new PlotCommitList<PlotLane>(); PlotCommitList<PlotLane> pcl = new PlotCommitList<>();
pcl.source(pw); pcl.source(pw);
pcl.fillTo(Integer.MAX_VALUE); pcl.fillTo(Integer.MAX_VALUE);
@ -205,7 +205,7 @@ public void test2SideBranches() throws Exception {
pw.markStart(pw.lookupCommit(c.getId())); pw.markStart(pw.lookupCommit(c.getId()));
pw.markStart(pw.lookupCommit(d.getId())); pw.markStart(pw.lookupCommit(d.getId()));
PlotCommitList<PlotLane> pcl = new PlotCommitList<PlotLane>(); PlotCommitList<PlotLane> pcl = new PlotCommitList<>();
pcl.source(pw); pcl.source(pw);
pcl.fillTo(Integer.MAX_VALUE); pcl.fillTo(Integer.MAX_VALUE);
@ -240,7 +240,7 @@ public void testBug300282_1() throws Exception {
// pw.markStart(pw.lookupCommit(f.getId())); // pw.markStart(pw.lookupCommit(f.getId()));
pw.markStart(pw.lookupCommit(g.getId())); pw.markStart(pw.lookupCommit(g.getId()));
PlotCommitList<PlotLane> pcl = new PlotCommitList<PlotLane>(); PlotCommitList<PlotLane> pcl = new PlotCommitList<>();
pcl.source(pw); pcl.source(pw);
pcl.fillTo(Integer.MAX_VALUE); pcl.fillTo(Integer.MAX_VALUE);
@ -274,7 +274,7 @@ public void testBug368927() throws Exception {
pw.markStart(pw.lookupCommit(i.getId())); pw.markStart(pw.lookupCommit(i.getId()));
pw.markStart(pw.lookupCommit(g.getId())); pw.markStart(pw.lookupCommit(g.getId()));
PlotCommitList<PlotLane> pcl = new PlotCommitList<PlotLane>(); PlotCommitList<PlotLane> pcl = new PlotCommitList<>();
pcl.source(pw); pcl.source(pw);
pcl.fillTo(Integer.MAX_VALUE); pcl.fillTo(Integer.MAX_VALUE);
Set<Integer> childPositions = asSet(0, 1); Set<Integer> childPositions = asSet(0, 1);
@ -333,7 +333,7 @@ public void testEgitHistory() throws Exception {
PlotWalk pw = new PlotWalk(db); PlotWalk pw = new PlotWalk(db);
pw.markStart(pw.lookupCommit(merge_fixed_logged_npe.getId())); pw.markStart(pw.lookupCommit(merge_fixed_logged_npe.getId()));
PlotCommitList<PlotLane> pcl = new PlotCommitList<PlotLane>(); PlotCommitList<PlotLane> pcl = new PlotCommitList<>();
pcl.source(pw); pcl.source(pw);
pcl.fillTo(Integer.MAX_VALUE); pcl.fillTo(Integer.MAX_VALUE);
@ -406,7 +406,7 @@ public void testDuplicateParents() throws Exception {
PlotWalk pw = new PlotWalk(db); PlotWalk pw = new PlotWalk(db);
pw.markStart(pw.lookupCommit(m3)); pw.markStart(pw.lookupCommit(m3));
pw.markStart(pw.lookupCommit(s2)); pw.markStart(pw.lookupCommit(s2));
PlotCommitList<PlotLane> pcl = new PlotCommitList<PlotLane>(); PlotCommitList<PlotLane> pcl = new PlotCommitList<>();
pcl.source(pw); pcl.source(pw);
pcl.fillTo(Integer.MAX_VALUE); pcl.fillTo(Integer.MAX_VALUE);
@ -471,7 +471,7 @@ public void testBug419359() throws Exception {
pw.markStart(pw.lookupCommit(e.getId())); pw.markStart(pw.lookupCommit(e.getId()));
pw.markStart(pw.lookupCommit(a5.getId())); pw.markStart(pw.lookupCommit(a5.getId()));
PlotCommitList<PlotLane> pcl = new PlotCommitList<PlotLane>(); PlotCommitList<PlotLane> pcl = new PlotCommitList<>();
pcl.source(pw); pcl.source(pw);
pcl.fillTo(Integer.MAX_VALUE); pcl.fillTo(Integer.MAX_VALUE);
@ -520,7 +520,7 @@ public void testMultipleMerges() throws Exception {
PlotWalk pw = new PlotWalk(db); PlotWalk pw = new PlotWalk(db);
pw.markStart(pw.lookupCommit(a4)); pw.markStart(pw.lookupCommit(a4));
pw.markStart(pw.lookupCommit(b3)); pw.markStart(pw.lookupCommit(b3));
PlotCommitList<PlotLane> pcl = new PlotCommitList<PlotLane>(); PlotCommitList<PlotLane> pcl = new PlotCommitList<>();
pcl.source(pw); pcl.source(pw);
pcl.fillTo(Integer.MAX_VALUE); pcl.fillTo(Integer.MAX_VALUE);
@ -565,7 +565,7 @@ public void testMergeBlockedBySelf() throws Exception {
PlotWalk pw = new PlotWalk(db); PlotWalk pw = new PlotWalk(db);
pw.markStart(pw.lookupCommit(a4)); pw.markStart(pw.lookupCommit(a4));
pw.markStart(pw.lookupCommit(b3)); pw.markStart(pw.lookupCommit(b3));
PlotCommitList<PlotLane> pcl = new PlotCommitList<PlotLane>(); PlotCommitList<PlotLane> pcl = new PlotCommitList<>();
pcl.source(pw); pcl.source(pw);
pcl.fillTo(Integer.MAX_VALUE); pcl.fillTo(Integer.MAX_VALUE);
@ -615,7 +615,7 @@ public void testMergeBlockedByOther() throws Exception {
pw.markStart(pw.lookupCommit(a4)); pw.markStart(pw.lookupCommit(a4));
pw.markStart(pw.lookupCommit(b2)); pw.markStart(pw.lookupCommit(b2));
pw.markStart(pw.lookupCommit(c)); pw.markStart(pw.lookupCommit(c));
PlotCommitList<PlotLane> pcl = new PlotCommitList<PlotLane>(); PlotCommitList<PlotLane> pcl = new PlotCommitList<>();
pcl.source(pw); pcl.source(pw);
pcl.fillTo(Integer.MAX_VALUE); pcl.fillTo(Integer.MAX_VALUE);
@ -654,7 +654,7 @@ public void testDanglingCommitShouldContinueLane() throws Exception {
PlotWalk pw = new PlotWalk(db); PlotWalk pw = new PlotWalk(db);
pw.markStart(pw.lookupCommit(a3)); pw.markStart(pw.lookupCommit(a3));
pw.markStart(pw.lookupCommit(b1)); pw.markStart(pw.lookupCommit(b1));
PlotCommitList<PlotLane> pcl = new PlotCommitList<PlotLane>(); PlotCommitList<PlotLane> pcl = new PlotCommitList<>();
pcl.source(pw); pcl.source(pw);
pcl.fillTo(2); // don't process a1 pcl.fillTo(2); // don't process a1
@ -677,7 +677,7 @@ public void testTwoRoots1() throws Exception {
PlotWalk pw = new PlotWalk(db); PlotWalk pw = new PlotWalk(db);
pw.markStart(pw.lookupCommit(a)); pw.markStart(pw.lookupCommit(a));
pw.markStart(pw.lookupCommit(b)); pw.markStart(pw.lookupCommit(b));
PlotCommitList<PlotLane> pcl = new PlotCommitList<PlotLane>(); PlotCommitList<PlotLane> pcl = new PlotCommitList<>();
pcl.source(pw); pcl.source(pw);
pcl.fillTo(Integer.MAX_VALUE); pcl.fillTo(Integer.MAX_VALUE);
@ -696,7 +696,7 @@ public void testTwoRoots2() throws Exception {
PlotWalk pw = new PlotWalk(db); PlotWalk pw = new PlotWalk(db);
pw.markStart(pw.lookupCommit(a)); pw.markStart(pw.lookupCommit(a));
pw.markStart(pw.lookupCommit(b2)); pw.markStart(pw.lookupCommit(b2));
PlotCommitList<PlotLane> pcl = new PlotCommitList<PlotLane>(); PlotCommitList<PlotLane> pcl = new PlotCommitList<>();
pcl.source(pw); pcl.source(pw);
pcl.fillTo(Integer.MAX_VALUE); pcl.fillTo(Integer.MAX_VALUE);

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