From 46b7128a2e604c85d9c8ce0ce5501a994105a49c Mon Sep 17 00:00:00 2001 From: David Pursehouse Date: Tue, 15 May 2018 09:56:32 +0900 Subject: [PATCH 01/18] BatchRefUpdate: Don't use deprecated RefDatabase#getRefs(String) Change-Id: I672c9cfe221ddc4acbde7a8040bd6ba83b16626e Signed-off-by: David Pursehouse --- .../src/org/eclipse/jgit/lib/BatchRefUpdate.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/BatchRefUpdate.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/BatchRefUpdate.java index 5e1755370..925b6bead 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/BatchRefUpdate.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/BatchRefUpdate.java @@ -46,6 +46,7 @@ package org.eclipse.jgit.lib; import static org.eclipse.jgit.transport.ReceiveCommand.Result.NOT_ATTEMPTED; import static org.eclipse.jgit.transport.ReceiveCommand.Result.REJECTED_OTHER_REASON; +import static java.util.stream.Collectors.toCollection; import java.io.IOException; import java.text.MessageFormat; @@ -528,8 +529,9 @@ public class BatchRefUpdate { } if (!commands2.isEmpty()) { // What part of the name space is already taken - Collection takenNames = new HashSet<>(refdb.getRefs( - RefDatabase.ALL).keySet()); + Collection takenNames = refdb.getRefs().stream() + .map(Ref::getName) + .collect(toCollection(HashSet::new)); Collection takenPrefixes = getTakenPrefixes(takenNames); // Now to the update that may require more room in the name space From 1046ba12f971c0e5d527f3f4153bf2f1c85bd824 Mon Sep 17 00:00:00 2001 From: David Pursehouse Date: Tue, 15 May 2018 13:41:15 +0900 Subject: [PATCH 02/18] FileRepository: Don't use deprecated RefDatabase#getRefs(String) Change-Id: Iec58c973537ddbe0f4e6b8b62fcda5cecc961661 Signed-off-by: David Pursehouse --- .../eclipse/jgit/internal/storage/file/FileRepository.java | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/FileRepository.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/FileRepository.java index f174e491a..ed5cf2c9e 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/FileRepository.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/FileRepository.java @@ -46,8 +46,6 @@ package org.eclipse.jgit.internal.storage.file; -import static org.eclipse.jgit.lib.RefDatabase.ALL; - import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; @@ -540,7 +538,7 @@ public class FileRepository extends Repository { /** {@inheritDoc} */ @Override public void scanForRepoChanges() throws IOException { - getRefDatabase().getRefs(ALL); // This will look for changes to refs + getRefDatabase().getRefs(); // This will look for changes to refs detectIndexChanges(); } From c79e7f1c27c73732310bc64c2071a79902447dcc Mon Sep 17 00:00:00 2001 From: Jonathan Tan Date: Mon, 23 Apr 2018 13:03:04 -0700 Subject: [PATCH 03/18] Avoid using #refs in UploadPack#sendPack When OPTION_INCLUDE_TAG is set, UploadPack#sendPack uses the #refs instance variable as a source of information of tags. A subsequent patch will need to supply this information to #sendPack without modifying #refs, so refactor #sendPack to take in this information through a parameter instead. Note that prior to this patch, #refs was used twice in #sendPack: once to generate the argument to PackWriter#setTagTargets, and once to determine if any tags need to be included in the packfile. This patch only updates the latter use, since the former is meant not only for "true" tag targets but any object that should be hoisted earlier during packing (see the documentation of PackWriter#setTagTargets). This patch does not introduce any functionality change. Change-Id: I70ed65a1041334abeda8d4bac98cce7cae7efcdf Signed-off-by: Jonathan Tan Signed-off-by: Jonathan Nieder --- .../eclipse/jgit/transport/UploadPack.java | 50 +++++++++++++++---- 1 file changed, 41 insertions(+), 9 deletions(-) diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPack.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPack.java index 393b3aa1a..b1f4d1186 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPack.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPack.java @@ -76,6 +76,7 @@ import java.util.List; import java.util.Map; import java.util.Set; +import org.eclipse.jgit.annotations.Nullable; import org.eclipse.jgit.errors.CorruptObjectException; import org.eclipse.jgit.errors.IncorrectObjectTypeException; import org.eclipse.jgit.errors.MissingObjectException; @@ -866,7 +867,7 @@ public class UploadPack { } if (sendPack) - sendPack(accumulator); + sendPack(accumulator, refs == null ? null : refs.values()); } private void lsRefsV2() throws IOException { @@ -988,7 +989,8 @@ public class UploadPack { if (sectionSent) pckOut.writeDelim(); pckOut.writeString("packfile\n"); //$NON-NLS-1$ - sendPack(new PackStatistics.Accumulator()); + sendPack(new PackStatistics.Accumulator(), + refs == null ? null : refs.values()); } pckOut.end(); } @@ -1734,13 +1736,25 @@ public class UploadPack { return false; } - private void sendPack(PackStatistics.Accumulator accumulator) - throws IOException { + /** + * Send the requested objects to the client. + * + * @param accumulator + * where to write statistics about the content of the pack. + * @param allTags + * refs to search for annotated tags to include in the pack + * if the {@link #OPTION_INCLUDE_TAG} capability was + * requested. + * @throws IOException + * if an error occured while generating or writing the pack. + */ + private void sendPack(PackStatistics.Accumulator accumulator, + @Nullable Collection allTags) throws IOException { final boolean sideband = options.contains(OPTION_SIDE_BAND) || options.contains(OPTION_SIDE_BAND_64K); if (sideband) { try { - sendPack(true, accumulator); + sendPack(true, accumulator, allTags); } catch (ServiceMayNotContinueException noPack) { // This was already reported on (below). throw noPack; @@ -1761,7 +1775,7 @@ public class UploadPack { throw err; } } else { - sendPack(false, accumulator); + sendPack(false, accumulator, allTags); } } @@ -1781,8 +1795,24 @@ public class UploadPack { } } + /** + * Send the requested objects to the client. + * + * @param sideband + * whether to wrap the pack in side-band pkt-lines, + * interleaved with progress messages and errors. + * @param accumulator + * where to write statistics about the content of the pack. + * @param allTags + * refs to search for annotated tags to include in the pack + * if the {@link #OPTION_INCLUDE_TAG} capability was + * requested. + * @throws IOException + * if an error occured while generating or writing the pack. + */ private void sendPack(final boolean sideband, - PackStatistics.Accumulator accumulator) throws IOException { + PackStatistics.Accumulator accumulator, + @Nullable Collection allTags) throws IOException { ProgressMonitor pm = NullProgressMonitor.INSTANCE; OutputStream packOut = rawOut; @@ -1842,6 +1872,8 @@ public class UploadPack { pw.setThin(options.contains(OPTION_THIN_PACK)); pw.setReuseValidatingObjects(false); + // Objects named directly by references go at the beginning + // of the pack. if (commonBase.isEmpty() && refs != null) { Set tagTargets = new HashSet<>(); for (Ref ref : refs.values()) { @@ -1872,8 +1904,8 @@ public class UploadPack { rw = ow; } - if (options.contains(OPTION_INCLUDE_TAG) && refs != null) { - for (Ref ref : refs.values()) { + if (options.contains(OPTION_INCLUDE_TAG) && allTags != null) { + for (Ref ref : allTags) { ObjectId objectId = ref.getObjectId(); if (objectId == null) { // skip unborn branch From 5a87d50408642f619b77d12a981e6e23f407752e Mon Sep 17 00:00:00 2001 From: Jonathan Tan Date: Tue, 13 Mar 2018 11:07:36 -0700 Subject: [PATCH 04/18] Teach UploadPack "include-tag" in "fetch" Add support for the "include-tag" parameter in the "fetch" command in the fetch-pack/upload-pack protocol v2. In order to determine which tags to include, only objects pointed to by refs starting with "refs/tags/" are checked. This restriction is for performance reasons and to match the behavior of Git (see add_ref_tag() in builtin/pack-objects.c). Change-Id: I7d70aa09bcc8a525218ff1559e286c2a610258ca Signed-off-by: Jonathan Tan Signed-off-by: Jonathan Nieder --- .../jgit/transport/UploadPackTest.java | 33 +++++++++++++++++++ .../eclipse/jgit/transport/UploadPack.java | 9 ++++- 2 files changed, 41 insertions(+), 1 deletion(-) diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/UploadPackTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/UploadPackTest.java index 5073e0ed3..5ae93fc12 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/UploadPackTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/UploadPackTest.java @@ -805,6 +805,39 @@ public class UploadPackTest { assertTrue(sw.toString().isEmpty()); } + @Test + public void testV2FetchIncludeTag() throws Exception { + RevCommit commit = remote.commit().message("x").create(); + RevTag tag = remote.tag("tag", commit); + remote.update("branch1", commit); + remote.update("refs/tags/tag", tag); + + // Without include-tag. + ByteArrayInputStream recvStream = uploadPackV2( + "command=fetch\n", + PacketLineIn.DELIM, + "want " + commit.toObjectId().getName() + "\n", + "done\n", + PacketLineIn.END); + PacketLineIn pckIn = new PacketLineIn(recvStream); + assertThat(pckIn.readString(), is("packfile")); + parsePack(recvStream); + assertFalse(client.hasObject(tag.toObjectId())); + + // With tag. + recvStream = uploadPackV2( + "command=fetch\n", + PacketLineIn.DELIM, + "want " + commit.toObjectId().getName() + "\n", + "include-tag\n", + "done\n", + PacketLineIn.END); + pckIn = new PacketLineIn(recvStream); + assertThat(pckIn.readString(), is("packfile")); + parsePack(recvStream); + assertTrue(client.hasObject(tag.toObjectId())); + } + private static class RejectAllRefFilter implements RefFilter { @Override public Map filter(Map refs) { diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPack.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPack.java index b1f4d1186..199a007ab 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPack.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPack.java @@ -43,6 +43,7 @@ package org.eclipse.jgit.transport; +import static org.eclipse.jgit.lib.Constants.R_TAGS; import static org.eclipse.jgit.lib.RefDatabase.ALL; import static org.eclipse.jgit.transport.GitProtocolConstants.COMMAND_FETCH; import static org.eclipse.jgit.transport.GitProtocolConstants.COMMAND_LS_REFS; @@ -951,6 +952,7 @@ public class UploadPack { .format(JGitText.get().unexpectedPacketLine, line)); } + boolean includeTag = false; while ((line = pckIn.readString()) != PacketLineIn.END) { if (line.startsWith("want ")) { //$NON-NLS-1$ wantIds.add(ObjectId.fromString(line.substring(5))); @@ -962,6 +964,9 @@ public class UploadPack { options.add(OPTION_THIN_PACK); } else if (line.equals(OPTION_NO_PROGRESS)) { options.add(OPTION_NO_PROGRESS); + } else if (line.equals(OPTION_INCLUDE_TAG)) { + options.add(OPTION_INCLUDE_TAG); + includeTag = true; } // else ignore it } @@ -990,7 +995,9 @@ public class UploadPack { pckOut.writeDelim(); pckOut.writeString("packfile\n"); //$NON-NLS-1$ sendPack(new PackStatistics.Accumulator(), - refs == null ? null : refs.values()); + includeTag + ? db.getRefDatabase().getRefsByPrefix(R_TAGS) + : null); } pckOut.end(); } From 526f5cf9840490720f8b4fd6d647bb8beb67e143 Mon Sep 17 00:00:00 2001 From: Jonathan Tan Date: Tue, 13 Mar 2018 13:29:46 -0700 Subject: [PATCH 05/18] Teach UploadPack "ofs-delta" in "fetch" Add support for the "ofs-delta" parameter in the "fetch" command in the fetch-pack/upload-pack protocol v2. Change-Id: I728cf986082fce4ddeb6a6435897692e15e60cc7 Signed-off-by: Jonathan Tan --- .../jgit/transport/UploadPackTest.java | 49 +++++++++++++++++-- .../eclipse/jgit/transport/UploadPack.java | 2 + 2 files changed, 46 insertions(+), 5 deletions(-) diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/UploadPackTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/UploadPackTest.java index 5ae93fc12..133ecd01e 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/UploadPackTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/UploadPackTest.java @@ -518,15 +518,18 @@ public class UploadPackTest { * Parse multiplexed packfile output from upload-pack using protocol V2 * into the client repository. */ - private void parsePack(ByteArrayInputStream recvStream) throws Exception { - parsePack(recvStream, NullProgressMonitor.INSTANCE); + private ReceivedPackStatistics parsePack(ByteArrayInputStream recvStream) throws Exception { + return parsePack(recvStream, NullProgressMonitor.INSTANCE); } - private void parsePack(ByteArrayInputStream recvStream, ProgressMonitor pm) + private ReceivedPackStatistics parsePack(ByteArrayInputStream recvStream, ProgressMonitor pm) throws Exception { SideBandInputStream sb = new SideBandInputStream( - recvStream, pm, new StringWriter(), NullOutputStream.INSTANCE); - client.newObjectInserter().newPackParser(sb).parse(NullProgressMonitor.INSTANCE); + recvStream, pm, + new StringWriter(), NullOutputStream.INSTANCE); + PackParser pp = client.newObjectInserter().newPackParser(sb); + pp.parse(NullProgressMonitor.INSTANCE); + return pp.getReceivedPackStatistics(); } @Test @@ -838,6 +841,42 @@ public class UploadPackTest { assertTrue(client.hasObject(tag.toObjectId())); } + @Test + public void testV2FetchOfsDelta() throws Exception { + String commonInBlob = "abcdefghijklmnopqrstuvwxyz"; + + RevBlob parentBlob = remote.blob(commonInBlob + "a"); + RevCommit parent = remote.commit(remote.tree(remote.file("foo", parentBlob))); + RevBlob childBlob = remote.blob(commonInBlob + "b"); + RevCommit child = remote.commit(remote.tree(remote.file("foo", childBlob)), parent); + remote.update("branch1", child); + + // Without ofs-delta. + ByteArrayInputStream recvStream = uploadPackV2( + "command=fetch\n", + PacketLineIn.DELIM, + "want " + child.toObjectId().getName() + "\n", + "done\n", + PacketLineIn.END); + PacketLineIn pckIn = new PacketLineIn(recvStream); + assertThat(pckIn.readString(), is("packfile")); + ReceivedPackStatistics stats = parsePack(recvStream); + assertTrue(stats.getNumOfsDelta() == 0); + + // With ofs-delta. + recvStream = uploadPackV2( + "command=fetch\n", + PacketLineIn.DELIM, + "want " + child.toObjectId().getName() + "\n", + "ofs-delta\n", + "done\n", + PacketLineIn.END); + pckIn = new PacketLineIn(recvStream); + assertThat(pckIn.readString(), is("packfile")); + stats = parsePack(recvStream); + assertTrue(stats.getNumOfsDelta() != 0); + } + private static class RejectAllRefFilter implements RefFilter { @Override public Map filter(Map refs) { diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPack.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPack.java index 199a007ab..a1c222b19 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPack.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPack.java @@ -967,6 +967,8 @@ public class UploadPack { } else if (line.equals(OPTION_INCLUDE_TAG)) { options.add(OPTION_INCLUDE_TAG); includeTag = true; + } else if (line.equals(OPTION_OFS_DELTA)) { + options.add(OPTION_OFS_DELTA); } // else ignore it } From 2841bab938b823c47041adc98d3a24673fd57475 Mon Sep 17 00:00:00 2001 From: Jonathan Tan Date: Fri, 23 Feb 2018 16:55:03 -0800 Subject: [PATCH 06/18] Add protocol v2 support in "jgit daemon" With this patch, a server spawned by "jgit daemon" can be accessed using protocol v2 from a Git client that supports it (for example, "git" with the appropriate patches). This is only activated if the repository's config has "protocol.version" be 2. This required a change to the package-private #execute methods in DaemonService to allow passing of extra parameters. This has been tested with a patched Git. Change-Id: Icf043efec7ce956d72b075fc6dc7a87d5a2da82a Signed-off-by: Jonathan Tan --- .../src/org/eclipse/jgit/transport/Daemon.java | 13 +++++++++++-- .../org/eclipse/jgit/transport/DaemonClient.java | 12 +++++++++++- .../org/eclipse/jgit/transport/DaemonService.java | 10 +++++++--- 3 files changed, 29 insertions(+), 6 deletions(-) diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/Daemon.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/Daemon.java index 2b2f25782..656390528 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/Daemon.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/Daemon.java @@ -53,7 +53,9 @@ import java.net.Socket; import java.net.SocketAddress; import java.net.SocketException; import java.util.concurrent.atomic.AtomicBoolean; +import java.util.Collection; +import org.eclipse.jgit.annotations.Nullable; import org.eclipse.jgit.errors.RepositoryNotFoundException; import org.eclipse.jgit.internal.JGitText; import org.eclipse.jgit.lib.PersonIdent; @@ -153,12 +155,17 @@ public class Daemon { @Override protected void execute(final DaemonClient dc, - final Repository db) throws IOException, + final Repository db, + @Nullable Collection extraParameters) + throws IOException, ServiceNotEnabledException, ServiceNotAuthorizedException { UploadPack up = uploadPackFactory.create(dc, db); InputStream in = dc.getInputStream(); OutputStream out = dc.getOutputStream(); + if (extraParameters != null) { + up.setExtraParameters(extraParameters); + } up.upload(in, out, null); } }, new DaemonService("receive-pack", "receivepack") { //$NON-NLS-1$ //$NON-NLS-2$ @@ -168,7 +175,9 @@ public class Daemon { @Override protected void execute(final DaemonClient dc, - final Repository db) throws IOException, + final Repository db, + @Nullable Collection extraParameters) + throws IOException, ServiceNotEnabledException, ServiceNotAuthorizedException { ReceivePack rp = receivePackFactory.create(dc, db); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/DaemonClient.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/DaemonClient.java index a9731ac3a..65b2dc61e 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/DaemonClient.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/DaemonClient.java @@ -50,6 +50,8 @@ import java.io.InputStream; import java.io.OutputStream; import java.net.InetAddress; import java.net.Socket; +import java.util.Arrays; +import java.util.Collection; import org.eclipse.jgit.transport.resolver.ServiceNotAuthorizedException; import org.eclipse.jgit.transport.resolver.ServiceNotEnabledException; @@ -118,6 +120,14 @@ public class DaemonClient { if (0 < daemon.getTimeout()) sock.setSoTimeout(daemon.getTimeout() * 1000); String cmd = new PacketLineIn(rawIn).readStringRaw(); + + Collection extraParameters = null; + + int nulnul = cmd.indexOf("\0\0"); //$NON-NLS-1$ + if (nulnul != -1) { + extraParameters = Arrays.asList(cmd.substring(nulnul + 2).split("\0")); //$NON-NLS-1$ + } + final int nul = cmd.indexOf('\0'); if (nul >= 0) { // Newer clients hide a "host" header behind this byte. @@ -131,6 +141,6 @@ public class DaemonClient { if (srv == null) return; sock.setSoTimeout(0); - srv.execute(this, cmd); + srv.execute(this, cmd, extraParameters); } } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/DaemonService.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/DaemonService.java index 1dc55beb1..1b24f404d 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/DaemonService.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/DaemonService.java @@ -45,7 +45,9 @@ package org.eclipse.jgit.transport; import java.io.IOException; +import java.util.Collection; +import org.eclipse.jgit.annotations.Nullable; import org.eclipse.jgit.lib.Config; import org.eclipse.jgit.lib.Config.SectionParser; import org.eclipse.jgit.lib.Repository; @@ -146,13 +148,14 @@ public abstract class DaemonService { && commandLine.startsWith(command); } - void execute(final DaemonClient client, final String commandLine) + void execute(DaemonClient client, String commandLine, + @Nullable Collection extraParameters) throws IOException, ServiceNotEnabledException, ServiceNotAuthorizedException { final String name = commandLine.substring(command.length() + 1); try (Repository db = client.getDaemon().openRepository(client, name)) { if (isEnabledFor(db)) { - execute(client, db); + execute(client, db, extraParameters); } } catch (ServiceMayNotContinueException e) { // An error when opening the repo means the client is expecting a ref @@ -168,7 +171,8 @@ public abstract class DaemonService { return isEnabled(); } - abstract void execute(DaemonClient client, Repository db) + abstract void execute(DaemonClient client, Repository db, + @Nullable Collection extraParameters) throws IOException, ServiceNotEnabledException, ServiceNotAuthorizedException; } From 667e30678a6bad26f4d4d412e996b293e52e5b87 Mon Sep 17 00:00:00 2001 From: Masaya Suzuki Date: Mon, 14 May 2018 14:13:11 -0700 Subject: [PATCH 07/18] Execute AdvertiseRefsHook only for protocol v0 and v1 Refs are not advertised as part of the protocol v2 capability advertisement. Don't call AdvertiseRefsHook. Noticed because many implementations of AdvertiseRefsHook read all refs in order to call UploadPack#setAdvertisedRefs, causing the capability advertisement to be as slow as a v0 ref advertisement with some RefDatabase implementations. Such an AdvertiseRefsHook is of dubious utility (a better place to determine which refs are advertised is in the RefDatabase implementation itself, as in Gerrit), but at any rate since it's not bringing about any benefit here, we can skip the hook call. TODO: - call an appropriate hook instead (https://bugs.eclipse.org/534847) - add tests [jn: fleshed out commit message; added TODO notes] Change-Id: I6eb60ccfb251a45432954467a9ae9c1079a8c8b5 Signed-off-by: Masaya Suzuki Signed-off-by: Jonathan Nieder --- .../eclipse/jgit/transport/UploadPack.java | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPack.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPack.java index a1c222b19..3d4d279a5 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPack.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPack.java @@ -1153,16 +1153,6 @@ public class UploadPack { */ public void sendAdvertisedRefs(RefAdvertiser adv) throws IOException, ServiceMayNotContinueException { - try { - advertiseRefsHook.advertiseRefs(this); - } catch (ServiceMayNotContinueException fail) { - if (fail.getMessage() != null) { - adv.writeOne("ERR " + fail.getMessage()); //$NON-NLS-1$ - fail.setOutput(); - } - throw fail; - } - if (useProtocolV2()) { // The equivalent in v2 is only the capabilities // advertisement. @@ -1173,6 +1163,16 @@ public class UploadPack { return; } + try { + advertiseRefsHook.advertiseRefs(this); + } catch (ServiceMayNotContinueException fail) { + if (fail.getMessage() != null) { + adv.writeOne("ERR " + fail.getMessage()); //$NON-NLS-1$ + fail.setOutput(); + } + throw fail; + } + adv.init(db); adv.advertiseCapability(OPTION_INCLUDE_TAG); adv.advertiseCapability(OPTION_MULTI_ACK_DETAILED); From f3ec7cf3f0436a79e252251a31dbc62694555897 Mon Sep 17 00:00:00 2001 From: Han-Wen Nienhuys Date: Wed, 16 May 2018 16:34:16 +0200 Subject: [PATCH 08/18] Remove further unnecessary 'final' keywords Remove it from * package private functions. * try blocks * for loops this was done with the following python script: $ cat f.py import sys import re import os def replaceFinal(m): return m.group(1) + "(" + m.group(2).replace('final ', '') + ")" methodDecl = re.compile(r"^([\t ]*[a-zA-Z_ ]+)\(([^)]*)\)") def subst(fn): input = open(fn) os.rename(fn, fn + "~") dest = open(fn, 'w') for l in input: l = methodDecl.sub(replaceFinal, l) dest.write(l) dest.close() for root, dirs, files in os.walk(".", topdown=False): for f in files: if not f.endswith('.java'): continue full = os.path.join(root, f) print full subst(full) Change-Id: If533a75a417594fc893e7c669d2c1f0f6caeb7ca Signed-off-by: Han-Wen Nienhuys --- .../jgit/http/server/AsIsFileFilter.java | 2 +- .../eclipse/jgit/http/server/FileSender.java | 2 +- .../jgit/http/server/ObjectFileServlet.java | 6 ++-- .../jgit/http/server/ServletUtils.java | 2 +- .../http/server/SmartServiceInfoRefs.java | 2 +- .../jgit/http/server/TextFileServlet.java | 2 +- .../jgit/http/server/glue/RegexPipeline.java | 6 ++-- .../jgit/http/server/glue/SuffixPipeline.java | 4 +-- .../jgit/http/server/glue/UrlPipeline.java | 8 ++--- .../http/server/resolver/AsIsFileService.java | 2 +- .../resolver/DefaultReceivePackFactory.java | 2 +- .../resolver/DefaultUploadPackFactory.java | 2 +- .../jgit/http/test/AsIsServiceTest.java | 2 +- .../test/DefaultReceivePackFactoryTest.java | 2 +- .../test/DefaultUploadPackFactoryTest.java | 2 +- .../eclipse/jgit/junit/http/AccessEvent.java | 2 +- .../eclipse/jgit/junit/TestRepository.java | 4 +-- .../jgit/lfs/server/fs/UploadTest.java | 2 +- .../jgit/lfs/lib/AbbreviatedLongObjectId.java | 2 +- .../eclipse/jgit/lfs/lib/AnyLongObjectId.java | 2 +- .../org/eclipse/jgit/pgm/CLIGitCommand.java | 2 +- .../jgit/pgm/AbstractFetchCommand.java | 2 +- .../org/eclipse/jgit/pgm/AmazonS3Client.java | 2 +- .../src/org/eclipse/jgit/pgm/Branch.java | 4 +-- .../org/eclipse/jgit/pgm/CommandCatalog.java | 2 +- .../src/org/eclipse/jgit/pgm/CommandRef.java | 6 ++-- .../src/org/eclipse/jgit/pgm/Daemon.java | 10 +++--- .../src/org/eclipse/jgit/pgm/DiffTree.java | 4 +-- .../src/org/eclipse/jgit/pgm/Log.java | 2 +- .../src/org/eclipse/jgit/pgm/LsRemote.java | 2 +- .../src/org/eclipse/jgit/pgm/LsTree.java | 2 +- .../src/org/eclipse/jgit/pgm/Main.java | 6 ++-- .../src/org/eclipse/jgit/pgm/MergeBase.java | 2 +- .../src/org/eclipse/jgit/pgm/Push.java | 6 ++-- .../src/org/eclipse/jgit/pgm/RevParse.java | 2 +- .../eclipse/jgit/pgm/RevWalkTextBuiltin.java | 20 +++++------ .../src/org/eclipse/jgit/pgm/Show.java | 6 ++-- .../src/org/eclipse/jgit/pgm/ShowRef.java | 2 +- .../src/org/eclipse/jgit/pgm/TextBuiltin.java | 4 +-- .../jgit/pgm/debug/RebuildCommitGraph.java | 2 +- .../eclipse/jgit/pgm/debug/ShowCommands.java | 10 +++--- .../jgit/patch/EGitPatchHistoryTest.java | 10 +++--- .../org/eclipse/jgit/api/CommitOnlyTest.java | 2 +- .../dircache/DirCacheBuilderIteratorTest.java | 2 +- .../DirCacheCGitCompatabilityTest.java | 8 ++--- .../jgit/dircache/DirCacheIteratorTest.java | 14 ++++---- .../storage/file/ConcurrentRepackTest.java | 4 +-- .../internal/storage/file/PackWriterTest.java | 2 +- .../storage/file/T0003_BasicTest.java | 6 ++-- .../storage/file/WindowCacheGetTest.java | 4 +-- .../internal/storage/file/XInputStream.java | 4 +-- .../eclipse/jgit/revwalk/RevObjectTest.java | 2 +- .../revwalk/RevWalkPathFilter6012Test.java | 4 +-- .../jgit/transport/PushProcessTest.java | 4 +-- .../ReceivePackAdvertiseRefsHookTest.java | 4 +-- .../eclipse/jgit/transport/TransportTest.java | 6 ++-- .../treewalk/CanonicalTreeParserTest.java | 2 +- .../jgit/treewalk/PostOrderTreeWalkTest.java | 12 +++---- .../treewalk/filter/PathFilterGroupTest.java | 4 +-- .../treewalk/filter/PathSuffixFilterTest.java | 2 +- .../jgit/treewalk/filter/TreeFilterTest.java | 6 ++-- .../jgit/util/TemporaryBufferTest.java | 2 +- .../eclipse/jgit/awtui/AWTPlotRenderer.java | 6 ++-- .../eclipse/jgit/awtui/CommitGraphPane.java | 4 +-- .../org/eclipse/jgit/api/CloneCommand.java | 6 ++-- .../org/eclipse/jgit/api/ResetCommand.java | 2 +- .../src/org/eclipse/jgit/api/RmCommand.java | 2 +- .../eclipse/jgit/api/StashCreateCommand.java | 2 +- .../org/eclipse/jgit/blame/ReverseWalk.java | 2 +- .../src/org/eclipse/jgit/diff/MyersDiff.java | 18 +++++----- .../eclipse/jgit/diff/SimilarityIndex.java | 2 +- .../org/eclipse/jgit/dircache/DirCache.java | 10 +++--- .../eclipse/jgit/dircache/DirCacheEntry.java | 6 ++-- .../jgit/dircache/DirCacheIterator.java | 2 +- .../eclipse/jgit/dircache/DirCacheTree.java | 6 ++-- .../jgit/errors/CompoundException.java | 2 +- .../MissingBundlePrerequisiteException.java | 2 +- .../org/eclipse/jgit/fnmatch/GroupHead.java | 4 +-- .../jgit/fnmatch/RestrictedWildCardHead.java | 2 +- .../internal/storage/dfs/DfsObjDatabase.java | 2 +- .../internal/storage/dfs/DfsObjectToPack.java | 2 +- .../storage/file/ByteArrayWindow.java | 2 +- .../storage/file/ByteBufferWindow.java | 2 +- .../internal/storage/file/ByteWindow.java | 2 +- .../storage/file/CachedObjectDirectory.java | 2 +- .../internal/storage/file/DeltaBaseCache.java | 4 +-- .../jgit/internal/storage/file/GC.java | 2 +- .../storage/file/LocalObjectToPack.java | 2 +- .../storage/file/ObjectDirectory.java | 14 ++++---- .../storage/file/ObjectDirectoryInserter.java | 6 ++-- .../jgit/internal/storage/file/PackFile.java | 16 ++++----- .../internal/storage/file/PackIndexV1.java | 2 +- .../storage/file/PackIndexWriter.java | 6 ++-- .../storage/file/PackIndexWriterV1.java | 4 +-- .../storage/file/PackIndexWriterV2.java | 8 ++--- .../storage/file/PackReverseIndex.java | 2 +- .../internal/storage/file/RefDirectory.java | 8 ++--- .../storage/file/RefDirectoryRename.java | 2 +- .../storage/file/RefDirectoryUpdate.java | 2 +- .../internal/storage/file/UnpackedObject.java | 2 +- .../internal/storage/file/WindowCache.java | 6 ++-- .../internal/storage/file/WindowCursor.java | 2 +- .../internal/storage/pack/PackWriter.java | 2 +- .../eclipse/jgit/lib/AbbreviatedObjectId.java | 2 +- .../src/org/eclipse/jgit/lib/AnyObjectId.java | 2 +- .../src/org/eclipse/jgit/lib/Config.java | 4 +-- .../src/org/eclipse/jgit/lib/ConfigLine.java | 4 +-- .../jgit/lib/DefaultTypedConfigGetter.java | 2 +- .../org/eclipse/jgit/lib/ObjectDatabase.java | 4 +-- .../src/org/eclipse/jgit/lib/RefWriter.java | 6 ++-- .../merge/StrategySimpleTwoWayInCore.java | 4 +-- .../org/eclipse/jgit/patch/BinaryHunk.java | 4 +-- .../jgit/patch/CombinedFileHeader.java | 6 ++-- .../jgit/patch/CombinedHunkHeader.java | 8 ++--- .../org/eclipse/jgit/patch/FileHeader.java | 30 ++++++++-------- .../org/eclipse/jgit/patch/HunkHeader.java | 10 +++--- .../src/org/eclipse/jgit/patch/Patch.java | 6 ++-- .../jgit/revplot/AbstractPlotRenderer.java | 2 +- .../org/eclipse/jgit/revplot/PlotCommit.java | 10 +++--- .../eclipse/jgit/revplot/PlotCommitList.java | 2 +- .../eclipse/jgit/revwalk/BlockObjQueue.java | 6 ++-- .../eclipse/jgit/revwalk/BlockRevQueue.java | 8 ++--- .../jgit/revwalk/BoundaryGenerator.java | 10 +++--- .../eclipse/jgit/revwalk/DateRevQueue.java | 6 ++-- .../eclipse/jgit/revwalk/DelayRevQueue.java | 2 +- .../eclipse/jgit/revwalk/DepthGenerator.java | 4 +-- .../eclipse/jgit/revwalk/FIFORevQueue.java | 8 ++--- .../revwalk/FixUninterestingGenerator.java | 2 +- .../eclipse/jgit/revwalk/FollowFilter.java | 2 +- .../org/eclipse/jgit/revwalk/Generator.java | 2 +- .../eclipse/jgit/revwalk/LIFORevQueue.java | 6 ++-- .../jgit/revwalk/MergeBaseGenerator.java | 6 ++-- .../jgit/revwalk/PendingGenerator.java | 2 +- .../org/eclipse/jgit/revwalk/RevCommit.java | 10 +++--- .../src/org/eclipse/jgit/revwalk/RevFlag.java | 4 +-- .../org/eclipse/jgit/revwalk/RevObject.java | 2 +- .../eclipse/jgit/revwalk/RevObjectList.java | 2 +- .../src/org/eclipse/jgit/revwalk/RevTag.java | 6 ++-- .../src/org/eclipse/jgit/revwalk/RevWalk.java | 14 ++++---- .../jgit/revwalk/RewriteGenerator.java | 8 ++--- .../eclipse/jgit/revwalk/StartGenerator.java | 2 +- .../jgit/revwalk/TopoSortGenerator.java | 8 ++--- .../jgit/revwalk/filter/AndRevFilter.java | 6 ++-- .../jgit/revwalk/filter/AuthorRevFilter.java | 6 ++-- .../revwalk/filter/CommitTimeRevFilter.java | 8 ++--- .../revwalk/filter/CommitterRevFilter.java | 6 ++-- .../jgit/revwalk/filter/MessageRevFilter.java | 6 ++-- .../jgit/revwalk/filter/OrRevFilter.java | 6 ++-- .../jgit/revwalk/filter/RevFlagFilter.java | 10 +++--- .../org/eclipse/jgit/transport/AmazonS3.java | 14 ++++---- .../jgit/transport/BasePackConnection.java | 2 +- .../transport/BasePackFetchConnection.java | 8 ++--- .../transport/BasePackPushConnection.java | 12 +++---- .../jgit/transport/BaseReceivePack.java | 16 ++++----- .../jgit/transport/BundleFetchConnection.java | 10 +++--- .../eclipse/jgit/transport/BundleWriter.java | 6 ++-- .../org/eclipse/jgit/transport/Daemon.java | 8 ++--- .../eclipse/jgit/transport/DaemonClient.java | 6 ++-- .../eclipse/jgit/transport/DaemonService.java | 2 +- .../jgit/transport/FetchHeadRecord.java | 2 +- .../eclipse/jgit/transport/FetchProcess.java | 34 +++++++++---------- .../eclipse/jgit/transport/FetchResult.java | 2 +- .../jgit/transport/HttpAuthMethod.java | 12 +++---- .../eclipse/jgit/transport/JschSession.java | 2 +- .../eclipse/jgit/transport/OpenSshConfig.java | 4 +-- .../jgit/transport/OperationResult.java | 6 ++-- .../eclipse/jgit/transport/PackParser.java | 12 +++---- .../eclipse/jgit/transport/PacketLineIn.java | 2 +- .../eclipse/jgit/transport/PushProcess.java | 12 +++---- .../jgit/transport/ReceiveCommand.java | 4 +-- .../eclipse/jgit/transport/ReceivePack.java | 6 ++-- .../eclipse/jgit/transport/RefAdvertiser.java | 2 +- .../eclipse/jgit/transport/RemoteConfig.java | 14 ++++---- .../jgit/transport/RemoteRefUpdate.java | 4 +-- .../transport/SideBandProgressMonitor.java | 2 +- .../org/eclipse/jgit/transport/TagOpt.java | 2 +- .../jgit/transport/TransferConfig.java | 4 +-- .../org/eclipse/jgit/transport/Transport.java | 14 ++++---- .../jgit/transport/TransportAmazonS3.java | 10 +++--- .../jgit/transport/TransportGitAnon.java | 6 ++-- .../jgit/transport/TransportGitSsh.java | 6 ++-- .../eclipse/jgit/transport/TransportHttp.java | 16 ++++----- .../jgit/transport/TransportLocal.java | 4 +-- .../eclipse/jgit/transport/TransportSftp.java | 18 +++++----- .../jgit/transport/WalkEncryption.java | 12 +++---- .../jgit/transport/WalkFetchConnection.java | 28 +++++++-------- .../jgit/transport/WalkPushConnection.java | 20 +++++------ .../transport/WalkRemoteObjectDatabase.java | 20 +++++------ .../jgit/treewalk/AbstractTreeIterator.java | 2 +- .../jgit/treewalk/EmptyTreeIterator.java | 2 +- .../jgit/treewalk/NameConflictTreeWalk.java | 8 ++--- .../org/eclipse/jgit/treewalk/TreeWalk.java | 6 ++-- .../jgit/treewalk/WorkingTreeIterator.java | 2 +- .../jgit/treewalk/filter/AndTreeFilter.java | 8 ++--- .../jgit/treewalk/filter/ByteArraySet.java | 2 +- .../jgit/treewalk/filter/OrTreeFilter.java | 8 ++--- .../jgit/treewalk/filter/PathFilter.java | 2 +- .../jgit/treewalk/filter/PathFilterGroup.java | 2 +- .../jgit/util/CachedAuthenticator.java | 2 +- .../src/org/eclipse/jgit/util/FS.java | 2 +- .../src/org/eclipse/jgit/util/LongMap.java | 2 +- .../eclipse/jgit/util/TemporaryBuffer.java | 8 ++--- .../eclipse/jgit/util/io/InterruptTimer.java | 6 ++-- 203 files changed, 570 insertions(+), 570 deletions(-) diff --git a/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/AsIsFileFilter.java b/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/AsIsFileFilter.java index 7f826d4f2..9e9f25e61 100644 --- a/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/AsIsFileFilter.java +++ b/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/AsIsFileFilter.java @@ -66,7 +66,7 @@ import org.eclipse.jgit.transport.resolver.ServiceNotEnabledException; class AsIsFileFilter implements Filter { private final AsIsFileService asIs; - AsIsFileFilter(final AsIsFileService getAnyFile) { + AsIsFileFilter(AsIsFileService getAnyFile) { this.asIs = getAnyFile; } diff --git a/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/FileSender.java b/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/FileSender.java index 09f110d9b..05510a05b 100644 --- a/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/FileSender.java +++ b/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/FileSender.java @@ -84,7 +84,7 @@ final class FileSender { private long end; - FileSender(final File path) throws FileNotFoundException { + FileSender(File path) throws FileNotFoundException { this.path = path; this.source = new RandomAccessFile(path, "r"); diff --git a/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/ObjectFileServlet.java b/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/ObjectFileServlet.java index 1c523a062..62f075c73 100644 --- a/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/ObjectFileServlet.java +++ b/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/ObjectFileServlet.java @@ -75,7 +75,7 @@ abstract class ObjectFileServlet extends HttpServlet { } @Override - String etag(final FileSender sender) throws IOException { + String etag(FileSender sender) throws IOException { return Long.toHexString(sender.getLastModified()); } } @@ -88,7 +88,7 @@ abstract class ObjectFileServlet extends HttpServlet { } @Override - String etag(final FileSender sender) throws IOException { + String etag(FileSender sender) throws IOException { return sender.getTailChecksum(); } } @@ -111,7 +111,7 @@ abstract class ObjectFileServlet extends HttpServlet { private final String contentType; - ObjectFileServlet(final String contentType) { + ObjectFileServlet(String contentType) { this.contentType = contentType; } diff --git a/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/ServletUtils.java b/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/ServletUtils.java index 2ff385dbe..9601c8caf 100644 --- a/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/ServletUtils.java +++ b/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/ServletUtils.java @@ -238,7 +238,7 @@ public final class ServletUtils { return content; } - static boolean acceptsGzipEncoding(final HttpServletRequest req) { + static boolean acceptsGzipEncoding(HttpServletRequest req) { return acceptsGzipEncoding(req.getHeader(HDR_ACCEPT_ENCODING)); } diff --git a/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/SmartServiceInfoRefs.java b/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/SmartServiceInfoRefs.java index 6417877e1..92009c573 100644 --- a/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/SmartServiceInfoRefs.java +++ b/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/SmartServiceInfoRefs.java @@ -75,7 +75,7 @@ abstract class SmartServiceInfoRefs implements Filter { private final Filter[] filters; - SmartServiceInfoRefs(final String service, final List filters) { + SmartServiceInfoRefs(String service, List filters) { this.svc = service; this.filters = filters.toArray(new Filter[filters.size()]); } diff --git a/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/TextFileServlet.java b/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/TextFileServlet.java index 5cac868b9..b2466d0e3 100644 --- a/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/TextFileServlet.java +++ b/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/TextFileServlet.java @@ -64,7 +64,7 @@ class TextFileServlet extends HttpServlet { private final String fileName; - TextFileServlet(final String name) { + TextFileServlet(String name) { this.fileName = name; } diff --git a/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/glue/RegexPipeline.java b/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/glue/RegexPipeline.java index bf2d6dbb4..010810508 100644 --- a/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/glue/RegexPipeline.java +++ b/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/glue/RegexPipeline.java @@ -87,11 +87,11 @@ class RegexPipeline extends UrlPipeline { static class Binder extends ServletBinderImpl { private final Pattern pattern; - Binder(final String p) { + Binder(String p) { pattern = Pattern.compile(p); } - Binder(final Pattern p) { + Binder(Pattern p) { pattern = p; } @@ -110,7 +110,7 @@ class RegexPipeline extends UrlPipeline { } @Override - boolean match(final HttpServletRequest req) { + boolean match(HttpServletRequest req) { final String pathInfo = req.getPathInfo(); return pathInfo != null && pattern.matcher(pathInfo).matches(); } diff --git a/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/glue/SuffixPipeline.java b/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/glue/SuffixPipeline.java index 6742c9f72..4fd99c6ef 100644 --- a/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/glue/SuffixPipeline.java +++ b/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/glue/SuffixPipeline.java @@ -67,7 +67,7 @@ class SuffixPipeline extends UrlPipeline { static class Binder extends ServletBinderImpl { private final String suffix; - Binder(final String suffix) { + Binder(String suffix) { this.suffix = suffix; } @@ -89,7 +89,7 @@ class SuffixPipeline extends UrlPipeline { } @Override - boolean match(final HttpServletRequest req) { + boolean match(HttpServletRequest req) { final String pathInfo = req.getPathInfo(); return pathInfo != null && pathInfo.endsWith(suffix); } diff --git a/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/glue/UrlPipeline.java b/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/glue/UrlPipeline.java index 56e4e2288..c02399a23 100644 --- a/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/glue/UrlPipeline.java +++ b/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/glue/UrlPipeline.java @@ -79,7 +79,7 @@ abstract class UrlPipeline { /** Instance that must generate the response; never null. */ private final HttpServlet servlet; - UrlPipeline(final Filter[] filters, final HttpServlet servlet) { + UrlPipeline(Filter[] filters, HttpServlet servlet) { this.filters = filters; this.servlet = servlet; } @@ -99,7 +99,7 @@ abstract class UrlPipeline { * @throws ServletException * a filter or servlet is unable to initialize. */ - void init(final ServletContext context, final Set inited) + void init(ServletContext context, Set inited) throws ServletException { for (Filter ref : filters) initFilter(ref, context, inited); @@ -165,7 +165,7 @@ abstract class UrlPipeline { * destroyed a second time. Filters and servlets that are first * destroyed by this pipeline will be added to this set. */ - void destroy(final Set destroyed) { + void destroy(Set destroyed) { for (Filter ref : filters) destroyFilter(ref, destroyed); destroyServlet(servlet, destroyed); @@ -230,7 +230,7 @@ abstract class UrlPipeline { private int filterIdx; - Chain(final Filter[] filters, final HttpServlet servlet) { + Chain(Filter[] filters, HttpServlet servlet) { this.filters = filters; this.servlet = servlet; } diff --git a/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/resolver/AsIsFileService.java b/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/resolver/AsIsFileService.java index 11ad5e0e1..9a928b1e2 100644 --- a/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/resolver/AsIsFileService.java +++ b/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/resolver/AsIsFileService.java @@ -73,7 +73,7 @@ public class AsIsFileService { private static class ServiceConfig { final boolean enabled; - ServiceConfig(final Config cfg) { + ServiceConfig(Config cfg) { enabled = cfg.getBoolean("http", "getanyfile", true); } } diff --git a/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/resolver/DefaultReceivePackFactory.java b/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/resolver/DefaultReceivePackFactory.java index fbd155c0d..06a8f5eff 100644 --- a/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/resolver/DefaultReceivePackFactory.java +++ b/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/resolver/DefaultReceivePackFactory.java @@ -74,7 +74,7 @@ public class DefaultReceivePackFactory implements final boolean enabled; - ServiceConfig(final Config cfg) { + ServiceConfig(Config cfg) { set = cfg.getString("http", null, "receivepack") != null; enabled = cfg.getBoolean("http", "receivepack", false); } diff --git a/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/resolver/DefaultUploadPackFactory.java b/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/resolver/DefaultUploadPackFactory.java index e6df77b83..30edc1516 100644 --- a/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/resolver/DefaultUploadPackFactory.java +++ b/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/resolver/DefaultUploadPackFactory.java @@ -64,7 +64,7 @@ public class DefaultUploadPackFactory implements private static class ServiceConfig { final boolean enabled; - ServiceConfig(final Config cfg) { + ServiceConfig(Config cfg) { enabled = cfg.getBoolean("http", "uploadpack", true); } } diff --git a/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/AsIsServiceTest.java b/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/AsIsServiceTest.java index e94a792ff..298bf2170 100644 --- a/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/AsIsServiceTest.java +++ b/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/AsIsServiceTest.java @@ -133,7 +133,7 @@ public class AsIsServiceTest extends LocalDiskRepositoryTestCase { private final String host; - R(final String user, final String host) { + R(String user, String host) { super(new Request(null, null) /* can't pass null, sigh */); this.user = user; this.host = host; diff --git a/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/DefaultReceivePackFactoryTest.java b/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/DefaultReceivePackFactoryTest.java index b24e2dfc7..ade1e1d2b 100644 --- a/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/DefaultReceivePackFactoryTest.java +++ b/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/DefaultReceivePackFactoryTest.java @@ -205,7 +205,7 @@ public class DefaultReceivePackFactoryTest extends LocalDiskRepositoryTestCase { private final String host; - R(final String user, final String host) { + R(String user, String host) { super(new Request(null, null) /* can't pass null, sigh */); this.user = user; this.host = host; diff --git a/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/DefaultUploadPackFactoryTest.java b/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/DefaultUploadPackFactoryTest.java index ce24d64b7..268c281e2 100644 --- a/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/DefaultUploadPackFactoryTest.java +++ b/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/DefaultUploadPackFactoryTest.java @@ -161,7 +161,7 @@ public class DefaultUploadPackFactoryTest extends LocalDiskRepositoryTestCase { private final String host; - R(final String user, final String host) { + R(String user, String host) { super(new Request(null, null) /* can't pass null, sigh */); this.user = user; this.host = host; 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 8d08c038d..82476dea4 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 @@ -67,7 +67,7 @@ public class AccessEvent { private final Map responseHeaders; - AccessEvent(final Request req, final Response rsp) { + AccessEvent(Request req, Response rsp) { method = req.getMethod(); uri = req.getRequestURI(); requestHeaders = cloneHeaders(req); diff --git a/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/TestRepository.java b/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/TestRepository.java index 4891c0194..d23c0d3c2 100644 --- a/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/TestRepository.java +++ b/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/TestRepository.java @@ -318,7 +318,7 @@ public class TestRepository { public RevTree tree(DirCacheEntry... entries) throws Exception { final DirCache dc = DirCache.newInCore(); final DirCacheBuilder b = dc.builder(); - for (final DirCacheEntry e : entries) + for (DirCacheEntry e : entries) b.add(e); b.finish(); ObjectId root; @@ -962,7 +962,7 @@ public class TestRepository { public class BranchBuilder { private final String ref; - BranchBuilder(final String ref) { + BranchBuilder(String ref) { this.ref = ref; } diff --git a/org.eclipse.jgit.lfs.server.test/tst/org/eclipse/jgit/lfs/server/fs/UploadTest.java b/org.eclipse.jgit.lfs.server.test/tst/org/eclipse/jgit/lfs/server/fs/UploadTest.java index 8a8f49c1b..09f8d0aea 100644 --- a/org.eclipse.jgit.lfs.server.test/tst/org/eclipse/jgit/lfs/server/fs/UploadTest.java +++ b/org.eclipse.jgit.lfs.server.test/tst/org/eclipse/jgit/lfs/server/fs/UploadTest.java @@ -122,7 +122,7 @@ public class UploadTest extends LfsServerTest { ExecutorService e = Executors.newFixedThreadPool(count); try { - for (final Path p : paths) { + for (Path p : paths) { e.submit(new Callable() { @Override public Void call() throws Exception { diff --git a/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/lib/AbbreviatedLongObjectId.java b/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/lib/AbbreviatedLongObjectId.java index d26885791..bdd1b39c0 100644 --- a/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/lib/AbbreviatedLongObjectId.java +++ b/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/lib/AbbreviatedLongObjectId.java @@ -173,7 +173,7 @@ public final class AbbreviatedLongObjectId implements Serializable { return r << (16 - n) * 4; } - static long mask(final int nibbles, final long word, final long v) { + static long mask(int nibbles, long word, long v) { final long b = (word - 1) * 16; if (b + 16 <= nibbles) { // We have all of the bits required for this word. diff --git a/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/lib/AnyLongObjectId.java b/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/lib/AnyLongObjectId.java index cdb297eb1..078892263 100644 --- a/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/lib/AnyLongObjectId.java +++ b/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/lib/AnyLongObjectId.java @@ -476,7 +476,7 @@ public abstract class AnyLongObjectId implements Comparable { private static final char[] hexchar = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' }; - static void formatHexChar(final char[] dst, final int p, long w) { + static void formatHexChar(char[] dst, int p, long w) { int o = p + 15; while (o >= p && w != 0) { dst[o--] = hexchar[(int) (w & 0xf)]; 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 69eb1989d..44ad79def 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 @@ -157,7 +157,7 @@ public class CLIGitCommand extends Main { } @Override - void init(final TextBuiltin cmd) throws IOException { + void init(TextBuiltin cmd) throws IOException { cmd.outs = result.out; cmd.errs = result.err; super.init(cmd); diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/AbstractFetchCommand.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/AbstractFetchCommand.java index 2b6ea2a0e..9223e0fcd 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/AbstractFetchCommand.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/AbstractFetchCommand.java @@ -77,7 +77,7 @@ abstract class AbstractFetchCommand extends TextBuiltin { protected void showFetchResult(FetchResult r) throws IOException { try (ObjectReader reader = db.newObjectReader()) { boolean shownURI = false; - for (final TrackingRefUpdate u : r.getTrackingRefUpdates()) { + for (TrackingRefUpdate u : r.getTrackingRefUpdates()) { if (!verbose && u.getResult() == RefUpdate.Result.NO_CHANGE) continue; diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/AmazonS3Client.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/AmazonS3Client.java index cce889b76..f4f8d8f50 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/AmazonS3Client.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/AmazonS3Client.java @@ -105,7 +105,7 @@ class AmazonS3Client extends TextBuiltin { } } else if ("ls".equals(op) || "list".equals(op)) { //$NON-NLS-1$//$NON-NLS-2$ - for (final String k : s3.list(bucket, key)) + for (String k : s3.list(bucket, key)) outw.println(k); } else if ("rm".equals(op) || "delete".equals(op)) { //$NON-NLS-1$ //$NON-NLS-2$ diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Branch.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Branch.java index 65d60bce5..a88354deb 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Branch.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Branch.java @@ -292,7 +292,7 @@ class Branch extends TextBuiltin { addRefs(refs, Constants.R_REMOTES); try (ObjectReader reader = db.newObjectReader()) { - for (final Entry e : printRefs.entrySet()) { + for (Entry e : printRefs.entrySet()) { final Ref ref = e.getValue(); printHead(reader, e.getKey(), current.equals(ref.getName()), ref); @@ -303,7 +303,7 @@ class Branch extends TextBuiltin { } private void addRefs(Collection refs, String prefix) { - for (final Ref ref : RefComparator.sort(refs)) { + for (Ref ref : RefComparator.sort(refs)) { final String name = ref.getName(); if (name.startsWith(prefix)) addRef(name.substring(name.indexOf('/', 5) + 1), ref); diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/CommandCatalog.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/CommandCatalog.java index e699326a0..5754d7c44 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/CommandCatalog.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/CommandCatalog.java @@ -107,7 +107,7 @@ public class CommandCatalog { */ public static CommandRef[] common() { final ArrayList common = new ArrayList<>(); - for (final CommandRef c : INSTANCE.commands.values()) + for (CommandRef c : INSTANCE.commands.values()) if (c.isCommon()) common.add(c); return toSortedArray(common); diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/CommandRef.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/CommandRef.java index 4df446fe8..1773de5d7 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/CommandRef.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/CommandRef.java @@ -66,11 +66,11 @@ public class CommandRef { boolean common; - CommandRef(final Class clazz) { + CommandRef(Class clazz) { this(clazz, guessName(clazz)); } - CommandRef(final Class clazz, final Command cmd) { + CommandRef(Class clazz, Command cmd) { this(clazz, cmd.name().length() > 0 ? cmd.name() : guessName(clazz)); usage = cmd.usage(); common = cmd.common(); @@ -88,7 +88,7 @@ public class CommandRef { s.append("debug-"); //$NON-NLS-1$ boolean lastWasDash = true; - for (final char c : clazz.getSimpleName().toCharArray()) { + for (char c : clazz.getSimpleName().toCharArray()) { if (Character.isUpperCase(c)) { if (!lastWasDash) s.append('-'); diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Daemon.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Daemon.java index d0ada67fc..319b5e39d 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Daemon.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Daemon.java @@ -142,7 +142,7 @@ class Daemon extends TextBuiltin { packConfig.setExecutor(Executors.newFixedThreadPool(threads)); final FileResolver resolver = new FileResolver<>(); - for (final File f : directory) { + for (File f : directory) { outw.println(MessageFormat.format(CLIText.get().exporting, f.getAbsolutePath())); resolver.exportDirectory(f); } @@ -157,14 +157,14 @@ class Daemon extends TextBuiltin { if (0 <= timeout) d.setTimeout(timeout); - for (final String n : enable) + for (String n : enable) service(d, n).setEnabled(true); - for (final String n : disable) + for (String n : disable) service(d, n).setEnabled(false); - for (final String n : canOverride) + for (String n : canOverride) service(d, n).setOverridable(true); - for (final String n : forbidOverride) + for (String n : forbidOverride) service(d, n).setOverridable(false); if (ketchServerType == KetchServerType.LEADER) { startKetchLeader(d); diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/DiffTree.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/DiffTree.java index 510406345..42aabc2f4 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/DiffTree.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/DiffTree.java @@ -75,9 +75,9 @@ class DiffTree extends TextBuiltin { /** {@inheritDoc} */ @Override protected void run() throws Exception { - try (final TreeWalk walk = new TreeWalk(db)) { + try (TreeWalk walk = new TreeWalk(db)) { walk.setRecursive(recursive); - for (final AbstractTreeIterator i : trees) + for (AbstractTreeIterator i : trees) walk.addTree(i); walk.setFilter(AndTreeFilter.create(TreeFilter.ANY_DIFF, pathFilter)); diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Log.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Log.java index 0d8b7ec00..ad92a78f6 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Log.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Log.java @@ -266,7 +266,7 @@ class Log extends RevWalkTextBuiltin { outw.println(); final String[] lines = c.getFullMessage().split("\n"); //$NON-NLS-1$ - for (final String s : lines) { + for (String s : lines) { outw.print(" "); //$NON-NLS-1$ outw.print(s); outw.println(); diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/LsRemote.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/LsRemote.java index 907923358..2711c1572 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/LsRemote.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/LsRemote.java @@ -83,7 +83,7 @@ class LsRemote extends TextBuiltin { } }); refs.addAll(command.call()); - for (final Ref r : refs) { + for (Ref r : refs) { show(r.getObjectId(), r.getName()); if (r.getPeeledObjectId() != null) show(r.getPeeledObjectId(), r.getName() + "^{}"); //$NON-NLS-1$ diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/LsTree.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/LsTree.java index c57f9f2c3..01fa7eeb8 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/LsTree.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/LsTree.java @@ -73,7 +73,7 @@ class LsTree extends TextBuiltin { /** {@inheritDoc} */ @Override protected void run() throws Exception { - try (final TreeWalk walk = new TreeWalk(db)) { + try (TreeWalk walk = new TreeWalk(db)) { walk.reset(); // drop the first empty tree, which we do not need here if (paths.size() > 0) walk.setFilter(PathFilterGroup.createFromStrings(paths)); diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Main.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Main.java index e303f385a..ac53de976 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Main.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Main.java @@ -256,12 +256,12 @@ public class Main { writer.println(CLIText.get().mostCommonlyUsedCommandsAre); final CommandRef[] common = CommandCatalog.common(); int width = 0; - for (final CommandRef c : common) { + for (CommandRef c : common) { width = Math.max(width, c.getName().length()); } width += 2; - for (final CommandRef c : common) { + for (CommandRef c : common) { writer.print(' '); writer.print(c.getName()); for (int i = c.getName().length(); i < width; i++) { @@ -296,7 +296,7 @@ public class Main { } } - void init(final TextBuiltin cmd) throws IOException { + void init(TextBuiltin cmd) throws IOException { if (cmd.requiresRepository()) { cmd.init(openGitDir(gitdir), null); } else { diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/MergeBase.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/MergeBase.java index 62a88aeed..6842d8ddb 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/MergeBase.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/MergeBase.java @@ -68,7 +68,7 @@ class MergeBase extends TextBuiltin { /** {@inheritDoc} */ @Override protected void run() throws Exception { - for (final RevCommit c : commits) + for (RevCommit c : commits) argWalk.markStart(c); argWalk.setRevFilter(RevFilter.MERGE_BASE); int max = all ? Integer.MAX_VALUE : 1; diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Push.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Push.java index 309dca2a7..be8ad374d 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Push.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Push.java @@ -149,7 +149,7 @@ class Push extends TextBuiltin { boolean everythingUpToDate = true; // at first, print up-to-date ones... - for (final RemoteRefUpdate rru : result.getRemoteUpdates()) { + for (RemoteRefUpdate rru : result.getRemoteUpdates()) { if (rru.getStatus() == Status.UP_TO_DATE) { if (verbose) printRefUpdateResult(reader, uri, result, rru); @@ -157,13 +157,13 @@ class Push extends TextBuiltin { everythingUpToDate = false; } - for (final RemoteRefUpdate rru : result.getRemoteUpdates()) { + for (RemoteRefUpdate rru : result.getRemoteUpdates()) { // ...then successful updates... if (rru.getStatus() == Status.OK) printRefUpdateResult(reader, uri, result, rru); } - for (final RemoteRefUpdate rru : result.getRemoteUpdates()) { + for (RemoteRefUpdate rru : result.getRemoteUpdates()) { // ...finally, others (problematic) if (rru.getStatus() != Status.OK && rru.getStatus() != Status.UP_TO_DATE) diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/RevParse.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/RevParse.java index 21e37cd8c..ac08cd6ac 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/RevParse.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/RevParse.java @@ -87,7 +87,7 @@ class RevParse extends TextBuiltin { CLIText.format(CLIText.get().needSingleRevision)); } - for (final ObjectId o : commits) { + for (ObjectId o : commits) { outw.println(o.name()); } } diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/RevWalkTextBuiltin.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/RevWalkTextBuiltin.java index 1178f8801..15abeac96 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/RevWalkTextBuiltin.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/RevWalkTextBuiltin.java @@ -99,22 +99,22 @@ abstract class RevWalkTextBuiltin extends TextBuiltin { } @Option(name = "--date-order") - void enableDateOrder(final boolean on) { + void enableDateOrder(boolean on) { enableRevSort(RevSort.COMMIT_TIME_DESC, on); } @Option(name = "--topo-order") - void enableTopoOrder(final boolean on) { + void enableTopoOrder(boolean on) { enableRevSort(RevSort.TOPO, on); } @Option(name = "--reverse") - void enableReverse(final boolean on) { + void enableReverse(boolean on) { enableRevSort(RevSort.REVERSE, on); } @Option(name = "--boundary") - void enableBoundary(final boolean on) { + void enableBoundary(boolean on) { enableRevSort(RevSort.BOUNDARY, on); } @@ -130,17 +130,17 @@ abstract class RevWalkTextBuiltin extends TextBuiltin { private final List revLimiter = new ArrayList<>(); @Option(name = "--author") - void addAuthorRevFilter(final String who) { + void addAuthorRevFilter(String who) { revLimiter.add(AuthorRevFilter.create(who)); } @Option(name = "--committer") - void addCommitterRevFilter(final String who) { + void addCommitterRevFilter(String who) { revLimiter.add(CommitterRevFilter.create(who)); } @Option(name = "--grep") - void addCMessageRevFilter(final String msg) { + void addCMessageRevFilter(String msg) { revLimiter.add(MessageRevFilter.create(msg)); } @@ -151,7 +151,7 @@ abstract class RevWalkTextBuiltin extends TextBuiltin { @Override protected void run() throws Exception { walk = createWalk(); - for (final RevSort s : sorting) + for (RevSort s : sorting) walk.sort(s, true); if (pathFilter == TreeFilter.ALL) { @@ -187,7 +187,7 @@ abstract class RevWalkTextBuiltin extends TextBuiltin { throw die(MessageFormat.format(CLIText.get().cannotResolve, Constants.HEAD)); commits.add(walk.parseCommit(head)); } - for (final RevCommit c : commits) { + for (RevCommit c : commits) { final RevCommit real = argWalk == walk ? c : walk.parseCommit(c); if (c.has(RevFlag.UNINTERESTING)) walk.markUninteresting(real); @@ -233,7 +233,7 @@ abstract class RevWalkTextBuiltin extends TextBuiltin { */ protected int walkLoop() throws Exception { int n = 0; - for (final RevCommit c : walk) { + for (RevCommit c : walk) { if (++n > maxCount && maxCount >= 0) break; show(c); diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Show.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Show.java index fb1e6d0a5..89a15fe4d 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Show.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Show.java @@ -248,7 +248,7 @@ class Show extends TextBuiltin { outw.println(); final String[] lines = tag.getFullMessage().split("\n"); //$NON-NLS-1$ - for (final String s : lines) { + for (String s : lines) { outw.print(" "); //$NON-NLS-1$ outw.print(s); outw.println(); @@ -259,7 +259,7 @@ class Show extends TextBuiltin { private void show(RevTree obj) throws MissingObjectException, IncorrectObjectTypeException, CorruptObjectException, IOException { - try (final TreeWalk walk = new TreeWalk(db)) { + try (TreeWalk walk = new TreeWalk(db)) { walk.reset(); walk.addTree(obj); @@ -292,7 +292,7 @@ class Show extends TextBuiltin { outw.println(); final String[] lines = c.getFullMessage().split("\n"); //$NON-NLS-1$ - for (final String s : lines) { + for (String s : lines) { outw.print(" "); //$NON-NLS-1$ outw.print(s); outw.println(); diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/ShowRef.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/ShowRef.java index 0cc5dbc47..6318a633c 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/ShowRef.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/ShowRef.java @@ -57,7 +57,7 @@ class ShowRef extends TextBuiltin { /** {@inheritDoc} */ @Override protected void run() throws Exception { - for (final Ref r : getSortedRefs()) { + for (Ref r : getSortedRefs()) { show(r.getObjectId(), r.getName()); if (r.getPeeledObjectId() != null) show(r.getPeeledObjectId(), r.getName() + "^{}"); //$NON-NLS-1$ diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/TextBuiltin.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/TextBuiltin.java index 7b3854212..7e5b5451b 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/TextBuiltin.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/TextBuiltin.java @@ -129,7 +129,7 @@ public abstract class TextBuiltin { /** RevWalk used during command line parsing, if it was required. */ protected RevWalk argWalk; - final void setCommandName(final String name) { + final void setCommandName(String name) { commandName = name; } @@ -361,7 +361,7 @@ public abstract class TextBuiltin { return db; } - ObjectId resolve(final String s) throws IOException { + ObjectId resolve(String s) throws IOException { final ObjectId r = db.resolve(s); if (r == null) throw die(MessageFormat.format(CLIText.get().notARevision, s)); diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/RebuildCommitGraph.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/RebuildCommitGraph.java index a133b0537..2d16fefa7 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/RebuildCommitGraph.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/RebuildCommitGraph.java @@ -222,7 +222,7 @@ class RebuildCommitGraph extends TextBuiltin { ObjectId newId; - ToRewrite(final ObjectId o, final long t, final ObjectId[] p) { + ToRewrite(ObjectId o, long t, ObjectId[] p) { oldId = o; commitTime = t; oldParents = p; diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/ShowCommands.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/ShowCommands.java index a960ec6dd..af56d65c0 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/ShowCommands.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/ShowCommands.java @@ -65,11 +65,11 @@ class ShowCommands extends TextBuiltin { final CommandRef[] list = CommandCatalog.all(); int width = 0; - for (final CommandRef c : list) + for (CommandRef c : list) width = Math.max(width, c.getName().length()); width += 2; - for (final CommandRef c : list) { + for (CommandRef c : list) { errw.print(c.isCommon() ? '*' : ' '); errw.print(' '); @@ -87,7 +87,7 @@ class ShowCommands extends TextBuiltin { /** */ USAGE { @Override - void print(ThrowingPrintWriter err, final CommandRef c) throws IOException { + void print(ThrowingPrintWriter err, CommandRef c) throws IOException { String usage = c.getUsage(); if (usage != null && usage.length() > 0) err.print(CLIText.get().resourceBundle().getString(usage)); @@ -97,7 +97,7 @@ class ShowCommands extends TextBuiltin { /** */ CLASSES { @Override - void print(ThrowingPrintWriter err, final CommandRef c) throws IOException { + void print(ThrowingPrintWriter err, CommandRef c) throws IOException { err.print(c.getImplementationClassName()); } }, @@ -105,7 +105,7 @@ class ShowCommands extends TextBuiltin { /** */ URLS { @Override - void print(ThrowingPrintWriter err, final CommandRef c) throws IOException { + void print(ThrowingPrintWriter err, CommandRef c) throws IOException { final ClassLoader ldr = c.getImplementationClassLoader(); String cn = c.getImplementationClassName(); diff --git a/org.eclipse.jgit.test/exttst/org/eclipse/jgit/patch/EGitPatchHistoryTest.java b/org.eclipse.jgit.test/exttst/org/eclipse/jgit/patch/EGitPatchHistoryTest.java index f26952ea7..79d8d0e10 100644 --- a/org.eclipse.jgit.test/exttst/org/eclipse/jgit/patch/EGitPatchHistoryTest.java +++ b/org.eclipse.jgit.test/exttst/org/eclipse/jgit/patch/EGitPatchHistoryTest.java @@ -85,7 +85,7 @@ public class EGitPatchHistoryTest { int errors; - PatchReader(final HashMap> s) + PatchReader(HashMap> s) throws IOException { super(new String[] { "-p" }); stats = s; @@ -103,7 +103,7 @@ public class EGitPatchHistoryTest { p.parse(buf, 0, buf.length - 1); assertEquals("File count " + cid, files.size(), p.getFiles().size()); if (!p.getErrors().isEmpty()) { - for (final FormatError e : p.getErrors()) { + for (FormatError e : p.getErrors()) { System.out.println("error " + e.getMessage()); System.out.println(" at " + e.getLineText()); } @@ -111,7 +111,7 @@ public class EGitPatchHistoryTest { fail("Unexpected error in " + cid); } - for (final FileHeader fh : p.getFiles()) { + for (FileHeader fh : p.getFiles()) { final String fileName; if (fh.getChangeType() != FileHeader.ChangeType.DELETE) fileName = fh.getNewPath(); @@ -121,7 +121,7 @@ public class EGitPatchHistoryTest { final String nid = fileName + " in " + cid; assertNotNull("No " + nid, s); int added = 0, deleted = 0; - for (final HunkHeader h : fh.getHunks()) { + for (HunkHeader h : fh.getHunks()) { added += h.getOldImage().getLinesAdded(); deleted += h.getOldImage().getLinesDeleted(); } @@ -188,7 +188,7 @@ public class EGitPatchHistoryTest { static abstract class CommitReader { private Process proc; - CommitReader(final String[] args) throws IOException { + CommitReader(String[] args) throws IOException { final String[] realArgs = new String[3 + args.length + 1]; realArgs[0] = "git"; realArgs[1] = "log"; diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/CommitOnlyTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/CommitOnlyTest.java index cc21b473e..bbd6ec0bd 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/CommitOnlyTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/CommitOnlyTest.java @@ -1289,7 +1289,7 @@ public class CommitOnlyTest extends RepositoryTestCase { return null; } - static private String getHead(final Git git, final String path) + static private String getHead(Git git, String path) throws Exception { try { final Repository repo = git.getRepository(); diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/dircache/DirCacheBuilderIteratorTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/dircache/DirCacheBuilderIteratorTest.java index 2b108870f..3598f3a4a 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/dircache/DirCacheBuilderIteratorTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/dircache/DirCacheBuilderIteratorTest.java @@ -78,7 +78,7 @@ public class DirCacheBuilderIteratorTest extends RepositoryTestCase { final int expIdx = 2; final DirCacheBuilder b = dc.builder(); - try (final TreeWalk tw = new TreeWalk(db)) { + try (TreeWalk tw = new TreeWalk(db)) { tw.addTree(new DirCacheBuildIterator(b)); tw.setRecursive(true); tw.setFilter(PathFilterGroup.createFromStrings(Collections diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/dircache/DirCacheCGitCompatabilityTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/dircache/DirCacheCGitCompatabilityTest.java index 0b261840c..c362e7497 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/dircache/DirCacheCGitCompatabilityTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/dircache/DirCacheCGitCompatabilityTest.java @@ -99,7 +99,7 @@ public class DirCacheCGitCompatabilityTest extends LocalDiskRepositoryTestCase { assertEquals(ls.size(), dc.getEntryCount()); { final Iterator rItr = ls.values().iterator(); - try (final TreeWalk tw = new TreeWalk(db)) { + try (TreeWalk tw = new TreeWalk(db)) { tw.setRecursive(true); tw.addTree(new DirCacheIterator(dc)); while (rItr.hasNext()) { @@ -180,7 +180,7 @@ public class DirCacheCGitCompatabilityTest extends LocalDiskRepositoryTestCase { assertEquals(cList.size(), jTree.getEntrySpan()); final ArrayList subtrees = new ArrayList<>(); - for (final CGitLsTreeRecord r : cTree.values()) { + for (CGitLsTreeRecord r : cTree.values()) { if (FileMode.TREE.equals(r.mode)) subtrees.add(r); } @@ -268,7 +268,7 @@ public class DirCacheCGitCompatabilityTest extends LocalDiskRepositoryTestCase { final String path; - CGitIndexRecord(final String line) { + CGitIndexRecord(String line) { final int tab = line.indexOf('\t'); final int sp1 = line.indexOf(' '); final int sp2 = line.indexOf(' ', sp1 + 1); @@ -286,7 +286,7 @@ public class DirCacheCGitCompatabilityTest extends LocalDiskRepositoryTestCase { final String path; - CGitLsTreeRecord(final String line) { + CGitLsTreeRecord(String line) { final int tab = line.indexOf('\t'); final int sp1 = line.indexOf(' '); final int sp2 = line.indexOf(' ', sp1 + 1); diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/dircache/DirCacheIteratorTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/dircache/DirCacheIteratorTest.java index dd242e5a1..82565fcee 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/dircache/DirCacheIteratorTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/dircache/DirCacheIteratorTest.java @@ -76,7 +76,7 @@ public class DirCacheIteratorTest extends RepositoryTestCase { final DirCache dc = DirCache.newInCore(); assertEquals(0, dc.getEntryCount()); - try (final TreeWalk tw = new TreeWalk(db)) { + try (TreeWalk tw = new TreeWalk(db)) { tw.addTree(new DirCacheIterator(dc)); assertFalse(tw.next()); } @@ -126,7 +126,7 @@ public class DirCacheIteratorTest extends RepositoryTestCase { b.finish(); final DirCacheIterator i = new DirCacheIterator(dc); - try (final TreeWalk tw = new TreeWalk(db)) { + try (TreeWalk tw = new TreeWalk(db)) { tw.addTree(i); int pathIdx = 0; while (tw.next()) { @@ -164,7 +164,7 @@ public class DirCacheIteratorTest extends RepositoryTestCase { final int expPos[] = { 0, -1, 4 }; final DirCacheIterator i = new DirCacheIterator(dc); - try (final TreeWalk tw = new TreeWalk(db)) { + try (TreeWalk tw = new TreeWalk(db)) { tw.addTree(i); tw.setRecursive(false); int pathIdx = 0; @@ -205,7 +205,7 @@ public class DirCacheIteratorTest extends RepositoryTestCase { b.finish(); final DirCacheIterator i = new DirCacheIterator(dc); - try (final TreeWalk tw = new TreeWalk(db)) { + try (TreeWalk tw = new TreeWalk(db)) { tw.addTree(i); tw.setRecursive(true); int pathIdx = 0; @@ -240,7 +240,7 @@ public class DirCacheIteratorTest extends RepositoryTestCase { b.add(ents[i]); b.finish(); - try (final TreeWalk tw = new TreeWalk(db)) { + try (TreeWalk tw = new TreeWalk(db)) { tw.addTree(new DirCacheIterator(dc)); tw.setRecursive(true); int pathIdx = 0; @@ -402,7 +402,7 @@ public class DirCacheIteratorTest extends RepositoryTestCase { b.add(ents[i]); b.finish(); - try (final TreeWalk tw = new TreeWalk(db)) { + try (TreeWalk tw = new TreeWalk(db)) { for (int victimIdx = 0; victimIdx < paths.length; victimIdx++) { tw.reset(); tw.addTree(new DirCacheIterator(dc)); @@ -430,7 +430,7 @@ public class DirCacheIteratorTest extends RepositoryTestCase { final DirCache dc = DirCache.read(path, FS.DETECTED); assertEquals(2, dc.getEntryCount()); - try (final TreeWalk tw = new TreeWalk(db)) { + try (TreeWalk tw = new TreeWalk(db)) { tw.setRecursive(true); tw.addTree(new DirCacheIterator(dc)); diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/ConcurrentRepackTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/ConcurrentRepackTest.java index 2895b3026..643daa5c9 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/ConcurrentRepackTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/ConcurrentRepackTest.java @@ -220,7 +220,7 @@ public class ConcurrentRepackTest extends RepositoryTestCase { private File[] pack(Repository src, RevObject... list) throws IOException { try (PackWriter pw = new PackWriter(src)) { - for (final RevObject o : list) { + for (RevObject o : list) { pw.addObject(o); } @@ -253,7 +253,7 @@ public class ConcurrentRepackTest extends RepositoryTestCase { private static void delete(File[] list) throws IOException { final long begin = list[0].getParentFile().lastModified(); - for (final File f : list) { + for (File f : list) { FileUtils.delete(f); assertFalse(f + " was removed", f.exists()); } diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/PackWriterTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/PackWriterTest.java index ed427d889..04bed09af 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/PackWriterTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/PackWriterTest.java @@ -368,7 +368,7 @@ public class PackWriterTest extends SampleDataRepositoryTestCase { ObjectId.fromString("902d5476fa249b7abc9d84c611577a81381f0327"), ObjectId.fromString("6ff87c4664981e4397625791c8ea3bbb5f2279a3") , ObjectId.fromString("5b6e7c66c276e7610d4a73c70ec1a1f7c1003259") }; - try (final RevWalk parser = new RevWalk(db)) { + try (RevWalk parser = new RevWalk(db)) { final RevObject forcedOrderRevs[] = new RevObject[forcedOrder.length]; for (int i = 0; i < forcedOrder.length; i++) forcedOrderRevs[i] = parser.parseAny(forcedOrder[i]); diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/T0003_BasicTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/T0003_BasicTest.java index a549d32df..e113db12a 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/T0003_BasicTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/T0003_BasicTest.java @@ -305,7 +305,7 @@ public class T0003_BasicTest extends SampleDataRepositoryTestCase { // object (as it already exists in the pack). // final Repository newdb = createBareRepository(); - try (final ObjectInserter oi = newdb.newObjectInserter()) { + try (ObjectInserter oi = newdb.newObjectInserter()) { final ObjectId treeId = oi.insert(new TreeFormatter()); assertEquals("4b825dc642cb6eb9a060e54bf8d69288fbee4904", treeId.name()); @@ -373,7 +373,7 @@ public class T0003_BasicTest extends SampleDataRepositoryTestCase { @Test public void test007_Open() throws IOException { - try (final FileRepository db2 = new FileRepository(db.getDirectory())) { + try (FileRepository db2 = new FileRepository(db.getDirectory())) { assertEquals(db.getDirectory(), db2.getDirectory()); assertEquals(db.getObjectDatabase().getDirectory(), db2 .getObjectDatabase().getDirectory()); @@ -557,7 +557,7 @@ public class T0003_BasicTest extends SampleDataRepositoryTestCase { @Test public void test026_CreateCommitMultipleparents() throws IOException { final ObjectId treeId; - try (final ObjectInserter oi = db.newObjectInserter()) { + try (ObjectInserter oi = db.newObjectInserter()) { final ObjectId blobId = oi.insert(Constants.OBJ_BLOB, "and this is the data in me\n".getBytes(Constants.CHARSET .name())); diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/WindowCacheGetTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/WindowCacheGetTest.java index bee11cd71..82ad28ed2 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/WindowCacheGetTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/WindowCacheGetTest.java @@ -133,7 +133,7 @@ public class WindowCacheGetTest extends SampleDataRepositoryTestCase { } private void doCacheTests() throws IOException { - for (final TestObject o : toLoad) { + for (TestObject o : toLoad) { final ObjectLoader or = db.open(o.id, o.type); assertNotNull(or); assertEquals(o.type, or.getType()); @@ -145,7 +145,7 @@ public class WindowCacheGetTest extends SampleDataRepositoryTestCase { int type; - void setType(final String typeStr) throws CorruptObjectException { + void setType(String typeStr) throws CorruptObjectException { final byte[] typeRaw = Constants.encode(typeStr + " "); final MutableInteger ptr = new MutableInteger(); type = Constants.decodeTypeString(id, typeRaw, (byte) ' ', ptr); diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/XInputStream.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/XInputStream.java index 46f9ee3ff..910999c10 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/XInputStream.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/XInputStream.java @@ -53,7 +53,7 @@ import org.eclipse.jgit.util.NB; class XInputStream extends BufferedInputStream { private final byte[] intbuf = new byte[8]; - XInputStream(final InputStream s) { + XInputStream(InputStream s) { super(s); } @@ -63,7 +63,7 @@ class XInputStream extends BufferedInputStream { return b; } - synchronized void readFully(final byte[] b, int o, int len) + synchronized void readFully(byte[] b, int o, int len) throws IOException { int r; while (len > 0 && (r = read(b, o, len)) > 0) { diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/revwalk/RevObjectTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/revwalk/RevObjectTest.java index 122a3973d..8e389ae25 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/revwalk/RevObjectTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/revwalk/RevObjectTest.java @@ -76,7 +76,7 @@ public class RevObjectTest extends RevWalkTestCase { final RevCommit a2; final RevCommit b2; - try (final RevWalk rw2 = new RevWalk(db)) { + try (RevWalk rw2 = new RevWalk(db)) { a2 = rw2.parseCommit(a1); b2 = rw2.parseCommit(b1); } diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/revwalk/RevWalkPathFilter6012Test.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/revwalk/RevWalkPathFilter6012Test.java index 70b4e154a..cef55210f 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/revwalk/RevWalkPathFilter6012Test.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/revwalk/RevWalkPathFilter6012Test.java @@ -105,14 +105,14 @@ public class RevWalkPathFilter6012Test extends RevWalkTestCase { protected void check(RevCommit... order) throws Exception { markStart(i); final StringBuilder act = new StringBuilder(); - for (final RevCommit z : rw) { + for (RevCommit z : rw) { final String name = byName.get(z); assertNotNull(name); act.append(name); act.append(' '); } final StringBuilder exp = new StringBuilder(); - for (final RevCommit z : order) { + for (RevCommit z : order) { final String name = byName.get(z); assertNotNull(name); exp.append(name); diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/PushProcessTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/PushProcessTest.java index 104a69c9f..611cd0cef 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/PushProcessTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/PushProcessTest.java @@ -422,7 +422,7 @@ public class PushProcessTest extends SampleDataRepositoryTestCase { PushConnection { MockPushConnection() { final Map refsMap = new HashMap<>(); - for (final Ref r : advertisedRefs) + for (Ref r : advertisedRefs) refsMap.put(r.getName(), r); available(refsMap); } @@ -443,7 +443,7 @@ public class PushProcessTest extends SampleDataRepositoryTestCase { public void push(ProgressMonitor monitor, Map refsToUpdate) throws TransportException { - for (final RemoteRefUpdate rru : refsToUpdate.values()) { + for (RemoteRefUpdate rru : refsToUpdate.values()) { assertEquals(Status.NOT_ATTEMPTED, rru.getStatus()); rru.setStatus(connectionUpdateStatus); } diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/ReceivePackAdvertiseRefsHookTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/ReceivePackAdvertiseRefsHookTest.java index 7aae7b0c3..b77042220 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/ReceivePackAdvertiseRefsHookTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/ReceivePackAdvertiseRefsHookTest.java @@ -136,7 +136,7 @@ public class ReceivePackAdvertiseRefsHookTest extends LocalDiskRepositoryTestCas try (TransportLocal t = new TransportLocal(src, uriOf(dst), dst.getDirectory()) { @Override - ReceivePack createReceivePack(final Repository db) { + ReceivePack createReceivePack(Repository db) { db.close(); dst.incrementOpen(); @@ -203,7 +203,7 @@ public class ReceivePackAdvertiseRefsHookTest extends LocalDiskRepositoryTestCas throws Exception { return new TransportLocal(src, uriOf(dst), dst.getDirectory()) { @Override - ReceivePack createReceivePack(final Repository db) { + ReceivePack createReceivePack(Repository db) { db.close(); dst.incrementOpen(); diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/TransportTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/TransportTest.java index d4c47d37e..c239922d7 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/TransportTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/TransportTest.java @@ -142,7 +142,7 @@ public class TransportTest extends SampleDataRepositoryTestCase { assertEquals(12, result.size()); boolean foundA = false; boolean foundB = false; - for (final RemoteRefUpdate rru : result) { + for (RemoteRefUpdate rru : result) { if ("refs/heads/a".equals(rru.getSrcRef()) && "refs/heads/test/a".equals(rru.getRemoteName())) foundA = true; @@ -174,7 +174,7 @@ public class TransportTest extends SampleDataRepositoryTestCase { assertEquals(2, result.size()); boolean foundA = false; boolean foundC = false; - for (final RemoteRefUpdate rru : result) { + for (RemoteRefUpdate rru : result) { if ("refs/heads/a".equals(rru.getSrcRef()) && "refs/heads/b".equals(rru.getRemoteName())) foundA = true; @@ -233,7 +233,7 @@ public class TransportTest extends SampleDataRepositoryTestCase { assertEquals(2, result.size()); boolean foundA = false; boolean foundC = false; - for (final RemoteRefUpdate rru : result) { + for (RemoteRefUpdate rru : result) { if ("refs/heads/a".equals(rru.getSrcRef()) && "refs/heads/b".equals(rru.getRemoteName())) { foundA = true; diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/CanonicalTreeParserTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/CanonicalTreeParserTest.java index 57eec0b58..6195e640f 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/CanonicalTreeParserTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/CanonicalTreeParserTest.java @@ -93,7 +93,7 @@ public class CanonicalTreeParserTest { private static byte[] mktree(byte[]... data) throws Exception { final ByteArrayOutputStream out = new ByteArrayOutputStream(); - for (final byte[] e : data) + for (byte[] e : data) out.write(e); return out.toByteArray(); } diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/PostOrderTreeWalkTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/PostOrderTreeWalkTest.java index 87fe00b1c..232422edf 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/PostOrderTreeWalkTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/PostOrderTreeWalkTest.java @@ -60,14 +60,14 @@ import org.junit.Test; public class PostOrderTreeWalkTest extends RepositoryTestCase { @Test public void testInitialize_NoPostOrder() throws Exception { - try (final TreeWalk tw = new TreeWalk(db)) { + try (TreeWalk tw = new TreeWalk(db)) { assertFalse(tw.isPostOrderTraversal()); } } @Test public void testInitialize_TogglePostOrder() throws Exception { - try (final TreeWalk tw = new TreeWalk(db)) { + try (TreeWalk tw = new TreeWalk(db)) { assertFalse(tw.isPostOrderTraversal()); tw.setPostOrderTraversal(true); assertTrue(tw.isPostOrderTraversal()); @@ -78,7 +78,7 @@ public class PostOrderTreeWalkTest extends RepositoryTestCase { @Test public void testResetDoesNotAffectPostOrder() throws Exception { - try (final TreeWalk tw = new TreeWalk(db)) { + try (TreeWalk tw = new TreeWalk(db)) { tw.setPostOrderTraversal(true); assertTrue(tw.isPostOrderTraversal()); tw.reset(); @@ -104,7 +104,7 @@ public class PostOrderTreeWalkTest extends RepositoryTestCase { b.finish(); assertEquals(4, tree.getEntryCount()); - try (final TreeWalk tw = new TreeWalk(db)) { + try (TreeWalk tw = new TreeWalk(db)) { tw.setPostOrderTraversal(false); tw.addTree(new DirCacheIterator(tree)); @@ -132,7 +132,7 @@ public class PostOrderTreeWalkTest extends RepositoryTestCase { b.finish(); assertEquals(4, tree.getEntryCount()); - try (final TreeWalk tw = new TreeWalk(db)) { + try (TreeWalk tw = new TreeWalk(db)) { tw.setPostOrderTraversal(true); tw.addTree(new DirCacheIterator(tree)); @@ -166,7 +166,7 @@ public class PostOrderTreeWalkTest extends RepositoryTestCase { b.finish(); assertEquals(4, tree.getEntryCount()); - try (final TreeWalk tw = new TreeWalk(db)) { + try (TreeWalk tw = new TreeWalk(db)) { tw.setPostOrderTraversal(true); tw.addTree(new DirCacheIterator(tree)); diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/filter/PathFilterGroupTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/filter/PathFilterGroupTest.java index d921aabdc..71a2f327c 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/filter/PathFilterGroupTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/filter/PathFilterGroupTest.java @@ -254,7 +254,7 @@ public class PathFilterGroupTest { } } - TreeWalk fakeWalk(final String path) throws IOException { + TreeWalk fakeWalk(String path) throws IOException { DirCache dc = DirCache.newInCore(); DirCacheEditor dce = dc.editor(); dce.add(new DirCacheEditor.PathEdit(path) { @@ -274,7 +274,7 @@ public class PathFilterGroupTest { return ret; } - TreeWalk fakeWalkAtSubtree(final String path) throws IOException { + TreeWalk fakeWalkAtSubtree(String path) throws IOException { DirCache dc = DirCache.newInCore(); DirCacheEditor dce = dc.editor(); dce.add(new DirCacheEditor.PathEdit(path + "/README") { diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/filter/PathSuffixFilterTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/filter/PathSuffixFilterTest.java index 38adda312..148d5ac82 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/filter/PathSuffixFilterTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/filter/PathSuffixFilterTest.java @@ -113,7 +113,7 @@ public class PathSuffixFilterTest extends RepositoryTestCase { private List getMatchingPaths(String suffixFilter, final ObjectId treeId, boolean recursiveWalk) throws IOException { - try (final TreeWalk tw = new TreeWalk(db)) { + try (TreeWalk tw = new TreeWalk(db)) { tw.setFilter(PathSuffixFilter.create(suffixFilter)); tw.setRecursive(recursiveWalk); tw.addTree(treeId); diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/filter/TreeFilterTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/filter/TreeFilterTest.java index c3423b6fb..8686c4f09 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/filter/TreeFilterTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/filter/TreeFilterTest.java @@ -55,7 +55,7 @@ import org.junit.Test; public class TreeFilterTest extends RepositoryTestCase { @Test public void testALL_IncludesAnything() throws Exception { - try (final TreeWalk tw = new TreeWalk(db)) { + try (TreeWalk tw = new TreeWalk(db)) { tw.addTree(new EmptyTreeIterator()); assertTrue(TreeFilter.ALL.include(tw)); } @@ -73,7 +73,7 @@ public class TreeFilterTest extends RepositoryTestCase { @Test public void testNotALL_IncludesNothing() throws Exception { - try (final TreeWalk tw = new TreeWalk(db)) { + try (TreeWalk tw = new TreeWalk(db)) { tw.addTree(new EmptyTreeIterator()); assertFalse(TreeFilter.ALL.negate().include(tw)); } @@ -81,7 +81,7 @@ public class TreeFilterTest extends RepositoryTestCase { @Test public void testANY_DIFF_IncludesSingleTreeCase() throws Exception { - try (final TreeWalk tw = new TreeWalk(db)) { + try (TreeWalk tw = new TreeWalk(db)) { tw.addTree(new EmptyTreeIterator()); assertTrue(TreeFilter.ANY_DIFF.include(tw)); } diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/TemporaryBufferTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/TemporaryBufferTest.java index e73dab2ce..edcce126b 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/TemporaryBufferTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/TemporaryBufferTest.java @@ -248,7 +248,7 @@ public class TemporaryBufferTest { public void testInCoreInputStream() throws IOException { final int cnt = 256; final byte[] test = new TestRng(getName()).nextBytes(cnt); - try (final TemporaryBuffer.Heap b = new TemporaryBuffer.Heap(cnt + 4)) { + try (TemporaryBuffer.Heap b = new TemporaryBuffer.Heap(cnt + 4)) { b.write(test); InputStream in = b.openInputStream(); byte[] act = new byte[cnt]; diff --git a/org.eclipse.jgit.ui/src/org/eclipse/jgit/awtui/AWTPlotRenderer.java b/org.eclipse.jgit.ui/src/org/eclipse/jgit/awtui/AWTPlotRenderer.java index dcf27b4a7..b1fffd82f 100644 --- a/org.eclipse.jgit.ui/src/org/eclipse/jgit/awtui/AWTPlotRenderer.java +++ b/org.eclipse.jgit.ui/src/org/eclipse/jgit/awtui/AWTPlotRenderer.java @@ -66,11 +66,11 @@ final class AWTPlotRenderer extends AbstractPlotRenderer transient Graphics2D g; - AWTPlotRenderer(final GraphCellRender c) { + AWTPlotRenderer(GraphCellRender c) { cell = c; } - void paint(final Graphics in, final PlotCommit commit) { + void paint(Graphics in, PlotCommit commit) { g = (Graphics2D) in.create(); try { final int h = cell.getHeight(); @@ -138,7 +138,7 @@ final class AWTPlotRenderer extends AbstractPlotRenderer return myLane != null ? myLane.color : Color.black; } - void paintTriangleDown(final int cx, final int y, final int h) { + void paintTriangleDown(int cx, int y, int h) { final int tipX = cx; final int tipY = y + h; final int baseX1 = cx - 10 / 2; diff --git a/org.eclipse.jgit.ui/src/org/eclipse/jgit/awtui/CommitGraphPane.java b/org.eclipse.jgit.ui/src/org/eclipse/jgit/awtui/CommitGraphPane.java index 3f9217d1c..943a3256f 100644 --- a/org.eclipse.jgit.ui/src/org/eclipse/jgit/awtui/CommitGraphPane.java +++ b/org.eclipse.jgit.ui/src/org/eclipse/jgit/awtui/CommitGraphPane.java @@ -175,7 +175,7 @@ public class CommitGraphPane extends JTable { } } - PersonIdent authorFor(final PlotCommit c) { + PersonIdent authorFor(PlotCommit c) { if (c != lastCommit) { lastCommit = c; lastAuthor = c.getAuthorIdent(); @@ -259,7 +259,7 @@ public class CommitGraphPane extends JTable { strokeCache[i] = new BasicStroke(i); } - static Stroke stroke(final int width) { + static Stroke stroke(int width) { if (width < strokeCache.length) return strokeCache[width]; return new BasicStroke(width); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/CloneCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/CloneCommand.java index a05d96255..5c06bac1f 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/api/CloneCommand.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/CloneCommand.java @@ -315,7 +315,7 @@ public class CloneCommand extends TransportCommand { specs.add(wcrs); else if (branchesToClone != null && branchesToClone.size() > 0) { - for (final String selectedRef : branchesToClone) + for (String selectedRef : branchesToClone) if (wcrs.matchSource(selectedRef)) specs.add(wcrs.expandFromSource(selectedRef)); } @@ -410,7 +410,7 @@ public class CloneCommand extends TransportCommand { } Ref foundBranch = null; - for (final Ref r : result.getAdvertisedRefs()) { + for (Ref r : result.getAdvertisedRefs()) { final String n = r.getName(); if (!n.startsWith(Constants.R_HEADS)) continue; @@ -444,7 +444,7 @@ public class CloneCommand extends TransportCommand { throws MissingObjectException, IncorrectObjectTypeException, IOException { final RevCommit commit; - try (final RevWalk rw = new RevWalk(clonedRepo)) { + try (RevWalk rw = new RevWalk(clonedRepo)) { commit = rw.parseCommit(ref.getObjectId()); } return commit; diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/ResetCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/ResetCommand.java index 31987036a..13ce4e769 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/api/ResetCommand.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/ResetCommand.java @@ -360,7 +360,7 @@ public class ResetCommand extends GitCommand { private void resetIndexForPaths(ObjectId commitTree) { DirCache dc = null; - try (final TreeWalk tw = new TreeWalk(repo)) { + try (TreeWalk tw = new TreeWalk(repo)) { dc = repo.lockDirCache(); DirCacheBuilder builder = dc.builder(); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/RmCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/RmCommand.java index 088aa15e5..d2f4be84b 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/api/RmCommand.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/RmCommand.java @@ -154,7 +154,7 @@ public class RmCommand extends GitCommand { DirCache dc = null; List actuallyDeletedFiles = new ArrayList<>(); - try (final TreeWalk tw = new TreeWalk(repo)) { + try (TreeWalk tw = new TreeWalk(repo)) { dc = repo.lockDirCache(); DirCacheBuilder builder = dc.builder(); tw.reset(); // drop the first empty tree, which we do not need here diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/StashCreateCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/StashCreateCommand.java index 82c7a4b6c..c32890d8a 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/api/StashCreateCommand.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/StashCreateCommand.java @@ -195,7 +195,7 @@ public class StashCreateCommand extends GitCommand { private RevCommit parseCommit(final ObjectReader reader, final ObjectId headId) throws IOException { - try (final RevWalk walk = new RevWalk(reader)) { + try (RevWalk walk = new RevWalk(reader)) { return walk.parseCommit(headId); } } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/blame/ReverseWalk.java b/org.eclipse.jgit/src/org/eclipse/jgit/blame/ReverseWalk.java index 2eb313f60..106737805 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/blame/ReverseWalk.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/blame/ReverseWalk.java @@ -108,7 +108,7 @@ final class ReverseWalk extends RevWalk { return children.length; } - ReverseCommit getChild(final int nth) { + ReverseCommit getChild(int nth) { return children[nth]; } } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/diff/MyersDiff.java b/org.eclipse.jgit/src/org/eclipse/jgit/diff/MyersDiff.java index 646f264e0..caaffe349 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/diff/MyersDiff.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/diff/MyersDiff.java @@ -359,7 +359,7 @@ if (k < beginK || k > endK) abstract int getLeft(int x); abstract int getRight(int x); abstract boolean isBetter(int left, int right); - abstract void adjustMinMaxK(final int k, final int x); + abstract void adjustMinMaxK(int k, int x); abstract boolean meets(int d, int k, int x, long snake); final long newSnake(int k, int x) { @@ -469,22 +469,22 @@ if (k < beginK || k > endK) } @Override - final int getLeft(final int x) { + final int getLeft(int x) { return x; } @Override - final int getRight(final int x) { + final int getRight(int x) { return x + 1; } @Override - final boolean isBetter(final int left, final int right) { + final boolean isBetter(int left, int right) { return left > right; } @Override - final void adjustMinMaxK(final int k, final int x) { + final void adjustMinMaxK(int k, int x) { if (x >= endA || k + x >= endB) { if (k > backward.middleK) maxK = k; @@ -517,22 +517,22 @@ if (k < beginK || k > endK) } @Override - final int getLeft(final int x) { + final int getLeft(int x) { return x - 1; } @Override - final int getRight(final int x) { + final int getRight(int x) { return x; } @Override - final boolean isBetter(final int left, final int right) { + final boolean isBetter(int left, int right) { return left < right; } @Override - final void adjustMinMaxK(final int k, final int x) { + final void adjustMinMaxK(int k, int x) { if (x <= beginA || k + x <= beginB) { if (k > forward.middleK) maxK = k; diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/diff/SimilarityIndex.java b/org.eclipse.jgit/src/org/eclipse/jgit/diff/SimilarityIndex.java index 09c0351b8..5897ffb75 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/diff/SimilarityIndex.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/diff/SimilarityIndex.java @@ -157,7 +157,7 @@ public class SimilarityIndex { } } - void hash(byte[] raw, int ptr, final int end) throws TableFullException { + void hash(byte[] raw, int ptr, int end) throws TableFullException { final boolean text = !RawText.isBinary(raw); hashedCnt = 0; while (ptr < end) { diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCache.java b/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCache.java index 752c01758..14653fe17 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCache.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCache.java @@ -121,11 +121,11 @@ public class DirCache { } }; - static int cmp(final DirCacheEntry a, final DirCacheEntry b) { + static int cmp(DirCacheEntry a, DirCacheEntry b) { return cmp(a.path, a.path.length, b); } - static int cmp(final byte[] aPath, final int aLen, final DirCacheEntry b) { + static int cmp(byte[] aPath, int aLen, DirCacheEntry b) { return cmp(aPath, aLen, b.path, b.path.length); } @@ -404,7 +404,7 @@ public class DirCache { return new DirCacheEditor(this, entryCnt + 16); } - void replace(final DirCacheEntry[] e, final int cnt) { + void replace(DirCacheEntry[] e, int cnt) { sortedEntries = e; entryCnt = cnt; tree = null; @@ -648,7 +648,7 @@ public class DirCache { } } - void writeTo(File dir, final OutputStream os) throws IOException { + void writeTo(File dir, OutputStream os) throws IOException { final MessageDigest foot = Constants.newMessageDigest(); final DigestOutputStream dos = new DigestOutputStream(os, foot); @@ -848,7 +848,7 @@ public class DirCache { return nextIdx; } - int nextEntry(final byte[] p, final int pLen, int nextIdx) { + int nextEntry(byte[] p, int pLen, int nextIdx) { while (nextIdx < entryCnt) { final DirCacheEntry next = sortedEntries[nextIdx]; if (!DirCacheTree.peq(p, next.path, pLen)) diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheEntry.java b/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheEntry.java index 19408b059..fee9f5100 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheEntry.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheEntry.java @@ -312,7 +312,7 @@ public class DirCacheEntry { System.arraycopy(src.info, src.infoOffset, info, 0, INFO_LEN); } - void write(final OutputStream os) throws IOException { + void write(OutputStream os) throws IOException { final int len = isExtended() ? INFO_LEN_EXTENDED : INFO_LEN; final int pathLen = path.length; os.write(info, infoOffset, len); @@ -719,7 +719,7 @@ public class DirCacheEntry { * @param keepStage * if true, the stage attribute will not be copied */ - void copyMetaData(final DirCacheEntry src, boolean keepStage) { + void copyMetaData(DirCacheEntry src, boolean keepStage) { int origflags = NB.decodeUInt16(info, infoOffset + P_FLAGS); int newflags = NB.decodeUInt16(src.info, src.infoOffset + P_FLAGS); System.arraycopy(src.info, src.infoOffset, info, infoOffset, INFO_LEN); @@ -771,7 +771,7 @@ public class DirCacheEntry { } } - static String toString(final byte[] path) { + static String toString(byte[] path) { return Constants.CHARSET.decode(ByteBuffer.wrap(path)).toString(); } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheIterator.java b/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheIterator.java index 575b9a25f..19c916f81 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheIterator.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheIterator.java @@ -124,7 +124,7 @@ public class DirCacheIterator extends AbstractTreeIterator { parseEntry(); } - DirCacheIterator(final DirCacheIterator p, final DirCacheTree dct) { + DirCacheIterator(DirCacheIterator p, DirCacheTree dct) { super(p, p.path, p.pathLen + 1); cache = p.cache; tree = dct; diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheTree.java b/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheTree.java index e9f1fcd92..b605f3ca8 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheTree.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheTree.java @@ -185,7 +185,7 @@ public class DirCacheTree { childCnt = subcnt; } - void write(final byte[] tmp, final OutputStream os) throws IOException { + void write(byte[] tmp, OutputStream os) throws IOException { int ptr = tmp.length; tmp[--ptr] = '\n'; ptr = RawParseUtils.formatBase10(tmp, ptr, childCnt); @@ -404,7 +404,7 @@ public class DirCacheTree { return encodedName.length; } - final boolean contains(final byte[] a, int aOff, final int aLen) { + final boolean contains(byte[] a, int aOff, int aLen) { final byte[] e = encodedName; final int eLen = e.length; for (int eOff = 0; eOff < eLen && aOff < aLen; eOff++, aOff++) @@ -531,7 +531,7 @@ public class DirCacheTree { children[n] = null; } - static boolean peq(final byte[] a, final byte[] b, int aLen) { + static boolean peq(byte[] a, byte[] b, int aLen) { if (b.length < aLen) return false; for (aLen--; aLen >= 0; aLen--) diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/errors/CompoundException.java b/org.eclipse.jgit/src/org/eclipse/jgit/errors/CompoundException.java index 7192138b1..1df70e350 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/errors/CompoundException.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/errors/CompoundException.java @@ -59,7 +59,7 @@ public class CompoundException extends Exception { private static String format(Collection causes) { final StringBuilder msg = new StringBuilder(); msg.append(JGitText.get().failureDueToOneOfTheFollowing); - for (final Throwable c : causes) { + for (Throwable c : causes) { msg.append(" "); //$NON-NLS-1$ msg.append(c.getMessage()); msg.append("\n"); //$NON-NLS-1$ diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/errors/MissingBundlePrerequisiteException.java b/org.eclipse.jgit/src/org/eclipse/jgit/errors/MissingBundlePrerequisiteException.java index 9efc21e7c..b37d20d58 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/errors/MissingBundlePrerequisiteException.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/errors/MissingBundlePrerequisiteException.java @@ -59,7 +59,7 @@ public class MissingBundlePrerequisiteException extends TransportException { private static String format(Map missingCommits) { final StringBuilder r = new StringBuilder(); r.append(JGitText.get().missingPrerequisiteCommits); - for (final Map.Entry e : missingCommits.entrySet()) { + for (Map.Entry e : missingCommits.entrySet()) { r.append("\n "); //$NON-NLS-1$ r.append(e.getKey().name()); if (e.getValue() != null) diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/fnmatch/GroupHead.java b/org.eclipse.jgit/src/org/eclipse/jgit/fnmatch/GroupHead.java index eb98a3acd..1dc5931ca 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/fnmatch/GroupHead.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/fnmatch/GroupHead.java @@ -61,7 +61,7 @@ final class GroupHead extends AbstractHead { private final boolean inverse; - GroupHead(String pattern, final String wholePattern) + GroupHead(String pattern, String wholePattern) throws InvalidPatternException { super(false); this.characterClasses = new ArrayList<>(); @@ -214,7 +214,7 @@ final class GroupHead extends AbstractHead { private static final class OneCharacterPattern implements CharacterPattern { private char expectedCharacter; - OneCharacterPattern(final char c) { + OneCharacterPattern(char c) { this.expectedCharacter = c; } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/fnmatch/RestrictedWildCardHead.java b/org.eclipse.jgit/src/org/eclipse/jgit/fnmatch/RestrictedWildCardHead.java index 2068b0d89..45e6ed294 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/fnmatch/RestrictedWildCardHead.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/fnmatch/RestrictedWildCardHead.java @@ -47,7 +47,7 @@ package org.eclipse.jgit.fnmatch; final class RestrictedWildCardHead extends AbstractHead { private final char excludedCharacter; - RestrictedWildCardHead(final char excludedCharacter, final boolean star) { + RestrictedWildCardHead(char excludedCharacter, boolean star) { super(star); this.excludedCharacter = excludedCharacter; } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsObjDatabase.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsObjDatabase.java index 8e9ed5d0d..ca54ee22e 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsObjDatabase.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsObjDatabase.java @@ -497,7 +497,7 @@ public abstract class DfsObjDatabase extends ObjectDatabase { } while (!packList.compareAndSet(o, n)); } - PackList scanPacks(final PackList original) throws IOException { + PackList scanPacks(PackList original) throws IOException { PackList o, n; synchronized (packList) { do { diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsObjectToPack.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsObjectToPack.java index 3a04d70db..5f4dee226 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsObjectToPack.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsObjectToPack.java @@ -60,7 +60,7 @@ class DfsObjectToPack extends ObjectToPack { /** Length of the data section of the object. */ long length; - DfsObjectToPack(AnyObjectId src, final int type) { + DfsObjectToPack(AnyObjectId src, int type) { super(src, type); } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/ByteArrayWindow.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/ByteArrayWindow.java index 07b607c18..c6fdeb0d1 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/ByteArrayWindow.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/ByteArrayWindow.java @@ -58,7 +58,7 @@ import org.eclipse.jgit.internal.storage.pack.PackOutputStream; final class ByteArrayWindow extends ByteWindow { private final byte[] array; - ByteArrayWindow(final PackFile pack, final long o, final byte[] b) { + ByteArrayWindow(PackFile pack, long o, byte[] b) { super(pack, o, b.length); array = b; } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/ByteBufferWindow.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/ByteBufferWindow.java index 343d36922..8e7904f88 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/ByteBufferWindow.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/ByteBufferWindow.java @@ -60,7 +60,7 @@ import org.eclipse.jgit.internal.storage.pack.PackOutputStream; final class ByteBufferWindow extends ByteWindow { private final ByteBuffer buffer; - ByteBufferWindow(final PackFile pack, final long o, final ByteBuffer b) { + ByteBufferWindow(PackFile pack, long o, ByteBuffer b) { super(pack, o, b.capacity()); buffer = b; } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/ByteWindow.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/ByteWindow.java index a3146dbb5..60073f39d 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/ByteWindow.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/ByteWindow.java @@ -86,7 +86,7 @@ abstract class ByteWindow { return (int) (end - start); } - final boolean contains(final PackFile neededFile, final long neededPos) { + final boolean contains(PackFile neededFile, long neededPos) { return pack == neededFile && start <= neededPos && neededPos < end; } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/CachedObjectDirectory.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/CachedObjectDirectory.java index 945e97950..7f7ecc268 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/CachedObjectDirectory.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/CachedObjectDirectory.java @@ -205,7 +205,7 @@ class CachedObjectDirectory extends FileObjectDatabase { } @Override - ObjectLoader openObject(final WindowCursor curs, final AnyObjectId objectId) + ObjectLoader openObject(WindowCursor curs, AnyObjectId objectId) throws IOException { return openObject(curs, objectId, null); } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/DeltaBaseCache.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/DeltaBaseCache.java index b464a1b79..ed73e7223 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/DeltaBaseCache.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/DeltaBaseCache.java @@ -82,7 +82,7 @@ class DeltaBaseCache { cache = new Slot[CACHE_SZ]; } - Entry get(final PackFile pack, final long position) { + Entry get(PackFile pack, long position) { Slot e = cache[hash(position)]; if (e == null) return null; @@ -168,7 +168,7 @@ class DeltaBaseCache { final int type; - Entry(final byte[] aData, final int aType) { + Entry(byte[] aData, int aType) { data = aData; type = aType; } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/GC.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/GC.java index 137a75731..342e2c842 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/GC.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/GC.java @@ -852,7 +852,7 @@ public class GC { } List excluded = new LinkedList<>(); - for (final PackFile f : repo.getObjectDatabase().getPacks()) { + for (PackFile f : repo.getObjectDatabase().getPacks()) { checkCancelled(); if (f.shouldBeKept()) excluded.add(f.getIndex()); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/LocalObjectToPack.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/LocalObjectToPack.java index 55eeb95ce..ed5cbfcf5 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/LocalObjectToPack.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/LocalObjectToPack.java @@ -58,7 +58,7 @@ class LocalObjectToPack extends ObjectToPack { /** Length of the data section of the object. */ long length; - LocalObjectToPack(AnyObjectId src, final int type) { + LocalObjectToPack(AnyObjectId src, int type) { super(src, type); } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/ObjectDirectory.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/ObjectDirectory.java index 4cab5f8bb..51c5702fc 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/ObjectDirectory.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/ObjectDirectory.java @@ -257,7 +257,7 @@ public class ObjectDirectory extends FileObjectDatabase { // Fully close all loaded alternates and clear the alternate list. AlternateHandle[] alt = alternates.get(); if (alt != null && alternates.compareAndSet(alt, null)) { - for(final AlternateHandle od : alt) + for(AlternateHandle od : alt) od.close(); } } @@ -619,7 +619,7 @@ public class ObjectDirectory extends FileObjectDatabase { WindowCursor curs, Set skips) throws IOException { PackList pList = packList.get(); SEARCH: for (;;) { - for (final PackFile p : pList.packs) { + for (PackFile p : pList.packs) { try { LocalObjectRepresentation rep = p.representation(curs, otp); p.resetTransientErrorCount(); @@ -888,7 +888,7 @@ public class ObjectDirectory extends FileObjectDatabase { final Set names = listPackDirectory(); final List list = new ArrayList<>(names.size() >> 2); boolean foundNew = false; - for (final String indexName : names) { + for (String indexName : names) { // Must match "pack-[0-9a-f]{40}.idx" to be an index. // if (indexName.length() != 49 || !indexName.endsWith(".idx")) //$NON-NLS-1$ @@ -931,7 +931,7 @@ public class ObjectDirectory extends FileObjectDatabase { return old; } - for (final PackFile p : forReuse.values()) { + for (PackFile p : forReuse.values()) { p.close(); } @@ -945,7 +945,7 @@ public class ObjectDirectory extends FileObjectDatabase { private static Map reuseMap(PackList old) { final Map forReuse = new HashMap<>(); - for (final PackFile p : old.packs) { + for (PackFile p : old.packs) { if (p.invalid()) { // The pack instance is corrupted, and cannot be safely used // again. Do not include it in our reuse map. @@ -974,7 +974,7 @@ public class ObjectDirectory extends FileObjectDatabase { if (nameList == null) return Collections.emptySet(); final Set nameSet = new HashSet<>(nameList.length << 1); - for (final String name : nameList) { + for (String name : nameList) { if (name.startsWith("pack-")) //$NON-NLS-1$ nameSet.add(name); } @@ -1076,7 +1076,7 @@ public class ObjectDirectory extends FileObjectDatabase { /** All known packs, sorted by {@link PackFile#SORT}. */ final PackFile[] packs; - PackList(final FileSnapshot monitor, final PackFile[] packs) { + PackList(FileSnapshot monitor, PackFile[] packs) { this.snapshot = monitor; this.packs = packs; } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/ObjectDirectoryInserter.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/ObjectDirectoryInserter.java index e6ae9686a..e5a54e372 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/ObjectDirectoryInserter.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/ObjectDirectoryInserter.java @@ -78,7 +78,7 @@ class ObjectDirectoryInserter extends ObjectInserter { private Deflater deflate; - ObjectDirectoryInserter(final FileObjectDatabase dest, final Config cfg) { + ObjectDirectoryInserter(FileObjectDatabase dest, Config cfg) { db = dest; config = cfg.get(WriteConfig.KEY); } @@ -267,7 +267,7 @@ class ObjectDirectoryInserter extends ObjectInserter { } } - void writeHeader(OutputStream out, final int type, long len) + void writeHeader(OutputStream out, int type, long len) throws IOException { out.write(Constants.encodedTypeString(type)); out.write((byte) ' '); @@ -279,7 +279,7 @@ class ObjectDirectoryInserter extends ObjectInserter { return File.createTempFile("noz", null, db.getDirectory()); //$NON-NLS-1$ } - DeflaterOutputStream compress(final OutputStream out) { + DeflaterOutputStream compress(OutputStream out) { if (deflate == null) deflate = new Deflater(config.getCompression()); else diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackFile.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackFile.java index c32ba3601..71f64ae11 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackFile.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackFile.java @@ -279,7 +279,7 @@ public class PackFile implements Iterable { * @throws IOException * the pack file or the index could not be read. */ - ObjectLoader get(final WindowCursor curs, final AnyObjectId id) + ObjectLoader get(WindowCursor curs, AnyObjectId id) throws IOException { final long offset = idx().findOffset(id); return 0 < offset && !isCorrupt(offset) ? load(curs, offset) : null; @@ -344,7 +344,7 @@ public class PackFile implements Iterable { * @throws IOException * the index file cannot be loaded into memory. */ - ObjectId findObjectForOffset(final long offset) throws IOException { + ObjectId findObjectForOffset(long offset) throws IOException { return getReverseIdx().findObject(offset); } @@ -692,7 +692,7 @@ public class PackFile implements Iterable { } } - ByteArrayWindow read(final long pos, int size) throws IOException { + ByteArrayWindow read(long pos, int size) throws IOException { synchronized (readLock) { if (length < pos + size) size = (int) (length - pos); @@ -703,7 +703,7 @@ public class PackFile implements Iterable { } } - ByteWindow mmap(final long pos, int size) throws IOException { + ByteWindow mmap(long pos, int size) throws IOException { synchronized (readLock) { if (length < pos + size) size = (int) (length - pos); @@ -760,7 +760,7 @@ public class PackFile implements Iterable { } } - ObjectLoader load(final WindowCursor curs, long pos) + ObjectLoader load(WindowCursor curs, long pos) throws IOException, LargeObjectException { try { final byte[] ib = curs.tempId; @@ -949,7 +949,7 @@ public class PackFile implements Iterable { return hdr; } - int getObjectType(final WindowCursor curs, long pos) throws IOException { + int getObjectType(WindowCursor curs, long pos) throws IOException { final byte[] ib = curs.tempId; for (;;) { readFully(pos, ib, 0, 20, curs); @@ -996,13 +996,13 @@ public class PackFile implements Iterable { } } - long getObjectSize(final WindowCursor curs, final AnyObjectId id) + long getObjectSize(WindowCursor curs, AnyObjectId id) throws IOException { final long offset = idx().findOffset(id); return 0 < offset ? getObjectSize(curs, offset) : -1; } - long getObjectSize(final WindowCursor curs, final long pos) + long getObjectSize(WindowCursor curs, long pos) throws IOException { final byte[] ib = curs.tempId; readFully(pos, ib, 0, 20, curs); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackIndexV1.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackIndexV1.java index 66d35bd90..4444dd691 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackIndexV1.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackIndexV1.java @@ -113,7 +113,7 @@ class PackIndexV1 extends PackIndex { @Override public long getOffset64Count() { long n64 = 0; - for (final MutableEntry e : this) { + for (MutableEntry e : this) { if (e.getOffset() >= Integer.MAX_VALUE) n64++; } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackIndexWriter.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackIndexWriter.java index 61bb902a9..553f7c9a1 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackIndexWriter.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackIndexWriter.java @@ -123,7 +123,7 @@ public abstract class PackIndexWriter { */ public static int oldestPossibleFormat( final List objs) { - for (final PackedObjectInfo oe : objs) { + for (PackedObjectInfo oe : objs) { if (!PackIndexWriterV1.canStore(oe)) return 2; } @@ -269,11 +269,11 @@ public abstract class PackIndexWriter { */ protected void writeFanOutTable() throws IOException { final int[] fanout = new int[256]; - for (final PackedObjectInfo po : entries) + for (PackedObjectInfo po : entries) fanout[po.getFirstByte() & 0xff]++; for (int i = 1; i < 256; i++) fanout[i] += fanout[i - 1]; - for (final int n : fanout) { + for (int n : fanout) { NB.encodeInt32(tmp, 0, n); out.write(tmp, 0, 4); } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackIndexWriterV1.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackIndexWriterV1.java index f220e7a6c..877f7c8cd 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackIndexWriterV1.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackIndexWriterV1.java @@ -58,7 +58,7 @@ import org.eclipse.jgit.util.NB; * @see PackIndexV1 */ class PackIndexWriterV1 extends PackIndexWriter { - static boolean canStore(final PackedObjectInfo oe) { + static boolean canStore(PackedObjectInfo oe) { // We are limited to 4 GB per pack as offset is 32 bit unsigned int. // return oe.getOffset() >>> 1 < Integer.MAX_VALUE; @@ -73,7 +73,7 @@ class PackIndexWriterV1 extends PackIndexWriter { protected void writeImpl() throws IOException { writeFanOutTable(); - for (final PackedObjectInfo oe : entries) { + for (PackedObjectInfo oe : entries) { if (!canStore(oe)) throw new IOException(JGitText.get().packTooLargeForIndexVersion1); NB.encodeInt32(tmp, 0, (int) oe.getOffset()); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackIndexWriterV2.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackIndexWriterV2.java index a18ccaf9e..9505d35b7 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackIndexWriterV2.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackIndexWriterV2.java @@ -76,12 +76,12 @@ class PackIndexWriterV2 extends PackIndexWriter { } private void writeObjectNames() throws IOException { - for (final PackedObjectInfo oe : entries) + for (PackedObjectInfo oe : entries) oe.copyRawTo(out); } private void writeCRCs() throws IOException { - for (final PackedObjectInfo oe : entries) { + for (PackedObjectInfo oe : entries) { NB.encodeInt32(tmp, 0, oe.getCRC()); out.write(tmp, 0, 4); } @@ -89,7 +89,7 @@ class PackIndexWriterV2 extends PackIndexWriter { private void writeOffset32() throws IOException { int o64 = 0; - for (final PackedObjectInfo oe : entries) { + for (PackedObjectInfo oe : entries) { final long o = oe.getOffset(); if (o <= MAX_OFFSET_32) NB.encodeInt32(tmp, 0, (int) o); @@ -100,7 +100,7 @@ class PackIndexWriterV2 extends PackIndexWriter { } private void writeOffset64() throws IOException { - for (final PackedObjectInfo oe : entries) { + for (PackedObjectInfo oe : entries) { final long o = oe.getOffset(); if (MAX_OFFSET_32 < o) { NB.encodeInt64(tmp, 0, o); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackReverseIndex.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackReverseIndex.java index fb7eddf6b..dfe23ba79 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackReverseIndex.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackReverseIndex.java @@ -107,7 +107,7 @@ public class PackReverseIndex { long maxOffset = 0; int ith = 0; - for (final MutableEntry me : index) { + for (MutableEntry me : index) { final long o = me.getOffset(); offsetsBySha1[ith++] = o; if (o > maxOffset) diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/RefDirectory.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/RefDirectory.java index 8e3357fdc..a27b99157 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/RefDirectory.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/RefDirectory.java @@ -208,7 +208,7 @@ public class RefDirectory extends RefDatabase { private List retrySleepMs = RETRY_SLEEP_MS; - RefDirectory(final FileRepository db) { + RefDirectory(FileRepository db) { final FS fs = db.getFS(); parent = db; gitDir = db.getDirectory(); @@ -434,7 +434,7 @@ public class RefDirectory extends RefDatabase { RefList.Builder newLoose; - LooseScanner(final RefList curLoose) { + LooseScanner(RefList curLoose) { this.curLoose = curLoose; } @@ -1262,14 +1262,14 @@ public class RefDirectory extends RefDatabase { return new File(gitDir, name); } - static int levelsIn(final String name) { + static int levelsIn(String name) { int count = 0; for (int p = name.indexOf('/'); p >= 0; p = name.indexOf('/', p + 1)) count++; return count; } - static void delete(final File file, final int depth) throws IOException { + static void delete(File file, int depth) throws IOException { delete(file, depth, null); } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/RefDirectoryRename.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/RefDirectoryRename.java index 202e51f6c..ec7ec73be 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/RefDirectoryRename.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/RefDirectoryRename.java @@ -104,7 +104,7 @@ class RefDirectoryRename extends RefRename { objId = source.getOldObjectId(); updateHEAD = needToUpdateHEAD(); tmp = refdb.newTemporaryUpdate(); - try (final RevWalk rw = new RevWalk(refdb.getRepository())) { + try (RevWalk rw = new RevWalk(refdb.getRepository())) { // First backup the source so its never unreachable. tmp.setNewObjectId(objId); tmp.setForceUpdate(true); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/RefDirectoryUpdate.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/RefDirectoryUpdate.java index fb839dff6..45ce6349a 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/RefDirectoryUpdate.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/RefDirectoryUpdate.java @@ -60,7 +60,7 @@ class RefDirectoryUpdate extends RefUpdate { private boolean shouldDeref; private LockFile lock; - RefDirectoryUpdate(final RefDirectory r, final Ref ref) { + RefDirectoryUpdate(RefDirectory r, Ref ref) { super(ref); database = r; } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/UnpackedObject.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/UnpackedObject.java index adb05e4d9..cf474afbb 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/UnpackedObject.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/UnpackedObject.java @@ -266,7 +266,7 @@ public class UnpackedObject { } } - static boolean isStandardFormat(final byte[] hdr) { + static boolean isStandardFormat(byte[] hdr) { /* * We must determine if the buffer contains the standard * zlib-deflated stream or the experimental format based diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/WindowCache.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/WindowCache.java index c03fb2f83..8cf1d4e21 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/WindowCache.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/WindowCache.java @@ -178,7 +178,7 @@ public class WindowCache { return cache; } - static final ByteWindow get(final PackFile pack, final long offset) + static final ByteWindow get(PackFile pack, long offset) throws IOException { final WindowCache c = cache; final ByteWindow r = c.getOrLoad(pack, c.toStart(offset)); @@ -193,7 +193,7 @@ public class WindowCache { return r; } - static final void purge(final PackFile pack) { + static final void purge(PackFile pack) { cache.removeAll(pack); } @@ -556,7 +556,7 @@ public class WindowCache { */ volatile boolean dead; - Entry(final Entry n, final Ref r) { + Entry(Entry n, Ref r) { next = n; ref = r; } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/WindowCursor.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/WindowCursor.java index 569bfe895..010c14288 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/WindowCursor.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/WindowCursor.java @@ -347,7 +347,7 @@ final class WindowCursor extends ObjectReader implements ObjectReuseAsIs { inf.reset(); } - void pin(final PackFile pack, final long position) + void pin(PackFile pack, long position) throws IOException { final ByteWindow w = window; if (w == null || !w.contains(pack, position)) { diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java index f5e600d55..36d6f0aeb 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java @@ -1526,7 +1526,7 @@ public class PackWriter implements AutoCloseable { // The caller gave us an executor, but it might not do // asynchronous execution. Wrap everything and hope it // can schedule these for us. - for (final DeltaTask task : taskBlock.tasks) { + for (DeltaTask task : taskBlock.tasks) { executor.execute(new Runnable() { @Override public void run() { diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/AbbreviatedObjectId.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/AbbreviatedObjectId.java index 6acc684bc..d105d0d20 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/AbbreviatedObjectId.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/AbbreviatedObjectId.java @@ -165,7 +165,7 @@ public final class AbbreviatedObjectId implements Serializable { return r << (8 - n) * 4; } - static int mask(final int nibbles, final int word, final int v) { + static int mask(int nibbles, int word, int v) { final int b = (word - 1) * 8; if (b + 8 <= nibbles) { // We have all of the bits required for this word. diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/AnyObjectId.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/AnyObjectId.java index e7d465b12..978dd3a72 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/AnyObjectId.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/AnyObjectId.java @@ -481,7 +481,7 @@ public abstract class AnyObjectId implements Comparable { private static final char[] hexchar = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' }; - static void formatHexChar(final char[] dst, final int p, int w) { + static void formatHexChar(char[] dst, int p, int w) { int o = p + 7; while (o >= p && w != 0) { dst[o--] = hexchar[w & 0xf]; diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/Config.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/Config.java index f59cc6961..0e01cca99 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/Config.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/Config.java @@ -1010,7 +1010,7 @@ public class Config { */ public String toText() { final StringBuilder out = new StringBuilder(); - for (final ConfigLine e : state.get().entryList) { + for (ConfigLine e : state.get().entryList) { if (e.prefix != null) out.append(e.prefix); if (e.section != null && e.name == null) { @@ -1452,7 +1452,7 @@ public class Config { private int pos; - StringReader(final String in) { + StringReader(String in) { buf = in.toCharArray(); } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/ConfigLine.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/ConfigLine.java index 011ceccca..937ba925c 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/ConfigLine.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/ConfigLine.java @@ -73,7 +73,7 @@ class ConfigLine { /** The text content after entry. */ String suffix; - ConfigLine forValue(final String newValue) { + ConfigLine forValue(String newValue) { final ConfigLine e = new ConfigLine(); e.prefix = prefix; e.section = section; @@ -91,7 +91,7 @@ class ConfigLine { && eqIgnoreCase(name, aKey); } - boolean match(final String aSection, final String aSubsection) { + boolean match(String aSection, String aSubsection) { return eqIgnoreCase(section, aSection) && eqSameCase(subsection, aSubsection); } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/DefaultTypedConfigGetter.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/DefaultTypedConfigGetter.java index 89aef7fcf..891c7f23b 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/DefaultTypedConfigGetter.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/DefaultTypedConfigGetter.java @@ -271,7 +271,7 @@ public class DefaultTypedConfigGetter implements TypedConfigGetter { } private static boolean match(String a, String... cases) { - for (final String b : cases) { + for (String b : cases) { if (b != null && b.equalsIgnoreCase(a)) { return true; } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectDatabase.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectDatabase.java index 3abdc0c41..93add5c66 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectDatabase.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectDatabase.java @@ -122,7 +122,7 @@ public abstract class ObjectDatabase { * the object store cannot be accessed. */ public boolean has(AnyObjectId objectId) throws IOException { - try (final ObjectReader or = newReader()) { + try (ObjectReader or = newReader()) { return or.has(objectId); } } @@ -172,7 +172,7 @@ public abstract class ObjectDatabase { public ObjectLoader open(AnyObjectId objectId, int typeHint) throws MissingObjectException, IncorrectObjectTypeException, IOException { - try (final ObjectReader or = newReader()) { + try (ObjectReader or = newReader()) { return or.open(objectId, typeHint); } } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/RefWriter.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/RefWriter.java index 90a0350dd..71ee96363 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/RefWriter.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/RefWriter.java @@ -116,7 +116,7 @@ public abstract class RefWriter { public void writeInfoRefs() throws IOException { final StringWriter w = new StringWriter(); final char[] tmp = new char[Constants.OBJECT_ID_STRING_LENGTH]; - for (final Ref r : refs) { + for (Ref r : refs) { if (Constants.HEAD.equals(r.getName())) { // Historically HEAD has never been published through // the INFO_REFS file. This is a mistake, but its the @@ -161,7 +161,7 @@ public abstract class RefWriter { */ public void writePackedRefs() throws IOException { boolean peeled = false; - for (final Ref r : refs) { + for (Ref r : refs) { if (r.getStorage().isPacked() && r.isPeeled()) { peeled = true; break; @@ -177,7 +177,7 @@ public abstract class RefWriter { } final char[] tmp = new char[Constants.OBJECT_ID_STRING_LENGTH]; - for (final Ref r : refs) { + for (Ref r : refs) { if (r.getStorage() != Ref.Storage.PACKED) continue; diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/merge/StrategySimpleTwoWayInCore.java b/org.eclipse.jgit/src/org/eclipse/jgit/merge/StrategySimpleTwoWayInCore.java index 08f0a8a62..4aeacf508 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/merge/StrategySimpleTwoWayInCore.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/merge/StrategySimpleTwoWayInCore.java @@ -116,13 +116,13 @@ public class StrategySimpleTwoWayInCore extends ThreeWayMergeStrategy { private ObjectId resultTree; - InCoreMerger(final Repository local) { + InCoreMerger(Repository local) { super(local); tw = new NameConflictTreeWalk(local, reader); cache = DirCache.newInCore(); } - InCoreMerger(final ObjectInserter inserter) { + InCoreMerger(ObjectInserter inserter) { super(inserter); tw = new NameConflictTreeWalk(null, reader); cache = DirCache.newInCore(); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/patch/BinaryHunk.java b/org.eclipse.jgit/src/org/eclipse/jgit/patch/BinaryHunk.java index 079d6f6d6..95391ec56 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/patch/BinaryHunk.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/patch/BinaryHunk.java @@ -80,7 +80,7 @@ public class BinaryHunk { /** Inflated length of the data. */ private int length; - BinaryHunk(final FileHeader fh, final int offset) { + BinaryHunk(FileHeader fh, int offset) { file = fh; startOffset = offset; } @@ -139,7 +139,7 @@ public class BinaryHunk { return length; } - int parseHunk(int ptr, final int end) { + int parseHunk(int ptr, int end) { final byte[] buf = file.buf; if (match(buf, ptr, LITERAL) >= 0) { diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/patch/CombinedFileHeader.java b/org.eclipse.jgit/src/org/eclipse/jgit/patch/CombinedFileHeader.java index 0f8f7aad0..34075787f 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/patch/CombinedFileHeader.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/patch/CombinedFileHeader.java @@ -69,7 +69,7 @@ public class CombinedFileHeader extends FileHeader { private FileMode[] oldModes; - CombinedFileHeader(final byte[] b, final int offset) { + CombinedFileHeader(byte[] b, int offset) { super(b, offset); } @@ -154,7 +154,7 @@ public class CombinedFileHeader extends FileHeader { } @Override - int parseGitHeaders(int ptr, final int end) { + int parseGitHeaders(int ptr, int end) { while (ptr < end) { final int eol = nextLF(buf, ptr); if (isHunkHdr(buf, ptr, end) >= 1) { @@ -220,7 +220,7 @@ public class CombinedFileHeader extends FileHeader { } @Override - HunkHeader newHunkHeader(final int offset) { + HunkHeader newHunkHeader(int offset) { return new CombinedHunkHeader(this, offset); } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/patch/CombinedHunkHeader.java b/org.eclipse.jgit/src/org/eclipse/jgit/patch/CombinedHunkHeader.java index 3f27bb3b2..d278132c6 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/patch/CombinedHunkHeader.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/patch/CombinedHunkHeader.java @@ -64,7 +64,7 @@ public class CombinedHunkHeader extends HunkHeader { private CombinedOldImage[] old; - CombinedHunkHeader(final CombinedFileHeader fh, final int offset) { + CombinedHunkHeader(CombinedFileHeader fh, int offset) { super(fh, offset, null); old = new CombinedOldImage[fh.getParentCount()]; for (int i = 0; i < old.length; i++) { @@ -125,11 +125,11 @@ public class CombinedHunkHeader extends HunkHeader { } @Override - int parseBody(final Patch script, final int end) { + int parseBody(Patch script, int end) { final byte[] buf = file.buf; int c = nextLF(buf, startOffset); - for (final CombinedOldImage o : old) { + for (CombinedOldImage o : old) { o.nDeleted = 0; o.nAdded = 0; o.nContext = 0; @@ -207,7 +207,7 @@ public class CombinedHunkHeader extends HunkHeader { } @Override - void extractFileLines(final OutputStream[] out) throws IOException { + void extractFileLines(OutputStream[] out) throws IOException { final byte[] buf = file.buf; int ptr = startOffset; int eol = nextLF(buf, ptr); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/patch/FileHeader.java b/org.eclipse.jgit/src/org/eclipse/jgit/patch/FileHeader.java index 32cf64230..d0a5216e1 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/patch/FileHeader.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/patch/FileHeader.java @@ -155,7 +155,7 @@ public class FileHeader extends DiffEntry { addHunk(new HunkHeader(this, edits)); } - FileHeader(final byte[] b, final int offset) { + FileHeader(byte[] b, int offset) { buf = b; startOffset = offset; changeType = ChangeType.MODIFY; // unless otherwise designated @@ -264,7 +264,7 @@ public class FileHeader extends DiffEntry { final String[] files = extractFileLines(charsetGuess); final int[] offsets = new int[files.length]; - for (final HunkHeader h : getHunks()) + for (HunkHeader h : getHunks()) h.extractFileLines(r, files, offsets); return r.toString(); } @@ -284,7 +284,7 @@ public class FileHeader extends DiffEntry { try { for (int i = 0; i < tmp.length; i++) tmp[i] = new TemporaryBuffer.Heap(Integer.MAX_VALUE); - for (final HunkHeader h : getHunks()) + for (HunkHeader h : getHunks()) h.extractFileLines(tmp); final String[] r = new String[tmp.length]; @@ -329,7 +329,7 @@ public class FileHeader extends DiffEntry { return hunks; } - void addHunk(final HunkHeader h) { + void addHunk(HunkHeader h) { if (h.getFileHeader() != this) throw new IllegalArgumentException(JGitText.get().hunkBelongsToAnotherFile); if (hunks == null) @@ -337,7 +337,7 @@ public class FileHeader extends DiffEntry { hunks.add(h); } - HunkHeader newHunkHeader(final int offset) { + HunkHeader newHunkHeader(int offset) { return new HunkHeader(this, offset); } @@ -370,7 +370,7 @@ public class FileHeader extends DiffEntry { */ public EditList toEditList() { final EditList r = new EditList(); - for (final HunkHeader hunk : hunks) + for (HunkHeader hunk : hunks) r.addAll(hunk.toEditList()); return r; } @@ -384,7 +384,7 @@ public class FileHeader extends DiffEntry { * one past the last position to parse. * @return first character after the LF at the end of the line; -1 on error. */ - int parseGitFileName(int ptr, final int end) { + int parseGitFileName(int ptr, int end) { final int eol = nextLF(buf, ptr); final int bol = ptr; if (eol >= end) { @@ -444,7 +444,7 @@ public class FileHeader extends DiffEntry { return eol; } - int parseGitHeaders(int ptr, final int end) { + int parseGitHeaders(int ptr, int end) { while (ptr < end) { final int eol = nextLF(buf, ptr); if (isHunkHdr(buf, ptr, eol) >= 1) { @@ -514,25 +514,25 @@ public class FileHeader extends DiffEntry { return ptr; } - void parseOldName(int ptr, final int eol) { + void parseOldName(int ptr, int eol) { oldPath = p1(parseName(oldPath, ptr + OLD_NAME.length, eol)); if (oldPath == DEV_NULL) changeType = ChangeType.ADD; } - void parseNewName(int ptr, final int eol) { + void parseNewName(int ptr, int eol) { newPath = p1(parseName(newPath, ptr + NEW_NAME.length, eol)); if (newPath == DEV_NULL) changeType = ChangeType.DELETE; } - void parseNewFileMode(int ptr, final int eol) { + void parseNewFileMode(int ptr, int eol) { oldMode = FileMode.MISSING; newMode = parseFileMode(ptr + NEW_FILE_MODE.length, eol); changeType = ChangeType.ADD; } - int parseTraditionalHeaders(int ptr, final int end) { + int parseTraditionalHeaders(int ptr, int end) { while (ptr < end) { final int eol = nextLF(buf, ptr); if (isHunkHdr(buf, ptr, eol) >= 1) { @@ -585,7 +585,7 @@ public class FileHeader extends DiffEntry { return s > 0 ? r.substring(s + 1) : r; } - FileMode parseFileMode(int ptr, final int end) { + FileMode parseFileMode(int ptr, int end) { int tmp = 0; while (ptr < end - 1) { tmp <<= 3; @@ -594,7 +594,7 @@ public class FileHeader extends DiffEntry { return FileMode.fromBits(tmp); } - void parseIndexLine(int ptr, final int end) { + void parseIndexLine(int ptr, int end) { // "index $asha1..$bsha1[ $mode]" where $asha1 and $bsha1 // can be unique abbreviations // @@ -636,7 +636,7 @@ public class FileHeader extends DiffEntry { * for a 3 way-merge returns 3. If this is not a hunk header, 0 is * returned instead. */ - static int isHunkHdr(final byte[] buf, final int start, final int end) { + static int isHunkHdr(byte[] buf, int start, int end) { int ptr = start; while (ptr < end && buf[ptr] == '@') ptr++; diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/patch/HunkHeader.java b/org.eclipse.jgit/src/org/eclipse/jgit/patch/HunkHeader.java index d022d4783..1458945c3 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/patch/HunkHeader.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/patch/HunkHeader.java @@ -120,7 +120,7 @@ public class HunkHeader { private EditList editList; - HunkHeader(final FileHeader fh, final int offset) { + HunkHeader(FileHeader fh, int offset) { this(fh, offset, new OldImage() { @Override public AbbreviatedObjectId getId() { @@ -129,13 +129,13 @@ public class HunkHeader { }); } - HunkHeader(final FileHeader fh, final int offset, final OldImage oi) { + HunkHeader(FileHeader fh, int offset, OldImage oi) { file = fh; startOffset = offset; old = oi; } - HunkHeader(final FileHeader fh, final EditList editList) { + HunkHeader(FileHeader fh, EditList editList) { this(fh, fh.buf.length); this.editList = editList; endOffset = startOffset; @@ -293,7 +293,7 @@ public class HunkHeader { newLineCount = 1; } - int parseBody(final Patch script, final int end) { + int parseBody(Patch script, int end) { final byte[] buf = file.buf; int c = nextLF(buf, startOffset), last = c; @@ -359,7 +359,7 @@ public class HunkHeader { return c; } - void extractFileLines(final OutputStream[] out) throws IOException { + void extractFileLines(OutputStream[] out) throws IOException { final byte[] buf = file.buf; int ptr = startOffset; int eol = nextLF(buf, ptr); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/patch/Patch.java b/org.eclipse.jgit/src/org/eclipse/jgit/patch/Patch.java index 3a77387f2..052f2a790 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/patch/Patch.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/patch/Patch.java @@ -373,17 +373,17 @@ public class Patch { return c; } - void warn(final byte[] buf, final int ptr, final String msg) { + void warn(byte[] buf, int ptr, String msg) { addError(new FormatError(buf, ptr, FormatError.Severity.WARNING, msg)); } - void error(final byte[] buf, final int ptr, final String msg) { + void error(byte[] buf, int ptr, String msg) { addError(new FormatError(buf, ptr, FormatError.Severity.ERROR, msg)); } private static boolean matchAny(final byte[] buf, final int c, final byte[][] srcs) { - for (final byte[] s : srcs) { + for (byte[] s : srcs) { if (match(buf, c, s) >= 0) return true; } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/revplot/AbstractPlotRenderer.java b/org.eclipse.jgit/src/org/eclipse/jgit/revplot/AbstractPlotRenderer.java index c12acb40c..58e2106fe 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/revplot/AbstractPlotRenderer.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/revplot/AbstractPlotRenderer.java @@ -99,7 +99,7 @@ public abstract class AbstractPlotRenderer { final TColor myColor = laneColor(myLane); int maxCenter = myLaneX; - for (final TLane passingLane : (TLane[]) commit.passingLanes) { + for (TLane passingLane : (TLane[]) commit.passingLanes) { final int cx = laneC(passingLane); final TColor c = laneColor(passingLane); drawLine(c, cx, 0, cx, h, LINE_WIDTH); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/revplot/PlotCommit.java b/org.eclipse.jgit/src/org/eclipse/jgit/revplot/PlotCommit.java index fecc48d55..9914b0c99 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/revplot/PlotCommit.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/revplot/PlotCommit.java @@ -88,15 +88,15 @@ public class PlotCommit extends RevCommit { refs = NO_REFS; } - void addForkingOffLane(final PlotLane f) { + void addForkingOffLane(PlotLane f) { forkingOffLanes = addLane(f, forkingOffLanes); } - void addPassingLane(final PlotLane c) { + void addPassingLane(PlotLane c) { passingLanes = addLane(c, passingLanes); } - void addMergingLane(final PlotLane m) { + void addMergingLane(PlotLane m) { mergingLanes = addLane(m, mergingLanes); } @@ -115,7 +115,7 @@ public class PlotCommit extends RevCommit { return lanes; } - void addChild(final PlotCommit c) { + void addChild(PlotCommit c) { final int cnt = children.length; if (cnt == 0) children = new PlotCommit[] { c }; @@ -164,7 +164,7 @@ public class PlotCommit extends RevCommit { * @return true if the given commit built on top of this commit. */ public final boolean isChild(PlotCommit c) { - for (final PlotCommit a : children) + for (PlotCommit a : children) if (a == c) return true; return false; diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/revplot/PlotCommitList.java b/org.eclipse.jgit/src/org/eclipse/jgit/revplot/PlotCommitList.java index d952fa67e..5e153164a 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/revplot/PlotCommitList.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/revplot/PlotCommitList.java @@ -120,7 +120,7 @@ public class PlotCommitList extends @SuppressWarnings("unchecked") public void findPassingThrough(final PlotCommit currCommit, final Collection result) { - for (final PlotLane p : currCommit.passingLanes) + for (PlotLane p : currCommit.passingLanes) result.add((L) p); } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/BlockObjQueue.java b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/BlockObjQueue.java index 371cd06dd..fcdf79520 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/BlockObjQueue.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/BlockObjQueue.java @@ -55,7 +55,7 @@ class BlockObjQueue { free = new BlockFreeList(); } - void add(final RevObject c) { + void add(RevObject c) { Block b = tail; if (b == null) { b = free.newBlock(); @@ -98,7 +98,7 @@ class BlockObjQueue { return b; } - void freeBlock(final Block b) { + void freeBlock(Block b) { b.next = next; next = b; } @@ -127,7 +127,7 @@ class BlockObjQueue { return headIndex == tailIndex; } - void add(final RevObject c) { + void add(RevObject c) { objects[tailIndex++] = c; } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/BlockRevQueue.java b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/BlockRevQueue.java index 31612ff66..79307b5b7 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/BlockRevQueue.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/BlockRevQueue.java @@ -58,7 +58,7 @@ abstract class BlockRevQueue extends AbstractRevQueue { free = new BlockFreeList(); } - BlockRevQueue(final Generator s) throws MissingObjectException, + BlockRevQueue(Generator s) throws MissingObjectException, IncorrectObjectTypeException, IOException { free = new BlockFreeList(); outputType = s.outputType(); @@ -101,7 +101,7 @@ abstract class BlockRevQueue extends AbstractRevQueue { return b; } - void freeBlock(final Block b) { + void freeBlock(Block b) { b.next = next; next = b; } @@ -138,11 +138,11 @@ abstract class BlockRevQueue extends AbstractRevQueue { return headIndex > 0; } - void add(final RevCommit c) { + void add(RevCommit c) { commits[tailIndex++] = c; } - void unpop(final RevCommit c) { + void unpop(RevCommit c) { commits[--headIndex] = c; } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/BoundaryGenerator.java b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/BoundaryGenerator.java index 6be0c8584..0fd6621e6 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/BoundaryGenerator.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/BoundaryGenerator.java @@ -54,7 +54,7 @@ class BoundaryGenerator extends Generator { Generator g; - BoundaryGenerator(final RevWalk w, final Generator s) { + BoundaryGenerator(RevWalk w, Generator s) { g = new InitialGenerator(w, s); } @@ -64,7 +64,7 @@ class BoundaryGenerator extends Generator { } @Override - void shareFreeList(final BlockRevQueue q) { + void shareFreeList(BlockRevQueue q) { g.shareFreeList(q); } @@ -85,7 +85,7 @@ class BoundaryGenerator extends Generator { private final Generator source; - InitialGenerator(final RevWalk w, final Generator s) { + InitialGenerator(RevWalk w, Generator s) { walk = w; held = new FIFORevQueue(); source = s; @@ -98,7 +98,7 @@ class BoundaryGenerator extends Generator { } @Override - void shareFreeList(final BlockRevQueue q) { + void shareFreeList(BlockRevQueue q) { q.shareFreeList(held); } @@ -107,7 +107,7 @@ class BoundaryGenerator extends Generator { IncorrectObjectTypeException, IOException { RevCommit c = source.next(); if (c != null) { - for (final RevCommit p : c.parents) + for (RevCommit p : c.parents) if ((p.flags & UNINTERESTING) != 0) held.add(p); return c; diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/DateRevQueue.java b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/DateRevQueue.java index 795bdf195..b86e87620 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/DateRevQueue.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/DateRevQueue.java @@ -76,7 +76,7 @@ public class DateRevQueue extends AbstractRevQueue { super(); } - DateRevQueue(final Generator s) throws MissingObjectException, + DateRevQueue(Generator s) throws MissingObjectException, IncorrectObjectTypeException, IOException { for (;;) { final RevCommit c = s.next(); @@ -181,7 +181,7 @@ public class DateRevQueue extends AbstractRevQueue { } @Override - boolean everbodyHasFlag(final int f) { + boolean everbodyHasFlag(int f) { for (Entry q = head; q != null; q = q.next) { if ((q.commit.flags & f) == 0) return false; @@ -190,7 +190,7 @@ public class DateRevQueue extends AbstractRevQueue { } @Override - boolean anybodyHasFlag(final int f) { + boolean anybodyHasFlag(int f) { for (Entry q = head; q != null; q = q.next) { if ((q.commit.flags & f) != 0) return true; diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/DelayRevQueue.java b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/DelayRevQueue.java index 4a0d19d60..c397a0131 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/DelayRevQueue.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/DelayRevQueue.java @@ -69,7 +69,7 @@ final class DelayRevQueue extends Generator { private int size; - DelayRevQueue(final Generator g) { + DelayRevQueue(Generator g) { pending = g; delay = new FIFORevQueue(); } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/DepthGenerator.java b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/DepthGenerator.java index ad0518635..eaec305b4 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/DepthGenerator.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/DepthGenerator.java @@ -113,7 +113,7 @@ class DepthGenerator extends Generator { } @Override - void shareFreeList(final BlockRevQueue q) { + void shareFreeList(BlockRevQueue q) { pending.shareFreeList(q); } @@ -134,7 +134,7 @@ class DepthGenerator extends Generator { int newDepth = c.depth + 1; - for (final RevCommit p : c.parents) { + for (RevCommit p : c.parents) { DepthWalk.Commit dp = (DepthWalk.Commit) p; // If no depth has been assigned to this commit, assign diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/FIFORevQueue.java b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/FIFORevQueue.java index 1bb8715a3..cdb084c15 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/FIFORevQueue.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/FIFORevQueue.java @@ -63,7 +63,7 @@ public class FIFORevQueue extends BlockRevQueue { super(); } - FIFORevQueue(final Generator s) throws MissingObjectException, + FIFORevQueue(Generator s) throws MissingObjectException, IncorrectObjectTypeException, IOException { super(s); } @@ -139,7 +139,7 @@ public class FIFORevQueue extends BlockRevQueue { } @Override - boolean everbodyHasFlag(final int f) { + boolean everbodyHasFlag(int f) { for (Block b = head; b != null; b = b.next) { for (int i = b.headIndex; i < b.tailIndex; i++) if ((b.commits[i].flags & f) == 0) @@ -149,7 +149,7 @@ public class FIFORevQueue extends BlockRevQueue { } @Override - boolean anybodyHasFlag(final int f) { + boolean anybodyHasFlag(int f) { for (Block b = head; b != null; b = b.next) { for (int i = b.headIndex; i < b.tailIndex; i++) if ((b.commits[i].flags & f) != 0) @@ -158,7 +158,7 @@ public class FIFORevQueue extends BlockRevQueue { return false; } - void removeFlag(final int f) { + void removeFlag(int f) { final int not_f = ~f; for (Block b = head; b != null; b = b.next) { for (int i = b.headIndex; i < b.tailIndex; i++) diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/FixUninterestingGenerator.java b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/FixUninterestingGenerator.java index 9d734a729..4e6d7e681 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/FixUninterestingGenerator.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/FixUninterestingGenerator.java @@ -61,7 +61,7 @@ import org.eclipse.jgit.errors.MissingObjectException; final class FixUninterestingGenerator extends Generator { private final Generator pending; - FixUninterestingGenerator(final Generator g) { + FixUninterestingGenerator(Generator g) { pending = g; } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/FollowFilter.java b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/FollowFilter.java index 567c8465c..dae3aacb8 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/FollowFilter.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/FollowFilter.java @@ -95,7 +95,7 @@ public class FollowFilter extends TreeFilter { private RenameCallback renameCallback; - FollowFilter(final PathFilter path, final DiffConfig cfg) { + FollowFilter(PathFilter path, DiffConfig cfg) { this.path = path; this.cfg = cfg; } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/Generator.java b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/Generator.java index a95303b64..b2c92ea24 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/Generator.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/Generator.java @@ -81,7 +81,7 @@ abstract class Generator { * @param q * another FIFO queue that wants to share our queue's free list. */ - void shareFreeList(final BlockRevQueue q) { + void shareFreeList(BlockRevQueue q) { // Do nothing by default. } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/LIFORevQueue.java b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/LIFORevQueue.java index cbffd91d7..846b8d92f 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/LIFORevQueue.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/LIFORevQueue.java @@ -62,7 +62,7 @@ public class LIFORevQueue extends BlockRevQueue { super(); } - LIFORevQueue(final Generator s) throws MissingObjectException, + LIFORevQueue(Generator s) throws MissingObjectException, IncorrectObjectTypeException, IOException { super(s); } @@ -103,7 +103,7 @@ public class LIFORevQueue extends BlockRevQueue { } @Override - boolean everbodyHasFlag(final int f) { + boolean everbodyHasFlag(int f) { for (Block b = head; b != null; b = b.next) { for (int i = b.headIndex; i < b.tailIndex; i++) if ((b.commits[i].flags & f) == 0) @@ -113,7 +113,7 @@ public class LIFORevQueue extends BlockRevQueue { } @Override - boolean anybodyHasFlag(final int f) { + boolean anybodyHasFlag(int f) { for (Block b = head; b != null; b = b.next) { for (int i = b.headIndex; i < b.tailIndex; i++) if ((b.commits[i].flags & f) != 0) diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/MergeBaseGenerator.java b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/MergeBaseGenerator.java index 755df58cf..2fe95318b 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/MergeBaseGenerator.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/MergeBaseGenerator.java @@ -84,12 +84,12 @@ class MergeBaseGenerator extends Generator { private CarryStack stack; - MergeBaseGenerator(final RevWalk w) { + MergeBaseGenerator(RevWalk w) { walker = w; pending = new DateRevQueue(); } - void init(final AbstractRevQueue p) throws IOException { + void init(AbstractRevQueue p) throws IOException { try { for (;;) { final RevCommit c = p.next(); @@ -146,7 +146,7 @@ class MergeBaseGenerator extends Generator { return null; } - for (final RevCommit p : c.parents) { + for (RevCommit p : c.parents) { if ((p.flags & IN_PENDING) != 0) continue; if ((p.flags & PARSED) == 0) diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/PendingGenerator.java b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/PendingGenerator.java index 94ae2c993..e607b7daa 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/PendingGenerator.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/PendingGenerator.java @@ -140,7 +140,7 @@ class PendingGenerator extends Generator { produce = filter.include(walker, c); } - for (final RevCommit p : c.parents) { + for (RevCommit p : c.parents) { if ((p.flags & SEEN) != 0) continue; if ((p.flags & PARSED) == 0) diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RevCommit.java b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RevCommit.java index 14222e9d5..b67f934f6 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RevCommit.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RevCommit.java @@ -153,13 +153,13 @@ public class RevCommit extends RevObject { } @Override - void parseHeaders(final RevWalk walk) throws MissingObjectException, + void parseHeaders(RevWalk walk) throws MissingObjectException, IncorrectObjectTypeException, IOException { parseCanonical(walk, walk.getCachedBytes(this)); } @Override - void parseBody(final RevWalk walk) throws MissingObjectException, + void parseBody(RevWalk walk) throws MissingObjectException, IncorrectObjectTypeException, IOException { if (buffer == null) { buffer = walk.getCachedBytes(this); @@ -168,7 +168,7 @@ public class RevCommit extends RevObject { } } - void parseCanonical(final RevWalk walk, final byte[] raw) + void parseCanonical(RevWalk walk, byte[] raw) throws IOException { if (!walk.shallowCommitsInitialized) walk.initializeShallowCommits(); @@ -490,7 +490,7 @@ public class RevCommit extends RevObject { return str; } - static boolean hasLF(final byte[] r, int b, final int e) { + static boolean hasLF(byte[] r, int b, int e) { while (b < e) if (r[b++] == '\n') return true; @@ -635,7 +635,7 @@ public class RevCommit extends RevObject { if (src.isEmpty()) return Collections.emptyList(); final ArrayList r = new ArrayList<>(src.size()); - for (final FooterLine f : src) { + for (FooterLine f : src) { if (f.matches(keyName)) r.add(f.getValue()); } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RevFlag.java b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RevFlag.java index 1e7986742..413a55296 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RevFlag.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RevFlag.java @@ -85,7 +85,7 @@ public class RevFlag { final int mask; - RevFlag(final RevWalk w, final String n, final int m) { + RevFlag(RevWalk w, String n, int m) { walker = w; name = n; mask = m; @@ -107,7 +107,7 @@ public class RevFlag { } static class StaticRevFlag extends RevFlag { - StaticRevFlag(final String n, final int m) { + StaticRevFlag(String n, int m) { super(null, n, m); } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RevObject.java b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RevObject.java index 1c76fe9c1..eef9bf33e 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RevObject.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RevObject.java @@ -60,7 +60,7 @@ public abstract class RevObject extends ObjectIdOwnerMap.Entry { int flags; - RevObject(final AnyObjectId name) { + RevObject(AnyObjectId name) { super(name); } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RevObjectList.java b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RevObjectList.java index 42f26d267..2f21e1745 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RevObjectList.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RevObjectList.java @@ -147,7 +147,7 @@ public class RevObjectList extends AbstractList { final int shift; - Block(final int s) { + Block(int s) { shift = s; } } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RevTag.java b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RevTag.java index e7fe0f73b..0050bac0a 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RevTag.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RevTag.java @@ -142,13 +142,13 @@ public class RevTag extends RevObject { } @Override - void parseHeaders(final RevWalk walk) throws MissingObjectException, + void parseHeaders(RevWalk walk) throws MissingObjectException, IncorrectObjectTypeException, IOException { parseCanonical(walk, walk.getCachedBytes(this)); } @Override - void parseBody(final RevWalk walk) throws MissingObjectException, + void parseBody(RevWalk walk) throws MissingObjectException, IncorrectObjectTypeException, IOException { if (buffer == null) { buffer = walk.getCachedBytes(this); @@ -157,7 +157,7 @@ public class RevTag extends RevObject { } } - void parseCanonical(final RevWalk walk, final byte[] rawTag) + void parseCanonical(RevWalk walk, byte[] rawTag) throws CorruptObjectException { final MutableInteger pos = new MutableInteger(); final int oType; diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RevWalk.java b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RevWalk.java index cf278bbbe..a986cfd8f 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RevWalk.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RevWalk.java @@ -327,7 +327,7 @@ public class RevWalk implements Iterable, AutoCloseable { public void markStart(Collection list) throws MissingObjectException, IncorrectObjectTypeException, IOException { - for (final RevCommit c : list) + for (RevCommit c : list) markStart(c); } @@ -1142,7 +1142,7 @@ public class RevWalk implements Iterable, AutoCloseable { * the flags to carry onto parents, if set on a descendant. */ public void carry(Collection set) { - for (final RevFlag flag : set) + for (RevFlag flag : set) carry(flag); } @@ -1204,7 +1204,7 @@ public class RevWalk implements Iterable, AutoCloseable { freeFlag(flag.mask); } - void freeFlag(final int mask) { + void freeFlag(int mask) { retainOnReset &= ~mask; if (isNotStarted()) { freeFlags |= mask; @@ -1264,7 +1264,7 @@ public class RevWalk implements Iterable, AutoCloseable { */ public final void resetRetain(RevFlag... retainFlags) { int mask = 0; - for (final RevFlag flag : retainFlags) + for (RevFlag flag : retainFlags) mask |= flag.mask; reset(mask); } @@ -1286,7 +1286,7 @@ public class RevWalk implements Iterable, AutoCloseable { final int clearFlags = ~retainFlags; final FIFORevQueue q = new FIFORevQueue(); - for (final RevCommit c : roots) { + for (RevCommit c : roots) { if ((c.flags & clearFlags) == 0) continue; c.flags &= retainFlags; @@ -1300,7 +1300,7 @@ public class RevWalk implements Iterable, AutoCloseable { break; if (c.parents == null) continue; - for (final RevCommit p : c.parents) { + for (RevCommit p : c.parents) { if ((p.flags & clearFlags) == 0) continue; p.flags &= retainFlags; @@ -1439,7 +1439,7 @@ public class RevWalk implements Iterable, AutoCloseable { return new RevCommit(id); } - void carryFlagsImpl(final RevCommit c) { + void carryFlagsImpl(RevCommit c) { final int carry = c.flags & carryFlags; if (carry != 0) RevCommit.carryFlags(c, carry); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RewriteGenerator.java b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RewriteGenerator.java index bb0955ccf..1c868ffe0 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RewriteGenerator.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RewriteGenerator.java @@ -76,12 +76,12 @@ class RewriteGenerator extends Generator { private final Generator source; - RewriteGenerator(final Generator s) { + RewriteGenerator(Generator s) { source = s; } @Override - void shareFreeList(final BlockRevQueue q) { + void shareFreeList(BlockRevQueue q) { source.shareFreeList(q); } @@ -167,14 +167,14 @@ class RewriteGenerator extends Generator { } if (newCnt == oldList.length) { - for (final RevCommit p : oldList) + for (RevCommit p : oldList) p.flags &= ~DUPLICATE; return oldList; } final RevCommit[] newList = new RevCommit[newCnt]; newCnt = 0; - for (final RevCommit p : oldList) { + for (RevCommit p : oldList) { if (p != null) { newList[newCnt++] = p; p.flags &= ~DUPLICATE; diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/StartGenerator.java b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/StartGenerator.java index 1ec629031..eb129a263 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/StartGenerator.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/StartGenerator.java @@ -66,7 +66,7 @@ import org.eclipse.jgit.treewalk.filter.TreeFilter; class StartGenerator extends Generator { private final RevWalk walker; - StartGenerator(final RevWalk w) { + StartGenerator(RevWalk w) { walker = w; } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/TopoSortGenerator.java b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/TopoSortGenerator.java index 7b11d0490..645034351 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/TopoSortGenerator.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/TopoSortGenerator.java @@ -69,7 +69,7 @@ class TopoSortGenerator extends Generator { * @throws IncorrectObjectTypeException * @throws IOException */ - TopoSortGenerator(final Generator s) throws MissingObjectException, + TopoSortGenerator(Generator s) throws MissingObjectException, IncorrectObjectTypeException, IOException { pending = new FIFORevQueue(); outputType = s.outputType() | SORT_TOPO; @@ -78,7 +78,7 @@ class TopoSortGenerator extends Generator { final RevCommit c = s.next(); if (c == null) break; - for (final RevCommit p : c.parents) + for (RevCommit p : c.parents) p.inDegree++; pending.add(c); } @@ -90,7 +90,7 @@ class TopoSortGenerator extends Generator { } @Override - void shareFreeList(final BlockRevQueue q) { + void shareFreeList(BlockRevQueue q) { q.shareFreeList(pending); } @@ -113,7 +113,7 @@ class TopoSortGenerator extends Generator { // All of our children have already produced, // so it is OK for us to produce now as well. // - for (final RevCommit p : c.parents) { + for (RevCommit p : c.parents) { if (--p.inDegree == 0 && (p.flags & TOPO_DELAY) != 0) { // This parent tried to come before us, but we are // his last child. unpop the parent so it goes right diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/filter/AndRevFilter.java b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/filter/AndRevFilter.java index 4215f2121..dfb83b491 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/filter/AndRevFilter.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/filter/AndRevFilter.java @@ -123,7 +123,7 @@ public abstract class AndRevFilter extends RevFilter { private final boolean requiresCommitBody; - Binary(final RevFilter one, final RevFilter two) { + Binary(RevFilter one, RevFilter two) { a = one; b = two; requiresCommitBody = a.requiresCommitBody() @@ -159,7 +159,7 @@ public abstract class AndRevFilter extends RevFilter { private final boolean requiresCommitBody; - List(final RevFilter[] list) { + List(RevFilter[] list) { subfilters = list; boolean rcb = false; @@ -172,7 +172,7 @@ public abstract class AndRevFilter extends RevFilter { public boolean include(RevWalk walker, RevCommit c) throws MissingObjectException, IncorrectObjectTypeException, IOException { - for (final RevFilter f : subfilters) { + for (RevFilter f : subfilters) { if (!f.include(walker, c)) return false; } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/filter/AuthorRevFilter.java b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/filter/AuthorRevFilter.java index 8474e6c43..334d4f014 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/filter/AuthorRevFilter.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/filter/AuthorRevFilter.java @@ -81,7 +81,7 @@ public class AuthorRevFilter { // Don't permit us to be created. } - static RawCharSequence textFor(final RevCommit cmit) { + static RawCharSequence textFor(RevCommit cmit) { final byte[] raw = cmit.getRawBuffer(); final int b = RawParseUtils.author(raw, 0); if (b < 0) @@ -91,7 +91,7 @@ public class AuthorRevFilter { } private static class PatternSearch extends PatternMatchRevFilter { - PatternSearch(final String patternText) { + PatternSearch(String patternText) { super(patternText, true, true, Pattern.CASE_INSENSITIVE); } @@ -107,7 +107,7 @@ public class AuthorRevFilter { } private static class SubStringSearch extends SubStringRevFilter { - SubStringSearch(final String patternText) { + SubStringSearch(String patternText) { super(patternText); } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/filter/CommitTimeRevFilter.java b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/filter/CommitTimeRevFilter.java index 002985b11..38805153e 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/filter/CommitTimeRevFilter.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/filter/CommitTimeRevFilter.java @@ -127,7 +127,7 @@ public abstract class CommitTimeRevFilter extends RevFilter { final int when; - CommitTimeRevFilter(final long ts) { + CommitTimeRevFilter(long ts) { when = (int) (ts / 1000); } @@ -144,7 +144,7 @@ public abstract class CommitTimeRevFilter extends RevFilter { } private static class Before extends CommitTimeRevFilter { - Before(final long ts) { + Before(long ts) { super(ts); } @@ -163,7 +163,7 @@ public abstract class CommitTimeRevFilter extends RevFilter { } private static class After extends CommitTimeRevFilter { - After(final long ts) { + After(long ts) { super(ts); } @@ -190,7 +190,7 @@ public abstract class CommitTimeRevFilter extends RevFilter { private static class Between extends CommitTimeRevFilter { private final int until; - Between(final long since, final long until) { + Between(long since, long until) { super(since); this.until = (int) (until / 1000); } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/filter/CommitterRevFilter.java b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/filter/CommitterRevFilter.java index 8d73ce43b..37c840e37 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/filter/CommitterRevFilter.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/filter/CommitterRevFilter.java @@ -81,7 +81,7 @@ public class CommitterRevFilter { // Don't permit us to be created. } - static RawCharSequence textFor(final RevCommit cmit) { + static RawCharSequence textFor(RevCommit cmit) { final byte[] raw = cmit.getRawBuffer(); final int b = RawParseUtils.committer(raw, 0); if (b < 0) @@ -91,7 +91,7 @@ public class CommitterRevFilter { } private static class PatternSearch extends PatternMatchRevFilter { - PatternSearch(final String patternText) { + PatternSearch(String patternText) { super(patternText, true, true, Pattern.CASE_INSENSITIVE); } @@ -107,7 +107,7 @@ public class CommitterRevFilter { } private static class SubStringSearch extends SubStringRevFilter { - SubStringSearch(final String patternText) { + SubStringSearch(String patternText) { super(patternText); } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/filter/MessageRevFilter.java b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/filter/MessageRevFilter.java index 5621e6463..480aaa38e 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/filter/MessageRevFilter.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/filter/MessageRevFilter.java @@ -81,7 +81,7 @@ public class MessageRevFilter { // Don't permit us to be created. } - static RawCharSequence textFor(final RevCommit cmit) { + static RawCharSequence textFor(RevCommit cmit) { final byte[] raw = cmit.getRawBuffer(); final int b = RawParseUtils.commitMessage(raw, 0); if (b < 0) @@ -90,7 +90,7 @@ public class MessageRevFilter { } private static class PatternSearch extends PatternMatchRevFilter { - PatternSearch(final String patternText) { + PatternSearch(String patternText) { super(patternText, true, true, Pattern.CASE_INSENSITIVE | Pattern.DOTALL); } @@ -107,7 +107,7 @@ public class MessageRevFilter { } private static class SubStringSearch extends SubStringRevFilter { - SubStringSearch(final String patternText) { + SubStringSearch(String patternText) { super(patternText); } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/filter/OrRevFilter.java b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/filter/OrRevFilter.java index 97697349f..1cef12f79 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/filter/OrRevFilter.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/filter/OrRevFilter.java @@ -121,7 +121,7 @@ public abstract class OrRevFilter extends RevFilter { private final boolean requiresCommitBody; - Binary(final RevFilter one, final RevFilter two) { + Binary(RevFilter one, RevFilter two) { a = one; b = two; requiresCommitBody = a.requiresCommitBody() @@ -157,7 +157,7 @@ public abstract class OrRevFilter extends RevFilter { private final boolean requiresCommitBody; - List(final RevFilter[] list) { + List(RevFilter[] list) { subfilters = list; boolean rcb = false; @@ -170,7 +170,7 @@ public abstract class OrRevFilter extends RevFilter { public boolean include(RevWalk walker, RevCommit c) throws MissingObjectException, IncorrectObjectTypeException, IOException { - for (final RevFilter f : subfilters) { + for (RevFilter f : subfilters) { if (f.include(walker, c)) return true; } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/filter/RevFlagFilter.java b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/filter/RevFlagFilter.java index 4d5690bb1..c67c44b21 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/filter/RevFlagFilter.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/filter/RevFlagFilter.java @@ -78,7 +78,7 @@ public abstract class RevFlagFilter extends RevFilter { */ public static RevFilter hasAll(RevFlag... a) { final RevFlagSet set = new RevFlagSet(); - for (final RevFlag flag : a) + for (RevFlag flag : a) set.add(flag); return new HasAll(set); } @@ -103,7 +103,7 @@ public abstract class RevFlagFilter extends RevFilter { */ public static RevFilter hasAny(RevFlag... a) { final RevFlagSet set = new RevFlagSet(); - for (final RevFlag flag : a) + for (RevFlag flag : a) set.add(flag); return new HasAny(set); } @@ -121,7 +121,7 @@ public abstract class RevFlagFilter extends RevFilter { final RevFlagSet flags; - RevFlagFilter(final RevFlagSet m) { + RevFlagFilter(RevFlagSet m) { flags = m; } @@ -138,7 +138,7 @@ public abstract class RevFlagFilter extends RevFilter { } private static class HasAll extends RevFlagFilter { - HasAll(final RevFlagSet m) { + HasAll(RevFlagSet m) { super(m); } @@ -156,7 +156,7 @@ public abstract class RevFlagFilter extends RevFilter { } private static class HasAny extends RevFlagFilter { - HasAny(final RevFlagSet m) { + HasAny(RevFlagSet m) { super(m); } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/AmazonS3.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/AmazonS3.java index 3df5bdb2c..a0fc57ca1 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/AmazonS3.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/AmazonS3.java @@ -135,7 +135,7 @@ public class AmazonS3 { private static String toCleanString(List list) { final StringBuilder s = new StringBuilder(); - for (final String v : list) { + for (String v : list) { if (s.length() > 0) s.append(','); s.append(v.replaceAll("\n", "").trim()); //$NON-NLS-1$ //$NON-NLS-2$ @@ -548,7 +548,7 @@ public class AmazonS3 { return err; } - IOException maxAttempts(final String action, final String key) { + IOException maxAttempts(String action, String key) { return new IOException(MessageFormat.format( JGitText.get().amazonS3ActionFailedGivingUp, action, key, Integer.valueOf(maxAttempts))); @@ -597,10 +597,10 @@ public class AmazonS3 { return c; } - void authorize(final HttpURLConnection c) throws IOException { + void authorize(HttpURLConnection c) throws IOException { final Map> reqHdr = c.getRequestProperties(); final SortedMap sigHdr = new TreeMap<>(); - for (final Map.Entry> entry : reqHdr.entrySet()) { + for (Map.Entry> entry : reqHdr.entrySet()) { final String hdr = entry.getKey(); if (isSignedHeader(hdr)) sigHdr.put(StringUtils.toLowerCase(hdr), toCleanString(entry.getValue())); @@ -619,7 +619,7 @@ public class AmazonS3 { s.append(remove(sigHdr, "date")); //$NON-NLS-1$ s.append('\n'); - for (final Map.Entry e : sigHdr.entrySet()) { + for (Map.Entry e : sigHdr.entrySet()) { s.append(e.getKey()); s.append(':'); s.append(e.getValue()); @@ -644,7 +644,7 @@ public class AmazonS3 { c.setRequestProperty("Authorization", "AWS " + publicKey + ":" + sec); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ } - static Properties properties(final File authFile) + static Properties properties(File authFile) throws FileNotFoundException, IOException { final Properties p = new Properties(); try (FileInputStream in = new FileInputStream(authFile)) { @@ -664,7 +664,7 @@ public class AmazonS3 { private StringBuilder data; - ListParser(final String bn, final String p) { + ListParser(String bn, String p) { bucket = bn; prefix = p; } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/BasePackConnection.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/BasePackConnection.java index 1bda91494..38eae1cd4 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/BasePackConnection.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/BasePackConnection.java @@ -122,7 +122,7 @@ abstract class BasePackConnection extends BaseConnection { /** Extra objects the remote has, but which aren't offered as refs. */ protected final Set additionalHaves = new HashSet<>(); - BasePackConnection(final PackTransport packTransport) { + BasePackConnection(PackTransport packTransport) { transport = (Transport) packTransport; local = transport.local; uri = transport.uri; diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/BasePackFetchConnection.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/BasePackFetchConnection.java index 6e4b05fe2..0dfcd8716 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/BasePackFetchConnection.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/BasePackFetchConnection.java @@ -296,7 +296,7 @@ public abstract class BasePackFetchConnection extends BasePackConnection final boolean minimalNegotiation; - FetchConfig(final Config c) { + FetchConfig(Config c) { allowOfsDelta = c.getBoolean("repack", "usedeltabaseoffset", true); //$NON-NLS-1$ //$NON-NLS-2$ minimalNegotiation = c.getBoolean("fetch", "useminimalnegotiation", //$NON-NLS-1$ //$NON-NLS-2$ false); @@ -420,7 +420,7 @@ public abstract class BasePackFetchConnection extends BasePackConnection private int maxTimeWanted(Collection wants) { int maxTime = 0; - for (final Ref r : wants) { + for (Ref r : wants) { try { final RevObject obj = walk.parseAny(r.getObjectId()); if (obj instanceof RevCommit) { @@ -492,7 +492,7 @@ public abstract class BasePackFetchConnection extends BasePackConnection private boolean sendWants(Collection want) throws IOException { final PacketLineOut p = statelessRPC ? pckState : pckOut; boolean first = true; - for (final Ref r : want) { + for (Ref r : want) { ObjectId objectId = r.getObjectId(); if (objectId == null) { continue; @@ -806,7 +806,7 @@ public abstract class BasePackFetchConnection extends BasePackConnection } private void markRefsAdvertised() { - for (final Ref r : getRefs()) { + for (Ref r : getRefs()) { markAdvertised(r.getObjectId()); if (r.getPeeledObjectId() != null) markAdvertised(r.getPeeledObjectId()); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/BasePackPushConnection.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/BasePackPushConnection.java index 5624377b7..69624ff7a 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/BasePackPushConnection.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/BasePackPushConnection.java @@ -256,7 +256,7 @@ public abstract class BasePackPushConnection extends BasePackConnection implemen pushOptions.toString())); } - for (final RemoteRefUpdate rru : refUpdates) { + for (RemoteRefUpdate rru : refUpdates) { if (!capableDeleteRefs && rru.isDelete()) { rru.setStatus(Status.REJECTED_NODELETE); continue; @@ -294,7 +294,7 @@ public abstract class BasePackPushConnection extends BasePackConnection implemen } private void transmitOptions() throws IOException { - for (final String pushOption : pushOptions) { + for (String pushOption : pushOptions) { pckOut.writeString(pushOption); } @@ -332,17 +332,17 @@ public abstract class BasePackPushConnection extends BasePackConnection implemen Set remoteObjects = new HashSet<>(); Set newObjects = new HashSet<>(); - try (final PackWriter writer = new PackWriter(transport.getPackConfig(), + try (PackWriter writer = new PackWriter(transport.getPackConfig(), local.newObjectReader())) { - for (final Ref r : getRefs()) { + for (Ref r : getRefs()) { // only add objects that we actually have ObjectId oid = r.getObjectId(); if (local.hasObject(oid)) remoteObjects.add(oid); } remoteObjects.addAll(additionalHaves); - for (final RemoteRefUpdate r : refUpdates.values()) { + for (RemoteRefUpdate r : refUpdates.values()) { if (!ObjectId.zeroId().equals(r.getNewObjectId())) newObjects.add(r.getNewObjectId()); } @@ -411,7 +411,7 @@ public abstract class BasePackPushConnection extends BasePackConnection implemen rru.setMessage(message); } } - for (final RemoteRefUpdate rru : refUpdates.values()) { + for (RemoteRefUpdate rru : refUpdates.values()) { if (rru.getStatus() == Status.AWAITING_REPORT) throw new PackProtocolException(MessageFormat.format( JGitText.get().expectedReportForRefNotReceived , uri, rru.getRemoteName())); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/BaseReceivePack.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/BaseReceivePack.java index d78751f89..c426e3c05 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/BaseReceivePack.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/BaseReceivePack.java @@ -340,7 +340,7 @@ public abstract class BaseReceivePack { final long maxDiscardBytes; final SignedPushConfig signedPush; - ReceiveConfig(final Config config) { + ReceiveConfig(Config config) { allowCreates = true; allowDeletes = !config.getBoolean("receive", "denydeletes", false); //$NON-NLS-1$ //$NON-NLS-2$ allowNonFastForwards = !config.getBoolean("receive", //$NON-NLS-1$ @@ -1440,7 +1440,7 @@ public abstract class BaseReceivePack { * @return {@code true} if a pack is expected based on the list of commands. */ protected boolean needPack() { - for (final ReceiveCommand cmd : commands) { + for (ReceiveCommand cmd : commands) { if (cmd.getType() != ReceiveCommand.Type.DELETE) return true; } @@ -1526,21 +1526,21 @@ public abstract class BaseReceivePack { } parser = null; - try (final ObjectWalk ow = new ObjectWalk(db)) { + try (ObjectWalk ow = new ObjectWalk(db)) { if (baseObjects != null) { ow.sort(RevSort.TOPO); if (!baseObjects.isEmpty()) ow.sort(RevSort.BOUNDARY, true); } - for (final ReceiveCommand cmd : commands) { + for (ReceiveCommand cmd : commands) { if (cmd.getResult() != Result.NOT_ATTEMPTED) continue; if (cmd.getType() == ReceiveCommand.Type.DELETE) continue; ow.markStart(ow.parseAny(cmd.getNewId())); } - for (final ObjectId have : advertisedHaves) { + for (ObjectId have : advertisedHaves) { RevObject o = ow.parseAny(have); ow.markUninteresting(o); @@ -1596,7 +1596,7 @@ public abstract class BaseReceivePack { * Validate the command list. */ protected void validateCommands() { - for (final ReceiveCommand cmd : commands) { + for (ReceiveCommand cmd : commands) { final Ref ref = cmd.getRef(); if (cmd.getResult() != Result.NOT_ATTEMPTED) continue; @@ -1815,7 +1815,7 @@ public abstract class BaseReceivePack { if (unpackError != null) { out.sendString("unpack error " + unpackError.getMessage()); //$NON-NLS-1$ if (forClient) { - for (final ReceiveCommand cmd : commands) { + for (ReceiveCommand cmd : commands) { out.sendString("ng " + cmd.getRefName() //$NON-NLS-1$ + " n/a (unpacker error)"); //$NON-NLS-1$ } @@ -1825,7 +1825,7 @@ public abstract class BaseReceivePack { if (forClient) out.sendString("unpack ok"); //$NON-NLS-1$ - for (final ReceiveCommand cmd : commands) { + for (ReceiveCommand cmd : commands) { if (cmd.getResult() == Result.OK) { if (forClient) out.sendString("ok " + cmd.getRefName()); //$NON-NLS-1$ diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/BundleFetchConnection.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/BundleFetchConnection.java index 2002c9199..449f52944 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/BundleFetchConnection.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/BundleFetchConnection.java @@ -96,7 +96,7 @@ class BundleFetchConnection extends BaseFetchConnection { private PackLock packLock; - BundleFetchConnection(Transport transportBundle, final InputStream src) throws TransportException { + BundleFetchConnection(Transport transportBundle, InputStream src) throws TransportException { transport = transportBundle; bin = new BufferedInputStream(src); try { @@ -226,13 +226,13 @@ class BundleFetchConnection extends BaseFetchConnection { if (prereqs.isEmpty()) return; - try (final RevWalk rw = new RevWalk(transport.local)) { + try (RevWalk rw = new RevWalk(transport.local)) { final RevFlag PREREQ = rw.newFlag("PREREQ"); //$NON-NLS-1$ final RevFlag SEEN = rw.newFlag("SEEN"); //$NON-NLS-1$ final Map missing = new HashMap<>(); final List commits = new ArrayList<>(); - for (final Map.Entry e : prereqs.entrySet()) { + for (Map.Entry e : prereqs.entrySet()) { ObjectId p = e.getKey(); try { final RevCommit c = rw.parseCommit(p); @@ -258,7 +258,7 @@ class BundleFetchConnection extends BaseFetchConnection { } catch (IOException e) { throw new TransportException(transport.uri, e.getMessage(), e); } - for (final Ref r : localRefs) { + for (Ref r : localRefs) { try { rw.markStart(rw.parseCommit(r.getObjectId())); } catch (IOException readError) { @@ -282,7 +282,7 @@ class BundleFetchConnection extends BaseFetchConnection { } if (remaining > 0) { - for (final RevObject o : commits) { + for (RevObject o : commits) { if (!o.has(SEEN)) missing.put(o, prereqs.get(o)); } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/BundleWriter.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/BundleWriter.java index 5779b0d75..f2a261bbe 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/BundleWriter.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/BundleWriter.java @@ -221,7 +221,7 @@ public class BundleWriter { final HashSet inc = new HashSet<>(); final HashSet exc = new HashSet<>(); inc.addAll(include.values()); - for (final RevCommit r : assume) + for (RevCommit r : assume) exc.add(r.getId()); packWriter.setIndexDisabled(true); packWriter.setDeltaBaseAsOffset(true); @@ -236,7 +236,7 @@ public class BundleWriter { w.write('\n'); final char[] tmp = new char[Constants.OBJECT_ID_STRING_LENGTH]; - for (final RevCommit a : assume) { + for (RevCommit a : assume) { w.write('-'); a.copyTo(tmp, w); if (a.getRawBuffer() != null) { @@ -245,7 +245,7 @@ public class BundleWriter { } w.write('\n'); } - for (final Map.Entry e : include.entrySet()) { + for (Map.Entry e : include.entrySet()) { e.getValue().copyTo(tmp, w); w.write(' '); w.write(e.getKey()); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/Daemon.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/Daemon.java index 656390528..7289ce7b6 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/Daemon.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/Daemon.java @@ -209,7 +209,7 @@ public class Daemon { public synchronized DaemonService getService(String name) { if (!name.startsWith("git-")) //$NON-NLS-1$ name = "git-" + name; //$NON-NLS-1$ - for (final DaemonService s : services) { + for (DaemonService s : services) { if (s.getCommandName().equals(name)) return s; } @@ -420,7 +420,7 @@ public class Daemon { } } - void startClient(final Socket s) { + void startClient(Socket s) { final DaemonClient dc = new DaemonClient(this); final SocketAddress peer = s.getRemoteSocketAddress(); @@ -454,8 +454,8 @@ public class Daemon { }.start(); } - synchronized DaemonService matchService(final String cmd) { - for (final DaemonService d : services) { + synchronized DaemonService matchService(String cmd) { + for (DaemonService d : services) { if (d.handles(cmd)) return d; } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/DaemonClient.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/DaemonClient.java index 65b2dc61e..51c4918f5 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/DaemonClient.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/DaemonClient.java @@ -68,11 +68,11 @@ public class DaemonClient { private OutputStream rawOut; - DaemonClient(final Daemon d) { + DaemonClient(Daemon d) { daemon = d; } - void setRemoteAddress(final InetAddress ia) { + void setRemoteAddress(InetAddress ia) { peer = ia; } @@ -112,7 +112,7 @@ public class DaemonClient { return rawOut; } - void execute(final Socket sock) throws IOException, + void execute(Socket sock) throws IOException, ServiceNotEnabledException, ServiceNotAuthorizedException { rawIn = new BufferedInputStream(sock.getInputStream()); rawOut = new BufferedOutputStream(sock.getOutputStream()); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/DaemonService.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/DaemonService.java index 1b24f404d..6d2bee8dc 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/DaemonService.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/DaemonService.java @@ -67,7 +67,7 @@ public abstract class DaemonService { private boolean overridable; - DaemonService(final String cmdName, final String cfgName) { + DaemonService(String cmdName, String cfgName) { command = cmdName.startsWith("git-") ? cmdName : "git-" + cmdName; //$NON-NLS-1$ //$NON-NLS-2$ configKey = cfg -> new ServiceConfig(DaemonService.this, cfg, cfgName); overridable = true; diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/FetchHeadRecord.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/FetchHeadRecord.java index 421ef2107..34ab361c7 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/FetchHeadRecord.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/FetchHeadRecord.java @@ -63,7 +63,7 @@ class FetchHeadRecord { URIish sourceURI; - void write(final Writer pw) throws IOException { + void write(Writer pw) throws IOException { final String type; final String name; if (sourceName.startsWith(R_HEADS)) { diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/FetchProcess.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/FetchProcess.java index 1ef190057..51f900b24 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/FetchProcess.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/FetchProcess.java @@ -106,12 +106,12 @@ class FetchProcess { private Map localRefs; - FetchProcess(final Transport t, final Collection f) { + FetchProcess(Transport t, Collection f) { transport = t; toFetch = f; } - void execute(final ProgressMonitor monitor, final FetchResult result) + void execute(ProgressMonitor monitor, FetchResult result) throws NotSupportedException, TransportException { askFor.clear(); localUpdates.clear(); @@ -123,7 +123,7 @@ class FetchProcess { executeImp(monitor, result); } finally { try { - for (final PackLock lock : packLocks) + for (PackLock lock : packLocks) lock.unlock(); } catch (IOException e) { throw new TransportException(e.getMessage(), e); @@ -139,7 +139,7 @@ class FetchProcess { result.setAdvertisedRefs(transport.getURI(), conn.getRefsMap()); result.peerUserAgent = conn.getPeerUserAgent(); final Set matched = new HashSet<>(); - for (final RefSpec spec : toFetch) { + for (RefSpec spec : toFetch) { if (spec.getSource() == null) throw new TransportException(MessageFormat.format( JGitText.get().sourceRefNotSpecifiedForRefspec, spec)); @@ -176,7 +176,7 @@ class FetchProcess { // have.addAll(askFor.keySet()); askFor.clear(); - for (final Ref r : additionalTags) { + for (Ref r : additionalTags) { ObjectId id = r.getPeeledObjectId(); if (id == null) id = r.getObjectId(); @@ -198,7 +198,7 @@ class FetchProcess { .newBatchUpdate() .setAllowNonFastForwards(true) .setRefLogMessage("fetch", true); //$NON-NLS-1$ - try (final RevWalk walk = new RevWalk(transport.local)) { + try (RevWalk walk = new RevWalk(transport.local)) { if (monitor instanceof BatchingProgressMonitor) { ((BatchingProgressMonitor) monitor).setDelayStart( 250, TimeUnit.MILLISECONDS); @@ -277,12 +277,12 @@ class FetchProcess { // new connection has offered to us. // final HashMap avail = new HashMap<>(); - for (final Ref r : conn.getRefs()) + for (Ref r : conn.getRefs()) avail.put(r.getObjectId(), r); final Collection wants = new ArrayList<>(askFor.values()); askFor.clear(); - for (final Ref want : wants) { + for (Ref want : wants) { final Ref newRef = avail.get(want.getObjectId()); if (newRef != null) { askFor.put(newRef.getObjectId(), newRef); @@ -320,7 +320,7 @@ class FetchProcess { if (lock.lock()) { try (Writer w = new OutputStreamWriter( lock.getOutputStream())) { - for (final FetchHeadRecord h : fetchHeadUpdates) { + for (FetchHeadRecord h : fetchHeadUpdates) { h.write(w); result.add(h); } @@ -334,10 +334,10 @@ class FetchProcess { private boolean askForIsComplete() throws TransportException { try { - try (final ObjectWalk ow = new ObjectWalk(transport.local)) { - for (final ObjectId want : askFor.keySet()) + try (ObjectWalk ow = new ObjectWalk(transport.local)) { + for (ObjectId want : askFor.keySet()) ow.markStart(ow.parseAny(want)); - for (final Ref ref : localRefs().values()) + for (Ref ref : localRefs().values()) ow.markUninteresting(ow.parseAny(ref.getObjectId())); ow.checkConnectivity(); } @@ -351,7 +351,7 @@ class FetchProcess { private void expandWildcard(RefSpec spec, Set matched) throws TransportException { - for (final Ref src : conn.getRefs()) { + for (Ref src : conn.getRefs()) { if (spec.matchSource(src) && matched.add(src)) want(src, spec.expandFromSource(src)); } @@ -377,7 +377,7 @@ class FetchProcess { private Collection expandAutoFollowTags() throws TransportException { final Collection additionalTags = new ArrayList<>(); final Map haveRefs = localRefs(); - for (final Ref r : conn.getRefs()) { + for (Ref r : conn.getRefs()) { if (!isTag(r)) continue; @@ -401,7 +401,7 @@ class FetchProcess { private void expandFetchTags() throws TransportException { final Map haveRefs = localRefs(); - for (final Ref r : conn.getRefs()) { + for (Ref r : conn.getRefs()) { if (!isTag(r)) { continue; } @@ -479,9 +479,9 @@ class FetchProcess { private void deleteStaleTrackingRefs(FetchResult result, BatchRefUpdate batch) throws IOException { - for (final Ref ref : localRefs().values()) { + for (Ref ref : localRefs().values()) { final String refname = ref.getName(); - for (final RefSpec spec : toFetch) { + for (RefSpec spec : toFetch) { if (spec.matchDestination(refname)) { final RefSpec s = spec.expandFromDestination(refname); if (result.getAdvertisedRef(s.getSource()) == null) { diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/FetchResult.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/FetchResult.java index 2667ec37c..ad4c5e935 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/FetchResult.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/FetchResult.java @@ -68,7 +68,7 @@ public class FetchResult extends OperationResult { submodules = new HashMap<>(); } - void add(final FetchHeadRecord r) { + void add(FetchHeadRecord r) { if (!r.notForMerge) forMerge.add(r); } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/HttpAuthMethod.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/HttpAuthMethod.java index 56b202eab..fb03190b0 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/HttpAuthMethod.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/HttpAuthMethod.java @@ -160,10 +160,10 @@ abstract class HttpAuthMethod { final Map> headers = conn.getHeaderFields(); HttpAuthMethod authentication = Type.NONE.method(EMPTY_STRING); - for (final Entry> entry : headers.entrySet()) { + for (Entry> entry : headers.entrySet()) { if (HDR_WWW_AUTHENTICATE.equalsIgnoreCase(entry.getKey())) { if (entry.getValue() != null) { - for (final String value : entry.getValue()) { + for (String value : entry.getValue()) { if (value != null && value.length() != 0) { final String[] valuePart = value.split( SCHEMA_NAME_SEPARATOR, 2); @@ -307,13 +307,13 @@ abstract class HttpAuthMethod { } @Override - void authorize(final String username, final String password) { + void authorize(String username, String password) { this.user = username; this.pass = password; } @Override - void configureRequest(final HttpConnection conn) throws IOException { + void configureRequest(HttpConnection conn) throws IOException { String ident = user + ":" + pass; //$NON-NLS-1$ String enc = Base64.encodeBytes(ident.getBytes(CHARSET)); conn.setRequestProperty(HDR_AUTHORIZATION, type.getSchemeName() @@ -346,14 +346,14 @@ abstract class HttpAuthMethod { } @Override - void authorize(final String username, final String password) { + void authorize(String username, String password) { this.user = username; this.pass = password; } @SuppressWarnings("boxing") @Override - void configureRequest(final HttpConnection conn) throws IOException { + void configureRequest(HttpConnection conn) throws IOException { final Map r = new LinkedHashMap<>(); final String realm = params.get("realm"); //$NON-NLS-1$ diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/JschSession.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/JschSession.java index 68757803c..e3ef83234 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/JschSession.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/JschSession.java @@ -145,7 +145,7 @@ public class JschSession implements RemoteSession { * @throws IOException * on problems opening streams */ - JschProcess(final String commandName, int tms) + JschProcess(String commandName, int tms) throws TransportException, IOException { timeout = tms; try { diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/OpenSshConfig.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/OpenSshConfig.java index 4cb839369..f5ccdc8f1 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/OpenSshConfig.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/OpenSshConfig.java @@ -186,7 +186,7 @@ public class OpenSshConfig implements ConfigRepository { /** State read from the config file, plus {@link Host}s created from it. */ private State state; - OpenSshConfig(final File h, final File cfg) { + OpenSshConfig(File h, File cfg) { home = h; configFile = cfg; state = new State(); @@ -211,7 +211,7 @@ public class OpenSshConfig implements ConfigRepository { // Initialize with default entries at the top of the file, before the // first Host block. fullConfig.merge(cache.entries.get(HostEntry.DEFAULT_NAME)); - for (final Map.Entry e : cache.entries.entrySet()) { + for (Map.Entry e : cache.entries.entrySet()) { String key = e.getKey(); if (isHostMatch(key, hostName)) { fullConfig.merge(e.getValue()); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/OperationResult.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/OperationResult.java index 0fc24ed9b..08f7f0d1a 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/OperationResult.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/OperationResult.java @@ -133,12 +133,12 @@ public abstract class OperationResult { return updates.get(localName); } - void setAdvertisedRefs(final URIish u, final Map ar) { + void setAdvertisedRefs(URIish u, Map ar) { uri = u; advertisedRefs = ar; } - void add(final TrackingRefUpdate u) { + void add(TrackingRefUpdate u) { updates.put(u.getLocalName(), u); } @@ -158,7 +158,7 @@ public abstract class OperationResult { return messageBuffer != null ? messageBuffer.toString() : ""; //$NON-NLS-1$ } - void addMessages(final String msg) { + void addMessages(String msg) { if (msg != null && msg.length() > 0) { if (messageBuffer == null) messageBuffer = new StringBuilder(); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/PackParser.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/PackParser.java index 8ac7926dc..49acb4d9d 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/PackParser.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/PackParser.java @@ -873,7 +873,7 @@ public abstract class PackParser { baseObjectIds = new ObjectIdSubclassMap<>(); final List missing = new ArrayList<>(64); - for (final DeltaChain baseId : baseById) { + for (DeltaChain baseId : baseById) { if (baseId.head == null) continue; @@ -905,7 +905,7 @@ public abstract class PackParser { JGitText.get().downloadCancelledDuringIndexing); } - for (final DeltaChain base : missing) { + for (DeltaChain base : missing) { if (base.head != null) throw new MissingObjectException(base, "delta base"); //$NON-NLS-1$ } @@ -1232,13 +1232,13 @@ public abstract class PackParser { } // Consume cnt bytes from the buffer. - void use(final int cnt) { + void use(int cnt) { bOffset += cnt; bAvail -= cnt; } // Ensure at least need bytes are available in in {@link #buf}. - int fill(final Source src, final int need) throws IOException { + int fill(Source src, int need) throws IOException { while (bAvail < need) { int next = bOffset + bAvail; int free = buf.length - next; @@ -1661,7 +1661,7 @@ public abstract class PackParser { private static class DeltaChain extends ObjectIdOwnerMap.Entry { UnresolvedDelta head; - DeltaChain(final AnyObjectId id) { + DeltaChain(AnyObjectId id) { super(id); } @@ -1672,7 +1672,7 @@ public abstract class PackParser { return r; } - void add(final UnresolvedDelta d) { + void add(UnresolvedDelta d) { d.next = head; head = d; } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/PacketLineIn.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/PacketLineIn.java index f64c8efe8..cc556f8af 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/PacketLineIn.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/PacketLineIn.java @@ -122,7 +122,7 @@ public class PacketLineIn { this.limit = limit; } - AckNackResult readACK(final MutableObjectId returnedId) throws IOException { + AckNackResult readACK(MutableObjectId returnedId) throws IOException { final String line = readString(); if (line.length() == 0) throw new PackProtocolException(JGitText.get().expectedACKNAKFoundEOF); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/PushProcess.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/PushProcess.java index b7debe2c3..470a3c046 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/PushProcess.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/PushProcess.java @@ -127,7 +127,7 @@ class PushProcess { this.toPush = new LinkedHashMap<>(); this.out = out; this.pushOptions = transport.getPushOptions(); - for (final RemoteRefUpdate rru : toPush) { + for (RemoteRefUpdate rru : toPush) { if (this.toPush.put(rru.getRemoteName(), rru) != null) throw new TransportException(MessageFormat.format( JGitText.get().duplicateRemoteRefUpdateIsIllegal, rru.getRemoteName())); @@ -150,7 +150,7 @@ class PushProcess { * when some error occurred during operation, like I/O, protocol * error, or local database consistency error. */ - PushResult execute(final ProgressMonitor monitor) + PushResult execute(ProgressMonitor monitor) throws NotSupportedException, TransportException { try { monitor.beginTask(PROGRESS_OPENING_CONNECTION, @@ -176,7 +176,7 @@ class PushProcess { } if (!transport.isDryRun()) updateTrackingRefs(); - for (final RemoteRefUpdate rru : toPush.values()) { + for (RemoteRefUpdate rru : toPush.values()) { final TrackingRefUpdate tru = rru.getTrackingRefUpdate(); if (tru != null) res.add(tru); @@ -191,7 +191,7 @@ class PushProcess { throws TransportException { boolean atomic = transport.isPushAtomic(); final Map result = new LinkedHashMap<>(); - for (final RemoteRefUpdate rru : toPush.values()) { + for (RemoteRefUpdate rru : toPush.values()) { final Ref advertisedRef = connection.getRef(rru.getRemoteName()); ObjectId advertisedOld = null; if (advertisedRef != null) { @@ -277,13 +277,13 @@ class PushProcess { } private void modifyUpdatesForDryRun() { - for (final RemoteRefUpdate rru : toPush.values()) + for (RemoteRefUpdate rru : toPush.values()) if (rru.getStatus() == Status.NOT_ATTEMPTED) rru.setStatus(Status.OK); } private void updateTrackingRefs() { - for (final RemoteRefUpdate rru : toPush.values()) { + for (RemoteRefUpdate rru : toPush.values()) { final Status status = rru.getStatus(); if (rru.hasTrackingRefUpdate() && (status == Status.UP_TO_DATE || status == Status.OK)) { diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/ReceiveCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/ReceiveCommand.java index 5c52f2c3e..d61aeb04d 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/ReceiveCommand.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/ReceiveCommand.java @@ -818,11 +818,11 @@ public class ReceiveCommand { } } - void setRef(final Ref r) { + void setRef(Ref r) { ref = r; } - void setType(final Type t) { + void setType(Type t) { type = t; } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/ReceivePack.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/ReceivePack.java index 31b75b07f..35fb0b17a 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/ReceivePack.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/ReceivePack.java @@ -288,7 +288,7 @@ public class ReceivePack extends BaseReceivePack { if (echoCommandFailures && msgOut != null) { sendStatusReport(false, unpackError, new Reporter() { @Override - void sendString(final String s) throws IOException { + void sendString(String s) throws IOException { msgOut.write(Constants.encode(s + "\n")); //$NON-NLS-1$ } }); @@ -301,7 +301,7 @@ public class ReceivePack extends BaseReceivePack { } sendStatusReport(true, unpackError, new Reporter() { @Override - void sendString(final String s) throws IOException { + void sendString(String s) throws IOException { pckOut.writeString(s + "\n"); //$NON-NLS-1$ } }); @@ -309,7 +309,7 @@ public class ReceivePack extends BaseReceivePack { } else if (msgOut != null) { sendStatusReport(false, unpackError, new Reporter() { @Override - void sendString(final String s) throws IOException { + void sendString(String s) throws IOException { msgOut.write(Constants.encode(s + "\n")); //$NON-NLS-1$ } }); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/RefAdvertiser.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/RefAdvertiser.java index 859ef2c97..b4d780346 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/RefAdvertiser.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/RefAdvertiser.java @@ -402,7 +402,7 @@ public abstract class RefAdvertiser { first = false; if (!capablities.isEmpty()) { tmpLine.append('\0'); - for (final String capName : capablities) { + for (String capName : capablities) { tmpLine.append(' '); tmpLine.append(capName); } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/RemoteConfig.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/RemoteConfig.java index 356976117..0a621f19e 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/RemoteConfig.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/RemoteConfig.java @@ -120,7 +120,7 @@ public class RemoteConfig implements Serializable { final List result = new ArrayList<>(names .size()); - for (final String name : names) + for (String name : names) result.add(new RemoteConfig(rc, name)); return result; } @@ -170,12 +170,12 @@ public class RemoteConfig implements Serializable { vlst = rc.getStringList(SECTION, name, KEY_URL); Map insteadOf = getReplacements(rc, KEY_INSTEADOF); uris = new ArrayList<>(vlst.length); - for (final String s : vlst) { + for (String s : vlst) { uris.add(new URIish(replaceUri(s, insteadOf))); } String[] plst = rc.getStringList(SECTION, name, KEY_PUSHURL); pushURIs = new ArrayList<>(plst.length); - for (final String s : plst) { + for (String s : plst) { pushURIs.add(new URIish(s)); } if (pushURIs.isEmpty()) { @@ -227,22 +227,22 @@ public class RemoteConfig implements Serializable { final List vlst = new ArrayList<>(); vlst.clear(); - for (final URIish u : getURIs()) + for (URIish u : getURIs()) vlst.add(u.toPrivateString()); rc.setStringList(SECTION, getName(), KEY_URL, vlst); vlst.clear(); - for (final URIish u : getPushURIs()) + for (URIish u : getPushURIs()) vlst.add(u.toPrivateString()); rc.setStringList(SECTION, getName(), KEY_PUSHURL, vlst); vlst.clear(); - for (final RefSpec u : getFetchRefSpecs()) + for (RefSpec u : getFetchRefSpecs()) vlst.add(u.toString()); rc.setStringList(SECTION, getName(), KEY_FETCH, vlst); vlst.clear(); - for (final RefSpec u : getPushRefSpecs()) + for (RefSpec u : getPushRefSpecs()) vlst.add(u.toString()); rc.setStringList(SECTION, getName(), KEY_PUSH, vlst); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/RemoteRefUpdate.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/RemoteRefUpdate.java index 2849afe20..931653fa9 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/RemoteRefUpdate.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/RemoteRefUpdate.java @@ -481,7 +481,7 @@ public class RemoteRefUpdate { expectedOldObjectId = id; } - void setStatus(final Status status) { + void setStatus(Status status) { this.status = status; } @@ -489,7 +489,7 @@ public class RemoteRefUpdate { this.fastForward = fastForward; } - void setMessage(final String message) { + void setMessage(String message) { this.message = message; } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/SideBandProgressMonitor.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/SideBandProgressMonitor.java index 365545a09..8a3e4efc9 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/SideBandProgressMonitor.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/SideBandProgressMonitor.java @@ -55,7 +55,7 @@ class SideBandProgressMonitor extends BatchingProgressMonitor { private boolean write; - SideBandProgressMonitor(final OutputStream os) { + SideBandProgressMonitor(OutputStream os) { out = os; write = true; } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/TagOpt.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/TagOpt.java index eae8aa06d..cd1791351 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/TagOpt.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/TagOpt.java @@ -107,7 +107,7 @@ public enum TagOpt { public static TagOpt fromOption(String o) { if (o == null || o.length() == 0) return AUTO_FOLLOW; - for (final TagOpt tagopt : values()) { + for (TagOpt tagopt : values()) { if (tagopt.option().equals(o)) return tagopt; } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransferConfig.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransferConfig.java index 21c0a9296..4ae1ccb42 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransferConfig.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransferConfig.java @@ -132,12 +132,12 @@ public class TransferConfig { final @Nullable ProtocolVersion protocolVersion; final String[] hideRefs; - TransferConfig(final Repository db) { + TransferConfig(Repository db) { this(db.getConfig()); } @SuppressWarnings("nls") - TransferConfig(final Config rc) { + TransferConfig(Config rc) { boolean fsck = rc.getBoolean("transfer", "fsckobjects", false); fetchFsck = rc.getBoolean("fetch", "fsckobjects", fsck); receiveFsck = rc.getBoolean("receive", "fsckobjects", fsck); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/Transport.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/Transport.java index 0336f4773..d342ef46d 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/Transport.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/Transport.java @@ -478,7 +478,7 @@ public abstract class Transport implements AutoCloseable { throws NotSupportedException, TransportException { final List uris = getURIs(cfg, op); final List transports = new ArrayList<>(uris.size()); - for (final URIish uri : uris) { + for (URIish uri : uris) { final Transport tn = open(local, uri, cfg.getName()); tn.applyConfig(cfg); transports.add(tn); @@ -621,7 +621,7 @@ public abstract class Transport implements AutoCloseable { final List result = new LinkedList<>(); final Collection procRefs = expandPushWildcardsFor(db, specs); - for (final RefSpec spec : procRefs) { + for (RefSpec spec : procRefs) { String srcSpec = spec.getSource(); final Ref srcRef = db.findRef(srcSpec); if (srcRef != null) @@ -691,9 +691,9 @@ public abstract class Transport implements AutoCloseable { final List localRefs = db.getRefDatabase().getRefs(); final Collection procRefs = new LinkedHashSet<>(); - for (final RefSpec spec : specs) { + for (RefSpec spec : specs) { if (spec.isWildcard()) { - for (final Ref localRef : localRefs) { + for (Ref localRef : localRefs) { if (spec.matchSource(localRef)) procRefs.add(spec.expandFromSource(localRef)); } @@ -707,7 +707,7 @@ public abstract class Transport implements AutoCloseable { private static String findTrackingRefName(final String remoteName, final Collection fetchSpecs) { // try to find matching tracking refs - for (final RefSpec fetchSpec : fetchSpecs) { + for (RefSpec fetchSpec : fetchSpecs) { if (fetchSpec.matchSource(remoteName)) { if (fetchSpec.isWildcard()) return fetchSpec.expandFromSource(remoteName) @@ -1253,9 +1253,9 @@ public abstract class Transport implements AutoCloseable { // object transfer overheads. // final Collection tmp = new ArrayList<>(toFetch); - for (final RefSpec requested : toFetch) { + for (RefSpec requested : toFetch) { final String reqSrc = requested.getSource(); - for (final RefSpec configured : fetch) { + for (RefSpec configured : fetch) { final String cfgSrc = configured.getSource(); final String cfgDst = configured.getDestination(); if (cfgSrc.equals(reqSrc) && cfgDst != null) { diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportAmazonS3.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportAmazonS3.java index 9ddfc4666..6118cb877 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportAmazonS3.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportAmazonS3.java @@ -267,7 +267,7 @@ public class TransportAmazonS3 extends HttpTransport implements WalkTransport { } @Override - WalkRemoteObjectDatabase openAlternate(final String location) + WalkRemoteObjectDatabase openAlternate(String location) throws IOException { return new DatabaseS3(bucketName, resolveKey(location)); } @@ -278,7 +278,7 @@ public class TransportAmazonS3 extends HttpTransport implements WalkTransport { have.addAll(s3.list(bucket, resolveKey("pack"))); //$NON-NLS-1$ final Collection packs = new ArrayList<>(); - for (final String n : have) { + for (String n : have) { if (!n.startsWith("pack-") || !n.endsWith(".pack")) //$NON-NLS-1$ //$NON-NLS-2$ continue; @@ -290,7 +290,7 @@ public class TransportAmazonS3 extends HttpTransport implements WalkTransport { } @Override - FileStream open(final String path) throws IOException { + FileStream open(String path) throws IOException { final URLConnection c = s3.get(bucket, resolveKey(path)); final InputStream raw = c.getInputStream(); final InputStream in = s3.decrypt(c); @@ -299,7 +299,7 @@ public class TransportAmazonS3 extends HttpTransport implements WalkTransport { } @Override - void deleteFile(final String path) throws IOException { + void deleteFile(String path) throws IOException { s3.delete(bucket, resolveKey(path)); } @@ -311,7 +311,7 @@ public class TransportAmazonS3 extends HttpTransport implements WalkTransport { } @Override - void writeFile(final String path, final byte[] data) throws IOException { + void writeFile(String path, byte[] data) throws IOException { s3.put(bucket, resolveKey(path), data); } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportGitAnon.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportGitAnon.java index cbf77bb0b..113250364 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportGitAnon.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportGitAnon.java @@ -113,11 +113,11 @@ class TransportGitAnon extends TcpTransport implements PackTransport { } }; - TransportGitAnon(final Repository local, final URIish uri) { + TransportGitAnon(Repository local, URIish uri) { super(local, uri); } - TransportGitAnon(final URIish uri) { + TransportGitAnon(URIish uri) { super(uri); } @@ -163,7 +163,7 @@ class TransportGitAnon extends TcpTransport implements PackTransport { return s; } - void service(final String name, final PacketLineOut pckOut) + void service(String name, PacketLineOut pckOut) throws IOException { final StringBuilder cmd = new StringBuilder(); cmd.append(name); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportGitSsh.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportGitSsh.java index 291b53618..d59fe33df 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportGitSsh.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportGitSsh.java @@ -141,12 +141,12 @@ public class TransportGitSsh extends SshTransport implements PackTransport { } }; - TransportGitSsh(final Repository local, final URIish uri) { + TransportGitSsh(Repository local, URIish uri) { super(local, uri); initSshSessionFactory(); } - TransportGitSsh(final URIish uri) { + TransportGitSsh(URIish uri) { super(uri); initSshSessionFactory(); } @@ -176,7 +176,7 @@ public class TransportGitSsh extends SshTransport implements PackTransport { return new SshPushConnection(); } - String commandFor(final String exe) { + String commandFor(String exe) { String path = uri.getPath(); if (uri.getScheme() != null && uri.getPath().startsWith("/~")) //$NON-NLS-1$ path = (uri.getPath().substring(1)); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportHttp.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportHttp.java index 7fb206003..c08f40030 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportHttp.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportHttp.java @@ -273,7 +273,7 @@ public class TransportHttp extends HttpTransport implements WalkTransport, private boolean sslFailure = false; - TransportHttp(final Repository local, final URIish uri) + TransportHttp(Repository local, URIish uri) throws NotSupportedException { super(local, uri); setURI(uri); @@ -314,7 +314,7 @@ public class TransportHttp extends HttpTransport implements WalkTransport, * @param uri * @throws NotSupportedException */ - TransportHttp(final URIish uri) throws NotSupportedException { + TransportHttp(URIish uri) throws NotSupportedException { super(uri); setURI(uri); http = new HttpConfig(uri); @@ -903,7 +903,7 @@ public class TransportHttp extends HttpTransport implements WalkTransport, class HttpObjectDB extends WalkRemoteObjectDatabase { private final URL httpObjectsUrl; - HttpObjectDB(final URL b) { + HttpObjectDB(URL b) { httpObjectsUrl = b; } @@ -930,7 +930,7 @@ public class TransportHttp extends HttpTransport implements WalkTransport, } @Override - WalkRemoteObjectDatabase openAlternate(final String location) + WalkRemoteObjectDatabase openAlternate(String location) throws IOException { return new HttpObjectDB(new URL(httpObjectsUrl, location)); } @@ -962,7 +962,7 @@ public class TransportHttp extends HttpTransport implements WalkTransport, } @Override - FileStream open(final String path) throws IOException { + FileStream open(String path) throws IOException { return open(path, AcceptEncoding.UNSPECIFIED); } @@ -1051,7 +1051,7 @@ public class TransportHttp extends HttpTransport implements WalkTransport, class SmartHttpFetchConnection extends BasePackFetchConnection { private MultiRequestService svc; - SmartHttpFetchConnection(final InputStream advertisement) + SmartHttpFetchConnection(InputStream advertisement) throws TransportException { super(TransportHttp.this); statelessRPC = true; @@ -1081,7 +1081,7 @@ public class TransportHttp extends HttpTransport implements WalkTransport, } class SmartHttpPushConnection extends BasePackPushConnection { - SmartHttpPushConnection(final InputStream advertisement) + SmartHttpPushConnection(InputStream advertisement) throws TransportException { super(TransportHttp.this); statelessRPC = true; @@ -1384,7 +1384,7 @@ public class TransportHttp extends HttpTransport implements WalkTransport, class MultiRequestService extends Service { boolean finalRequest; - MultiRequestService(final String serviceName) { + MultiRequestService(String serviceName) { super(serviceName); } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportLocal.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportLocal.java index 648eaa3cf..fbb2c4410 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportLocal.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportLocal.java @@ -162,11 +162,11 @@ class TransportLocal extends Transport implements PackTransport { remoteGitDir = gitDir; } - UploadPack createUploadPack(final Repository dst) { + UploadPack createUploadPack(Repository dst) { return new UploadPack(dst); } - ReceivePack createReceivePack(final Repository dst) { + ReceivePack createReceivePack(Repository dst) { return new ReceivePack(dst); } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportSftp.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportSftp.java index aa5ee7a3d..d8f3a12bf 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportSftp.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportSftp.java @@ -134,7 +134,7 @@ public class TransportSftp extends SshTransport implements WalkTransport { } }; - TransportSftp(final Repository local, final URIish uri) { + TransportSftp(Repository local, URIish uri) { super(local, uri); } @@ -195,7 +195,7 @@ public class TransportSftp extends SshTransport implements WalkTransport { } } - SftpObjectDB(final SftpObjectDB parent, final String p) + SftpObjectDB(SftpObjectDB parent, String p) throws TransportException { try { ftp = newSftp(); @@ -227,7 +227,7 @@ public class TransportSftp extends SshTransport implements WalkTransport { } @Override - WalkRemoteObjectDatabase openAlternate(final String location) + WalkRemoteObjectDatabase openAlternate(String location) throws IOException { return new SftpObjectDB(this, location); } @@ -244,9 +244,9 @@ public class TransportSftp extends SshTransport implements WalkTransport { files = new HashMap<>(); mtimes = new HashMap<>(); - for (final ChannelSftp.LsEntry ent : list) + for (ChannelSftp.LsEntry ent : list) files.put(ent.getFilename(), ent); - for (final ChannelSftp.LsEntry ent : list) { + for (ChannelSftp.LsEntry ent : list) { final String n = ent.getFilename(); if (!n.startsWith("pack-") || !n.endsWith(".pack")) //$NON-NLS-1$ //$NON-NLS-2$ continue; @@ -276,7 +276,7 @@ public class TransportSftp extends SshTransport implements WalkTransport { } @Override - FileStream open(final String path) throws IOException { + FileStream open(String path) throws IOException { try { final SftpATTRS a = ftp.lstat(path); return new FileStream(ftp.get(path), a.getSize()); @@ -290,7 +290,7 @@ public class TransportSftp extends SshTransport implements WalkTransport { } @Override - void deleteFile(final String path) throws IOException { + void deleteFile(String path) throws IOException { try { ftp.rm(path); } catch (SftpException je) { @@ -343,7 +343,7 @@ public class TransportSftp extends SshTransport implements WalkTransport { } @Override - void writeFile(final String path, final byte[] data) throws IOException { + void writeFile(String path, byte[] data) throws IOException { final String lock = path + ".lock"; //$NON-NLS-1$ try { super.writeFile(lock, data); @@ -411,7 +411,7 @@ public class TransportSftp extends SshTransport implements WalkTransport { je.getMessage()), je); } - for (final ChannelSftp.LsEntry ent : list) { + for (ChannelSftp.LsEntry ent : list) { final String n = ent.getFilename(); if (".".equals(n) || "..".equals(n)) //$NON-NLS-1$ //$NON-NLS-2$ continue; diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/WalkEncryption.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/WalkEncryption.java index 615e46b98..b4248ee3f 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/WalkEncryption.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/WalkEncryption.java @@ -128,7 +128,7 @@ abstract class WalkEncryption { throw new IOException(MessageFormat.format(JGitText.get().unsupportedEncryptionAlgorithm, v)); } - IOException error(final Throwable why) { + IOException error(Throwable why) { return new IOException(MessageFormat .format(JGitText.get().encryptionError, why.getMessage()), why); @@ -141,7 +141,7 @@ abstract class WalkEncryption { } @Override - void validate(final HttpURLConnection u, final String prefix) + void validate(HttpURLConnection u, String prefix) throws IOException { validateImpl(u, prefix, "", ""); //$NON-NLS-1$ //$NON-NLS-2$ } @@ -240,19 +240,19 @@ abstract class WalkEncryption { } @Override - void request(final HttpURLConnection u, final String prefix) { + void request(HttpURLConnection u, String prefix) { u.setRequestProperty(prefix + JETS3T_CRYPTO_VER, CRYPTO_VER); u.setRequestProperty(prefix + JETS3T_CRYPTO_ALG, cryptoAlg); } @Override - void validate(final HttpURLConnection u, final String prefix) + void validate(HttpURLConnection u, String prefix) throws IOException { validateImpl(u, prefix, CRYPTO_VER, cryptoAlg); } @Override - OutputStream encrypt(final OutputStream os) throws IOException { + OutputStream encrypt(OutputStream os) throws IOException { try { final Cipher cipher = InsecureCipherFactory.create(cryptoAlg); cipher.init(Cipher.ENCRYPT_MODE, secretKey, paramSpec); @@ -263,7 +263,7 @@ abstract class WalkEncryption { } @Override - InputStream decrypt(final InputStream in) throws IOException { + InputStream decrypt(InputStream in) throws IOException { try { final Cipher cipher = InsecureCipherFactory.create(cryptoAlg); cipher.init(Cipher.DECRYPT_MODE, secretKey, paramSpec); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/WalkFetchConnection.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/WalkFetchConnection.java index 9b6f45899..930791444 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/WalkFetchConnection.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/WalkFetchConnection.java @@ -187,7 +187,7 @@ class WalkFetchConnection extends BaseFetchConnection { /** Inserter to read objects from {@link #local}. */ private final ObjectReader reader; - WalkFetchConnection(final WalkTransport t, final WalkRemoteObjectDatabase w) { + WalkFetchConnection(WalkTransport t, WalkRemoteObjectDatabase w) { Transport wt = (Transport)t; local = wt.local; objCheck = wt.getObjectChecker(); @@ -265,18 +265,18 @@ class WalkFetchConnection extends BaseFetchConnection { public void close() { inserter.close(); reader.close(); - for (final RemotePack p : unfetchedPacks) { + for (RemotePack p : unfetchedPacks) { if (p.tmpIdx != null) p.tmpIdx.delete(); } - for (final WalkRemoteObjectDatabase r : remotes) + for (WalkRemoteObjectDatabase r : remotes) r.close(); } private void queueWants(Collection want) throws TransportException { final HashSet inWorkQueue = new HashSet<>(); - for (final Ref r : want) { + for (Ref r : want) { final ObjectId id = r.getObjectId(); if (id == null) { throw new NullPointerException(MessageFormat.format( @@ -385,7 +385,7 @@ class WalkFetchConnection extends BaseFetchConnection { final RevCommit commit = (RevCommit) obj; markLocalCommitsComplete(commit.getCommitTime()); needs(commit.getTree()); - for (final RevCommit p : commit.getParents()) + for (RevCommit p : commit.getParents()) needs(p); obj.add(COMPLETE); } @@ -459,7 +459,7 @@ class WalkFetchConnection extends BaseFetchConnection { if (packNameList == null || packNameList.isEmpty()) continue; - for (final String packName : packNameList) { + for (String packName : packNameList) { if (packsConsidered.add(packName)) unfetchedPacks.add(new RemotePack(wrr, packName)); } @@ -471,7 +471,7 @@ class WalkFetchConnection extends BaseFetchConnection { // Collection al = expandOneAlternate(id, pm); if (al != null && !al.isEmpty()) { - for (final WalkRemoteObjectDatabase alt : al) { + for (WalkRemoteObjectDatabase alt : al) { remotes.add(alt); noPacksYet.add(alt); noAlternatesYet.add(alt); @@ -693,14 +693,14 @@ class WalkFetchConnection extends BaseFetchConnection { } catch (IOException e) { throw new TransportException(e.getMessage(), e); } - for (final Ref r : refs) { + for (Ref r : refs) { try { markLocalObjComplete(revWalk.parseAny(r.getObjectId())); } catch (IOException readError) { throw new TransportException(MessageFormat.format(JGitText.get().localRefIsMissingObjects, r.getName()), readError); } } - for (final ObjectId id : have) { + for (ObjectId id : have) { try { markLocalObjComplete(revWalk.parseAny(id)); } catch (IOException readError) { @@ -739,7 +739,7 @@ class WalkFetchConnection extends BaseFetchConnection { localCommitQueue.next(); markTreeComplete(c.getTree()); - for (final RevCommit p : c.getParents()) + for (RevCommit p : c.getParents()) pushLocalCommit(p); } } catch (IOException err) { @@ -813,7 +813,7 @@ class WalkFetchConnection extends BaseFetchConnection { PackIndex index; - RemotePack(final WalkRemoteObjectDatabase c, final String pn) { + RemotePack(WalkRemoteObjectDatabase c, String pn) { connection = c; packName = pn; idxName = packName.substring(0, packName.length() - 5) + ".idx"; //$NON-NLS-1$ @@ -831,7 +831,7 @@ class WalkFetchConnection extends BaseFetchConnection { } } - void openIndex(final ProgressMonitor pm) throws IOException { + void openIndex(ProgressMonitor pm) throws IOException { if (index != null) return; if (tmpIdx == null) @@ -850,7 +850,7 @@ class WalkFetchConnection extends BaseFetchConnection { pm.beginTask("Get " + idxName.substring(0, 12) + "..idx", //$NON-NLS-1$ //$NON-NLS-2$ s.length < 0 ? ProgressMonitor.UNKNOWN : (int) (s.length / 1024)); - try (final FileOutputStream fos = new FileOutputStream(tmpIdx)) { + try (FileOutputStream fos = new FileOutputStream(tmpIdx)) { final byte[] buf = new byte[2048]; int cnt; while (!pm.isCancelled() && (cnt = s.in.read(buf)) >= 0) { @@ -878,7 +878,7 @@ class WalkFetchConnection extends BaseFetchConnection { } } - void downloadPack(final ProgressMonitor monitor) throws IOException { + void downloadPack(ProgressMonitor monitor) throws IOException { String name = "pack/" + packName; //$NON-NLS-1$ WalkRemoteObjectDatabase.FileStream s = connection.open(name); try { diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/WalkPushConnection.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/WalkPushConnection.java index 5cc616ed3..4c754252a 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/WalkPushConnection.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/WalkPushConnection.java @@ -157,7 +157,7 @@ class WalkPushConnection extends BaseConnection implements PushConnection { // ref using the directory name being created. // final List updates = new ArrayList<>(); - for (final RemoteRefUpdate u : refUpdates.values()) { + for (RemoteRefUpdate u : refUpdates.values()) { final String n = u.getRemoteName(); if (!n.startsWith("refs/") || !Repository.isValidRefName(n)) { //$NON-NLS-1$ u.setStatus(Status.REJECTED_OTHER_REASON); @@ -177,7 +177,7 @@ class WalkPushConnection extends BaseConnection implements PushConnection { // if (!updates.isEmpty()) sendpack(updates, monitor); - for (final RemoteRefUpdate u : updates) + for (RemoteRefUpdate u : updates) updateCommand(u); // Is this a new repository? If so we should create additional @@ -196,10 +196,10 @@ class WalkPushConnection extends BaseConnection implements PushConnection { if (!packedRefUpdates.isEmpty()) { try { refWriter.writePackedRefs(); - for (final RemoteRefUpdate u : packedRefUpdates) + for (RemoteRefUpdate u : packedRefUpdates) u.setStatus(Status.OK); } catch (IOException err) { - for (final RemoteRefUpdate u : packedRefUpdates) { + for (RemoteRefUpdate u : packedRefUpdates) { u.setStatus(Status.REJECTED_OTHER_REASON); u.setMessage(err.getMessage()); } @@ -225,14 +225,14 @@ class WalkPushConnection extends BaseConnection implements PushConnection { String pathPack = null; String pathIdx = null; - try (final PackWriter writer = new PackWriter(transport.getPackConfig(), + try (PackWriter writer = new PackWriter(transport.getPackConfig(), local.newObjectReader())) { final Set need = new HashSet<>(); final Set have = new HashSet<>(); - for (final RemoteRefUpdate r : updates) + for (RemoteRefUpdate r : updates) need.add(r.getNewObjectId()); - for (final Ref r : getRefs()) { + for (Ref r : getRefs()) { have.add(r.getObjectId()); if (r.getPeeledObjectId() != null) have.add(r.getPeeledObjectId()); @@ -247,7 +247,7 @@ class WalkPushConnection extends BaseConnection implements PushConnection { return; packNames = new LinkedHashMap<>(); - for (final String n : dest.getPackNames()) + for (String n : dest.getPackNames()) packNames.put(n, n); final String base = "pack-" + writer.computeName().name(); //$NON-NLS-1$ @@ -379,7 +379,7 @@ class WalkPushConnection extends BaseConnection implements PushConnection { // default branch and is likely what they want to remain as // the default on the new remote. // - for (final RemoteRefUpdate u : updates) { + for (RemoteRefUpdate u : updates) { final String n = u.getRemoteName(); if (n.equals(Constants.R_HEADS + Constants.MASTER)) return n; @@ -388,7 +388,7 @@ class WalkPushConnection extends BaseConnection implements PushConnection { // Pick any branch, under the assumption the user pushed only // one to the remote side. // - for (final RemoteRefUpdate u : updates) { + for (RemoteRefUpdate u : updates) { final String n = u.getRemoteName(); if (n.startsWith(Constants.R_HEADS)) return n; diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/WalkRemoteObjectDatabase.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/WalkRemoteObjectDatabase.java index dde7b0815..aa71c9445 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/WalkRemoteObjectDatabase.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/WalkRemoteObjectDatabase.java @@ -202,7 +202,7 @@ abstract class WalkRemoteObjectDatabase { * @throws IOException * deletion is not supported, or deletion failed. */ - void deleteFile(final String path) throws IOException { + void deleteFile(String path) throws IOException { throw new IOException(MessageFormat.format(JGitText.get().deletingNotSupported, path)); } @@ -263,7 +263,7 @@ abstract class WalkRemoteObjectDatabase { * writing is not supported, or attempting to write the file * failed, possibly due to permissions or remote disk full, etc. */ - void writeFile(final String path, final byte[] data) throws IOException { + void writeFile(String path, byte[] data) throws IOException { try (OutputStream os = writeFile(path, null, null)) { os.write(data); } @@ -278,7 +278,7 @@ abstract class WalkRemoteObjectDatabase { * @throws IOException * deletion is not supported, or deletion failed. */ - void deleteRef(final String name) throws IOException { + void deleteRef(String name) throws IOException { deleteFile(ROOT_DIR + name); } @@ -291,7 +291,7 @@ abstract class WalkRemoteObjectDatabase { * @throws IOException * deletion is not supported, or deletion failed. */ - void deleteRefLog(final String name) throws IOException { + void deleteRefLog(String name) throws IOException { deleteFile(ROOT_DIR + Constants.LOGS + "/" + name); //$NON-NLS-1$ } @@ -309,7 +309,7 @@ abstract class WalkRemoteObjectDatabase { * writing is not supported, or attempting to write the file * failed, possibly due to permissions or remote disk full, etc. */ - void writeRef(final String name, final ObjectId value) throws IOException { + void writeRef(String name, ObjectId value) throws IOException { final ByteArrayOutputStream b; b = new ByteArrayOutputStream(Constants.OBJECT_ID_STRING_LENGTH + 1); @@ -333,9 +333,9 @@ abstract class WalkRemoteObjectDatabase { * writing is not supported, or attempting to write the file * failed, possibly due to permissions or remote disk full, etc. */ - void writeInfoPacks(final Collection packNames) throws IOException { + void writeInfoPacks(Collection packNames) throws IOException { final StringBuilder w = new StringBuilder(); - for (final String n : packNames) { + for (String n : packNames) { w.append("P "); //$NON-NLS-1$ w.append(n); w.append('\n'); @@ -361,7 +361,7 @@ abstract class WalkRemoteObjectDatabase { * exists, or after it was determined to exist but before the * stream could be created. */ - BufferedReader openReader(final String path) throws IOException { + BufferedReader openReader(String path) throws IOException { final InputStream is = open(path).in; return new BufferedReader(new InputStreamReader(is, Constants.CHARSET)); } @@ -475,7 +475,7 @@ abstract class WalkRemoteObjectDatabase { * stream containing the file data. This stream will be * closed by the caller when reading is complete. */ - FileStream(final InputStream i) { + FileStream(InputStream i) { in = i; length = -1; } @@ -490,7 +490,7 @@ abstract class WalkRemoteObjectDatabase { * total number of bytes available for reading through * i. */ - FileStream(final InputStream i, final long n) { + FileStream(InputStream i, long n) { in = i; length = n; } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/AbstractTreeIterator.java b/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/AbstractTreeIterator.java index ad409f6d6..470ed0284 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/AbstractTreeIterator.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/AbstractTreeIterator.java @@ -326,7 +326,7 @@ public abstract class AbstractTreeIterator { return pathCompare(p, p.mode); } - int pathCompare(final AbstractTreeIterator p, final int pMode) { + int pathCompare(AbstractTreeIterator p, int pMode) { // Its common when we are a subtree for both parents to match; // when this happens everything in path[0..cPos] is known to // be equal and does not require evaluation again. diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/EmptyTreeIterator.java b/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/EmptyTreeIterator.java index 0639b0dbd..f5d45c768 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/EmptyTreeIterator.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/EmptyTreeIterator.java @@ -63,7 +63,7 @@ public class EmptyTreeIterator extends AbstractTreeIterator { // Create a root empty tree. } - EmptyTreeIterator(final AbstractTreeIterator p) { + EmptyTreeIterator(AbstractTreeIterator p) { super(p); pathLen = pathOffset; } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/NameConflictTreeWalk.java b/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/NameConflictTreeWalk.java index b0509705d..61b130f93 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/NameConflictTreeWalk.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/NameConflictTreeWalk.java @@ -135,7 +135,7 @@ public class NameConflictTreeWalk extends TreeWalk { if (isTree(minRef)) { if (skipEntry(minRef)) { - for (final AbstractTreeIterator t : trees) { + for (AbstractTreeIterator t : trees) { if (t.matches == minRef) { t.next(1); t.matches = null; @@ -231,7 +231,7 @@ public class NameConflictTreeWalk extends TreeWalk { // A tree D/F may have been handled earlier. We need to // not report this path if it has already been reported. // - for (final AbstractTreeIterator t : trees) { + for (AbstractTreeIterator t : trees) { if (t.matches == minRef || t.first()) continue; @@ -267,7 +267,7 @@ public class NameConflictTreeWalk extends TreeWalk { // such entries match this entry. // AbstractTreeIterator treeMatch = null; - for (final AbstractTreeIterator t : trees) { + for (AbstractTreeIterator t : trees) { if (t.matches == minRef || t.eof()) continue; @@ -306,7 +306,7 @@ public class NameConflictTreeWalk extends TreeWalk { // matching iterators instead of the file iterator. // This way isSubtree is true and isRecursive works. // - for (final AbstractTreeIterator t : trees) + for (AbstractTreeIterator t : trees) if (t.matches == minRef) t.matches = treeMatch; diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/TreeWalk.java b/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/TreeWalk.java index 8db95da34..d500aae68 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/TreeWalk.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/TreeWalk.java @@ -1361,7 +1361,7 @@ public class TreeWalk implements AutoCloseable, AttributesProvider { trees[i] = trees[i].parent; AbstractTreeIterator minRef = null; - for (final AbstractTreeIterator t : trees) { + for (AbstractTreeIterator t : trees) { if (t.matches != t) continue; if (minRef == null || t.pathCompare(minRef) < 0) @@ -1377,11 +1377,11 @@ public class TreeWalk implements AutoCloseable, AttributesProvider { return p; } - static String pathOf(final AbstractTreeIterator t) { + static String pathOf(AbstractTreeIterator t) { return RawParseUtils.decode(Constants.CHARSET, t.path, 0, t.pathLen); } - static String pathOf(final byte[] buf, int pos, int end) { + static String pathOf(byte[] buf, int pos, int end) { return RawParseUtils.decode(Constants.CHARSET, buf, pos, end); } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/WorkingTreeIterator.java b/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/WorkingTreeIterator.java index 44385eacb..10e919641 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/WorkingTreeIterator.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/WorkingTreeIterator.java @@ -1175,7 +1175,7 @@ public abstract class WorkingTreeIterator extends AbstractTreeIterator { int encodedNameLen; - void encodeName(final CharsetEncoder enc) { + void encodeName(CharsetEncoder enc) { final ByteBuffer b; try { b = enc.encode(CharBuffer.wrap(getName())); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/filter/AndTreeFilter.java b/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/filter/AndTreeFilter.java index 62a5440aa..a960bd7a8 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/filter/AndTreeFilter.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/filter/AndTreeFilter.java @@ -120,7 +120,7 @@ public abstract class AndTreeFilter extends TreeFilter { private final TreeFilter b; - Binary(final TreeFilter one, final TreeFilter two) { + Binary(TreeFilter one, TreeFilter two) { a = one; b = two; } @@ -170,7 +170,7 @@ public abstract class AndTreeFilter extends TreeFilter { private static class List extends AndTreeFilter { private final TreeFilter[] subfilters; - List(final TreeFilter[] list) { + List(TreeFilter[] list) { subfilters = list; } @@ -186,7 +186,7 @@ public abstract class AndTreeFilter extends TreeFilter { throws MissingObjectException, IncorrectObjectTypeException, IOException { int m = 0; - for (final TreeFilter f : subfilters) { + for (TreeFilter f : subfilters) { int r = f.matchFilter(walker); if (r == 1) { return 1; @@ -200,7 +200,7 @@ public abstract class AndTreeFilter extends TreeFilter { @Override public boolean shouldBeRecursive() { - for (final TreeFilter f : subfilters) + for (TreeFilter f : subfilters) if (f.shouldBeRecursive()) return true; return false; diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/filter/ByteArraySet.java b/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/filter/ByteArraySet.java index 0a3b7d02d..995561e59 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/filter/ByteArraySet.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/filter/ByteArraySet.java @@ -112,7 +112,7 @@ class ByteArraySet { * pre-computed hash of toFind * @return true if the mapping exists for this byte array; false otherwise. */ - boolean contains(final byte[] toFind, int length, int hash) { + boolean contains(byte[] toFind, int length, int hash) { return get(toFind, length, hash) != null; } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/filter/OrTreeFilter.java b/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/filter/OrTreeFilter.java index 07c6bfcfc..308ff0c96 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/filter/OrTreeFilter.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/filter/OrTreeFilter.java @@ -118,7 +118,7 @@ public abstract class OrTreeFilter extends TreeFilter { private final TreeFilter b; - Binary(final TreeFilter one, final TreeFilter two) { + Binary(TreeFilter one, TreeFilter two) { a = one; b = two; } @@ -168,7 +168,7 @@ public abstract class OrTreeFilter extends TreeFilter { private static class List extends OrTreeFilter { private final TreeFilter[] subfilters; - List(final TreeFilter[] list) { + List(TreeFilter[] list) { subfilters = list; } @@ -184,7 +184,7 @@ public abstract class OrTreeFilter extends TreeFilter { throws MissingObjectException, IncorrectObjectTypeException, IOException { int m = 1; - for (final TreeFilter f : subfilters) { + for (TreeFilter f : subfilters) { int r = f.matchFilter(walker); if (r == 0) { return 0; @@ -198,7 +198,7 @@ public abstract class OrTreeFilter extends TreeFilter { @Override public boolean shouldBeRecursive() { - for (final TreeFilter f : subfilters) + for (TreeFilter f : subfilters) if (f.shouldBeRecursive()) return true; return false; diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/filter/PathFilter.java b/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/filter/PathFilter.java index 66b3c8407..9267fb64f 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/filter/PathFilter.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/filter/PathFilter.java @@ -115,7 +115,7 @@ public class PathFilter extends TreeFilter { /** {@inheritDoc} */ @Override public boolean shouldBeRecursive() { - for (final byte b : pathRaw) + for (byte b : pathRaw) if (b == '/') return true; return false; diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/filter/PathFilterGroup.java b/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/filter/PathFilterGroup.java index 26cf8857b..5cf575080 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/filter/PathFilterGroup.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/filter/PathFilterGroup.java @@ -88,7 +88,7 @@ public class PathFilterGroup { JGitText.get().atLeastOnePathIsRequired); final PathFilter[] p = new PathFilter[paths.size()]; int i = 0; - for (final String s : paths) + for (String s : paths) p[i++] = PathFilter.create(s); return create(p); } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/util/CachedAuthenticator.java b/org.eclipse.jgit/src/org/eclipse/jgit/util/CachedAuthenticator.java index 25e9aafe1..6b58790b2 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/util/CachedAuthenticator.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/util/CachedAuthenticator.java @@ -70,7 +70,7 @@ public abstract class CachedAuthenticator extends Authenticator { protected final PasswordAuthentication getPasswordAuthentication() { final String host = getRequestingHost(); final int port = getRequestingPort(); - for (final CachedAuthentication ca : cached) { + for (CachedAuthentication ca : cached) { if (ca.host.equals(host) && ca.port == port) return ca.toPasswordAuthentication(); } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/util/FS.java b/org.eclipse.jgit/src/org/eclipse/jgit/util/FS.java index 0681a3f68..3372bbe6a 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/util/FS.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/util/FS.java @@ -470,7 +470,7 @@ public abstract class FS { if (path == null) return null; - for (final String p : path.split(File.pathSeparator)) { + for (String p : path.split(File.pathSeparator)) { for (String command : lookFor) { final File e = new File(p, command); if (e.isFile()) diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/util/LongMap.java b/org.eclipse.jgit/src/org/eclipse/jgit/util/LongMap.java index 146966dd4..8c7f67284 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/util/LongMap.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/util/LongMap.java @@ -182,7 +182,7 @@ public class LongMap { V value; Node next; - Node(final long k, final V v) { + Node(long k, V v) { key = k; value = v; } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/util/TemporaryBuffer.java b/org.eclipse.jgit/src/org/eclipse/jgit/util/TemporaryBuffer.java index 057b17785..3ed7aeb95 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/util/TemporaryBuffer.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/util/TemporaryBuffer.java @@ -238,7 +238,7 @@ public abstract class TemporaryBuffer extends OutputStream { throw new OutOfMemoryError(JGitText.get().lengthExceedsMaximumArraySize); final byte[] out = new byte[(int) len]; int outPtr = 0; - for (final Block b : blocks) { + for (Block b : blocks) { System.arraycopy(b.buffer, 0, out, outPtr, b.count); outPtr += b.count; } @@ -265,7 +265,7 @@ public abstract class TemporaryBuffer extends OutputStream { JGitText.get().lengthExceedsMaximumArraySize); final byte[] out = new byte[(int) len]; int outPtr = 0; - for (final Block b : blocks) { + for (Block b : blocks) { System.arraycopy(b.buffer, 0, out, outPtr, b.count); outPtr += b.count; } @@ -292,7 +292,7 @@ public abstract class TemporaryBuffer extends OutputStream { throws IOException { if (pm == null) pm = NullProgressMonitor.INSTANCE; - for (final Block b : blocks) { + for (Block b : blocks) { os.write(b.buffer, 0, b.count); pm.update(b.count / 1024); } @@ -373,7 +373,7 @@ public abstract class TemporaryBuffer extends OutputStream { overflow = overflow(); final Block last = blocks.remove(blocks.size() - 1); - for (final Block b : blocks) + for (Block b : blocks) overflow.write(b.buffer, 0, b.count); blocks = null; diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/util/io/InterruptTimer.java b/org.eclipse.jgit/src/org/eclipse/jgit/util/io/InterruptTimer.java index 475b0c110..b7feddda5 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/util/io/InterruptTimer.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/util/io/InterruptTimer.java @@ -145,7 +145,7 @@ public final class InterruptTimer { } static final class AlarmThread extends Thread { - AlarmThread(final String name, final AlarmState q) { + AlarmThread(String name, AlarmState q) { super(q); setName(name); setDaemon(true); @@ -161,7 +161,7 @@ public final class InterruptTimer { private static final class AutoKiller { private final AlarmState state; - AutoKiller(final AlarmState s) { + AutoKiller(AlarmState s) { state = s; } @@ -203,7 +203,7 @@ public final class InterruptTimer { } } - synchronized void begin(final int timeout) { + synchronized void begin(int timeout) { if (terminated) throw new IllegalStateException(JGitText.get().timerAlreadyTerminated); callingThread = Thread.currentThread(); From ca79b3d4af748c626d2b35d7404ef49983dfe917 Mon Sep 17 00:00:00 2001 From: Jonathan Nieder Date: Fri, 18 May 2018 09:15:30 -0700 Subject: [PATCH 09/18] Revive Repository#notifyIndexChanged() e9e150fdd24d (Store in IndexChangedEvent if it was caused by JGit itself, 2018-05-13) modified Repository#notifyIndexChanged to take a boolean argument to indicate whether the index change happened under the current process's control or externally, for use by EGit. In other words, the function signature changed from public abstract void notifyIndexChanged(); to public abstract void notifyIndexChanged(boolean internal); Callers outside JGit itself notifying a Repository about index changes are expected to be rare, so this is not very disruptive to them. In most cases they would be notifying about changes that they made themselves, so treating their notifyIndexChanged() calls as notifyIndexChanged(true) should be relatively safe. Implementors have the opposite problem: adding the new "abstract void notifyIndexChanged(boolean)" method means they are obligated to override it. Add a default implementation that calls their existing override of notifyIndexChanged() to make their migration easier. The main downside is that authors of new Repository subclasses that do not realize they need to override notifyIndexChanged would end up with a default implementation which calls notifyIndexChanged(true), in turn calling notifyIndexChanged() again and so on, resulting in StackOverflowException. Add an implementors' note to the class Javadoc to avoid this issue. A followup commit will force implementors to adapt to the new API by changing the methods to @Deprecated public final void notifyIndexChanged() { notifyIndexChanged(true); } public abstract void notifyIndexChanged(boolean internal); Change-Id: I7d014890ee19abf283ea824d9baa9044bfdde130 Signed-off-by: Jonathan Nieder --- .../src/org/eclipse/jgit/lib/Repository.java | 24 ++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/Repository.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/Repository.java index e7e2b0034..965ccb098 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/Repository.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/Repository.java @@ -112,6 +112,12 @@ import org.slf4j.LoggerFactory; *
  • {@code FileRepository} is thread-safe. *
  • {@code DfsRepository} thread-safety is determined by its subclass. * + *

    + * Note to implementors: Make sure to override + * {@link #notifyIndexChanged(boolean)} or {@link #notifyIndexChanged()}, or + * else both will throw {@code StackOverflowException}. In the next JGit minor + * release, {@link #notifyIndexChanged(boolean)} will be abstract and {@link + * #notifyIndexChanged()} will be final. */ public abstract class Repository implements AutoCloseable { private static final Logger LOG = LoggerFactory.getLogger(Repository.class); @@ -1567,15 +1573,31 @@ public abstract class Repository implements AutoCloseable { */ public abstract void scanForRepoChanges() throws IOException; + /** + * Backward compatibility synonym for {@code notifyIndexChanged(true)}. + * + * @deprecated replaced by {@link #notifyIndexChanged(boolean)} + */ + @Deprecated + public void notifyIndexChanged() { + notifyIndexChanged(true); + } + /** * Notify that the index changed by firing an IndexChangedEvent. + *

    + * The default implementation calls {@link #notifyIndexChanged()} for + * backward compatibility but will no longer do so in the next JGit minor + * release. Implementors should override this method directly instead. * * @param internal * {@code true} if the index was changed by the same * JGit process * @since 5.0 */ - public abstract void notifyIndexChanged(boolean internal); + public void notifyIndexChanged(boolean internal) { + notifyIndexChanged(); + } /** * Get a shortened more user friendly ref name From 8c580dd4c02213020d5a928df332a6641d066328 Mon Sep 17 00:00:00 2001 From: Jonathan Nieder Date: Fri, 18 May 2018 09:16:16 -0700 Subject: [PATCH 10/18] Implementors should override Repository#notifyIndexChanged(boolean) Declare Repository#notifyIndexChanged() final and Repository#notifyIndexChanged(boolean) abstract to force implementors to switch to overriding the latter method. This makes Repository less error-prone to extend since implementors no longer need to remember to override one of those two methods. Change-Id: I721db0f4a4865db3b35212ee0a2045d5b31c96af Signed-off-by: Jonathan Nieder --- .../src/org/eclipse/jgit/lib/Repository.java | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/Repository.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/Repository.java index 965ccb098..aa1f2de46 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/Repository.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/Repository.java @@ -112,12 +112,6 @@ import org.slf4j.LoggerFactory; *

  • {@code FileRepository} is thread-safe. *
  • {@code DfsRepository} thread-safety is determined by its subclass. * - *

    - * Note to implementors: Make sure to override - * {@link #notifyIndexChanged(boolean)} or {@link #notifyIndexChanged()}, or - * else both will throw {@code StackOverflowException}. In the next JGit minor - * release, {@link #notifyIndexChanged(boolean)} will be abstract and {@link - * #notifyIndexChanged()} will be final. */ public abstract class Repository implements AutoCloseable { private static final Logger LOG = LoggerFactory.getLogger(Repository.class); @@ -1579,25 +1573,19 @@ public abstract class Repository implements AutoCloseable { * @deprecated replaced by {@link #notifyIndexChanged(boolean)} */ @Deprecated - public void notifyIndexChanged() { + public final void notifyIndexChanged() { notifyIndexChanged(true); } /** * Notify that the index changed by firing an IndexChangedEvent. - *

    - * The default implementation calls {@link #notifyIndexChanged()} for - * backward compatibility but will no longer do so in the next JGit minor - * release. Implementors should override this method directly instead. * * @param internal * {@code true} if the index was changed by the same * JGit process * @since 5.0 */ - public void notifyIndexChanged(boolean internal) { - notifyIndexChanged(); - } + public abstract void notifyIndexChanged(boolean internal); /** * Get a shortened more user friendly ref name From e9d2a8bd85d700bb6f380530c53ab8f7a0415c4d Mon Sep 17 00:00:00 2001 From: Jonathan Nieder Date: Fri, 18 May 2018 09:23:03 -0700 Subject: [PATCH 11/18] Remove deprecated Repository#notifyIndexChanged It is no longer used. Change-Id: Ibf6ee80d5b6cd554295f4e657e087302770621b6 --- .../src/org/eclipse/jgit/lib/Repository.java | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/Repository.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/Repository.java index aa1f2de46..e7e2b0034 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/Repository.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/Repository.java @@ -1567,16 +1567,6 @@ public abstract class Repository implements AutoCloseable { */ public abstract void scanForRepoChanges() throws IOException; - /** - * Backward compatibility synonym for {@code notifyIndexChanged(true)}. - * - * @deprecated replaced by {@link #notifyIndexChanged(boolean)} - */ - @Deprecated - public final void notifyIndexChanged() { - notifyIndexChanged(true); - } - /** * Notify that the index changed by firing an IndexChangedEvent. * From 04560921c35380d1664e0a6cb9e645ae04ede1a9 Mon Sep 17 00:00:00 2001 From: David Pursehouse Date: Wed, 16 May 2018 12:03:02 +0900 Subject: [PATCH 12/18] RefAdvertiser: Add send(Collection) and deprecate send(Map) Bug: 534731 Change-Id: If15032a34dc62f420569e2b2b6d8e14e2dfed522 Signed-off-by: David Pursehouse --- .../eclipse/jgit/transport/RefAdvertiser.java | 33 +++++++++++++------ 1 file changed, 23 insertions(+), 10 deletions(-) diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/RefAdvertiser.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/RefAdvertiser.java index b4d780346..1bde49df2 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/RefAdvertiser.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/RefAdvertiser.java @@ -53,12 +53,12 @@ import java.nio.CharBuffer; import java.nio.charset.CharacterCodingException; import java.nio.charset.CharsetEncoder; import java.nio.charset.CoderResult; +import java.util.Collection; import java.util.HashMap; import java.util.HashSet; import java.util.LinkedHashSet; import java.util.Map; import java.util.Set; -import java.util.SortedMap; import org.eclipse.jgit.lib.AnyObjectId; import org.eclipse.jgit.lib.Constants; @@ -66,7 +66,6 @@ import org.eclipse.jgit.lib.ObjectId; import org.eclipse.jgit.lib.Ref; import org.eclipse.jgit.lib.RefComparator; import org.eclipse.jgit.lib.Repository; -import org.eclipse.jgit.util.RefMap; /** * Support for the start of {@link org.eclipse.jgit.transport.UploadPack} and @@ -287,9 +286,30 @@ public abstract class RefAdvertiser { * @throws java.io.IOException * the underlying output stream failed to write out an * advertisement record. + * @deprecated use {@link #send(Collection)} instead. */ + @Deprecated public Set send(Map refs) throws IOException { - for (Ref ref : getSortedRefs(refs)) { + return send(refs.values()); + } + + /** + * Format an advertisement for the supplied refs. + * + * @param refs + * zero or more refs to format for the client. The collection is + * sorted before display if necessary, and therefore may appear + * in any order. + * @return set of ObjectIds that were advertised to the client. + * @throws java.io.IOException + * the underlying output stream failed to write out an + * advertisement record. + * @since 5.0 + */ + public Set send(Collection refs) throws IOException { + for (Ref ref : RefComparator.sort(refs)) { + // TODO(jrn) revive the SortedMap optimization e.g. by introducing + // SortedList ObjectId objectId = ref.getObjectId(); if (objectId == null) { continue; @@ -331,13 +351,6 @@ public abstract class RefAdvertiser { return sent; } - private Iterable getSortedRefs(Map all) { - if (all instanceof RefMap - || (all instanceof SortedMap && ((SortedMap) all).comparator() == null)) - return all.values(); - return RefComparator.sort(all.values()); - } - /** * Advertise one object is available using the magic {@code .have}. *

    From a2b10e56bd0bb56bb45c9d000167258036b6d3b2 Mon Sep 17 00:00:00 2001 From: David Pursehouse Date: Wed, 16 May 2018 12:07:34 +0900 Subject: [PATCH 13/18] InfoRefsServlet: Refactor to not use deprecated methods - Replace RefDatabase#getRefs(String) with #getRefsByPrefix(String) - Replace RefAdvertiser#send(Map) with #send(Collection) Bug: 534731 Change-Id: I25b617c3b0c54793cf4ab5b62f002e17745a5377 Signed-off-by: David Pursehouse --- .../src/org/eclipse/jgit/http/server/InfoRefsServlet.java | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/InfoRefsServlet.java b/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/InfoRefsServlet.java index d7f6fbf29..0f4633b5e 100644 --- a/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/InfoRefsServlet.java +++ b/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/InfoRefsServlet.java @@ -44,18 +44,15 @@ package org.eclipse.jgit.http.server; import static org.eclipse.jgit.http.server.ServletUtils.getRepository; -import static org.eclipse.jgit.lib.RefDatabase.ALL; import java.io.IOException; import java.io.OutputStreamWriter; -import java.util.Map; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.eclipse.jgit.lib.Constants; -import org.eclipse.jgit.lib.Ref; import org.eclipse.jgit.lib.Repository; import org.eclipse.jgit.transport.RefAdvertiser; import org.eclipse.jgit.util.HttpSupport; @@ -94,10 +91,7 @@ class InfoRefsServlet extends HttpServlet { }; adv.init(db); adv.setDerefTags(true); - - Map refs = db.getRefDatabase().getRefs(ALL); - refs.remove(Constants.HEAD); - adv.send(refs); + adv.send(db.getRefDatabase().getRefsByPrefix(Constants.R_REFS)); } } } From 1da2ff7242dfc6df4d470e8519bfd8267940791a Mon Sep 17 00:00:00 2001 From: David Pursehouse Date: Tue, 22 May 2018 08:34:53 +0900 Subject: [PATCH 14/18] Repository: Deprecate getTags method Callers should use getRefDatabase().getRefsByPrefix(R_TAGS) instead. Adjust the tests accordingly. Bug: 534731 Change-Id: Ib28ae365e42720268996ff46e34cae1745ad545c Signed-off-by: David Pursehouse --- .../tst/org/eclipse/jgit/pgm/TagTest.java | 11 ++++------- .../org/eclipse/jgit/api/TagCommandTest.java | 17 +++++++++++------ .../src/org/eclipse/jgit/lib/Repository.java | 2 ++ 3 files changed, 17 insertions(+), 13 deletions(-) diff --git a/org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit/pgm/TagTest.java b/org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit/pgm/TagTest.java index 03391a0fb..d38a41dcb 100644 --- a/org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit/pgm/TagTest.java +++ b/org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit/pgm/TagTest.java @@ -43,10 +43,11 @@ package org.eclipse.jgit.pgm; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; import org.eclipse.jgit.api.Git; import org.eclipse.jgit.lib.CLIRepositoryTestCase; -import org.eclipse.jgit.lib.Ref; import org.junit.Before; import org.junit.Test; @@ -75,13 +76,9 @@ public class TagTest extends CLIRepositoryTestCase { @Test public void testTagDelete() throws Exception { git.tag().setName("test").call(); - - Ref ref = git.getRepository().getTags().get("test"); - assertEquals("refs/tags/test", ref.getName()); - + assertNotNull(git.getRepository().exactRef("refs/tags/test")); assertEquals("", executeUnchecked("git tag -d test")[0]); - Ref deletedRef = git.getRepository().getTags().get("test"); - assertEquals(null, deletedRef); + assertNull(git.getRepository().exactRef("refs/tags/test")); } @Test diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/TagCommandTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/TagCommandTest.java index 87098b65f..3b29a5bbf 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/TagCommandTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/TagCommandTest.java @@ -42,6 +42,7 @@ */ package org.eclipse.jgit.api; +import static org.eclipse.jgit.lib.Constants.R_TAGS; import static org.junit.Assert.assertEquals; import static org.junit.Assert.fail; @@ -135,26 +136,30 @@ public class TagCommandTest extends RepositoryTestCase { } } + private List getTags() throws Exception { + return db.getRefDatabase().getRefsByPrefix(R_TAGS); + } + @Test public void testDelete() throws Exception { try (Git git = new Git(db)) { git.commit().setMessage("initial commit").call(); Ref tagRef = git.tag().setName("tag").call(); - assertEquals(1, db.getTags().size()); + assertEquals(1, getTags().size()); List deleted = git.tagDelete().setTags(tagRef.getName()) .call(); assertEquals(1, deleted.size()); assertEquals(tagRef.getName(), deleted.get(0)); - assertEquals(0, db.getTags().size()); + assertEquals(0, getTags().size()); Ref tagRef1 = git.tag().setName("tag1").call(); Ref tagRef2 = git.tag().setName("tag2").call(); - assertEquals(2, db.getTags().size()); + assertEquals(2, getTags().size()); deleted = git.tagDelete().setTags(tagRef1.getName(), tagRef2.getName()) .call(); assertEquals(2, deleted.size()); - assertEquals(0, db.getTags().size()); + assertEquals(0, getTags().size()); } } @@ -163,13 +168,13 @@ public class TagCommandTest extends RepositoryTestCase { try (Git git = new Git(db)) { git.commit().setMessage("initial commit").call(); Ref tagRef = git.tag().setName("tag").call(); - assertEquals(1, db.getTags().size()); + assertEquals(1, getTags().size()); List deleted = git.tagDelete() .setTags(Repository.shortenRefName(tagRef.getName())).call(); assertEquals(1, deleted.size()); assertEquals(tagRef.getName(), deleted.get(0)); - assertEquals(0, db.getTags().size()); + assertEquals(0, getTags().size()); } } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/Repository.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/Repository.java index e7e2b0034..2d3473611 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/Repository.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/Repository.java @@ -1108,7 +1108,9 @@ public abstract class Repository implements AutoCloseable { * @return mutable map of all tags; key is short tag name ("v1.0") and value * of the entry contains the ref with the full tag name * ("refs/tags/v1.0"). + * @deprecated use {@code getRefDatabase().getRefsByPrefix(R_TAGS)} instead */ + @Deprecated @NonNull public Map getTags() { try { From d7deda98d0a18ca1e3a1fbb70acf8e7cbcf25833 Mon Sep 17 00:00:00 2001 From: Thomas Wolf Date: Tue, 27 Mar 2018 22:22:09 +0200 Subject: [PATCH 15/18] Skip ignored directories in FileTreeIterator Make FileTreeIterator not enter ignored directories by default. We only need to enter ignored directories if we do some operation against git, and there is at least one tracked file underneath an ignored directory. Walking ignored directories should be avoided as much as possible as it is a potential performance bottleneck. Some projects have a lot of files or very deep hierarchies in ignored directories; walking those may be costly (especially so on Windows). See for instance also bug 500106. Provide a FileTreeIterator.setWalkIgnoredDirectories() operation to force the iterator to iterate also through otherwise ignored directories. Useful for tests (IgnoreNodeTest, CGitIgnoreTest), or to implement things like "git ls-files --ignored". Add tests in DirCacheCheckoutTest, and amend IndexDiffTest to test a little bit more. Bug: 388582 Change-Id: I6ff584a42c55a07120a4369fd308409431bdb94a Signed-off-by: Thomas Wolf --- .../eclipse/jgit/ignore/CGitIgnoreTest.java | 4 +- .../eclipse/jgit/ignore/IgnoreNodeTest.java | 4 +- .../jgit/lib/DirCacheCheckoutTest.java | 113 ++++++++++++++++++ .../org/eclipse/jgit/lib/IndexDiffTest.java | 5 +- .../jgit/treewalk/FileTreeIterator.java | 30 ++++- .../jgit/treewalk/WorkingTreeIterator.java | 44 ++++++- 6 files changed, 195 insertions(+), 5 deletions(-) diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/ignore/CGitIgnoreTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/ignore/CGitIgnoreTest.java index 3b11616fe..0c6ed0c19 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/ignore/CGitIgnoreTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/ignore/CGitIgnoreTest.java @@ -141,7 +141,9 @@ public class CGitIgnoreTest extends RepositoryTestCase { // Do a tree walk that does descend into ignored directories and return // a list of all ignored files try (TreeWalk walk = new TreeWalk(db)) { - walk.addTree(new FileTreeIterator(db)); + FileTreeIterator iter = new FileTreeIterator(db); + iter.setWalkIgnoredDirectories(true); + walk.addTree(iter); walk.setRecursive(true); while (walk.next()) { if (walk.getTree(WorkingTreeIterator.class).isEntryIgnored()) { diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/ignore/IgnoreNodeTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/ignore/IgnoreNodeTest.java index 80595feff..78d9a82c2 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/ignore/IgnoreNodeTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/ignore/IgnoreNodeTest.java @@ -732,7 +732,9 @@ public class IgnoreNodeTest extends RepositoryTestCase { private void beginWalk() { walk = new TreeWalk(db); - walk.addTree(new FileTreeIterator(db)); + FileTreeIterator iter = new FileTreeIterator(db); + iter.setWalkIgnoredDirectories(true); + walk.addTree(iter); } private void endWalk() throws IOException { diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/DirCacheCheckoutTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/DirCacheCheckoutTest.java index 0412242eb..eb8782780 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/DirCacheCheckoutTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/DirCacheCheckoutTest.java @@ -78,8 +78,10 @@ import org.eclipse.jgit.junit.RepositoryTestCase; import org.eclipse.jgit.junit.TestRepository; import org.eclipse.jgit.junit.TestRepository.BranchBuilder; import org.eclipse.jgit.revwalk.RevCommit; +import org.eclipse.jgit.treewalk.AbstractTreeIterator; import org.eclipse.jgit.treewalk.FileTreeIterator; import org.eclipse.jgit.treewalk.TreeWalk; +import org.eclipse.jgit.treewalk.WorkingTreeIterator; import org.eclipse.jgit.util.FS; import org.eclipse.jgit.util.FileUtils; import org.junit.Assume; @@ -1904,6 +1906,117 @@ public class DirCacheCheckoutTest extends RepositoryTestCase { assertUpdated(longFileName); } + @Test + public void testIgnoredDirectory() throws Exception { + writeTrashFile(".gitignore", "src/ignored"); + writeTrashFile("src/ignored/sub/foo.txt", "1"); + try (Git git = new Git(db)) { + git.add().addFilepattern(".").call(); + RevCommit commit = git.commit().setMessage("adding .gitignore") + .call(); + writeTrashFile("foo.txt", "2"); + writeTrashFile("zzz.txt", "3"); + git.add().addFilepattern("foo.txt").call(); + git.commit().setMessage("add file").call(); + assertEquals("Should not have entered ignored directory", 1, + resetHardAndCount(commit)); + } + } + + @Test + public void testIgnoredDirectoryWithTrackedContent() throws Exception { + writeTrashFile("src/ignored/sub/foo.txt", "1"); + try (Git git = new Git(db)) { + git.add().addFilepattern(".").call(); + git.commit().setMessage("adding foo.txt").call(); + writeTrashFile(".gitignore", "src/ignored"); + writeTrashFile("src/ignored/sub/foo.txt", "2"); + writeTrashFile("src/ignored/other/bar.txt", "3"); + git.add().addFilepattern(".").call(); + RevCommit commit = git.commit().setMessage("adding .gitignore") + .call(); + writeTrashFile("foo.txt", "2"); + writeTrashFile("zzz.txt", "3"); + git.add().addFilepattern("foo.txt").call(); + git.commit().setMessage("add file").call(); + File file = writeTrashFile("src/ignored/sub/foo.txt", "3"); + assertEquals("Should have entered ignored directory", 3, + resetHardAndCount(commit)); + checkFile(file, "2"); + } + } + + @Test + public void testResetWithChangeInGitignore() throws Exception { + writeTrashFile(".gitignore", "src/ignored"); + writeTrashFile("src/ignored/sub/foo.txt", "1"); + try (Git git = new Git(db)) { + git.add().addFilepattern(".").call(); + RevCommit initial = git.commit().setMessage("initial").call(); + writeTrashFile("src/newignored/foo.txt", "2"); + writeTrashFile("src/.gitignore", "newignored"); + git.add().addFilepattern(".").call(); + RevCommit commit = git.commit().setMessage("newignored").call(); + assertEquals("Should not have entered src/newignored directory", 1, + resetHardAndCount(initial)); + assertEquals("Should have entered src/newignored directory", 2, + resetHardAndCount(commit)); + deleteTrashFile("src/.gitignore"); + git.rm().addFilepattern("src/.gitignore").call(); + RevCommit top = git.commit().setMessage("Unignore newignore") + .call(); + assertEquals("Should have entered src/newignored directory", 2, + resetHardAndCount(initial)); + assertEquals("Should have entered src/newignored directory", 2, + resetHardAndCount(commit)); + assertEquals("Should not have entered src/newignored directory", 1, + resetHardAndCount(top)); + + } + } + + private static class TestFileTreeIterator extends FileTreeIterator { + + // For assertions only + private final int[] count; + + public TestFileTreeIterator(Repository repo, int[] count) { + super(repo); + this.count = count; + } + + protected TestFileTreeIterator(final WorkingTreeIterator p, + final File root, FS fs, FileModeStrategy fileModeStrategy, + int[] count) { + super(p, root, fs, fileModeStrategy); + this.count = count; + } + + @Override + protected AbstractTreeIterator enterSubtree() { + count[0] += 1; + return new TestFileTreeIterator(this, + ((FileEntry) current()).getFile(), fs, fileModeStrategy, + count); + } + } + + private int resetHardAndCount(RevCommit commit) throws Exception { + int[] callCount = { 0 }; + DirCache cache = db.lockDirCache(); + FileTreeIterator workingTreeIterator = new TestFileTreeIterator(db, + callCount); + try { + DirCacheCheckout checkout = new DirCacheCheckout(db, null, cache, + commit.getTree().getId(), workingTreeIterator); + checkout.setFailOnConflict(false); + checkout.checkout(); + } finally { + cache.unlock(); + } + return callCount[0]; + } + public void assertWorkDir(Map i) throws CorruptObjectException, IOException { diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/IndexDiffTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/IndexDiffTest.java index 2cb8f86fc..580b08b42 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/IndexDiffTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/IndexDiffTest.java @@ -470,7 +470,8 @@ public class IndexDiffTest extends RepositoryTestCase { } /** - * Test that ignored folders aren't listed as untracked + * Test that ignored folders aren't listed as untracked, but are listed as + * ignored. * * @throws Exception */ @@ -499,6 +500,8 @@ public class IndexDiffTest extends RepositoryTestCase { diff.diff(); assertEquals(new HashSet<>(Arrays.asList("src")), diff.getUntrackedFolders()); + assertEquals(new HashSet<>(Arrays.asList("sr", "target")), + diff.getIgnoredNotInIndex()); git.add().addFilepattern("src").call(); writeTrashFile("sr/com/X1.java", ""); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/FileTreeIterator.java b/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/FileTreeIterator.java index ccd5e7091..24b9ac086 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/FileTreeIterator.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/FileTreeIterator.java @@ -52,6 +52,7 @@ import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; +import org.eclipse.jgit.dircache.DirCacheIterator; import org.eclipse.jgit.errors.IncorrectObjectTypeException; import org.eclipse.jgit.lib.Constants; import org.eclipse.jgit.lib.FileMode; @@ -67,6 +68,7 @@ import org.eclipse.jgit.util.FS; * {@link org.eclipse.jgit.treewalk.TreeWalk}. */ public class FileTreeIterator extends WorkingTreeIterator { + /** * the starting directory of this Iterator. All entries are located directly * in this directory. @@ -207,7 +209,33 @@ public class FileTreeIterator extends WorkingTreeIterator { @Override public AbstractTreeIterator createSubtreeIterator(ObjectReader reader) throws IncorrectObjectTypeException, IOException { - return new FileTreeIterator(this, ((FileEntry) current()).getFile(), fs, fileModeStrategy); + if (!walksIgnoredDirectories() && isEntryIgnored()) { + DirCacheIterator iterator = getDirCacheIterator(); + if (iterator == null) { + return new EmptyTreeIterator(this); + } + // Only enter if we have an associated DirCacheIterator that is + // at the same entry (which indicates there is some already + // tracked file underneath this directory). Otherwise the + // directory is indeed ignored and can be skipped entirely. + } + return enterSubtree(); + } + + + /** + * Create a new iterator for the current entry's subtree. + *

    + * The parent reference of the iterator must be this, otherwise + * the caller would not be able to exit out of the subtree iterator + * correctly and return to continue walking this. + * + * @return a new iterator that walks over the current subtree. + * @since 5.0 + */ + protected AbstractTreeIterator enterSubtree() { + return new FileTreeIterator(this, ((FileEntry) current()).getFile(), fs, + fileModeStrategy); } private Entry[] entries() { diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/WorkingTreeIterator.java b/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/WorkingTreeIterator.java index 10e919641..179fd4679 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/WorkingTreeIterator.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/WorkingTreeIterator.java @@ -256,6 +256,45 @@ public abstract class WorkingTreeIterator extends AbstractTreeIterator { state.dirCacheTree = treeId; } + /** + * Retrieves the {@link DirCacheIterator} at the current entry if + * {@link #setDirCacheIterator(TreeWalk, int)} was called. + * + * @return the DirCacheIterator, or {@code null} if not set or not at the + * current entry + * @since 5.0 + */ + protected DirCacheIterator getDirCacheIterator() { + if (state.dirCacheTree >= 0 && state.walk != null) { + return state.walk.getTree(state.dirCacheTree, + DirCacheIterator.class); + } + return null; + } + + /** + * Defines whether this {@link WorkingTreeIterator} walks ignored + * directories. + * + * @param includeIgnored + * {@code false} to skip ignored directories, if possible; + * {@code true} to always include them in the walk + * @since 5.0 + */ + public void setWalkIgnoredDirectories(boolean includeIgnored) { + state.walkIgnored = includeIgnored; + } + + /** + * Tells whether this {@link WorkingTreeIterator} walks ignored directories. + * + * @return {@code true} if it does, {@code false} otherwise + * @since 5.0 + */ + public boolean walksIgnoredDirectories() { + return state.walkIgnored; + } + /** {@inheritDoc} */ @Override public boolean hasId() { @@ -1365,7 +1404,10 @@ public abstract class WorkingTreeIterator extends AbstractTreeIterator { TreeWalk walk; /** Position of the matching {@link DirCacheIterator}. */ - int dirCacheTree; + int dirCacheTree = -1; + + /** Whether the iterator shall walk ignored directories. */ + boolean walkIgnored = false; final Map directoryToIgnored = new HashMap<>(); From e701c59a859e8fff46a1bc16aee7771a3a8aea8a Mon Sep 17 00:00:00 2001 From: David Pursehouse Date: Tue, 22 May 2018 09:47:16 +0900 Subject: [PATCH 16/18] Repository: Make #exactRef and #findRef final This means less cognitive overhead for both implementors and callers, since this way we can guarantee that they are always synonyms for RefDatabase#exactRef and RefDatabase#findRef, respectively. Change-Id: Ic8aeb52fc7ed65672f3f6cd1da39a66908d88baa Signed-off-by: David Pursehouse --- org.eclipse.jgit/src/org/eclipse/jgit/lib/Repository.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/Repository.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/Repository.java index 2d3473611..5fb4e4008 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/Repository.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/Repository.java @@ -1067,7 +1067,7 @@ public abstract class Repository implements AutoCloseable { * @since 4.2 */ @Nullable - public Ref exactRef(String name) throws IOException { + public final Ref exactRef(String name) throws IOException { return getRefDatabase().exactRef(name); } @@ -1083,7 +1083,7 @@ public abstract class Repository implements AutoCloseable { * @since 4.2 */ @Nullable - public Ref findRef(String name) throws IOException { + public final Ref findRef(String name) throws IOException { return getRefDatabase().getRef(name); } From f6c4a492d06e0dd345679bfba3399dabbf778f41 Mon Sep 17 00:00:00 2001 From: David Pursehouse Date: Tue, 22 May 2018 11:27:30 +0900 Subject: [PATCH 17/18] Repository: Deprecate #peel method Callers should use getRefDatabase().peel(ref) instead since it doesn't swallow the IOException. Adapt all trivial callers to user the alternative. DescribeCommand still uses the deprecated method and is not adapted in this change since it will require more refactoring to add handling of the IOException. Change-Id: I14d4a95a5e0570548753b9fc5c03d024dc3ff832 Signed-off-by: David Pursehouse --- .../src/org/eclipse/jgit/pgm/debug/RebuildRefTree.java | 2 +- .../tst/org/eclipse/jgit/api/LogCommandTest.java | 2 +- .../tst/org/eclipse/jgit/api/TagCommandTest.java | 9 ++++++--- .../tst/org/eclipse/jgit/gitrepo/RepoCommandTest.java | 2 +- .../src/org/eclipse/jgit/api/LogCommand.java | 2 +- .../src/org/eclipse/jgit/api/MergeCommand.java | 2 +- .../src/org/eclipse/jgit/lib/Repository.java | 2 ++ .../src/org/eclipse/jgit/transport/RefAdvertiser.java | 4 ++-- .../src/org/eclipse/jgit/transport/UploadPack.java | 2 +- 9 files changed, 16 insertions(+), 11 deletions(-) diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/RebuildRefTree.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/RebuildRefTree.java index 86092b27a..063600f4e 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/RebuildRefTree.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/RebuildRefTree.java @@ -161,7 +161,7 @@ class RebuildRefTree extends TextBuiltin { } cmds.add(new org.eclipse.jgit.internal.storage.reftree.Command( null, - db.peel(r))); + db.getRefDatabase().peel(r))); } tree.apply(cmds); return tree; diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/LogCommandTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/LogCommandTest.java index bd0efad01..4ef511e43 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/LogCommandTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/LogCommandTest.java @@ -116,7 +116,7 @@ public class LogCommandTest extends RepositoryTestCase { Iterator log = git.log().all().call().iterator(); assertTrue(log.hasNext()); RevCommit commit = log.next(); - tag = db.peel(tag); + tag = db.getRefDatabase().peel(tag); assertEquals(commit.getName(), tag.getPeeledObjectId().getName()); assertTrue(commits.contains(commit)); diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/TagCommandTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/TagCommandTest.java index 3b29a5bbf..a220e77e0 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/TagCommandTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/TagCommandTest.java @@ -67,19 +67,22 @@ public class TagCommandTest extends RepositoryTestCase { RevWalk walk = new RevWalk(db)) { RevCommit commit = git.commit().setMessage("initial commit").call(); Ref tagRef = git.tag().setName("tag").call(); - assertEquals(commit.getId(), db.peel(tagRef).getPeeledObjectId()); + assertEquals(commit.getId(), + db.getRefDatabase().peel(tagRef).getPeeledObjectId()); assertEquals("tag", walk.parseTag(tagRef.getObjectId()).getTagName()); } } @Test - public void testTagging() throws GitAPIException, JGitInternalException { + public void testTagging() + throws GitAPIException, JGitInternalException, IOException { try (Git git = new Git(db)) { git.commit().setMessage("initial commit").call(); RevCommit commit = git.commit().setMessage("second commit").call(); git.commit().setMessage("third commit").call(); Ref tagRef = git.tag().setObjectId(commit).setName("tag").call(); - assertEquals(commit.getId(), db.peel(tagRef).getPeeledObjectId()); + assertEquals(commit.getId(), + db.getRefDatabase().peel(tagRef).getPeeledObjectId()); } } diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/gitrepo/RepoCommandTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/gitrepo/RepoCommandTest.java index fa45214f0..df31ab086 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/gitrepo/RepoCommandTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/gitrepo/RepoCommandTest.java @@ -160,7 +160,7 @@ public class RepoCommandTest extends RepositoryTestCase { Ref ref = r.findRef(refname); if (ref == null) return null; - ref = r.peel(ref); + ref = r.getRefDatabase().peel(ref); ObjectId id = ref.getObjectId(); return id; } catch (IOException e) { diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/LogCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/LogCommand.java index cdf8cdd8d..cf3d35fe8 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/api/LogCommand.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/LogCommand.java @@ -274,7 +274,7 @@ public class LogCommand extends GitCommand> { public LogCommand all() throws IOException { for (Ref ref : getRepository().getRefDatabase().getRefs()) { if(!ref.isPeeled()) - ref = getRepository().peel(ref); + ref = getRepository().getRefDatabase().peel(ref); ObjectId objectId = ref.getPeeledObjectId(); if (objectId == null) diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/MergeCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/MergeCommand.java index c8a9049e6..b8fa74de7 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/api/MergeCommand.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/MergeCommand.java @@ -255,7 +255,7 @@ public class MergeCommand extends GitCommand { refLogMessage.append(ref.getName()); // handle annotated tags - ref = repo.peel(ref); + ref = repo.getRefDatabase().peel(ref); ObjectId objectId = ref.getPeeledObjectId(); if (objectId == null) objectId = ref.getObjectId(); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/Repository.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/Repository.java index 5fb4e4008..fa283d012 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/Repository.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/Repository.java @@ -1133,7 +1133,9 @@ public abstract class Repository implements AutoCloseable { * new Ref object representing the same data as Ref, but isPeeled() * will be true and getPeeledObjectId will contain the peeled object * (or null). + * @deprecated use {@code getRefDatabase().peel(ref)} instead. */ + @Deprecated @NonNull public Ref peel(Ref ref) { try { diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/RefAdvertiser.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/RefAdvertiser.java index 1bde49df2..dc1871b72 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/RefAdvertiser.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/RefAdvertiser.java @@ -322,7 +322,7 @@ public abstract class RefAdvertiser { String peelPart = ""; //$NON-NLS-1$ if (derefTags) { if (!ref.isPeeled() && repository != null) { - ref = repository.peel(ref); + ref = repository.getRefDatabase().peel(ref); } ObjectId peeledObjectId = ref.getPeeledObjectId(); if (peeledObjectId != null) { @@ -342,7 +342,7 @@ public abstract class RefAdvertiser { if (!ref.isPeeled()) { if (repository == null) continue; - ref = repository.peel(ref); + ref = repository.getRefDatabase().peel(ref); } if (ref.getPeeledObjectId() != null) diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPack.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPack.java index 3d4d279a5..82e6e62f0 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPack.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPack.java @@ -1932,7 +1932,7 @@ public class UploadPack { } if (!ref.isPeeled()) - ref = db.peel(ref); + ref = db.getRefDatabase().peel(ref); ObjectId peeledId = ref.getPeeledObjectId(); objectId = ref.getObjectId(); From 51599ebb84f3544df5b618dcce1995a569ce412c Mon Sep 17 00:00:00 2001 From: David Pursehouse Date: Tue, 22 May 2018 12:08:08 +0900 Subject: [PATCH 18/18] DescribeCommand: Refactor to not use deprecated Repository#peel Change-Id: I76073ad62d1bc4fc21d8a1f5fc7eb92060a73baa Signed-off-by: David Pursehouse --- .../src/org/eclipse/jgit/api/DescribeCommand.java | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/DescribeCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/DescribeCommand.java index 7f1ed8c14..dc605a91e 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/api/DescribeCommand.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/DescribeCommand.java @@ -224,12 +224,16 @@ public class DescribeCommand extends GitCommand { } } - private ObjectId getObjectIdFromRef(Ref r) { - ObjectId key = repo.peel(r).getPeeledObjectId(); - if (key == null) { - key = r.getObjectId(); + private ObjectId getObjectIdFromRef(Ref r) throws JGitInternalException { + try { + ObjectId key = repo.getRefDatabase().peel(r).getPeeledObjectId(); + if (key == null) { + key = r.getObjectId(); + } + return key; + } catch (IOException e) { + throw new JGitInternalException(e.getMessage(), e); } - return key; } /**