Conversation
- Update minimum supported IDEA version from 2021.2.1 to 2024.1.7 - Remove support for outdated IDEA versions (2021.2.1, 2022.2.3) - Fix binary incompatibility with IconLoader.findIcon(URL) method - Replace IconLoader.findIcon(URL) with javax.swing.ImageIcon for compatibility - This resolves NoSuchMethodError at runtime in IDEA 2024.1+
Review Summary by QodoFix IconLoader compatibility with IDEA 2024.1+
WalkthroughsDescription• Fix binary incompatibility with IconLoader.findIcon(URL) method • Replace IconLoader.findIcon(URL) with javax.swing.ImageIcon for IDEA 2024.1+ compatibility • Resolves NoSuchMethodError at runtime in newer IDEA versions Diagramflowchart LR
A["IconLoader.findIcon(URL)"] -->|"deprecated/incompatible"| B["javax.swing.ImageIcon"]
C["tryLoadCache(url)"] -->|"returns cached URL"| B
B -->|"compatible with IDEA 2024.1+"| D["Runtime compatibility"]
File Changes1. idea-plugin/src/main/kotlin/com/itangcent/idea/icons/EasyIcons.kt
|
Code Review by Qodo
1. Remote SVG icons break
|
| val cachedUrl = tryLoadCache(url) | ||
| return javax.swing.ImageIcon(cachedUrl) |
There was a problem hiding this comment.
1. Remote svg icons break 🐞 Bug ✓ Correctness
DefaultIconLoader.findIcon(URL) now returns ImageIcon(cachedUrl), which can’t render .svg resources, so URL fallbacks like EasyIcons.Reset (remote reset.svg) will load as a broken/empty icon. This is a functional regression for any SVG URL icon path.
Agent Prompt
### Issue description
`DefaultIconLoader.findIcon(URL)` now uses `ImageIcon(URL)`, which does not support SVG. This breaks `EasyIcons.Reset` which falls back to a remote `reset.svg` URL.
### Issue Context
`EasyIcons.Reset` uses `tryLoadByUrl(".../reset.svg")`. The repo’s headless IconLoader explicitly special-cases `.svg`, indicating SVG URLs are a supported/expected input.
### Fix Focus Areas
- idea-plugin/src/main/kotlin/com/itangcent/idea/icons/EasyIcons.kt[79-84]
- idea-plugin/src/main/kotlin/com/itangcent/idea/icons/EasyIcons.kt[184-188]
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
| val cachedUrl = tryLoadCache(url) | ||
| return javax.swing.ImageIcon(cachedUrl) |
There was a problem hiding this comment.
2. Fallback urls never tried 🐞 Bug ⛯ Reliability
tryLoadByUrl relies on findIcon(url) returning null to continue to the next candidate, but DefaultIconLoader.findIcon(URL) now returns a non-null ImageIcon for any non-null URL. This short-circuits fallback chains and can return a broken icon instead of trying subsequent URLs.
Agent Prompt
### Issue description
`tryLoadByUrl` expects `iconLoader.findIcon(url)` to return `null` when an icon cannot be loaded, so it can try the next URL. The new `ImageIcon(URL)` approach returns a non-null object without validation, preventing fallbacks.
### Issue Context
`tryLoadByUrl` uses `?.let { return it }` and has no dimension/validity checks.
### Fix Focus Areas
- idea-plugin/src/main/kotlin/com/itangcent/idea/icons/EasyIcons.kt[162-169]
- idea-plugin/src/main/kotlin/com/itangcent/idea/icons/EasyIcons.kt[184-188]
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
|
📦 Plugin has been packaged for this PR. You can download |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #618 +/- ##
===============================================
+ Coverage 53.908% 54.002% +0.094%
+ Complexity 2366 2350 -16
===============================================
Files 259 259
Lines 14699 13542 -1157
Branches 3248 3252 +4
===============================================
- Hits 7924 7313 -611
+ Misses 5331 4788 -543
+ Partials 1444 1441 -3
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 159 files with indirect coverage changes Continue to review full report in Codecov by Sentry.
🚀 New features to boost your workflow:
|
This PR cherry-picks a fix from easy-yapi to address IconLoader compatibility issues.
Changes
Source
Cherry-picked from easy-yapi commit 44030b39
Related