Skip to content

build: turn off code instrumentation, which goes through Gradle's deprecated Ant integration - #2072

Merged
lagergren merged 1 commit into
redhat-developer:mainfrom
lagergren:build/no-code-instrumentation
Nov 21, 2026
Merged

lagergren merged 1 commit into
redhat-developer:mainfrom
lagergren:build/no-code-instrumentation

Conversation

@lagergren

Copy link
Copy Markdown
Collaborator

What

Sets instrumentCode = false in the intellijPlatform { } block of build.gradle.kts.

Why

The instrumentCode task of the IntelliJ Platform Gradle Plugin calls Task.getAnt() (InstrumentCodeTask.prepareAntClassLoader). With --warning-mode all, the build reports:

The Task.getAnt() method has been deprecated. This is scheduled to be removed in Gradle 10.

Gradle 9.9 deprecates the whole Ant integration, and Gradle 10 removes it. Once LSP4IJ moves to Gradle 10, the build would fail at instrumentCode. The plugin still calls getAnt() in 2.20.0 and on its main branch. The upstream issue is JetBrains/intellij-platform-gradle-plugin#2294.

Trade-off

LSP4IJ has no GUI Designer .form files, so instrumentation only added runtime null checks for @NotNull parameters and return values. Those checks go away. A null passed where @NotNull is declared no longer fails at once with an IllegalArgumentException, or an IllegalStateException for a return value. It now fails later, where the value is used, or not at all. The IDE's static analysis still reports those nulls. Instrumentation can be turned back on once the plugin no longer needs Ant for it.

Verification

…recated Ant integration

The IntelliJ Platform Gradle Plugin instruments the classes through Task.getAnt(), which Gradle 9.9 deprecates and
Gradle 10 removes (JetBrains/intellij-platform-gradle-plugin#2294). LSP4IJ has no GUI Designer forms, so the
instrumentation only added null checks for @NotNull to its classes.
@coderabbitai

coderabbitai Bot commented Nov 21, 2026 •

Copy link
Copy Markdown

No actionable comments were generated in the recent review.

Summary

Summary by CodeRabbit

  • Chores
    • Updated the plugin build configuration. This is an internal build-process change and does not alter features or behavior visible to users. No user-facing changes are included in this update.

The IntelliJ Platform build configuration now disables code instrumentation. Comments describe the absence of GUI Designer forms and the deprecation and removal of Gradle’s Ant API.

Changes: Plugin Build Configuration

Layer / File(s) Summary
Disable code instrumentation
build.gradle.kts
The intellijPlatform configuration sets instrumentCode to false. Comments note that the project has no GUI Designer forms and describe Gradle’s Ant API deprecation and removal.

Estimated code review effort: 1 (Trivial) | ~3 minutes

Change: Other

Suggested reviewers: angelozerr

Merge Risk: Minimal · up to e4df1

This PR turns off build-time code instrumentation to avoid Gradle's deprecated Ant integration. Runtime null checks on annotated parameters are no longer injected, but the IDE's static analysis still reports them. The change is easy to revert and has no identified merge-blocking risk.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title states the main change: code instrumentation is turned off in the build because it uses Gradle's deprecated Ant integration. This matches the diff, which sets instrumentCode = false in build…
Description check Passed The description explains the change: it sets instrumentCode = false in the intellijPlatform block. It gives the reason (the Task.getAnt() deprecation and the Gradle 10 removal), the trade-off (no runt…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title states the main change: code instrumentation is turned off in the build because it uses Gradle's deprecated Ant integration. This matches the diff, which sets instrumentCode = false in build.gradle.kts, and the PR objectives, which describe the same change.

Full details: Description check

Explanation

The description explains the change: it sets instrumentCode = false in the intellijPlatform block. It gives the reason (the Task.getAnt() deprecation and the Gradle 10 removal), the trade-off (no runtime null checks), and the verification steps. It matches the changeset and the objectives.

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 0b37c1f8-e828-4c0c-bfd8-2a69df0c2792
Commits

Reviewing files that changed from the base of the PR and between 2da25ca and e4df1ce.

Files selected for processing: 1

  • build.gradle.kts

Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 0 remain after this review.

@codecov

codecov Bot commented Nov 21, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 50.16%. Comparing base (bba340e) to head (e4df1ce).
⚠️ Report is 4 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2072      +/-   ##
==========================================
+ Coverage   49.91%   50.16%   +0.25%     
==========================================
  Files         813      813              
  Lines       33396    33497     +101     
  Branches     6872     5221    -1651     
==========================================
+ Hits        16668    16803     +135     
+ Misses      14138    14064      -74     
- Partials     2590     2630      +40     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

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

@lagergren

Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Nov 21, 2026 •

Copy link
Copy Markdown
Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@lagergren
lagergren merged commit cc1776f into redhat-developer:main Nov 21, 2026
9 checks passed
@muescha

muescha commented Nov 22, 2026

Copy link
Copy Markdown
Contributor

The upstream issue is JetBrains/intellij-platform-gradle-plugin#2294.

@lagergren I would suggest opening an issue at https://youtrack.jetbrains.com/, as that is the main issue tracker, rather than using the GitHub mirror.

(And the same applies to PRs on the GitHub mirror: they only respond to PRs if you have also created a corresponding issue in YouTrack.)

lagergren added a commit that referenced this pull request Nov 23, 2026
…il it when it finds no test (#2125)

## What

`testJavaScript` runs the JavaScript plugin tests again (`*JavaScriptPluginTest`, today `DAPExpressionCodeFragmentJavaScriptPluginTest`). It now fails the build when, on an IDE that bundles the JavaScript plugin, it finds no test class.

## Cause

Since #2072 set `instrumentCode = false`, `testJavaScript` has found no test class: on CI's IU 2026.3 leg, it logs `Task :testJavaScript NO-SOURCE`, and the build passes. The last run of `main` where the test ran is that of fe9f583, just before #2072 (run 44925663365); from cc1776f, #2072 itself, every run logs NO-SOURCE.

Gradle 9 gives the classes and the classpath of the test source set to the `test` task only. Of those, the IntelliJ Platform Gradle Plugin 2.20.0 gives a `testIde` task only the classes of `instrumentTestCode` (`TestIdeTask`: `testClassesDirs = instrumentedTestCode + testClassesDirs`), which `instrumentCode = false` leaves empty. A local build can hide this: a leftover `build/instrumented/instrumentTestCode` from a build with instrumentation on makes the task run those old classes.

## Change

- `testJavaScript` takes `testClassesDirs` from the test source set. It also adds the test runtime classpath without that of main, whose classes and dependencies come from the plugin in the sandbox, as for `test`. That's what the plugin's own integration tests do for a `testIde` task with `instrumentCode = false`. The test resources, and with them the `HangingTestWatchdog` listener, are now on its classpath too.
- Gradle skips a test task that finds no test class as NO-SOURCE, before `failOnNoDiscoveredTests` can apply. A second `onlyIf`, evaluated before that skip and only where the IDE bundles the JavaScript plugin, fails the build when `testJavaScript` finds no `*JavaScriptPluginTest` class.
- `instrumentCode = false` stays (#2121 tracks JetBrains/intellij-platform-gradle-plugin#2294).

## Test

- `./gradlew testJavaScript -PplatformType=IU -PplatformVersion=2026.3 --rerun-tasks --no-build-cache` runs 1 test, which passes, 4 times out of 4. The configuration cache is stored and then reused.
- On the default IC 2024.2, the task is skipped, as the `onlyIf` for the JavaScript plugin is false, and the build passes.
- With the new lines removed, `testJavaScript` on IU 2026.3 fails: "Could not evaluate spec for 'testJavaScript finds a **/*JavaScriptPluginTest.class'". On IC 2024.2 it's still skipped.
- `./gradlew check -PplatformType=IU -PplatformVersion=2026.3 --rerun-tasks --no-build-cache` passes: `test` runs 1861 tests (7 skipped), and `testJavaScript` runs 1, with no failures. `DAPExpressionCodeFragmentJavaScriptPluginTest` still passes after a day of not running.
@lagergren lagergren added this to the 0.30.2 milestone Nov 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants