IntelliJ IDEA 2017.3 EAP: Configurable command line shortener and more
We are approaching the release of IntelliJ IDEA 2017.3 and are proud to give you a new EAP build! This build comes with awesome new features, and we hope these improvements will help you become even more productive.
Configurable command line shortener
When the classpath gets too long, or you have many VM arguments, the program cannot be launched. The reason is that most operating systems have a command line length limitation. In such cases IntelliJ IDEA will try to shorten the classpath.
There are several approaches to shorten the classpath. Initially, IntelliJ IDEA tried to write the long classpath into the text file (which means an intermediate classloader to the application). But unfortunately, this didn’t work for some frameworks, e.g. JMock. Then, IntelliJ IDEA tried to use a more or less standard way, which was to pack the long classpath into the classpath.jar. Unfortunately, that didn’t work either, for some other frameworks.
And, sadly, there is no way to predict which kind of shortening would work for the user application. So the user is left having to make this decision. For Application, JUnit and TestNG configurations, 2017.3 EAP provides a way to configure the shortener.
Starting with this EAP, there is no more need to edit the settings of your IDE through the XML files.
IntelliJ IDEA 2017.3 EAP build provides a convenient way to specify the method to shorten command line, for each configuration.
In the Run/Debug Configuration dialog, a new field appeared: Shorten command line. The new field allows you to choose the way the IDE will shorten the command line from a drop-down list:
None: This is the default option. The IDE doesn’t shorten the long classpath. If the command line exceeds the OS limitation, the IDEA will not be able to run your application, but the tooltip will suggest configuring the shortener.
JAR Manifest: The IDE passes the long classpath via a temporary classpath.jar. The Original classpath is defined inside MANIFEST.MF as a Class-Path attribute in classpath.jar.
classpath file: The IDE will write a long classpath into a text file.
User-local default: Legacy property. This option is set automatically for projects created before this EAP. The IDE will configure this setting, depending on the value of the properties set in: idea/workspace.xml file, property: “dynamic.classpath” and idea.config.path/options/options.xml file, property: “idea.dynamic.classpath.jar”.
So you will have User-local default: none – if nothing was specified for the classpath shortener before, User-local default: JAR Manifest – if your settings specified the shortener via classpath, and User-local default: classpath file: – if your settings specified the shortener through the text file.
You can set up a default way to shorten the command line and use it as a template for further configurations. IntelliJ IDEA 2017.3 enables you to share your configuration with your colleagues, so all team members will have the same behavior for the application/tests, even on different operating systems. The only exception is for the parameter User-local default: this parameter won’t be shared if the configuration itself is shared. If you want the team to have the same experience, it’s advised to explicitly set this option.
Up until now, when the IDE shortened the classpath via classpath.jar, you would see only the classpath of the temporary jar: -classpath C:\Users\jetbrains\AppData\Local\Temp\classpath.jar.
In the new IntelliJ IDEA 2017.3 EAP you can preview the full command line if a long classpath was shortened via classpath.jar (JAR Manifest option in Run/Debug Configuration dialog box).
As the Debugger is one of most important tools for any developer, we’re constantly working on making it even more capable and easier to use.
IntelliJ IDEA provides essential features for debugging asynchronous applications: Async stacktraces. The Async Stacktraces feature shows the full picture of the data flow between the threads. It allows you to view the combined stack traces of all threads.
For this code example:
We’ll have the following stacktrace:
Until now, in order to use the Async stacktraces feature, you had to specify the stacktraces to capture and the point to insert. This approach was not very convenient. Another issue that you probably faced while using this feature was a significant overhead.
To make the Async Stacktraces feature easier to use, we developed a new mechanism: Instrumenting agent. The new Instrumenting agent method extends the Async Stacktraces feature and provides almost the same functionality, with a very low overhead. You won’t need to spend time on configuring Async Stacktraces anymore, as common capture points are built-in. Starting with this EAP, the new Instrumenting agent option is enabled by default.
You can also set up a special configuration manually, if needed. (Settings | Build, Execution, Deployment | Debugger | Async Stacktraces).
Another improvement in this update is also related to the Debugger. With IntelliJ IDEA 2017.2, we presented a separate plugin to visualize the Java Stream operations called Java Stream Debugger. In this IntelliJ IDEA 2017.3 EAP build, the Java Stream Debugger plugin is bundled and available inside the Debug tool window.
Smarter code completion
The Smart Completion becomes aware of the type casts and uses them to suggest the chains of method calls. Please note that in order to use the Smart Completion feature, the project needs to be compiled by IntelliJ IDEA, don’t delegate the compilation to Gradle.
Improvements in Java inspections and actions
The IDE inspection for redundant throws declaration is now available on the fly.
IntelliJ IDEA 2017.3 provides quick-fix suggestions for deprecation inspections if a direct replacement method is available in JavaDoc.
IntelliJ IDEA detects different code inefficiencies, such as Invert boolean method inspection. If a method was used only in an invert way, the method would be highlighted and a quick-fix would be suggested. Starting from this new EAP build, this inspection is performed on the fly.
Starting with this EAP, IntelliJ IDEA warns you about duplicate Map keys.
And about duplicate Set elements.
New inspections for Fuse Stream API call chain and subsequent sort/toArray/collection creation:
There’s also a new intention action, Unroll loop:
- New improvements for unloaded modules: automatically unload newly added modules and check that unloaded modules compile successfully before commit.
- The ClearCase plugin is not bundled anymore.
- After a Drag & Drop from the Local tab to the Shelf tab in the Version Control Tool window, you can rename the changelist on the fly.
- You can also select the place where to drop your file if you Drag & Drop from Shelf to Local tab.
- When applying a patch from a file or the clipboard, the author and the commit message are automatically saved in the changelist and are used when the changelist is committed.
More details are coming in a separate blogpost. Stay tuned!
Check the release notes to satisfy your curiosity fully.
We hope you find these improvements useful! Please download the IntelliJ IDEA 2017.3 EAP build. And as usual, don’t forget that bug reports along with your feedback are very welcome in our issue tracker.