Skip to content

[CQ] remove experimental BadgeIcon dependency #8365

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jul 23, 2025

Conversation

pq
Copy link
Contributor

@pq pq commented Jul 23, 2025

The class com.intellij.ui.BadgeIcon is marked @experimental and is flagged by the verifier:

  Experimental API usages (4): 
      #Experimental API class com.intellij.ui.BadgeIcon reference
          Experimental API class com.intellij.ui.BadgeIcon is referenced in io.flutter.toolwindow.ToolWindowBadgeUpdater.lambda$updateBadgedIcon$1(ToolWindow) : void. This class can be changed in a future release leading to incompatibilities
          Experimental API class com.intellij.ui.BadgeIcon is referenced in io.flutter.toolwindow.ToolWindowBadgeUpdater.lambda$updateBadgedIcon$0(ToolWindow) : void. This class can be changed in a future release leading to incompatibilities
      #Experimental API constructor com.intellij.ui.BadgeIcon.<init>(Icon, Paint) invocation
          Experimental API constructor com.intellij.ui.BadgeIcon.<init>(javax.swing.Icon icon, java.awt.Paint paint) is invoked in io.flutter.toolwindow.ToolWindowBadgeUpdater.lambda$updateBadgedIcon$1(ToolWindow) : void. This constructor can be changed in a future release leading to incompatibilities
          Experimental API constructor com.intellij.ui.BadgeIcon.<init>(javax.swing.Icon icon, java.awt.Paint paint) is invoked in io.flutter.toolwindow.ToolWindowBadgeUpdater.lambda$updateBadgedIcon$0(ToolWindow) : void. This constructor can be changed in a future release leading to incompatibilities

This change introduces a lightweight replacement, allowing us to remove the dependency and enable VerifyPluginTask.FailureLevel.EXPERIMENTAL_API_USAGES failure checking in the verifier (see: #8361).


Behavior is preserved w/ the replacement:

Default:

image

with badge:

image
  • I’ve reviewed the contributor guide and applied the relevant portions to this PR.
Contribution guidelines:

@pq pq requested review from helin24 and jwren July 23, 2025 15:31
import io.flutter.run.common.RunMode;
import io.flutter.run.daemon.FlutterApp;

import java.awt.Color;
import java.awt.Paint;
import javax.swing.*;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was under the impression that we avoid * imports, but I'm not sure if that's enforced somewhere in java settings.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting! This is what the IDE did on-save. Doing a quick grep I see we've got 104+ * imports in 74+ files so we're definitely not consistently avoiding them.

That could be this inspection?

https://www.jetbrains.com/help/inspectopedia/OnDemandImport.html

Happy to discuss enabling!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A quick search suggests to me it is better to avoid * imports (avoids potential naming conflicts, avoids indexing classes that aren't needed). Is enabling the inspection something we do individually or can we save it to the repository?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thinking a bit about it, I tend to agree. Wildcard imports are probably best to avoid. Could you add some discussion to #8098?

We do have a checked in inspection set and think we should probably enable it there but we should discuss. It would also be great to get the inspections run in the CI, if not as part of the verifier, as a separate task. I've poked at that a bit but got distracted. (Some info here: https://www.jetbrains.com/help/idea/command-line-code-inspector.html#inspection-profiles.)

@pq pq merged commit 1b2fa45 into flutter:master Jul 23, 2025
8 checks passed
@pq pq deleted the cq_experimental_BadgeIcon branch July 23, 2025 15:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants