IntelliJ constantly indexing project - java

I'm really impressed with the startup time of IntelliJ which is really fast, however, every time I open it when it has started its always doing this indexing which causes everything to slow down, even if previously I have gracefully closed IntelliJ, the next start it will index again, why is that?

IntelliJ may not be the only application using your project working directory.
If you use version control like git, SVN, or hg, or other tools such as code generators that operate on the project, then they will likely not know about IntelliJ(with or without version control-ignored IntelliJ data), and will simply write their changes.
For that reason, the IDE reindexes completion and outline data to be consistent with the code,

Related

Netbeans: debugging Java Servlet on Tomcat opens two debug consoles?

I have been developing a Java Servlet app over several years. I have recently started to have slight problems debugging the app with Netbeans. When I click "Debug Project" under the Debug-menu in Netbeans 11.1, the following happens:
Tomcat is started and the app is deployed.
A debugger console is opened that says "User program running".
The app is recompiled.
There seems to be an attempt to somehow redeploy/debug(?) the app again: a second debugger console is opened but this one says "Connection refused".
Historically only steps 1-2 have occurred. I have no idea why recently also steps 3-4 have started to occur. E.g. the only changes I have done to the project pom-file is that some dependencies have been updated to a newer version. The only other major changes have been that the underlying Java SDK is now for version 12 and Netbeans has been updated from 8.2 to 11.1.
The end result is sort of half-ok: I am able to debug (set breakpoints, view variables etc.) the app. But one annoyance is that hot redeploying does not seem to work anymore. Previously changing and saving a Java code file caused that one file to be recompiled and the updated app to be redeployed automatically. This does not happen anymore if I modify and save Java code; I have to compile and redeploy manually. And of course also the fact that the whole project is recompiled at the beginning of each debug session slows things down. I assume these problems must be related to how the extra steps 3-4 have started to occur, but have no idea what could trigger those.
I wonder if anyone has any ideas what might cause this?

Spring Eclipse STS horrible code completion performance

I'm at the mercy of being on a corporate laptop but since using Eclipse STS for spring development for the last few years both the previous and current version I have always had issues with code completion freezing for a few seconds or throwing an exception with missing content message. My question is, how can I get my sanity back being able to code quickly and not have to wait seconds at a time just to get a code completion suggestion in the java editor for spring STS. is this a known bug? this does not happen in other flavors of eclipse and it really makes the product less desirable to use, but i guess that is the reality of open source software I appreciate all the development effort put into this product just hope someone can help me resolve this code completion issue because it really slows me down. - Duncna

What happens when i start an ant build and keep coding, are my changes (after running ant build) neglect or not?

I'm using Intellij IDEA, working on a Hybris project. We use ant for build, but the build takes too long (about 15 min), so when i start the build, I must stop coding, so i lose a lot of time.
My question is, can I keep coding while the build is running? Or will my uncomplete extra code make the build fail?
Thank you
can I keep coding while the build is running?
No, you should not change the code while the build is going on. Yes, you can keep changes unsaved :)
will my uncomplete extra code make the build fail?
Yes, it might.
I lose a lot of time.
Use code hot-swapping tools, like Jrebel(Licenced), DCEVM(opensource).
It is simply not possible to edit while building. You might end up with an inconsistent build. If you want to speed up development, try to set up something like jRebel.
you can just separate editing from building process by build on another computer device or try CI while you are using any CVS like GitLab, GitHub.

Reverting source code to Java after IntelliJ's Kotlin > Java conversion

So I wanted to try out converting our backend API source code which is written in Java and see how it looks (IIRC there is a preview before converting), but once I did it it automatically started converting all the files in the selected folders, and in the end it asked for code corrections, which I responded with no as I wanted to cancel it and now I am stuck with a broken code base with no other options than:
Reverting to the last git commit and reimplementing all the changes done from my side (I could have prevented it but committing before the conversion but oh well)
Continue using Kotlin to code in but I have code errors which I don't know how to fix
What I am asking instead is if there's anyway to convert Kotlin back to Java in IntelliJ IDEA? Thank you in advance
Intellij has a feature called Local History and it can be used to go back in time for things you did not commit to your source control system. This history is retained until you install a new version of IntelliJ IDEA or invalidate caches. Read more in the Intellij help for the feature.
Your source code constantly changes as you edit, test, or compile. Any version control system tracks the differences between the committed versions, but the local changes between commits pass unnoticed. Local History is your personal version control system that tracks changes to your source code on your computer and enables you to compare versions and roll changes back, if necessary. Local History is always at your disposal, no steps are required to enable it.
Local History is independent of external version control systems and works with the directories of your project even when they are not under any VCS control. It applies to any structural artifacts: a project, a directory or package, a file, a class, class members, tags, or selected fragment of text.

Does Eclipse debugger support save/restore or checkpoint/rewind?

What I mean is the following, illustrated via an example:
I start my Java application (which happens to be a simulator). The application runs for 1 hour and fails. I want to relaunch my application in debug mode, run it to minute 59, then start stepping through the code. At any point, I want to get back to the state that was present in minute 59 and re-start my debug.
Does Eclipse or some plugin have such support? If not, is there another open source application that can be used?
This can be accomplished by using a VM and simply saving state at the point of interest. But I'm wondering if there is a more native/faster Java solution.
The only possible solution to do this in Java that I know is this debugger from Chronon http://www.chrononsystems.com/ which integrates with Eclipse IDE.
The idea is that you record a debugging session which let you playback it. Although this is non-opensource and licensed software, it's still a cool product.
This could be done using a virtual maschine and taking a snapshot at the desired debugging state. You can then apply this snapshot over and over again, though this solution takes a considerably amount of time.

Categories