aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-duplications
diff options
context:
space:
mode:
authorMatteo Mara <matteo.mara@sonarsource.com>2023-12-04 12:50:58 +0100
committersonartech <sonartech@sonarsource.com>2023-12-04 20:03:22 +0000
commitd62a56ecfd4cf2f183873900fd32cffc4743c7fb (patch)
tree552481ceb8b8cab34f74b59563b58278ffa62f69 /sonar-duplications
parentcdda3dbcdd4e4b5f4a2e7471a37fa66877e26aad (diff)
downloadsonarqube-d62a56ecfd4cf2f183873900fd32cffc4743c7fb.tar.gz
sonarqube-d62a56ecfd4cf2f183873900fd32cffc4743c7fb.zip
SONAR-21174 Fix code smells raised after dropping JDK11 support
Diffstat (limited to 'sonar-duplications')
-rw-r--r--sonar-duplications/src/main/java/org/sonar/duplications/block/FileBlocks.java18
-rw-r--r--sonar-duplications/src/main/java/org/sonar/duplications/detector/suffixtree/TextSet.java4
2 files changed, 3 insertions, 19 deletions
diff --git a/sonar-duplications/src/main/java/org/sonar/duplications/block/FileBlocks.java b/sonar-duplications/src/main/java/org/sonar/duplications/block/FileBlocks.java
index 2ac876651a1..898200c8b36 100644
--- a/sonar-duplications/src/main/java/org/sonar/duplications/block/FileBlocks.java
+++ b/sonar-duplications/src/main/java/org/sonar/duplications/block/FileBlocks.java
@@ -24,22 +24,6 @@ import java.util.List;
/**
* Represents all blocks in a file.
*/
-public final class FileBlocks {
-
- private final String resourceId;
- private final List<Block> blocks;
-
- public FileBlocks(String resourceId, List<Block> blocks) {
- this.resourceId = resourceId;
- this.blocks = blocks;
- }
-
- public String resourceId() {
- return resourceId;
- }
-
- public List<Block> blocks() {
- return blocks;
- }
+public record FileBlocks(String resourceId, List<Block> blocks) {
}
diff --git a/sonar-duplications/src/main/java/org/sonar/duplications/detector/suffixtree/TextSet.java b/sonar-duplications/src/main/java/org/sonar/duplications/detector/suffixtree/TextSet.java
index 7c799001623..c48ced1f41b 100644
--- a/sonar-duplications/src/main/java/org/sonar/duplications/detector/suffixtree/TextSet.java
+++ b/sonar-duplications/src/main/java/org/sonar/duplications/detector/suffixtree/TextSet.java
@@ -69,8 +69,8 @@ public final class TextSet extends AbstractText {
@Override
public Object symbolAt(int index) {
Object obj = super.symbolAt(index);
- if (obj instanceof Block) {
- return ((Block) obj).getBlockHash();
+ if (obj instanceof Block block) {
+ return block.getBlockHash();
}
return obj;
}