diff options
Diffstat (limited to 'sonar-scanner-engine/src')
4 files changed, 7 insertions, 7 deletions
diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/InputModuleHierarchyProvider.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/InputModuleHierarchyProvider.java index aaa8cf5f54d..459c97075ae 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/InputModuleHierarchyProvider.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/InputModuleHierarchyProvider.java @@ -42,7 +42,7 @@ public class InputModuleHierarchyProvider extends ProviderAdapter { validator.validate(projectReactor); // 3 Create modules and the hierarchy - DefaultInputModule root = new DefaultInputModule(projectReactor.getRoot(), batchIdGenerator.get()); + DefaultInputModule root = new DefaultInputModule(projectReactor.getRoot(), batchIdGenerator.getAsInt()); Map<DefaultInputModule, DefaultInputModule> parents = createChildren(root, batchIdGenerator, new HashMap<>()); if (parents.isEmpty()) { hierarchy = new DefaultInputModuleHierarchy(root); @@ -56,7 +56,7 @@ public class InputModuleHierarchyProvider extends ProviderAdapter { private static Map<DefaultInputModule, DefaultInputModule> createChildren(DefaultInputModule parent, BatchIdGenerator batchIdGenerator, Map<DefaultInputModule, DefaultInputModule> parents) { for (ProjectDefinition def : parent.definition().getSubProjects()) { - DefaultInputModule child = new DefaultInputModule(def, batchIdGenerator.get()); + DefaultInputModule child = new DefaultInputModule(def, batchIdGenerator.getAsInt()); parents.put(child, parent); createChildren(child, batchIdGenerator, parents); } diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/filesystem/BatchIdGenerator.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/filesystem/BatchIdGenerator.java index 119d8d9bc9f..28a5ace2347 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/filesystem/BatchIdGenerator.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/filesystem/BatchIdGenerator.java @@ -20,7 +20,7 @@ package org.sonar.scanner.scan.filesystem; import java.util.concurrent.atomic.AtomicInteger; -import java.util.function.Supplier; +import java.util.function.IntSupplier; import javax.annotation.concurrent.ThreadSafe; @@ -32,11 +32,11 @@ import org.sonar.api.batch.fs.InputComponent; * The ID should never be 0, as it is sometimes used to indicate invalid components. */ @ThreadSafe -public class BatchIdGenerator implements Supplier<Integer> { +public class BatchIdGenerator implements IntSupplier { private AtomicInteger nextBatchId = new AtomicInteger(1); @Override - public Integer get() { + public int getAsInt() { return nextBatchId.getAndIncrement(); } } diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/filesystem/FileIndexer.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/filesystem/FileIndexer.java index 09f774a0d32..e0dc7eab38b 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/filesystem/FileIndexer.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/filesystem/FileIndexer.java @@ -198,7 +198,7 @@ public class FileIndexer { private void indexFileAndParentDir(InputFile inputFile, String parentRelativePath) { DefaultInputDir inputDir = (DefaultInputDir) componentStore.getDir(module.key(), parentRelativePath); if (inputDir == null) { - inputDir = new DefaultInputDir(module.key(), parentRelativePath, batchIdGenerator.get()); + inputDir = new DefaultInputDir(module.key(), parentRelativePath, batchIdGenerator.getAsInt()); inputDir.setModuleBaseDir(module.getBaseDir()); componentTree.index(inputDir, module); defaultModuleFileSystem.add(inputDir); diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/filesystem/InputFileBuilder.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/filesystem/InputFileBuilder.java index aee7714e9fc..2cb2969f1f3 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/filesystem/InputFileBuilder.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/filesystem/InputFileBuilder.java @@ -57,7 +57,7 @@ public class InputFileBuilder { DefaultIndexedFile indexedFile = new DefaultIndexedFile(absolutePath, moduleKey, PathUtils.sanitize(projectBaseDir.relativize(absolutePath).toString()), PathUtils.sanitize(moduleBaseDir.relativize(absolutePath).toString()), - type, language, idGenerator.get(), sensorStrategy); + type, language, idGenerator.getAsInt(), sensorStrategy); DefaultInputFile inputFile = new DefaultInputFile(indexedFile, f -> metadataGenerator.setMetadata(f, moduleFileSystemInitializer.defaultEncoding())); if (language != null) { inputFile.setPublished(true); |