From 3b4448637fbb9d74e0c9d44048ba76bb7c1214ce Mon Sep 17 00:00:00 2001 From: David Pursehouse Date: Mon, 20 Feb 2017 13:17:27 +0900 Subject: 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 --- .../src/org/eclipse/jgit/junit/http/AccessEvent.java | 4 ++-- .../src/org/eclipse/jgit/junit/http/AppServer.java | 4 ++-- .../src/org/eclipse/jgit/junit/http/HttpTestCase.java | 6 +++--- .../src/org/eclipse/jgit/junit/http/MockServletConfig.java | 2 +- .../src/org/eclipse/jgit/junit/http/RecordingLogger.java | 4 ++-- .../src/org/eclipse/jgit/junit/http/TestRequestLog.java | 2 +- 6 files changed, 11 insertions(+), 11 deletions(-) (limited to 'org.eclipse.jgit.junit.http/src/org/eclipse/jgit/junit') diff --git a/org.eclipse.jgit.junit.http/src/org/eclipse/jgit/junit/http/AccessEvent.java b/org.eclipse.jgit.junit.http/src/org/eclipse/jgit/junit/http/AccessEvent.java index 6580ade8ea..6b7853d730 100644 --- a/org.eclipse.jgit.junit.http/src/org/eclipse/jgit/junit/http/AccessEvent.java +++ b/org.eclipse.jgit.junit.http/src/org/eclipse/jgit/junit/http/AccessEvent.java @@ -76,7 +76,7 @@ public class AccessEvent { } private static Map cloneHeaders(final Request req) { - Map r = new TreeMap(); + Map r = new TreeMap<>(); Enumeration hn = req.getHeaderNames(); while (hn.hasMoreElements()) { String key = (String) hn.nextElement(); @@ -88,7 +88,7 @@ public class AccessEvent { } private static Map cloneHeaders(final Response rsp) { - Map r = new TreeMap(); + Map r = new TreeMap<>(); Enumeration hn = rsp.getHttpFields().getFieldNames(); while (hn.hasMoreElements()) { String key = hn.nextElement(); diff --git a/org.eclipse.jgit.junit.http/src/org/eclipse/jgit/junit/http/AppServer.java b/org.eclipse.jgit.junit.http/src/org/eclipse/jgit/junit/http/AppServer.java index 1575cb650c..e9480fa9ff 100644 --- a/org.eclipse.jgit.junit.http/src/org/eclipse/jgit/junit/http/AppServer.java +++ b/org.eclipse.jgit.junit.http/src/org/eclipse/jgit/junit/http/AppServer.java @@ -262,7 +262,7 @@ public class AppServer { /** @return all requests since the server was started. */ public List getRequests() { - return new ArrayList(log.getEvents()); + return new ArrayList<>(log.getEvents()); } /** @@ -282,7 +282,7 @@ public class AppServer { * @return all requests which match the given path. */ public List getRequests(String path) { - ArrayList r = new ArrayList(); + ArrayList r = new ArrayList<>(); for (AccessEvent event : log.getEvents()) { if (event.getPath().equals(path)) { r.add(event); diff --git a/org.eclipse.jgit.junit.http/src/org/eclipse/jgit/junit/http/HttpTestCase.java b/org.eclipse.jgit.junit.http/src/org/eclipse/jgit/junit/http/HttpTestCase.java index 5db76eb7b9..1b94e02fa4 100644 --- a/org.eclipse.jgit.junit.http/src/org/eclipse/jgit/junit/http/HttpTestCase.java +++ b/org.eclipse.jgit.junit.http/src/org/eclipse/jgit/junit/http/HttpTestCase.java @@ -88,7 +88,7 @@ public abstract class HttpTestCase extends LocalDiskRepositoryTestCase { protected TestRepository createTestRepository() throws IOException { - return new TestRepository(createBareRepository()); + return new TestRepository<>(createBareRepository()); } protected URIish toURIish(String path) throws URISyntaxException { @@ -120,12 +120,12 @@ public abstract class HttpTestCase extends LocalDiskRepositoryTestCase { protected static void fsck(Repository db, RevObject... tips) throws Exception { TestRepository tr = - new TestRepository(db); + new TestRepository<>(db); tr.fsck(tips); } protected static Set mirror(String... refs) { - HashSet r = new HashSet(); + HashSet r = new HashSet<>(); for (String name : refs) { RefSpec rs = new RefSpec(name); rs = rs.setDestination(name); diff --git a/org.eclipse.jgit.junit.http/src/org/eclipse/jgit/junit/http/MockServletConfig.java b/org.eclipse.jgit.junit.http/src/org/eclipse/jgit/junit/http/MockServletConfig.java index 4f11ea8fca..9defcd9833 100644 --- a/org.eclipse.jgit.junit.http/src/org/eclipse/jgit/junit/http/MockServletConfig.java +++ b/org.eclipse.jgit.junit.http/src/org/eclipse/jgit/junit/http/MockServletConfig.java @@ -52,7 +52,7 @@ import javax.servlet.ServletConfig; import javax.servlet.ServletContext; public class MockServletConfig implements ServletConfig { - private final Map parameters = new HashMap(); + private final Map parameters = new HashMap<>(); public void setInitParameter(String name, String value) { parameters.put(name, value); diff --git a/org.eclipse.jgit.junit.http/src/org/eclipse/jgit/junit/http/RecordingLogger.java b/org.eclipse.jgit.junit.http/src/org/eclipse/jgit/junit/http/RecordingLogger.java index 5fed122637..f28ef893bb 100644 --- a/org.eclipse.jgit.junit.http/src/org/eclipse/jgit/junit/http/RecordingLogger.java +++ b/org.eclipse.jgit.junit.http/src/org/eclipse/jgit/junit/http/RecordingLogger.java @@ -53,7 +53,7 @@ import org.slf4j.helpers.MessageFormatter; /** Logs warnings into an array for later inspection. */ public class RecordingLogger implements Logger { - private static List warnings = new ArrayList(); + private static List warnings = new ArrayList<>(); /** Clear the warnings, automatically done by {@link AppServer#setUp()} */ public static void clear() { @@ -65,7 +65,7 @@ public class RecordingLogger implements Logger { /** @return the warnings (if any) from the last execution */ public static List getWarnings() { synchronized (warnings) { - ArrayList copy = new ArrayList(warnings); + ArrayList copy = new ArrayList<>(warnings); return Collections.unmodifiableList(copy); } } diff --git a/org.eclipse.jgit.junit.http/src/org/eclipse/jgit/junit/http/TestRequestLog.java b/org.eclipse.jgit.junit.http/src/org/eclipse/jgit/junit/http/TestRequestLog.java index 14ea03a921..c218c07a6c 100644 --- a/org.eclipse.jgit.junit.http/src/org/eclipse/jgit/junit/http/TestRequestLog.java +++ b/org.eclipse.jgit.junit.http/src/org/eclipse/jgit/junit/http/TestRequestLog.java @@ -61,7 +61,7 @@ import org.eclipse.jetty.server.handler.HandlerWrapper; class TestRequestLog extends HandlerWrapper { private static final int MAX = 16; - private final List events = new ArrayList(); + private final List events = new ArrayList<>(); private final Semaphore active = new Semaphore(MAX); -- cgit v1.2.3