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 --- .../.settings/org.eclipse.jdt.core.prefs | 2 +- .../src/org/eclipse/jgit/lib/CLIRepositoryTestCase.java | 4 ++-- .../src/org/eclipse/jgit/pgm/CLIGitCommand.java | 2 +- .../tst/org/eclipse/jgit/pgm/ArchiveTest.java | 12 ++++++------ .../tst/org/eclipse/jgit/pgm/ConfigTest.java | 2 +- 5 files changed, 11 insertions(+), 11 deletions(-) (limited to 'org.eclipse.jgit.pgm.test') diff --git a/org.eclipse.jgit.pgm.test/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.jgit.pgm.test/.settings/org.eclipse.jdt.core.prefs index 47cca36924..64f74989e1 100644 --- a/org.eclipse.jgit.pgm.test/.settings/org.eclipse.jdt.core.prefs +++ b/org.eclipse.jgit.pgm.test/.settings/org.eclipse.jdt.core.prefs @@ -76,7 +76,7 @@ org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore org.eclipse.jdt.core.compiler.problem.rawTypeReference=ignore org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning org.eclipse.jdt.core.compiler.problem.redundantNullCheck=warning -org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=ignore +org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=warning org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=error org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore diff --git a/org.eclipse.jgit.pgm.test/src/org/eclipse/jgit/lib/CLIRepositoryTestCase.java b/org.eclipse.jgit.pgm.test/src/org/eclipse/jgit/lib/CLIRepositoryTestCase.java index 0bc2a3f8db..0eeababc5d 100644 --- a/org.eclipse.jgit.pgm.test/src/org/eclipse/jgit/lib/CLIRepositoryTestCase.java +++ b/org.eclipse.jgit.pgm.test/src/org/eclipse/jgit/lib/CLIRepositoryTestCase.java @@ -79,7 +79,7 @@ public class CLIRepositoryTestCase extends LocalDiskRepositoryTestCase { * @throws Exception */ protected String[] executeUnchecked(String... cmds) throws Exception { - List result = new ArrayList(cmds.length); + List result = new ArrayList<>(cmds.length); for (String cmd : cmds) { result.addAll(CLIGitCommand.executeUnchecked(cmd, db)); } @@ -97,7 +97,7 @@ public class CLIRepositoryTestCase extends LocalDiskRepositoryTestCase { * @throws Exception */ protected String[] execute(String... cmds) throws Exception { - List result = new ArrayList(cmds.length); + List result = new ArrayList<>(cmds.length); for (String cmd : cmds) { Result r = CLIGitCommand.executeRaw(cmd, db); if (r.ex instanceof TerminatedByHelpException) { diff --git a/org.eclipse.jgit.pgm.test/src/org/eclipse/jgit/pgm/CLIGitCommand.java b/org.eclipse.jgit.pgm.test/src/org/eclipse/jgit/pgm/CLIGitCommand.java index 2d0c8974eb..69eb1989d7 100644 --- a/org.eclipse.jgit.pgm.test/src/org/eclipse/jgit/pgm/CLIGitCommand.java +++ b/org.eclipse.jgit.pgm.test/src/org/eclipse/jgit/pgm/CLIGitCommand.java @@ -189,7 +189,7 @@ public class CLIGitCommand extends Main { * @return the array */ static String[] split(String commandLine) { - final List list = new ArrayList(); + final List list = new ArrayList<>(); boolean inquote = false; boolean inDblQuote = false; StringBuilder r = new StringBuilder(); diff --git a/org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit/pgm/ArchiveTest.java b/org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit/pgm/ArchiveTest.java index c0593a78f3..18c49ea286 100644 --- a/org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit/pgm/ArchiveTest.java +++ b/org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit/pgm/ArchiveTest.java @@ -529,7 +529,7 @@ public class ArchiveTest extends CLIRepositoryTestCase { @Test public void testArchiveWithLongFilename() throws Exception { StringBuilder filename = new StringBuilder(); - List l = new ArrayList(); + List l = new ArrayList<>(); for (int i = 0; i < 20; i++) { filename.append("1234567890/"); l.add(filename.toString()); @@ -549,7 +549,7 @@ public class ArchiveTest extends CLIRepositoryTestCase { @Test public void testTarWithLongFilename() throws Exception { StringBuilder filename = new StringBuilder(); - List l = new ArrayList(); + List l = new ArrayList<>(); for (int i = 0; i < 20; i++) { filename.append("1234567890/"); l.add(filename.toString()); @@ -691,7 +691,7 @@ public class ArchiveTest extends CLIRepositoryTestCase { } private static String[] listZipEntries(byte[] zipData) throws IOException { - List l = new ArrayList(); + List l = new ArrayList<>(); ZipInputStream in = new ZipInputStream( new ByteArrayInputStream(zipData)); @@ -719,7 +719,7 @@ public class ArchiveTest extends CLIRepositoryTestCase { } private String[] listTarEntries(byte[] tarData) throws Exception { - List l = new ArrayList(); + List l = new ArrayList<>(); Process proc = spawnAssumingCommandPresent("tar", "tf", "-"); BufferedReader reader = readFromProcess(proc); OutputStream out = proc.getOutputStream(); @@ -750,7 +750,7 @@ public class ArchiveTest extends CLIRepositoryTestCase { continue; // found! - List l = new ArrayList(); + List l = new ArrayList<>(); BufferedReader reader = new BufferedReader( new InputStreamReader(in, "UTF-8")); String line; @@ -765,7 +765,7 @@ public class ArchiveTest extends CLIRepositoryTestCase { private String[] tarEntryContent(byte[] tarData, String path) throws Exception { - List l = new ArrayList(); + List l = new ArrayList<>(); Process proc = spawnAssumingCommandPresent("tar", "Oxf", "-", path); BufferedReader reader = readFromProcess(proc); OutputStream out = proc.getOutputStream(); diff --git a/org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit/pgm/ConfigTest.java b/org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit/pgm/ConfigTest.java index 23aa97eeed..c43accdb6f 100644 --- a/org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit/pgm/ConfigTest.java +++ b/org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit/pgm/ConfigTest.java @@ -73,7 +73,7 @@ public class ConfigTest extends CLIRepositoryTestCase { .equals("Mac OS X"); String[] output = execute("git config --list"); - List expect = new ArrayList(); + List expect = new ArrayList<>(); expect.add("core.filemode=" + !isWindows); expect.add("core.logallrefupdates=true"); if (isMac) -- cgit v1.2.3