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.

Screen Shot 2017-10-09 at 08.58.33

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).

Screen Shot 2017-10-10 at 13.26.14

JVM debugger

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:

Screen Shot 2017-10-11 at 11.23.37

We’ll have the following stacktrace:

Screen Shot 2017-10-06 at 16.21.55

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.

Screen Shot 2017-10-08 at 20.03.25

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).

Screen Shot 2017-10-06 at 17.41.17

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.

2017-10-04 17_03_19

Click here to learn more about the Java Stream Debugger.

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.

Screen Shot 2017-10-09 at 5.57.23 PM (1)

Improvements in Java inspections and actions

The IDE inspection for redundant throws declaration is now available on the fly.

InspectionThrows

IntelliJ IDEA 2017.3 provides quick-fix suggestions for deprecation inspections if a direct replacement method is available in JavaDoc.

QuickFixForDeprecation

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.

InspectionInverted

Starting with this EAP, IntelliJ IDEA warns you about duplicate Map keys.

InspectionMap

And about duplicate Set elements.

InspectionsSET

New inspections for Fuse Stream API call chain and subsequent sort/toArray/collection creation:

12102017

fuseStreamOperations.JustArrayList

fuseStreamOperationsToCollectionGeneric

There’s also a new intention action, Unroll loop:

UnrollLoopIntention
There are many more enhancements to different areas in this EAP:

VCS

  • 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.

Happy developing!

 

About Zlata Kalyuzhnaya

IntelliJ IDEA Marketing Manager at JetBrains.
This entry was posted in EAP Releases, New Features and tagged , , . Bookmark the permalink.

6 Responses to IntelliJ IDEA 2017.3 EAP: Configurable command line shortener and more

  1. Dmitry says:

    Some more ideas for ways to shorten a command line:

    1) If a folder is present multiple times in the classpath and the classpath has all the jars from that folder – replace them all with “/*”

    2) Symlink (hard-link?) classpath jars into a temporary folder and use “-classpath /*”

    These should be fairly compatible. And do not require any special tricks like intermediate classloaders.

    There is one drawback though. The order of the jars enumeration is not specified.
    If it’s critical the user should use another shortening option.

    • Dmitry says:

      Comment sanitizer swallowed ” both times before ‘/*’

      • Anna Kozlova says:

        Hi Dmitry,
        thanks for the suggestions!

        1) What comes to my mind is that most people nowday use maven or gradle, and jars there are located per artifact id, per version. So, unfortunately, it won’t help much in those cases.

        Anna

  2. Dmitry says:

    .. [ folder ]

  3. Mike says:

    How do you configure intellij to not delegate compilation to gradle?

    “Please take into the consideration, 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.”

  4. Roman Koreshkov says:

    “Configurable command line shortener” – it is long awaited feature. Now we can use IDEA for running a selected test from the test’s code. Awesome!

Leave a Reply

Your email address will not be published. Required fields are marked *