diff options
author | Simon Brandhof <simon.brandhof@sonarsource.com> | 2014-10-10 00:01:22 +0200 |
---|---|---|
committer | Simon Brandhof <simon.brandhof@sonarsource.com> | 2014-10-10 00:01:23 +0200 |
commit | 736c775bfc2cde38a53e4d43f858d3a3b6728c34 (patch) | |
tree | caee18e0a6007e19e8ee81d64a2b1e8dfe17a847 /sonar-duplications/src/main/java | |
parent | 7d562d641868532e5edbd6f03fac739eff9bcc90 (diff) | |
download | sonarqube-736c775bfc2cde38a53e4d43f858d3a3b6728c34.tar.gz sonarqube-736c775bfc2cde38a53e4d43f858d3a3b6728c34.zip |
Add missing @Override annotations
Diffstat (limited to 'sonar-duplications/src/main/java')
15 files changed, 33 insertions, 0 deletions
diff --git a/sonar-duplications/src/main/java/net/sourceforge/pmd/cpd/TokenEntry.java b/sonar-duplications/src/main/java/net/sourceforge/pmd/cpd/TokenEntry.java index 69d1da87ce9..5a45dcf2623 100644 --- a/sonar-duplications/src/main/java/net/sourceforge/pmd/cpd/TokenEntry.java +++ b/sonar-duplications/src/main/java/net/sourceforge/pmd/cpd/TokenEntry.java @@ -132,6 +132,7 @@ public class TokenEntry implements Comparable<TokenEntry> { return other.hashCode == hashCode; } + @Override public int compareTo(TokenEntry other) { return getIndex() - other.getIndex(); } diff --git a/sonar-duplications/src/main/java/org/sonar/duplications/DuplicationPredicates.java b/sonar-duplications/src/main/java/org/sonar/duplications/DuplicationPredicates.java index 92afd9358a9..e45e6b48840 100644 --- a/sonar-duplications/src/main/java/org/sonar/duplications/DuplicationPredicates.java +++ b/sonar-duplications/src/main/java/org/sonar/duplications/DuplicationPredicates.java @@ -42,6 +42,7 @@ public final class DuplicationPredicates { this.min = min; } + @Override public boolean apply(@Nullable CloneGroup input) { return input != null && input.getLengthInUnits() >= min; } diff --git a/sonar-duplications/src/main/java/org/sonar/duplications/block/Block.java b/sonar-duplications/src/main/java/org/sonar/duplications/block/Block.java index 5525fd94966..349ada7dd16 100644 --- a/sonar-duplications/src/main/java/org/sonar/duplications/block/Block.java +++ b/sonar-duplications/src/main/java/org/sonar/duplications/block/Block.java @@ -129,10 +129,12 @@ public final class Block implements CodeFragment { return indexInFile; } + @Override public int getStartLine() { return startLine; } + @Override public int getEndLine() { return endLine; } diff --git a/sonar-duplications/src/main/java/org/sonar/duplications/detector/ContainsInComparator.java b/sonar-duplications/src/main/java/org/sonar/duplications/detector/ContainsInComparator.java index fd69c4ed1c2..9d93f9f0958 100644 --- a/sonar-duplications/src/main/java/org/sonar/duplications/detector/ContainsInComparator.java +++ b/sonar-duplications/src/main/java/org/sonar/duplications/detector/ContainsInComparator.java @@ -35,6 +35,7 @@ public final class ContainsInComparator implements Comparator<ClonePart> { * Defines order by resourceId. */ public static final Comparator<ClonePart> RESOURCE_ID_COMPARATOR = new Comparator<ClonePart>() { + @Override public int compare(ClonePart o1, ClonePart o2) { return FastStringComparator.INSTANCE.compare(o1.getResourceId(), o2.getResourceId()); } @@ -44,6 +45,7 @@ public final class ContainsInComparator implements Comparator<ClonePart> { * Defines order by resourceId and by unitStart. */ public static final Comparator<ClonePart> CLONEPART_COMPARATOR = new Comparator<ClonePart>() { + @Override public int compare(ClonePart o1, ClonePart o2) { int c = RESOURCE_ID_COMPARATOR.compare(o1, o2); if (c == 0) { @@ -71,6 +73,7 @@ public final class ContainsInComparator implements Comparator<ClonePart> { * 1 if resourceId of part1 is greater than resourceId of part2 or if unitStart of part1 is greater than unitStart of part2, * -1 in all other cases */ + @Override public int compare(ClonePart part1, ClonePart part2) { int c = RESOURCE_ID_COMPARATOR.compare(part1, part2); if (c == 0) { diff --git a/sonar-duplications/src/main/java/org/sonar/duplications/detector/original/BlocksGroup.java b/sonar-duplications/src/main/java/org/sonar/duplications/detector/original/BlocksGroup.java index 4e896b5e689..6cdd4c0cbcf 100644 --- a/sonar-duplications/src/main/java/org/sonar/duplications/detector/original/BlocksGroup.java +++ b/sonar-duplications/src/main/java/org/sonar/duplications/detector/original/BlocksGroup.java @@ -205,6 +205,7 @@ final class BlocksGroup { public static final BlockComparator INSTANCE = new BlockComparator(); + @Override public int compare(Block b1, Block b2) { int c = RESOURCE_ID_COMPARATOR.compare(b1.getResourceId(), b2.getResourceId()); if (c == 0) { diff --git a/sonar-duplications/src/main/java/org/sonar/duplications/detector/suffixtree/AbstractText.java b/sonar-duplications/src/main/java/org/sonar/duplications/detector/suffixtree/AbstractText.java index 9dbfe1e179e..0a13ccf1b29 100644 --- a/sonar-duplications/src/main/java/org/sonar/duplications/detector/suffixtree/AbstractText.java +++ b/sonar-duplications/src/main/java/org/sonar/duplications/detector/suffixtree/AbstractText.java @@ -34,14 +34,17 @@ public abstract class AbstractText implements Text { this.symbols = symbols; } + @Override public int length() { return symbols.size(); } + @Override public Object symbolAt(int index) { return symbols.get(index); } + @Override public List<Object> sequence(int fromIndex, int toIndex) { return symbols.subList(fromIndex, toIndex); } diff --git a/sonar-duplications/src/main/java/org/sonar/duplications/detector/suffixtree/Search.java b/sonar-duplications/src/main/java/org/sonar/duplications/detector/suffixtree/Search.java index 7d8a3a9877b..f010b4dbf01 100644 --- a/sonar-duplications/src/main/java/org/sonar/duplications/detector/suffixtree/Search.java +++ b/sonar-duplications/src/main/java/org/sonar/duplications/detector/suffixtree/Search.java @@ -54,6 +54,7 @@ public final class Search { } private static final Comparator<Node> DEPTH_COMPARATOR = new Comparator<Node>() { + @Override public int compare(Node o1, Node o2) { return o2.depth - o1.depth; } diff --git a/sonar-duplications/src/main/java/org/sonar/duplications/detector/suffixtree/SuffixTreeCloneDetectionAlgorithm.java b/sonar-duplications/src/main/java/org/sonar/duplications/detector/suffixtree/SuffixTreeCloneDetectionAlgorithm.java index b9a28041bd6..e95bb043b1a 100644 --- a/sonar-duplications/src/main/java/org/sonar/duplications/detector/suffixtree/SuffixTreeCloneDetectionAlgorithm.java +++ b/sonar-duplications/src/main/java/org/sonar/duplications/detector/suffixtree/SuffixTreeCloneDetectionAlgorithm.java @@ -108,6 +108,7 @@ public final class SuffixTreeCloneDetectionAlgorithm { } private static final Comparator<Block> BLOCK_COMPARATOR = new Comparator<Block>() { + @Override public int compare(Block o1, Block o2) { return o1.getIndexInFile() - o2.getIndexInFile(); } diff --git a/sonar-duplications/src/main/java/org/sonar/duplications/index/ClonePart.java b/sonar-duplications/src/main/java/org/sonar/duplications/index/ClonePart.java index 3b68f4b8381..6a569e27eae 100644 --- a/sonar-duplications/src/main/java/org/sonar/duplications/index/ClonePart.java +++ b/sonar-duplications/src/main/java/org/sonar/duplications/index/ClonePart.java @@ -48,10 +48,12 @@ public class ClonePart implements CodeFragment { return startUnit; } + @Override public int getStartLine() { return startLine; } + @Override public int getEndLine() { return endLine; } diff --git a/sonar-duplications/src/main/java/org/sonar/duplications/index/MemoryCloneIndex.java b/sonar-duplications/src/main/java/org/sonar/duplications/index/MemoryCloneIndex.java index 1cfc724c1b0..393a8e7d1dd 100644 --- a/sonar-duplications/src/main/java/org/sonar/duplications/index/MemoryCloneIndex.java +++ b/sonar-duplications/src/main/java/org/sonar/duplications/index/MemoryCloneIndex.java @@ -31,14 +31,17 @@ public class MemoryCloneIndex implements CloneIndex { private Multimap<String, Block> byResource = ArrayListMultimap.create(); private Multimap<ByteArray, Block> byHash = ArrayListMultimap.create(); + @Override public Collection<Block> getByResourceId(String resourceId) { return byResource.get(resourceId); } + @Override public Collection<Block> getBySequenceHash(ByteArray sequenceHash) { return byHash.get(sequenceHash); } + @Override public void insert(Block block) { byResource.put(block.getResourceId(), block); byHash.put(block.getBlockHash(), block); diff --git a/sonar-duplications/src/main/java/org/sonar/duplications/index/PackedMemoryCloneIndex.java b/sonar-duplications/src/main/java/org/sonar/duplications/index/PackedMemoryCloneIndex.java index ed080415de8..21a0f890ab0 100644 --- a/sonar-duplications/src/main/java/org/sonar/duplications/index/PackedMemoryCloneIndex.java +++ b/sonar-duplications/src/main/java/org/sonar/duplications/index/PackedMemoryCloneIndex.java @@ -92,6 +92,7 @@ public class PackedMemoryCloneIndex extends AbstractCloneIndex { * <strong>Note that this implementation does not guarantee that blocks would be sorted by index.</strong> * </p> */ + @Override public Collection<Block> getByResourceId(String resourceId) { ensureSorted(); @@ -134,6 +135,7 @@ public class PackedMemoryCloneIndex extends AbstractCloneIndex { /** * {@inheritDoc} */ + @Override public Collection<Block> getBySequenceHash(ByteArray sequenceHash) { ensureSorted(); @@ -179,6 +181,7 @@ public class PackedMemoryCloneIndex extends AbstractCloneIndex { * <strong>Note that this implementation allows insertion of two blocks with same index for one resource.</strong> * </p> */ + @Override public void insert(Block block) { sorted = false; ensureCapacity(); @@ -257,6 +260,7 @@ public class PackedMemoryCloneIndex extends AbstractCloneIndex { } private final DataUtils.Sortable byBlockHash = new DataUtils.Sortable() { + @Override public void swap(int i, int j) { String tmp = resourceIds[i]; resourceIds[i] = resourceIds[j]; @@ -271,28 +275,33 @@ public class PackedMemoryCloneIndex extends AbstractCloneIndex { } } + @Override public boolean isLess(int i, int j) { return isLessByHash(i, j); } + @Override public int size() { return size; } }; private final DataUtils.Sortable byResourceId = new DataUtils.Sortable() { + @Override public void swap(int i, int j) { int tmp = resourceIdsIndex[i]; resourceIdsIndex[i] = resourceIdsIndex[j]; resourceIdsIndex[j] = tmp; } + @Override public boolean isLess(int i, int j) { String s1 = resourceIds[resourceIdsIndex[i]]; String s2 = resourceIds[resourceIdsIndex[j]]; return FastStringComparator.INSTANCE.compare(s1, s2) < 0; } + @Override public int size() { return size; } diff --git a/sonar-duplications/src/main/java/org/sonar/duplications/internal/pmd/TokensLine.java b/sonar-duplications/src/main/java/org/sonar/duplications/internal/pmd/TokensLine.java index d8f5a304af9..bb826686774 100644 --- a/sonar-duplications/src/main/java/org/sonar/duplications/internal/pmd/TokensLine.java +++ b/sonar-duplications/src/main/java/org/sonar/duplications/internal/pmd/TokensLine.java @@ -50,6 +50,7 @@ public class TokensLine implements CodeFragment { return value; } + @Override public int getStartLine() { return startLine; } @@ -57,6 +58,7 @@ public class TokensLine implements CodeFragment { /** * Same as {@link #getStartLine()} */ + @Override public int getEndLine() { return startLine; } diff --git a/sonar-duplications/src/main/java/org/sonar/duplications/statement/Statement.java b/sonar-duplications/src/main/java/org/sonar/duplications/statement/Statement.java index 361c51cf112..49e9e90f743 100644 --- a/sonar-duplications/src/main/java/org/sonar/duplications/statement/Statement.java +++ b/sonar-duplications/src/main/java/org/sonar/duplications/statement/Statement.java @@ -54,10 +54,12 @@ public class Statement implements CodeFragment { this.endLine = tokens.get(tokens.size() - 1).getLine(); } + @Override public int getStartLine() { return startLine; } + @Override public int getEndLine() { return endLine; } diff --git a/sonar-duplications/src/main/java/org/sonar/duplications/token/TokenQueue.java b/sonar-duplications/src/main/java/org/sonar/duplications/token/TokenQueue.java index e1ad2e8da24..433238f3db4 100644 --- a/sonar-duplications/src/main/java/org/sonar/duplications/token/TokenQueue.java +++ b/sonar-duplications/src/main/java/org/sonar/duplications/token/TokenQueue.java @@ -72,6 +72,7 @@ public class TokenQueue implements Iterable<Token> { return nextToken.getValue().equals(expectedValue); } + @Override public Iterator<Token> iterator() { return tokenQueue.iterator(); } diff --git a/sonar-duplications/src/main/java/org/sonar/duplications/utils/FastStringComparator.java b/sonar-duplications/src/main/java/org/sonar/duplications/utils/FastStringComparator.java index d216e37656c..7b80a850280 100644 --- a/sonar-duplications/src/main/java/org/sonar/duplications/utils/FastStringComparator.java +++ b/sonar-duplications/src/main/java/org/sonar/duplications/utils/FastStringComparator.java @@ -33,6 +33,7 @@ public final class FastStringComparator implements Comparator<String> { /** * Compares two strings (not lexicographically). */ + @Override public int compare(String s1, String s2) { if (s1 == s2) { // NOSONAR false-positive: Compare Objects With Equals return 0; |