"Make project automatically" - only while not running/debugging

In build IU-123.45, I see an addition to the "make project automatically" option: "only works while not running / debugging".
Does this mean that if we have any run configuration started, this option won't do anything?

If this is so, then this option is quite useless for me. This is because I always have my web app running together with JRebel.
I suspect many others will also not be benefitted of this feature.

Could you explain why this restriction?
Is there any chance this restriction will be lifted soon?

15 comments

Hi Cristian,

> Could you explain why this restriction?

Sure. The main goal is to have all changes that are done to class files under control. When you run the application you want to be sure that it is run exactly on the same set of classes that was present on disk before you started your program. If you need to update classes, you invoke make explicitly and all classe are updated on disk as they should. But here you define when to update and not the program. Another point is that classes are updated on disk in non-atomic way. First old classes are removed in order to avoid compiler to use them for resolve, then compiler is run and classes are generated. So at some random points of time while the application is running the class set on disk may be incomplete or half-updated. If at this point the running application performs class loading, you may end up with some weird state where application is not functioning properly, so you'll have to restart it. If there was a way to determine "safe"  points of time where automatic class generation won't harm running application, we would not have put this restriction. But for now we believe that the current way of working is the best solution.



Regards,
  Eugene.
0

Hi Eugene,http://devnet.jetbrains.net/people/jeka

Thanks for responding.

> First old classes are removed in order to avoid compiler to use them for resolve, then compiler is run and classes are generated. So at some random points of time while the application is running the class set on disk may be incomplete or half-updated.

Does this mean that the new compiler mode is basically unusable together with JRebel? I think I've seen JRebel re-loading a lot of classes when only some changed.

0

> Does this mean that the new compiler mode is basically unusable together with JRebel?

In terms that you expect the make to start "automatically" - yes. By explicitly running make (ctrl-F9) all classes will be updated and JRebel will reload them.

0

The automatic part I understand. It's a pitty that it won't work while the program is running, but that's not such a big deal.

I am more concearned about this one:
> First old classes are removed in order to avoid compiler to use them for  resolve, then compiler is run and classes are generated.

To be clear: only classes that needs recompiling (+dependencies) will be deleted and recompiled, correct?
If it's like this, then it's fine by me.

I am asking this question because in an older EAP, I've seen JRebel reloading a lot more classes than were changed which made me think some .class files changed timestamp unnecesarily. But I think that might have been a bug which you already fixed.

0

> To be clear: only classes that needs recompiling (+dependencies) will be deleted and recompiled, correct?

Yes, exactly. This is what we call "incremental compilation". Though I must admit that the set of recompiled classes is not "strict" and depending on particular changes may be larger than actually needed: there is always a tradeoff between the precision and the speed of analysis. The same situation was with the previous implementation, so this is not a "degradation". Of course, we strive not to compile what is not needed to be compiled and for some cases the new implementation beats the old one.

0

Thank you very much for clearing things up.

0

Is it possible to make this a setting?

This is terribly inconvenient. I really liked it the way it was. This is enough for me to switch back to the older build or start using 11 again...

0

No need to go back. You can use the old compiler mode in 12.

0

> So at some random points of time while the application is running the  class set on disk may be incomplete or half-updated. If at this point  the running application performs class loading, you may end up with some  weird state where application is not functioning properly, so you'll  have to restart it. If there was a way to determine "safe"  points of time where automatic  class generation won't harm running application, we would not have put  this restriction.

I don't see how this is different from the application doing class loading while manually invoking Make. Neither IntelliJ nor the developer can know when it's safe to invoke Make. But I haven't had this issue yet in many years of IntelliJ usage. Admittedly, the new compiler mode will reload classes more often, but I still think it's a good idea to make it a setting to see how things are going with real-world projects.

0

This is horrifying.

I run Build - Make and I get some error about how Hot Swap Failed - Operation not supported by VM.

I build Grails applications - Are you saying if I want to debug my application I HAVE TO RESTART THE SERVER EVERYTIME I MAKE A CODE CHANGE???????

Please give me some answers here - I have been reccommending IntelliJ to everyone I know and I would hate to be seen as giving bad advice. When it's not broke don't fix it.

0

James,

Hot Swap failures has nothing to do with IntelliJ - it's a limitation of the JVM. Buy a JRebel license if you want to overcome some of its limitations. Without JRebel you can only change method bodies without restarting. I'm not sure how Grails works, so I can't help you there. Again: nothing to do with IntelliJ or its new compiler system.

0

Before this new feature I could change nearly anything in my grails projects without having to restart the grails application (in debug or run mode). Now I have to restart to get any changes to take affect. What is the problem?

0

File -> Settings -> Compiler -> Use external build.
I would encourage you to leave it enabled if you don't have any problem because it's much faster that the old mode.

0

http://youtrack.jetbrains.com/issue/IDEA-97889

Possibly this is the issue instead of what this thread was created for.

0

Please sign in to leave a comment.