diff options
author | Thomas Wolf <thomas.wolf@paranor.ch> | 2021-09-30 09:31:12 +0200 |
---|---|---|
committer | Thomas Wolf <thomas.wolf@paranor.ch> | 2021-09-30 09:31:12 +0200 |
commit | bdba9edd5f1212aee33a5bb713c27b80a72617cb (patch) | |
tree | 6ea092d9b6912d269d488218e917d7e4704efede | |
parent | 3d86d3e810d3c851d798259209eebfdcd0367516 (diff) | |
download | jgit-bdba9edd5f1212aee33a5bb713c27b80a72617cb.tar.gz jgit-bdba9edd5f1212aee33a5bb713c27b80a72617cb.zip |
Remove redundant type arguments
In Java 11 type arguments for anonymous subclasses can be inferred
and don't need to be specified. This resolves a number of compiler
warnings.
Change-Id: I55eff3babb7628aa0627085e65a1b45eb12c2cd3
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
28 files changed, 40 insertions, 31 deletions
diff --git a/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/glue/MetaFilter.java b/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/glue/MetaFilter.java index f53c8aecbf..772b996616 100644 --- a/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/glue/MetaFilter.java +++ b/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/glue/MetaFilter.java @@ -116,7 +116,8 @@ public class MetaFilter implements Filter { private static Set<Object> newIdentitySet() { final Map<Object, Object> m = new IdentityHashMap<>(); - return new AbstractSet<Object>() { + return new AbstractSet<>() { + @Override public boolean add(Object o) { return m.put(o, o) == null; diff --git a/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/glue/NoParameterFilterConfig.java b/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/glue/NoParameterFilterConfig.java index 91e9f02a65..ebe272885b 100644 --- a/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/glue/NoParameterFilterConfig.java +++ b/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/glue/NoParameterFilterConfig.java @@ -35,7 +35,8 @@ final class NoParameterFilterConfig implements FilterConfig { /** {@inheritDoc} */ @Override public Enumeration<String> getInitParameterNames() { - return new Enumeration<String>() { + return new Enumeration<>() { + @Override public boolean hasMoreElements() { return false; 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 37fc0283e4..7c5170d0f5 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 @@ -95,7 +95,8 @@ abstract class UrlPipeline { @Override public Enumeration<String> getInitParameterNames() { - return new Enumeration<String>() { + return new Enumeration<>() { + @Override public boolean hasMoreElements() { return false; diff --git a/org.eclipse.jgit.junit.http/src/org/eclipse/jgit/junit/http/MockServletConfig.java b/org.eclipse.jgit.junit.http/src/org/eclipse/jgit/junit/http/MockServletConfig.java index f2af67d273..715fd19451 100644 --- a/org.eclipse.jgit.junit.http/src/org/eclipse/jgit/junit/http/MockServletConfig.java +++ b/org.eclipse.jgit.junit.http/src/org/eclipse/jgit/junit/http/MockServletConfig.java @@ -44,7 +44,8 @@ public class MockServletConfig implements ServletConfig { @Override public Enumeration<String> getInitParameterNames() { final Iterator<String> i = parameters.keySet().iterator(); - return new Enumeration<String>() { + return new Enumeration<>() { + @Override public boolean hasMoreElements() { return i.hasNext(); diff --git a/org.eclipse.jgit.ssh.apache/src/org/eclipse/jgit/internal/transport/sshd/JGitSshClient.java b/org.eclipse.jgit.ssh.apache/src/org/eclipse/jgit/internal/transport/sshd/JGitSshClient.java index ae12c2028d..32819aea21 100644 --- a/org.eclipse.jgit.ssh.apache/src/org/eclipse/jgit/internal/transport/sshd/JGitSshClient.java +++ b/org.eclipse.jgit.ssh.apache/src/org/eclipse/jgit/internal/transport/sshd/JGitSshClient.java @@ -223,7 +223,7 @@ public class JGitSshClient extends SshClient { private SshFutureListener<IoConnectFuture> createConnectCompletionListener( ConnectFuture connectFuture, String username, InetSocketAddress address, HostConfigEntry hostConfig) { - return new SshFutureListener<IoConnectFuture>() { + return new SshFutureListener<>() { @Override public void operationComplete(IoConnectFuture future) { @@ -406,7 +406,7 @@ public class JGitSshClient extends SshClient { @Override public Iterable<KeyPair> loadKeys(SessionContext context) { - return () -> new Iterator<KeyPair>() { + return () -> new Iterator<>() { private Iterator<KeyIdentityProvider> factories = providers .iterator(); diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/diff/HistogramDiffTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/diff/HistogramDiffTest.java index 0256848e1d..3e288673ff 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/diff/HistogramDiffTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/diff/HistogramDiffTest.java @@ -61,7 +61,8 @@ public class HistogramDiffTest extends AbstractDiffTestCase { hd.setFallbackAlgorithm(null); hd.setMaxChainLength(3); - SequenceComparator<RawText> cmp = new SequenceComparator<RawText>() { + SequenceComparator<RawText> cmp = new SequenceComparator<>() { + @Override public boolean equals(RawText a, int ai, RawText b, int bi) { return RawTextComparator.DEFAULT.equals(a, ai, b, bi); 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 6a9fbd4f63..1e524fadab 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/api/DescribeCommand.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/DescribeCommand.java @@ -235,7 +235,7 @@ public class DescribeCommand extends GitCommand<String> { return this; } - private final Comparator<Ref> TAG_TIE_BREAKER = new Comparator<Ref>() { + private final Comparator<Ref> TAG_TIE_BREAKER = new Comparator<>() { @Override public int compare(Ref o1, Ref o2) { diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/diff/RenameDetector.java b/org.eclipse.jgit/src/org/eclipse/jgit/diff/RenameDetector.java index ba1f63b680..225921ecc1 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/diff/RenameDetector.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/diff/RenameDetector.java @@ -40,7 +40,8 @@ import org.eclipse.jgit.lib.Repository; public class RenameDetector { private static final int EXACT_RENAME_SCORE = 100; - private static final Comparator<DiffEntry> DIFF_COMPARATOR = new Comparator<DiffEntry>() { + private static final Comparator<DiffEntry> DIFF_COMPARATOR = new Comparator<>() { + @Override public int compare(DiffEntry a, DiffEntry b) { int cmp = nameOf(a).compareTo(nameOf(b)); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsReader.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsReader.java index e8018031a1..d043b05fb9 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsReader.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsReader.java @@ -371,7 +371,7 @@ public class DfsReader extends ObjectReader implements ObjectReuseAsIs { final Iterator<FoundObject<T>> idItr = order.iterator(); final IOException findAllError = error; - return new AsyncObjectLoaderQueue<T>() { + return new AsyncObjectLoaderQueue<>() { private FoundObject<T> cur; @Override @@ -431,7 +431,7 @@ public class DfsReader extends ObjectReader implements ObjectReuseAsIs { final Iterator<FoundObject<T>> idItr = order.iterator(); final IOException findAllError = error; - return new AsyncObjectSizeQueue<T>() { + return new AsyncObjectSizeQueue<>() { private FoundObject<T> cur; private long sz; diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/BitmapIndexImpl.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/BitmapIndexImpl.java index 0d3a2b4f12..9aa14171c7 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/BitmapIndexImpl.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/BitmapIndexImpl.java @@ -325,7 +325,7 @@ public class BitmapIndexImpl implements BitmapIndex { final IntIterator trees = ofObjectType(Constants.OBJ_TREE); final IntIterator blobs = ofObjectType(Constants.OBJ_BLOB); final IntIterator tags = ofObjectType(Constants.OBJ_TAG); - return new Iterator<BitmapObject>() { + return new Iterator<>() { private final BitmapObjectImpl out = new BitmapObjectImpl(); private int type; private IntIterator cached = dynamic; diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackBitmapIndexRemapper.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackBitmapIndexRemapper.java index dd5d03c6e9..e1b6f780c7 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackBitmapIndexRemapper.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackBitmapIndexRemapper.java @@ -111,7 +111,7 @@ public class PackBitmapIndexRemapper extends PackBitmapIndex return Collections.<Entry> emptyList().iterator(); final Iterator<StoredBitmap> it = oldPackIndex.getBitmaps().iterator(); - return new Iterator<Entry>() { + return new Iterator<>() { private Entry entry; @Override 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 61f92d2e16..59aa5c908e 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 @@ -144,7 +144,7 @@ public class PackWriter implements AutoCloseable { private static final Map<WeakReference<PackWriter>, Boolean> instances = new ConcurrentHashMap<>(); - private static final Iterable<PackWriter> instancesIterable = () -> new Iterator<PackWriter>() { + private static final Iterable<PackWriter> instancesIterable = () -> new Iterator<>() { private final Iterator<WeakReference<PackWriter>> it = instances .keySet().iterator(); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriterBitmapPreparer.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriterBitmapPreparer.java index f1ede2acff..771d574bd4 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriterBitmapPreparer.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriterBitmapPreparer.java @@ -518,7 +518,7 @@ class PackWriterBitmapPreparer { public Iterator<RevCommit> iterator() { // Member variables referenced by this iterator will have synthetic // accessors generated for them if they are made private. - return new Iterator<RevCommit>() { + return new Iterator<>() { int pos = newCommitStartPos; @Override diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/ConfigSnapshot.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/ConfigSnapshot.java index 303ddf6d52..3eac44a695 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/ConfigSnapshot.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/ConfigSnapshot.java @@ -253,7 +253,8 @@ class ConfigSnapshot { @Override public Iterator<String> iterator() { final Iterator<String> i = names.values().iterator(); - return new Iterator<String>() { + return new Iterator<>() { + @Override public boolean hasNext() { return i.hasNext(); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectIdOwnerMap.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectIdOwnerMap.java index ad529559ad..29039097f1 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectIdOwnerMap.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectIdOwnerMap.java @@ -202,7 +202,7 @@ public class ObjectIdOwnerMap<V extends ObjectIdOwnerMap.Entry> /** {@inheritDoc} */ @Override public Iterator<V> iterator() { - return new Iterator<V>() { + return new Iterator<>() { private int found; private int dirIdx; private int tblIdx; diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectIdSubclassMap.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectIdSubclassMap.java index 66b279a0af..0e015b658b 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectIdSubclassMap.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectIdSubclassMap.java @@ -165,7 +165,7 @@ public class ObjectIdSubclassMap<V extends ObjectId> /** {@inheritDoc} */ @Override public Iterator<V> iterator() { - return new Iterator<V>() { + return new Iterator<>() { private int found; private int i; diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectReader.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectReader.java index 718ed89142..a2c7381ce7 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectReader.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectReader.java @@ -261,7 +261,7 @@ public abstract class ObjectReader implements AutoCloseable { public <T extends ObjectId> AsyncObjectLoaderQueue<T> open( Iterable<T> objectIds, final boolean reportMissing) { final Iterator<T> idItr = objectIds.iterator(); - return new AsyncObjectLoaderQueue<T>() { + return new AsyncObjectLoaderQueue<>() { private T cur; @Override @@ -347,7 +347,7 @@ public abstract class ObjectReader implements AutoCloseable { public <T extends ObjectId> AsyncObjectSizeQueue<T> getObjectSize( Iterable<T> objectIds, final boolean reportMissing) { final Iterator<T> idItr = objectIds.iterator(); - return new AsyncObjectSizeQueue<T>() { + return new AsyncObjectSizeQueue<>() { private T cur; private long sz; diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/merge/MergeResult.java b/org.eclipse.jgit/src/org/eclipse/jgit/merge/MergeResult.java index 062a5a84e0..20fc3c339c 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/merge/MergeResult.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/merge/MergeResult.java @@ -100,7 +100,7 @@ public class MergeResult<S extends Sequence> implements Iterable<MergeChunk> { /** {@inheritDoc} */ @Override public Iterator<MergeChunk> iterator() { - return new Iterator<MergeChunk>() { + return new Iterator<>() { int idx; @Override diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/notes/FanoutBucket.java b/org.eclipse.jgit/src/org/eclipse/jgit/notes/FanoutBucket.java index 5ea511c545..493bcfbbed 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/notes/FanoutBucket.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/notes/FanoutBucket.java @@ -102,7 +102,7 @@ class FanoutBucket extends InMemoryNoteBucket { final MutableObjectId id = new MutableObjectId(); id.fromObjectId(objId); - return new Iterator<Note>() { + return new Iterator<>() { private int cell; private Iterator<Note> itr; diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/notes/LeafBucket.java b/org.eclipse.jgit/src/org/eclipse/jgit/notes/LeafBucket.java index 494045bf44..461adac5b2 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/notes/LeafBucket.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/notes/LeafBucket.java @@ -86,7 +86,7 @@ class LeafBucket extends InMemoryNoteBucket { @Override Iterator<Note> iterator(AnyObjectId objId, ObjectReader reader) { - return new Iterator<Note>() { + return new Iterator<>() { private int idx; @Override diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RevFlagSet.java b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RevFlagSet.java index 71cc9a4850..6a98249892 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RevFlagSet.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RevFlagSet.java @@ -104,7 +104,7 @@ public class RevFlagSet extends AbstractSet<RevFlag> { @Override public Iterator<RevFlag> iterator() { final Iterator<RevFlag> i = active.iterator(); - return new Iterator<RevFlag>() { + return new Iterator<>() { private RevFlag current; @Override 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 d5b3643af9..c06ca0bc16 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RevWalk.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RevWalk.java @@ -1552,7 +1552,7 @@ public class RevWalk implements Iterable<RevCommit>, AutoCloseable { public Iterator<RevCommit> iterator() { RevCommit first = nextForIterator(); - return new Iterator<RevCommit>() { + return new Iterator<>() { RevCommit next = first; @Override diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/NetRC.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/NetRC.java index 7dd019ba27..99937f6ff1 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/NetRC.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/NetRC.java @@ -131,7 +131,7 @@ public class NetRC { private Map<String, NetRCEntry> hosts = new HashMap<>(); - private static final TreeMap<String, State> STATE = new TreeMap<String, NetRC.State>() { + private static final TreeMap<String, State> STATE = new TreeMap<>() { private static final long serialVersionUID = -4285910831814853334L; { put("machine", State.MACHINE); //$NON-NLS-1$ 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 68c5b348ad..ed33eaed07 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/PacketLineIn.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/PacketLineIn.java @@ -388,7 +388,8 @@ public class PacketLineIn { @Override public Iterator<String> iterator() { - return new Iterator<String>() { + return new Iterator<>() { + @Override public boolean hasNext() { return !PacketLineIn.isEnd(current); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/TestProtocol.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/TestProtocol.java index c6ecb3a79f..1985b66d87 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/TestProtocol.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/TestProtocol.java @@ -158,7 +158,7 @@ public class TestProtocol<C> extends TransportProtocol { public FetchConnection openFetch() throws NotSupportedException, TransportException { handle.remote.incrementOpen(); - return new InternalFetchConnection<C>(this, uploadPackFactory, + return new InternalFetchConnection<>(this, uploadPackFactory, handle.req, handle.remote) { @Override FetchConfig getFetchConfig() { diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/util/GitDateParser.java b/org.eclipse.jgit/src/org/eclipse/jgit/util/GitDateParser.java index 0a1a90a8dd..6a4b39652a 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/util/GitDateParser.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/util/GitDateParser.java @@ -40,7 +40,7 @@ public class GitDateParser { // be cached. Since they are also not threadsafe they are cached using // ThreadLocal. private static ThreadLocal<Map<Locale, Map<ParseableSimpleDateFormat, SimpleDateFormat>>> formatCache = - new ThreadLocal<Map<Locale, Map<ParseableSimpleDateFormat, SimpleDateFormat>>>() { + new ThreadLocal<>() { @Override protected Map<Locale, Map<ParseableSimpleDateFormat, SimpleDateFormat>> initialValue() { diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/util/RefList.java b/org.eclipse.jgit/src/org/eclipse/jgit/util/RefList.java index 6bf8583411..462bab081a 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/util/RefList.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/util/RefList.java @@ -73,7 +73,7 @@ public class RefList<T extends Ref> implements Iterable<Ref> { /** {@inheritDoc} */ @Override public Iterator<Ref> iterator() { - return new Iterator<Ref>() { + return new Iterator<>() { private int idx; @Override diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/util/RefMap.java b/org.eclipse.jgit/src/org/eclipse/jgit/util/RefMap.java index fac63b8c72..c68a76cef4 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/util/RefMap.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/util/RefMap.java @@ -199,7 +199,8 @@ public class RefMap extends AbstractMap<String, Ref> { @Override public Set<Entry<String, Ref>> entrySet() { if (entrySet == null) { - entrySet = new AbstractSet<Entry<String, Ref>>() { + entrySet = new AbstractSet<>() { + @Override public Iterator<Entry<String, Ref>> iterator() { return new SetIterator(); |