IntelliJ IDEA 2018.1 EAP: inline external annotations, Java Compiler enhancement and more
As you may already know, IntelliJ IDEA provides an ability to annotate your code via annotations.xml files, which are stored outside of your source code. These external annotations are especially useful when direct annotation of the source code is not possible (library classes). IntelliJ IDEA shows the @ icon in the gutter near the externally annotated code. With the upcoming IntelliJ IDEA 2018.1, this functionality has been extended and now the IDE shows these external annotations inline in your code.
IntelliJ IDEA automatically inferences the @NotNull or @Nullable annotations and places the gutter icon near the inferred annotation. Starting with the latest EAP, the IDE provides the ability to show those right in your source code.
This option is disabled by default. To start using the new functionality, please enable the Show inferred annotations inline check-box in the Preferences | Editor | General | Appearance.
When there is a choice of more than just one annotation to add, the IDE now groups all annotation suggestions under the submenu.
The constant conditions and exceptions inspection now alerts you whenever nullable values are assigned to non-annotated fields.
To start using this functionality, go to the Preferences | Editor | Inspections | Probable bugs | Constant Conditions & exceptions and enable the check-box Suggest @Nullable annotation for methods/fields/parameters where nullable values are used.
Also, the Redundant Collection operation inspection has been updated and now the IDE advises you to simplify a call to Collections.sort(Arrays.asList(x)). It also provides a handy quick-fix to simplify it.
A new Use
--release option for cross-compilation (Java 9 and later) check-box has appeared in the Preferences | Build, Execution, Deployment | Compiler | Java Compiler. The option is enabled by default. IntelliJ IDEA deduces from project settings when cross-compilation is needed and automatically makes use of the
--release compiler option for Java 9. If you need to use the
--target options with Java 9 and link against Java 9 classes at the same time, you can disable the new check-box.
With the latest EAP build, you can also use a specific version of the ECJ compiler if the bundled one does not suit your needs. Go to Preferences | Build, Execution, Deployment | Compiler | Java Compiler and select Eclipse from the Use Compiler dropdown menu. A new field will appear where you can specify the path to the jar package with the needed compiler.
Version Control Systems
We’ve redesigned the Commit Details pane of the Log tab (available only for Git and Mercurial). The pane is now divided into several parts, and the Select All action (Cmd + A / Ctrl +A) independently copies the Commit message, the author or tags, depending on where the cursor is.
The Clone Repository dialogs for Git and GitHub have been merged into one. To log in to your GitHub account, please use the new Log in to GitHub… button.
After you log in to your GitHub account, the autocompletion for GitHub repositories will be enabled. The IDE makes suggestions based on the list of the available repositories.
IntelliJ IDEA now provides a new ability to change qualified names for multiple modules at once. This is done via the new Change Module Names… action, from the context menu of the Project Structure dialog.
Starting with this EAP, it’s possible to move the patch download process into the background and continue working in the IDE. Click the new Background button, and you’ll be notified when the patch is downloaded.
Last but not least, the JDK was updated to 1.8.0_152-release-1136-b11 and the following notable fixes were integrated:
- Unlimited cryptographic policy was enabled by default JRE-638
- The issue of empty Memory View in Debug session of application running with JRE9 was fixed JRE-641