Skip to content
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

build: Improved hotswap behavior for the IDE's JVM when executed via the runIde Gradle task. #654

Merged
merged 8 commits into from
Dec 6, 2024

Conversation

SCWells72
Copy link
Contributor

@SCWells72 SCWells72 commented Dec 1, 2024

Pretty much what it says in the title. This allows dynamic updates to the running IDE JVM instance for most changes. Changes to class constant values and significant restructuring of Java/Kotlin types will require a JVM restart, but most other changes -- including simple method extractions and such -- will not.

Once you did some Java code changes, you need to build project

image

(ex: Ctrl+F9 on Windows) and your changes is applied without restarting the IntelliJ! This feature works only for IJ > 2024.1

@SCWells72 SCWells72 changed the title Improved hotswap behavior for the IDE's JVM when executed via the runIde Gradle task. build - improved hotswap behavior for the IDE's JVM when executed via the runIde Gradle task. Dec 1, 2024
@fbricon
Copy link
Contributor

fbricon commented Dec 1, 2024

Please rebase your PR against master, we're keeping a linear git history. Merge commits are likely messing up with the conventional commits check

@SCWells72 SCWells72 changed the title build - improved hotswap behavior for the IDE's JVM when executed via the runIde Gradle task. build: Improved hotswap behavior for the IDE's JVM when executed via the runIde Gradle task. Dec 1, 2024
@angelozerr
Copy link
Contributor

I have tried the PR, but I cannot start the plugin:

Caused by: java.lang.VerifyError: Catch type is not a subclass of Throwable in exception handler 57

Execution failed for task ':runIde'.
> Process 'command 'C:\Users\XXXX\.gradle\caches\modules-2\files-2.1\com.jetbrains\jbre\jbr_jcef-17.0.7-windows-x64-b1000.6\extracted\jbr_jcef-17.0.7-windows-x64-b1000.6\bin\java.exe'' finished with non-zero exit value 1

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.
Deprecated Gradle features were used in this build, making it incompatible with Gradle 9.0.
You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.
For more on this, please refer to https://docs.gradle.org/8.5/userguide/command_line_interface.html#sec:command_line_warnings in the Gradle documentation.
BUILD FAILED in 53s
10 actionable tasks: 3 executed, 7 up-to-date
Configuration cache entry stored.


@angelozerr
Copy link
Contributor

@SCWells72 have you installed some external plugin? In my case I can start runIde (see my previous comment).

SCWells72 and others added 3 commits December 4, 2024 08:21
…ionally based on the IDE version. 2023.2/3 versions don't support them, but 2024.1+ versions do. Once 2023.* versions are no longer supported, these JVM args can be added unconditionally.
val platformVersion = properties("platformVersion").getOrNull()
return when (platformVersion) {
// Versions before 2024.1 don't support enhanced class redefinition
"2023.2", "2023.3" -> false
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've explicitly verified the correct behavior in 2023.2, 2023.3, 2024.1, 2024.2, and 2024.3. By "correct behavior", I mean that runIde actually does run an IDE instance of the specified platformVersion, and once started, only simple classloader hotswaps are supported on 2023.* and enhanced classloader hotswaps are supported on 2024.*.

Copy link
Contributor

@adietish adietish Dec 6, 2024

Choose a reason for hiding this comment

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

@SCWells72: that's great news, thanks for sharing!

@angelozerr angelozerr merged commit 5eda89b into redhat-developer:main Dec 6, 2024
7 checks passed
@angelozerr
Copy link
Contributor

@SCWells72 it works like a charm. Thanks so much for this great PR. It will change my life :)

@angelozerr angelozerr assigned angelozerr and SCWells72 and unassigned angelozerr Dec 6, 2024
@angelozerr angelozerr added this to the 0.9.0 milestone Dec 6, 2024
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.

4 participants