IntelliJ IDEA 2018.1 Public Preview

Good news everyone: IntelliJ IDEA 2018.1 is now ready for Public Preview! The upcoming v2018.1 will bring a lot of important improvements: support for Git partial commits, inline external annotations, merged features from Android Studio 3.0, and many more. We are excited about all these new features, and we encourage you to take the preview build for a ride right away!

800x400_blogIJ_2018_1_PP@2x

Enhancements in code completion

Now completion in the Stream API chains is aware of the type casts. The code completion suggests not only a completion item according to the existing call filter(String.class::isInstance), but also an automatically typecasted completion item.

image37

We have also improved the postfix code completion in the upcoming release. Now the IDE allows you to create your own Java templates or edit and rename some of the predefined Java templates at Preferences | Editor | General | Postfix Completion.

image4

image3

Improvements in data flow analysis

We’ve improved the data flow analysis to detect a wider variety of potential problems in your code.
First, data flow analysis now tracks relations between variables like “greater than” and “less than”. The IDE detects when a condition is always true (or false) in all the possible code paths when the variables are compared.

image17

Another enhancement is data flow analysis now works for non-terminated stream API chains.

image19

The IDE will now warn you when you try to assign a variable to the same value it already contains. This may help you detect and then remove some redundant code.

image32

The IDE also warns you about modifications of immutable collections.

image6

Read this blog post for more details an all the enhancements in data flow analysis.

As always, the upcoming 2018.1 release has a bagful of new inspections and quick fixes. Now, IntelliJ IDEA detects and warns you about while-loops with an idempotent body, as in most cases this indicates a programming error and can lead to a program hang.

image33

Also, the IDE now detects while-loops with a conditional break at the end or beginning of an infinite loop. It offers a quick-fix to replace a break condition with a loop condition, because in most cases it’ll make your code look clearer.

image29

The upcoming IntelliJ IDEA now warns you about any infinite streams that weren’t short-circuited, as such operations can be completed only by throwing an exception. Such code may result in an infinite loop or a running out of memory issue.

image22

You can now sort the array content alphabetically.

image18

If there is a copy constructor that doesn’t copy all the fields in a class, you’ll get a notification about it. Note that the IDE considers fields with a transient modifier unnecessary to copy.

image12

The upcoming IntelliJ IDEA now warns you about an explicitly redundant close() call and provides a handy quick-fix to remove it.

image39

The upcoming IntelliJ IDEA features Java 9 specific inspections and quick-fixes. The IDE checks that a service loaded by ServiceLoader is declared in the module-info.java file and provides a quick-fix to add a missing statement to the module-info.java file.

image24

For an unresolved class mentioned in module-info.java, the IDE now suggests creating that missing class. It suggests creating missing exported packages as well. (The IDE creates the package with the class in the required directory, as you can’t export an empty package in Java 9.)

image2

Now when there are several different approaches on how to fix possible problems in the chosen scope, you can group all the suggested quick-fixes by their quick-fix type. To do this, click the Fix partially button in the Inspection Results Tool Window.

image28

JUnit 5 @Tag annotation support

The upcoming IntelliJ IDEA 2018.1 now supports the JUnit5 @Tag annotation to let you include it in the testing scope, tagged classes, and tagged methods. Select the Tags (JUnit 5) option in the test kind field in the Run/Debug Configuration dialog. Use the Uniqueld field to filter tests according to their id.

image13

Code Generation

When you generate a test class in IntelliJ IDEA, by default it adds the Test suffix to the test class name. Now it’s possible to customize a test class template so that a test class is created with a Test prefix in the test class name. Adjust this in Preferences | Editor | Code Style | Java | Code Generation.

JVM Debugger

The new Throw Exception action now allows you to throw an exception from a certain location in your program without changing the code. It is available from the Run | Throw Exception menu, or the frame context menu during a debugging session.

image43

Print breakpoint stacktraces

The upcoming IntelliJ IDEA 2018.1 allows you to print breakpoints Stacktraces to the console. You can enable the Stacktrace option in the Breakpoints dialog box. The IDE also provides you with an ability to observe multiple breakpoints Stacktraces at the same time in the Console log.

image9

Also, you can now copy the current thread stack trace via a new Copy Stack action which is available from the frame context menu.

image27

Java Compiler

There is a new Use --release option for cross-compilation (Java 9 and later) check-box on the Java Compiler page at Preferences | Build, Execution, Deployment | Compiler | Java Compiler that is enabled by default. When you need to use the --source and --target options with Java 9 and link against Java 9 classes at the same time you now can disable the new checkbox.

Now you can also use a specific version of the ECJ compiler. Select Eclipse from the Use Compiler drop-down menu, and specify the path to the jar with the compiler.

Editor

In IntelliJ IDEA, you can annotate your code with external annotations even when direct annotation of the source code is not possible (library classes). You can configure your annotations in the annotations.xml files, which are stored outside of your source code.

Previously, the IDE only showed the @ icon in the gutter near the externally annotated code, but now it shows these external annotations inline in your code.

image30

IntelliJ IDEA now lets you view the automatic inferences of @NotNull or @Nullable annotations right in your source code (not only in the gutter icon near the inferred annotation, as it was before). You can enable the Show inferred annotations inline check-box in the Preferences | Editor | General | Appearance.

image26

If there are any problems in your code, the upcoming IntelliJ IDEA 2018.1 will let you find them quickly. The IDE now highlights the folded code regions that contain errors or warnings, and colors such blocks according to their validation status.

image11

The IDE also highlights the folded code regions if they contain any matching occurrences when you search through the current file.

image14

When you place the caret on an identifier and the IDE highlights its usages, you can now use the new Alt + Wheel down or Alt + Wheel up shortcuts to jump to the next or previous identifier occurrence.

image41

Project Configuration

There is a new Include dependencies with “Provided” scope option for the Application and Spring Boot configurations in the Run/Debug Configurations dialog. This new feature allows you to add “provided” dependencies to the classpath when needed. Please note that the Include dependencies with “Provided” scope option is enabled by default for Spring Boot applications.

The new release will also let you change qualified names for several modules at the same time, by using the new Change Module Names… action from the context menu of the Project Structure dialog.

image5

Replace improvements

In IntelliJ IDEA 2018.1, you’ll be able to preview a regex replacement in the Replace in Path window.

image1

Structural Search enhancements

We’ve improved Structural Search to help you find method calls to annotated methods. In the Structural Search dialog, you can create your own search template or choose from the existing search templates. In the following example, the Structural Search finds all method calls to methods marked as @Deprecated.

image40

StructuralSearch

Groovy

For Groovy files and modules, a new refactoring action is available from the context menu in Refactor | Convert to @CompileStatic.
The Convert to @CompileStatic action annotates every groovy class in the scope of the @CompileStatic annotation.

2018-02-27 18_05_36

Android

Here is some long awaited news for Android Developers! The upcoming IntelliJ IDEA 2018.1 merges the changes from Android Studio 3.0 and brings in dozens of new features. Here are the major new ones:

First, IntelliJ IDEA now supports the latest Android Oreo APIs, and lets you build Java 8 Android applications as well as Kotlin Android applications.

Second, the IDE now supports Gradle 3.0.0 for Android applications.

The Layout Editor has been improved with a new toolbar layout and icons, updated layouts in the component tree, a new error panel, and more.

image36

Now you can create App Icons with the updated Image Asset Studio. Right-click the res folder in your Android project, and select New | Image Asset from the context menu. In the Asset Studio window, select Launcher Icons (Adaptive and Legacy) as the icon type.

image25

The IDE now supports building Instant Apps – lightweight Android apps that can be run without being installed. Before building Instant Apps, make sure that the Instant Apps Development SDK is installed. You can check which SDK tools are installed if you need to, in Preferences | Appearance & Behavior | System Settings | Android SDK in the SDK tab.

image35

image10

The new Device File Explorer Tool Window displays the file and directory structure of your Android device or emulator. Use the Device File Explorer Tool Window to view, copy, or delete files on an Android device. You can access it through View | Tool Windows | Device File Explorer.

image31

The upcoming IntelliJ IDEA 2018.1 also merges Android Profiler – a brand new suite of profiling tools that provide real-time data for your app’s CPU, memory, and network activity.

image15

To learn more, please refer to the Android Studio Release Notes.

Version Control System

One of the highlights of the upcoming release is support for partial Git commits (git add -p). IntelliJ IDEA will allow you to associate the code chunks with a changelist. Create a changelist, put all the needed code chunks there, and then commit it. The IDE now commits only the selected changes from the file and skips all other changes.

To add the required code chunks to a commit, use the check-boxes in the gutter of the Diff pane in the Commit Changes dialog.

image34

To move code chunks between changelists, bring up the context menu of the Diff pane in the Commit Changes dialog, and then click Move to another changelist.

image42

As another option, the IDE lets you add code chunks to a changelist from the editor by simply clicking a change marker in the gutter.

Furthermore, the upcoming IntelliJ IDEA 2018.1 includes an ability to toggle the grouping of your local changes. To do this, go to the Local Changes tab of the Version Control Tool Window and look for the new Group by icon. Use it to group local changes by directory, module, or repository. Now you can select either a single grouping option, or all three at once.

image8

There are several improvements in the Log tab – the tab that’s available for Git and Mercurial VCS. The Commit Details pane of the Log tab has been redesigned. Now you can quickly navigate to a commit in the Log by clicking the corresponding commit hash in the Commit Details pane.

image21

For Git integration, we’ve improved the performance of the History for revision tab. The tab also has a refreshed UI.

image16

The Abort Rebase, Continue Rebase, and Skip Commit actions are now available from the Git Branches pop-up if there is an ongoing rebase process.

image23

The IDE has a new default shortcut to perform the Commit and Push… action from the Commit Changes dialog. Please use Alt + Cmd + K (on macOS) or Alt + Ctrl + K (on Windows and Linux).

Moreover, the Clone Repository dialogs for Git and GitHub have been merged into one. Autocompletion for GitHub repositories is now available in the new Clone Repository dialog. You just need to log in to your GitHub account using the Log in to GitHub… button.

image38

We’ve also removed the SVNKit library. See this blog post for more details.

Enhancements in Docker Compose

The Docker Compose workflow has been improved. The Run/Debug Configurations dialog for the Docker Compose run configuration has been improved to make it possible to use important Docker Compose features such as support of multiple compose files, and the ability to choose a service to run.

The Docker plugin now supports Multiple Docker Compose files and respects not only a docker-compose.yml, but also an optional docker-compose.override.yml file. You can add the docker-compose.override.yml as any other override file, right after the base configuration file.

Screen Shot 2018-02-27 at 11.07.19

For Docker Compose files, you can now define an environment variable in the updated Run/Debug Configurations dialog. Also, if you want to use the --build command line options, enable the Force build checkbox.

The Docker plugin allows you to choose the set of services to run after you choose configuration files in the Docker Compose Run configuration.

The Spring Boot enhancement

  • Support for Spring Boot Devtools.
  • A new gutter icon lets you open methods with @RequestMapping annotations via the new REST client.

OTHER

  • The IDE automatically resizes the graphics to fit the window.
  • During the import of an Eclipse project, IntelliJ IDEA is now able to import your code style configuration.
  • There is a new Open in terminal action that launches the integrated terminal on the folder’s path.
  • Better HiDPI support on multiple displays for Windows.

Also, the JDK has been updated to 1.8.0_152-release-1136-b16, with the following fixes integrated:

  • Follow-up fix for the issue with running IDE on 32-bits Windows  JRE-590.
  • Position of IME Composition windows was fixed  JRE-668,  JRE-669.
  • The issue with displaying UI after changing DPI was fixed  JRE-660.

With the upcoming IntelliJ IDEA 2018.1, we have completely reworked our focus subsystem. Many focus-related issues have been already fixed, such as: the Search Everywhere pop-up that now receives focus, and the Project tool window that now receives focus when invoked from the Select In pop-up and many others. Please check out this link. We expect that with the updated focus subsystem we can fix focus related issues much faster.

A big thanks for all the bug reports, please keep them coming!

Last but not least, the built-in SSH executable is now compatible with the new GitHub cryptographic standards. Learn more here.

You can look through the full list of v2018.1 changes in the Public Preview release notes.
Here are the release notes for the 181.3986.9 build.

As this post has hopefully demonstrated, tons of improvements are coming in the upcoming release. Download the IntelliJ IDEA 2018.1 Public Preview build and see for yourself! We welcome your feedback, so please reach out to us in the EAP discussion forum, issue tracker, on twitter, or in the comments below.

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.

26 Responses to IntelliJ IDEA 2018.1 Public Preview

  1. Roman Fiodorov says:

    It is great! Thank you!

  2. Matt says:

    I have some code like this, but I don’t see anything in the gutter:

    @RestController
    public class HealthCheckController {

    @RequestMapping(“/health”)
    public String healthCheck() {
    return “Service is running”;
    }
    }

    Always happy for a new release though :)

    • Zlata Kalyuzhnaya says:

      Hi Matt,
      1. Create Spring Boot Run Configuration in the Run/Debug Configurations dialog
      2. Activate the Enable JMX agent checkbox in the Run/Debug Configurations dialog
      3. In your pom.xml add dependency to spring-boot-starter-actuator

  3. SG says:

    Great update.
    Detail in first example. Prefer … filter(String.class::isInstance).map(String.class::cast), instead of lambda cast.

  4. Joe says:

    Any chance we’re ever going to get the Mockito Recorder from Android Studio?

  5. Max says:

    Where’s MacBook’s touchbar support?

  6. Robbin says:

    Where’s MacBook’s touchbar support?

    • Charlie Hayes says:

      What do you mean touchbar support? Does IDEA break the touchbar?

    • Will Stevens says:

      Good point. Touchbar as in IntelliJ uses the API to put special Intellij Touchbar buttons. Useful examples include debug buttons like step into, over, run, etc.. or a button to open Type, File.

  7. Grigori says:

    No Scala changes?

  8. Charlie Hayes says:

    The PHP and Python plugins don’t work with the new version, among many other plugins.

    • Zlata Kalyuzhnaya says:

      Hi Charlie,
      Can you please share more details: OS, IntelliJ IDEA Edition, Build number
      thank you!

      • John Paraskevopoulos says:

        IntelliJ IDEA 2018.1 (Ultimate Edition)
        Build #IU-181.4203.550, built on March 26, 2018
        JRE: 1.8.0_152-release-1136-b20 amd64
        JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
        Linux 4.15.10-200.fc26.x86_64

        Python plugin doesn’t work.

        Cannot determine module type (“PYTHON_MODULE”) for the following module:”ganetimgr”
        The module will be treated as a Unknown module.

        Django / flask project support does not work as well).

        Error Loading Project: Cannot load facet Django (ganetimgr)

        There are also UI glitches that did not exist before. I’m running awesome as my tiling window manager and I get overlapping submenus when trying to use the options bar. Also win17 / win9 / win[any-kind-of-number] shown as a header for each option menu.

  9. Nathan Williams says:

    Hopefully more of the focus regressions will get fixed before release. Things are getting better, but it’s still rough in places. IDEA-181572 IDEA-187610

  10. Svetlin says:

    What’s the expected GA release date ?

  11. Urs Metz says:

    Regarding the new focus subsytem: For me (I’m running Arch Linux with i3) the open class/file/… popup stopped working correctly in this EAP: after typing some letters in the input box the focus jumped to the currently open file. Turning on focus.follows.mouse.workarounds solved the issue, but I think it would be good to when you had another look at https://youtrack.jetbrains.com/issue/IDEA-112015

  12. Stuart Begg says:

    The released version of IntelliJ IDEA doesn’t appear to support the Ruby plugin. Is this correct?

    If so, it should be mentioned, because it’s a deal breaker for me.

    • Stuart Begg says:

      That’s the 2018.1 release of IntelliJ IDEA, of course.

    • Stuart Begg says:

      Okay. I was wrong. It’s just that it installed (kept) a previous (incompatible) version of the Ruby plugin from my 2017.3.5 version of IntelliJ during migration. Don’t mind me, sorry about that confusion (on my part).

  13. Jesse Boyd says:

    Why does code completion not work for .groovy files in 2018 Intellij Ultimate? I type main and there are not suggestions. In a groovy script I type main it does show correct code completion but when I hit enter it fills in “main()” // missing String[] args //

    Why does a script not run when I right click on it if another completely different .groovy file has a compilation error? A script should be able to run on it’s own merit.

    In Eclipse I can right click on a class and create a jUnit test which will also import jUnit if needed. How do you do that quickly in intellij?

Leave a Reply

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