IntelliJ IDEA
IntelliJ IDEA – the Leading Java and Kotlin IDE, by JetBrains
What’s new in IntelliJ IDEA 2018.3 EAP3?
The fresh IntelliJ IDEA 2018.3 EAP build that we have released today comes with the ability to disable formatting for groups of files, new Java inspections, improvements in VCS, and more. You can download it right now from the website, via Toolbox App, or update to it from the IDE. Let’s take a closer look at all these improvements.
Editor
In the upcoming IntelliJ IDEA 2018.3, you can now lock certain files from formatting, imports optimization, and code rearrangement, actually from any operations where formatting is involved, explicitly or implicitly.
You can add files to a scope which should not be formatted using the Preferences/ Settings| Editor | Code Style “Formatter Control” tab.
If you want protection from formatting any java files whose names end with “Test”, you can create a scope with the following pattern.
If then you try reformatting on files with disabled formatting, the IDE will give you a notification with the “Show settings…” action link which navigates you to the “Formatter Control” tab of Preferences/ Settings|Editor|Code Style. The same applies to selected fragments of code.
Files in selected scopes will be also skipped when formatting is invoked on multiple files including “Reformat on commit” in the VCS dialog.
Besides being stored in the scope, the pattern is also stored in the code style settings. Thus copying the code style settings, exporting and then importing them again, will also activate the pattern and make it work. If a named scope already exists, it will take precedence over the pattern stored in the code style. Editing a pattern from the code style settings will also update it there.
By the way, you can now navigate between editor tabs via a shortcut ( tab1, tab2, tab3…tab9 or just straight to the last tab). Note that there are no default shortcuts for these actions, but you can assign your own shortcuts in the Preferences / Settings | Keymap | Other.
Java
The IDE will detect cases where arguments of methods have the same value when it doesn’t make any sense. The reported methods include Math.min, Math.max, String.replace. This is part of our data flow analysis, so not only simple cases like Math.min(a, a) are ported, but also more complicated cases like if(a == 100) return Math.max(a, 100);
Sometimes if you have two or more conditions, the first one will be redundant, because the second one covers all the cases covered by the first one. A classic example is “obj != null && obj instanceof String” where the instanceof check already implies non-nullity. Before this was reported in a pattern-based inspection called the “Unnecessary ‘null’ check before the ‘instanceof’ expression or call”. Now we have created a data flow based inspection called “Condition is covered by further condition” which generalizes the problem. For example, the first check in “val != -1 && val > 0” is also unnecessary as it’s covered by the second check. Now it’s marked as redundant and can be removed via a quick-fix.
The new “Condition is covered by further condition” inspection also has an extra relation check between three variables which can be deduced from the transitivity:
VCS
The upcoming IntelliJ IDEA 2018.3, displays the branch you are committing the files to right inside the Commit dialog. This has been implemented for Git, Mercurial, and SVN.
Last but not least, we now support OpenShift Origin (V3).
Download and try out the new EAP build and remember to share your feedback here in the comments, on Twitter, or in our issue tracker.