Skip to content

fix: resolve MavenId binary incompatibility with IntelliJ IDEA 2025.1+ (IU-261)#1279

Merged
tangcent merged 1 commit intomasterfrom
fix/maven-id-binary-incompatibility
Mar 15, 2026
Merged

fix: resolve MavenId binary incompatibility with IntelliJ IDEA 2025.1+ (IU-261)#1279
tangcent merged 1 commit intomasterfrom
fix/maven-id-binary-incompatibility

Conversation

@tangcent
Copy link
Copy Markdown
Owner

@tangcent tangcent commented Mar 14, 2026

Summary

Fix binary incompatibility with IntelliJ IDEA IU-261.22158.121 caused by unresolved class org.jetbrains.idea.maven.model.MavenId.

fix #1277

Problem

MavenHelper.getMavenIdByMaven(PsiClass) directly accessed mavenProject.mavenId, which generates bytecode referencing org.jetbrains.idea.maven.model.MavenId as a return type. In IntelliJ IDEA 2025.1+ (build 261), the Maven model module was extracted into a separate classloader, making MavenId no longer resolvable from the plugin's classloader. This leads to NoSuchClassError at runtime.

Fix

Replace direct property access with reflection for the entire call chain:

  1. Call getMavenId() on MavenProject via reflection
  2. Call getGroupId(), getArtifactId(), getVersion() on the returned object via reflection

This avoids any compile-time or runtime dependency on org.jetbrains.idea.maven.model.MavenId.

@github-actions github-actions bot added the type: bug Something isn't working label Mar 14, 2026
@codecov
Copy link
Copy Markdown

codecov bot commented Mar 14, 2026

Codecov Report

❌ Patch coverage is 42.85714% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 54.663%. Comparing base (df083df) to head (e7d0668).
⚠️ Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
...ain/kotlin/com/itangcent/idea/utils/MavenHelper.kt 42.857% 0 Missing and 4 partials ⚠️
Additional details and impacted files

Impacted file tree graph

@@               Coverage Diff               @@
##              master     #1279       +/-   ##
===============================================
- Coverage     54.681%   54.663%   -0.017%     
  Complexity      2748      2748               
===============================================
  Files            289       289               
  Lines          15329     15332        +3     
  Branches        3714      3718        +4     
===============================================
- Hits            8382      8381        -1     
  Misses          5245      5245               
- Partials        1702      1706        +4     
Flag Coverage Δ
unittests 54.663% <42.857%> (-0.017%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
...ain/kotlin/com/itangcent/idea/utils/MavenHelper.kt 88.333% <42.857%> (-6.404%) ⬇️

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update df083df...e7d0668. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

… with IDEA 261+

MavenHelper.getMavenIdByMaven() previously accessed mavenProject.mavenId
directly, which references org.jetbrains.idea.maven.model.MavenId in its
bytecode. In IntelliJ IDEA IU-261.22158.121, this class is no longer
resolvable from the plugin classloader, causing NoSuchClassError at runtime.

This fix uses reflection to call getMavenId() and access groupId/artifactId/
version properties, avoiding any compile-time reference to the MavenId class.
@tangcent tangcent force-pushed the fix/maven-id-binary-incompatibility branch from 87b7fae to e7d0668 Compare March 14, 2026 13:27
@github-actions
Copy link
Copy Markdown
Contributor

📦 Plugin has been packaged for this PR. You can download easy-yapi-2.8.4.212.0.zip from the GitHub Actions workflow run by clicking on the "Artifacts" dropdown.

@tangcent tangcent merged commit f99e8c7 into master Mar 15, 2026
24 of 25 checks passed
@tangcent tangcent deleted the fix/maven-id-binary-incompatibility branch March 15, 2026 11:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] IntelliJ IDEA 2025.3.3 装不上

1 participant