aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-duplications
diff options
context:
space:
mode:
authorDavid Gageot <david@gageot.net>2015-05-12 10:42:31 +0200
committerDavid Gageot <david@gageot.net>2015-05-12 14:33:41 +0200
commit7d5701e0a327448484ccee968e12ae3d9162d407 (patch)
tree48765dedbd2125480a531d71e30801ee44d8bce9 /sonar-duplications
parent4bab89867b0484fa9d21d0d54e6d7687d2b2f5bf (diff)
downloadsonarqube-7d5701e0a327448484ccee968e12ae3d9162d407.tar.gz
sonarqube-7d5701e0a327448484ccee968e12ae3d9162d407.zip
Useless code
Diffstat (limited to 'sonar-duplications')
-rw-r--r--sonar-duplications/src/main/java/net/sourceforge/pmd/cpd/SourceCode.java4
-rw-r--r--sonar-duplications/src/main/java/net/sourceforge/pmd/cpd/TokenEntry.java2
-rw-r--r--sonar-duplications/src/main/java/org/sonar/duplications/detector/suffixtree/AbstractText.java2
-rw-r--r--sonar-duplications/src/main/java/org/sonar/duplications/detector/suffixtree/Node.java2
-rw-r--r--sonar-duplications/src/main/java/org/sonar/duplications/index/CloneGroup.java2
-rw-r--r--sonar-duplications/src/main/java/org/sonar/duplications/statement/StatementChannel.java2
-rw-r--r--sonar-duplications/src/main/java/org/sonar/duplications/statement/StatementChunker.java4
-rw-r--r--sonar-duplications/src/main/java/org/sonar/duplications/statement/matcher/UptoTokenMatcher.java2
-rw-r--r--sonar-duplications/src/main/java/org/sonar/duplications/token/TokenQueue.java4
-rw-r--r--sonar-duplications/src/test/java/org/sonar/duplications/detector/suffixtree/StringSuffixTree.java2
-rw-r--r--sonar-duplications/src/test/java/org/sonar/duplications/token/TokenQueueTest.java4
11 files changed, 15 insertions, 15 deletions
diff --git a/sonar-duplications/src/main/java/net/sourceforge/pmd/cpd/SourceCode.java b/sonar-duplications/src/main/java/net/sourceforge/pmd/cpd/SourceCode.java
index cf886d01122..57501d25d7a 100644
--- a/sonar-duplications/src/main/java/net/sourceforge/pmd/cpd/SourceCode.java
+++ b/sonar-duplications/src/main/java/net/sourceforge/pmd/cpd/SourceCode.java
@@ -50,7 +50,7 @@ public class SourceCode {
if (c != null) {
return c;
}
- this.code = new SoftReference<List<String>>(load());
+ this.code = new SoftReference<>(load());
return code.get();
}
@@ -62,7 +62,7 @@ public class SourceCode {
LineNumberReader lnr = null;
try {
lnr = new LineNumberReader(getReader());
- List<String> lines = new ArrayList<String>();
+ List<String> lines = new ArrayList<>();
String currentLine;
while ((currentLine = lnr.readLine()) != null) {
lines.add(currentLine);
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 be1bfb4bc83..395c9f9bdc2 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
@@ -34,7 +34,7 @@ import java.util.Map;
*/
public class TokenEntry implements Comparable<TokenEntry> {
- private static final Map<String, Integer> TOKENS = new HashMap<String, Integer>();
+ private static final Map<String, Integer> TOKENS = new HashMap<>();
private static int tokenCount = 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 0a13ccf1b29..6c3dde2496c 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
@@ -27,7 +27,7 @@ public abstract class AbstractText implements Text {
protected final List<Object> symbols;
public AbstractText(int size) {
- this.symbols = new ArrayList<Object>(size);
+ this.symbols = new ArrayList<>(size);
}
public AbstractText(List<Object> symbols) {
diff --git a/sonar-duplications/src/main/java/org/sonar/duplications/detector/suffixtree/Node.java b/sonar-duplications/src/main/java/org/sonar/duplications/detector/suffixtree/Node.java
index c94a89b407f..c6a95c9cae1 100644
--- a/sonar-duplications/src/main/java/org/sonar/duplications/detector/suffixtree/Node.java
+++ b/sonar-duplications/src/main/java/org/sonar/duplications/detector/suffixtree/Node.java
@@ -54,7 +54,7 @@ public final class Node {
public Node(SuffixTree suffixTree, Node suffixNode) {
this.suffixTree = suffixTree;
this.suffixNode = suffixNode;
- edges = new HashMap<Object, Edge>();
+ edges = new HashMap<>();
}
public Object symbolAt(int index) {
diff --git a/sonar-duplications/src/main/java/org/sonar/duplications/index/CloneGroup.java b/sonar-duplications/src/main/java/org/sonar/duplications/index/CloneGroup.java
index 01b7273da1c..05eab3dd108 100644
--- a/sonar-duplications/src/main/java/org/sonar/duplications/index/CloneGroup.java
+++ b/sonar-duplications/src/main/java/org/sonar/duplications/index/CloneGroup.java
@@ -55,7 +55,7 @@ public class CloneGroup {
private ClonePart origin;
private int length;
private int lengthInUnits;
- private List<ClonePart> parts = new ArrayList<ClonePart>();
+ private List<ClonePart> parts = new ArrayList<>();
public Builder setLength(int length) {
this.length = length;
diff --git a/sonar-duplications/src/main/java/org/sonar/duplications/statement/StatementChannel.java b/sonar-duplications/src/main/java/org/sonar/duplications/statement/StatementChannel.java
index d734b5dfa0a..39d45ede76b 100644
--- a/sonar-duplications/src/main/java/org/sonar/duplications/statement/StatementChannel.java
+++ b/sonar-duplications/src/main/java/org/sonar/duplications/statement/StatementChannel.java
@@ -48,7 +48,7 @@ public final class StatementChannel {
}
public boolean consume(TokenQueue tokenQueue, List<Statement> output) {
- List<Token> matchedTokenList = new ArrayList<Token>();
+ List<Token> matchedTokenList = new ArrayList<>();
for (TokenMatcher tokenMatcher : tokenMatchers) {
if (!tokenMatcher.matchToken(tokenQueue, matchedTokenList)) {
tokenQueue.pushForward(matchedTokenList);
diff --git a/sonar-duplications/src/main/java/org/sonar/duplications/statement/StatementChunker.java b/sonar-duplications/src/main/java/org/sonar/duplications/statement/StatementChunker.java
index 5223dbc96ed..3631d3e722b 100644
--- a/sonar-duplications/src/main/java/org/sonar/duplications/statement/StatementChunker.java
+++ b/sonar-duplications/src/main/java/org/sonar/duplications/statement/StatementChunker.java
@@ -42,7 +42,7 @@ public final class StatementChunker {
if (tokenQueue == null) {
throw new IllegalArgumentException();
}
- List<Statement> statements = new ArrayList<Statement>();
+ List<Statement> statements = new ArrayList<>();
try {
channelDispatcher.consume(tokenQueue, statements);
return statements;
@@ -58,7 +58,7 @@ public final class StatementChunker {
*/
public static final class Builder {
- private List<StatementChannel> channels = new ArrayList<StatementChannel>();
+ private List<StatementChannel> channels = new ArrayList<>();
private Builder() {
}
diff --git a/sonar-duplications/src/main/java/org/sonar/duplications/statement/matcher/UptoTokenMatcher.java b/sonar-duplications/src/main/java/org/sonar/duplications/statement/matcher/UptoTokenMatcher.java
index 1b0220009af..5e2928a1d61 100644
--- a/sonar-duplications/src/main/java/org/sonar/duplications/statement/matcher/UptoTokenMatcher.java
+++ b/sonar-duplications/src/main/java/org/sonar/duplications/statement/matcher/UptoTokenMatcher.java
@@ -31,7 +31,7 @@ import org.sonar.duplications.token.TokenQueue;
*/
public class UptoTokenMatcher extends TokenMatcher {
- private final Set<String> uptoMatchTokens = new HashSet<String>();
+ private final Set<String> uptoMatchTokens = new HashSet<>();
public UptoTokenMatcher(String[] uptoMatchTokens) {
if (uptoMatchTokens == null) {
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 433238f3db4..a6894bb46b9 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
@@ -30,11 +30,11 @@ public class TokenQueue implements Iterable<Token> {
private final Deque<Token> tokenQueue;
public TokenQueue(List<Token> tokenList) {
- tokenQueue = new LinkedList<Token>(tokenList);
+ tokenQueue = new LinkedList<>(tokenList);
}
public TokenQueue() {
- tokenQueue = new LinkedList<Token>();
+ tokenQueue = new LinkedList<>();
}
/**
diff --git a/sonar-duplications/src/test/java/org/sonar/duplications/detector/suffixtree/StringSuffixTree.java b/sonar-duplications/src/test/java/org/sonar/duplications/detector/suffixtree/StringSuffixTree.java
index b3074712146..346c5fba01c 100644
--- a/sonar-duplications/src/test/java/org/sonar/duplications/detector/suffixtree/StringSuffixTree.java
+++ b/sonar-duplications/src/test/java/org/sonar/duplications/detector/suffixtree/StringSuffixTree.java
@@ -38,7 +38,7 @@ public class StringSuffixTree {
private StringSuffixTree(String text) {
suffixTree = SuffixTree.create(new StringText(text));
- Queue<Node> queue = new LinkedList<Node>();
+ Queue<Node> queue = new LinkedList<>();
queue.add(suffixTree.getRootNode());
while (!queue.isEmpty()) {
Node node = queue.remove();
diff --git a/sonar-duplications/src/test/java/org/sonar/duplications/token/TokenQueueTest.java b/sonar-duplications/src/test/java/org/sonar/duplications/token/TokenQueueTest.java
index 5561f117dce..9495eeace8c 100644
--- a/sonar-duplications/src/test/java/org/sonar/duplications/token/TokenQueueTest.java
+++ b/sonar-duplications/src/test/java/org/sonar/duplications/token/TokenQueueTest.java
@@ -34,7 +34,7 @@ public class TokenQueueTest {
@Before
public void initTest() {
- List<Token> tokenList = new ArrayList<Token>();
+ List<Token> tokenList = new ArrayList<>();
tokenList.add(new Token("a", 1, 0));
tokenList.add(new Token("bc", 1, 2));
tokenList.add(new Token("def", 1, 5));
@@ -58,7 +58,7 @@ public class TokenQueueTest {
@Test
public void shouldPushTokenAtBegining() {
Token pushedToken = new Token("push", 1, 0);
- List<Token> pushedTokenList = new ArrayList<Token>();
+ List<Token> pushedTokenList = new ArrayList<>();
pushedTokenList.add(pushedToken);
tokenQueue.pushForward(pushedTokenList);
assertThat(tokenQueue.peek(), is(pushedToken));