Skip to content

Commit d075d82

Browse files
authored
Fixing compilation after platform update. (#311)
1 parent 64a0cd3 commit d075d82

1 file changed

Lines changed: 23 additions & 22 deletions

File tree

‎java-coverage-impl/src/main/java/com/intellij/java/coverage/JavaCoverageEngine.java‎

Lines changed: 23 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
import consulo.content.ContentFolderTypeProvider;
2323
import consulo.execution.configuration.RunConfigurationBase;
2424
import consulo.execution.coverage.*;
25+
import consulo.execution.coverage.localize.ExecutionCoverageLocalize;
2526
import consulo.execution.coverage.view.CoverageViewExtension;
2627
import consulo.execution.test.AbstractTestProxy;
2728
import consulo.java.coverage.localize.JavaCoverageLocalize;
@@ -32,6 +33,7 @@
3233
import consulo.language.psi.PsiPackage;
3334
import consulo.language.psi.scope.GlobalSearchScope;
3435
import consulo.language.psi.util.PsiTreeUtil;
36+
import consulo.localize.LocalizeValue;
3537
import consulo.logging.Logger;
3638
import consulo.module.Module;
3739
import consulo.module.content.ModuleRootManager;
@@ -193,13 +195,13 @@ public boolean recompileProjectAndRerunAction(
193195
CoverageSuitesBundle suite,
194196
Runnable chooseSuiteAction
195197
) {
196-
Path outputpath =
198+
Path outputPath =
197199
ModuleCompilerPathsManager.getInstance(module).getCompilerOutputPath(ProductionContentFolderTypeProvider.getInstance());
198-
Path testOutputpath =
200+
Path testOutputPath =
199201
ModuleCompilerPathsManager.getInstance(module).getCompilerOutputPath(TestContentFolderTypeProvider.getInstance());
200202

201-
if ((outputpath == null && isModuleOutputNeeded(module, ProductionContentFolderTypeProvider.getInstance()))
202-
|| (suite.isTrackTestFolders() && testOutputpath == null
203+
if ((outputPath == null && isModuleOutputNeeded(module, ProductionContentFolderTypeProvider.getInstance()))
204+
|| (suite.isTrackTestFolders() && testOutputPath == null
203205
&& isModuleOutputNeeded(module, TestContentFolderTypeProvider.getInstance()))) {
204206
Project project = module.getProject();
205207
if (suite.isModuleChecked(module)) {
@@ -332,11 +334,11 @@ public Set<File> getCorrespondingOutputFiles(
332334
}
333335
Set<File> classFiles = new HashSet<>();
334336
ModuleCompilerPathsManager pathsManager = ModuleCompilerPathsManager.getInstance(module);
335-
Path outputpath = pathsManager.getCompilerOutputPath(ProductionContentFolderTypeProvider.getInstance());
336-
Path testOutputpath = pathsManager.getCompilerOutputPath(TestContentFolderTypeProvider.getInstance());
337+
Path outputPath = pathsManager.getCompilerOutputPath(ProductionContentFolderTypeProvider.getInstance());
338+
Path testOutputPath = pathsManager.getCompilerOutputPath(TestContentFolderTypeProvider.getInstance());
337339

338340
for (JavaCoverageEngineExtension extension : JavaCoverageEngineExtension.EP_NAME.getExtensions()) {
339-
if (extension.collectOutputFiles(srcFile, outputpath, testOutputpath, suite, classFiles)) {
341+
if (extension.collectOutputFiles(srcFile, outputPath, testOutputPath, suite, classFiles)) {
340342
return classFiles;
341343
}
342344
}
@@ -345,21 +347,21 @@ public Set<File> getCorrespondingOutputFiles(
345347
String packageVmName = packageFQName.replace('.', '/');
346348

347349
List<File> children = new ArrayList<>();
348-
File vDir = outputpath == null
350+
File vDir = outputPath == null
349351
? null
350352
: packageVmName.length() > 0
351-
? new File(outputpath.toFile(), packageVmName)
352-
: outputpath.toFile();
353+
? new File(outputPath.toFile(), packageVmName)
354+
: outputPath.toFile();
353355
if (vDir != null && vDir.exists()) {
354356
Collections.addAll(children, vDir.listFiles());
355357
}
356358

357359
if (suite.isTrackTestFolders()) {
358-
File testDir = testOutputpath == null
360+
File testDir = testOutputPath == null
359361
? null
360362
: packageVmName.length() > 0
361-
? new File(testOutputpath.toFile(), packageVmName)
362-
: testOutputpath.toFile();
363+
? new File(testOutputPath.toFile(), packageVmName)
364+
: testOutputPath.toFile();
363365
if (testDir != null && testDir.exists()) {
364366
Collections.addAll(children, testDir.listFiles());
365367
}
@@ -384,7 +386,7 @@ public Set<File> getCorrespondingOutputFiles(
384386

385387
@Override
386388
@RequiredReadAction
387-
public String generateBriefReport(
389+
public LocalizeValue generateBriefReport(
388390
Editor editor,
389391
PsiFile psiFile,
390392
int lineNumber,
@@ -393,13 +395,12 @@ public String generateBriefReport(
393395
@Nullable CoverageLine coverageLine
394396
) {
395397
LineData lineData = coverageLine instanceof AgentCoverageLine agentLine ? agentLine.getLineData() : null;
396-
StringBuilder buf = new StringBuilder();
397-
buf.append("Hits: ");
398398
if (lineData == null) {
399-
buf.append(0);
400-
return buf.toString();
399+
return ExecutionCoverageLocalize.hitsTitle(0);
401400
}
402-
buf.append(lineData.getHits()).append("\n");
401+
402+
StringBuilder buf = new StringBuilder();
403+
buf.append(ExecutionCoverageLocalize.hitsTitle(lineData.getHits()).get()).append("\n");
403404

404405
List<PsiExpression> expressions = new ArrayList<>();
405406

@@ -442,7 +443,7 @@ else if (parent instanceof PsiAssertStatement assertStatement) {
442443
}
443444
}
444445
catch (AnalysisCanceledException e) {
445-
return buf.toString();
446+
return LocalizeValue.of(buf.toString());
446447
}
447448
}
448449
}
@@ -508,9 +509,9 @@ else if (parent instanceof PsiAssertStatement assertStatement) {
508509
}
509510
catch (Exception e) {
510511
LOG.info(e);
511-
return "Hits: " + lineData.getHits();
512+
return ExecutionCoverageLocalize.hitsTitle(0);
512513
}
513-
return buf.toString();
514+
return LocalizeValue.of(buf.toString());
514515
}
515516

516517
@Nullable

0 commit comments

Comments
 (0)