You are also able to hot-swap code directly into the running program. If you want to you can also change the JVM to use DCEVM (Dynamic Code Evolution VM) for even more advanced hot-swap, but Mojang's default JVM arguments (specifically the -XX:+UseG1GC argument) cause a crash when using this JVM. The final arguments that I use are
-Xms1536M
-Xmx2048M
-XX:+UnlockExperimentalVMOptions
-XX:G1NewSizePercent=20
-XX:G1ReservePercent=20
-XX:MaxGCPauseMillis=50
-XX:G1HeapRegionSize=32M
-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5009
If you are using DCEVM as an alternate JVM add -XXaltjvm=dcevm to the arguments
For more help read community.liferay/blogs/java-classes-instant-reloading-using-dcevm-hotswap-agent and GitHub/DCEVM