From b93b1e39fa14256add1243604193cb46de778fbe Mon Sep 17 00:00:00 2001 From: pq Date: Mon, 28 Jul 2025 15:14:27 -0700 Subject: [PATCH 1/2] [CQ] migrate off deprecated `loadCoverageData` override --- .../run/coverage/FlutterCoverageRunner.java | 22 +++++++++++++------ 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/src/io/flutter/run/coverage/FlutterCoverageRunner.java b/src/io/flutter/run/coverage/FlutterCoverageRunner.java index c9863a279f..fb6298bfe5 100644 --- a/src/io/flutter/run/coverage/FlutterCoverageRunner.java +++ b/src/io/flutter/run/coverage/FlutterCoverageRunner.java @@ -6,8 +6,12 @@ package io.flutter.run.coverage; import com.intellij.coverage.CoverageEngine; +import com.intellij.coverage.CoverageLoadErrorReporter; +import com.intellij.coverage.CoverageLoadingResult; import com.intellij.coverage.CoverageRunner; import com.intellij.coverage.CoverageSuite; +import com.intellij.coverage.FailedCoverageLoadingResult; +import com.intellij.coverage.SuccessCoverageLoadingResult; import com.intellij.openapi.diagnostic.Logger; import com.intellij.rt.coverage.data.ProjectData; import io.flutter.FlutterBundle; @@ -21,26 +25,30 @@ public class FlutterCoverageRunner extends CoverageRunner { private static final String ID = "FlutterCoverageRunner"; private static final @NotNull Logger LOG = Logger.getInstance(FlutterCoverageRunner.class.getName()); - @Nullable @Override - public ProjectData loadCoverageData(@NotNull final File sessionDataFile, @Nullable CoverageSuite baseCoverageSuite) { + public @NotNull CoverageLoadingResult loadCoverageData(@NotNull final File sessionDataFile, + @Nullable CoverageSuite baseCoverageSuite, + @NotNull CoverageLoadErrorReporter reporter) { if (!(baseCoverageSuite instanceof FlutterCoverageSuite)) { - return null; + return new FailedCoverageLoadingResult("Flutter coverage suite is not a FlutterCoverageSuite"); } return doLoadCoverageData(sessionDataFile, (FlutterCoverageSuite)baseCoverageSuite); } - @Nullable - private static ProjectData doLoadCoverageData(@NotNull final File sessionDataFile, @NotNull final FlutterCoverageSuite coverageSuite) { + private static @NotNull CoverageLoadingResult doLoadCoverageData(@NotNull final File sessionDataFile, + @NotNull final FlutterCoverageSuite coverageSuite) { final ProjectData projectData = new ProjectData(); try { LcovInfo.readInto(projectData, sessionDataFile); } catch (IOException ex) { LOG.warn(FlutterBundle.message("coverage.data.not.read", sessionDataFile.getAbsolutePath())); - return null; + return new FailedCoverageLoadingResult("Flutter coverage data could not be read"); } - return projectData; + if (projectData == null) { + return new FailedCoverageLoadingResult("Flutter coverage data could not be read"); + } + return new SuccessCoverageLoadingResult(projectData); } @NotNull From 9704c68dfca2e45f4f9581087af8c673ae24ddb0 Mon Sep 17 00:00:00 2001 From: pq Date: Mon, 28 Jul 2025 15:15:29 -0700 Subject: [PATCH 2/2] dedup --- src/io/flutter/run/coverage/FlutterCoverageRunner.java | 1 - 1 file changed, 1 deletion(-) diff --git a/src/io/flutter/run/coverage/FlutterCoverageRunner.java b/src/io/flutter/run/coverage/FlutterCoverageRunner.java index fb6298bfe5..5fccb9dc7b 100644 --- a/src/io/flutter/run/coverage/FlutterCoverageRunner.java +++ b/src/io/flutter/run/coverage/FlutterCoverageRunner.java @@ -43,7 +43,6 @@ public class FlutterCoverageRunner extends CoverageRunner { } catch (IOException ex) { LOG.warn(FlutterBundle.message("coverage.data.not.read", sessionDataFile.getAbsolutePath())); - return new FailedCoverageLoadingResult("Flutter coverage data could not be read"); } if (projectData == null) { return new FailedCoverageLoadingResult("Flutter coverage data could not be read");