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.

EditorDisableForm

If you want protection from formatting any java files whose names end with “Test”, you can create a scope with the following pattern.

EditorDisableFormating2

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.

EditorDisableFormating

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.

SelectTabShortCut2

SelectTabShortCut

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

JavaMinMAx

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.

JavaSimplifingCondition

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:

JavaSimplifingCondition2

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.

Screen Shot 2018-09-20 at 08.58.14

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.

About Zlata Kalyuzhnaya

IntelliJ IDEA Marketing Manager at JetBrains. twitter: @ZlataKalyuzhnay ‏
This entry was posted in EAP Releases and tagged . Bookmark the permalink.

8 Responses to What’s new in IntelliJ IDEA 2018.3 EAP3?

  1. Edoardo Luppi says:

    The branch thing is like “my god finally”.
    Thanks! A suggestion would be an option to exclude class fields from formatting.

  2. Cidereal says:

    “the instanceof check already implies non-nullity”
    This is true in C#, but not in Java. In Java the variable can be null and the result of instanceof will be false, while in C# you get null reference exception.

    • Tagir Valeev says:

      “the instanceof check already implies non-nullity” means that “if instanceof check is true, then value is non-null”. Sorry if the wording caused confusion. That’s why this simplification is possible in Java. Were instanceof throwing an exception, it would be not possible to remove null-check without semantics change.

  3. Eugene says:

    When I try run Spring project in 2018.3 (all EAPs)
    Process finished with exit code -1073741819 (0xC0000005)

    Running in debug mode goes fine.

    Used jdk1.8.0_181 and jdk-9.0.1

    For example: Hello World Spring Boot project

    <project …

    org.springframework.boot
    spring-boot-starter-parent
    2.0.5.RELEASE

    org.springframework.boot
    spring-boot-starter

    @SpringBootApplication
    public class DemoApplication {

    public static void main(String[] args) {
    SpringApplication.run(DemoApplication.class, args);
    }
    }

    “C:\Program Files\Java\jdk-9.0.1\bin\java.exe” -XX:TieredStopAtLevel=1 -noverify -Dspring.output.ansi.enabled=always -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=63353 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Djava.rmi.server.hostname=localhost -Dspring.liveBeansView.mbeanDomain -Dspring.application.admin.enabled=true -javaagent:C:\Users\Admin\AppData\Local\JetBrains\Toolbox\apps\IDEA-U\ch-0\183.2635.13\lib\idea_rt.jar=63354:C:\Users\Admin\AppData\Local\JetBrains\Toolbox\apps\IDEA-U\ch-0\183.2635.13\bin -Dfile.encoding=UTF-8 -classpath D:\temp\develop\demo\target\classes;C:\Users\Admin\.m2\repository\org\springframework\boot\spring-boot-starter\2.0.5.RELEASE\spring-boot-starter-2.0.5.RELEASE.jar;C:\Users\Admin\.m2\repository\org\springframework\boot\spring-boot\2.0.5.RELEASE\spring-boot-2.0.5.RELEASE.jar;C:\Users\Admin\.m2\repository\org\springframework\spring-context\5.0.9.RELEASE\spring-context-5.0.9.RELEASE.jar;C:\Users\Admin\.m2\repository\org\springframework\spring-aop\5.0.9.RELEASE\spring-aop-5.0.9.RELEASE.jar;C:\Users\Admin\.m2\repository\org\springframework\spring-beans\5.0.9.RELEASE\spring-beans-5.0.9.RELEASE.jar;C:\Users\Admin\.m2\repository\org\springframework\spring-expression\5.0.9.RELEASE\spring-expression-5.0.9.RELEASE.jar;C:\Users\Admin\.m2\repository\org\springframework\boot\spring-boot-autoconfigure\2.0.5.RELEASE\spring-boot-autoconfigure-2.0.5.RELEASE.jar;C:\Users\Admin\.m2\repository\org\springframework\boot\spring-boot-starter-logging\2.0.5.RELEASE\spring-boot-starter-logging-2.0.5.RELEASE.jar;C:\Users\Admin\.m2\repository\ch\qos\logback\logback-classic\1.2.3\logback-classic-1.2.3.jar;C:\Users\Admin\.m2\repository\ch\qos\logback\logback-core\1.2.3\logback-core-1.2.3.jar;C:\Users\Admin\.m2\repository\org\slf4j\slf4j-api\1.7.25\slf4j-api-1.7.25.jar;C:\Users\Admin\.m2\repository\org\apache\logging\log4j\log4j-to-slf4j\2.10.0\log4j-to-slf4j-2.10.0.jar;C:\Users\Admin\.m2\repository\org\apache\logging\log4j\log4j-api\2.10.0\log4j-api-2.10.0.jar;C:\Users\Admin\.m2\repository\org\slf4j\jul-to-slf4j\1.7.25\jul-to-slf4j-1.7.25.jar;C:\Users\Admin\.m2\repository\javax\annotation\javax.annotation-api\1.3.2\javax.annotation-api-1.3.2.jar;C:\Users\Admin\.m2\repository\org\springframework\spring-core\5.0.9.RELEASE\spring-core-5.0.9.RELEASE.jar;C:\Users\Admin\.m2\repository\org\springframework\spring-jcl\5.0.9.RELEASE\spring-jcl-5.0.9.RELEASE.jar;C:\Users\Admin\.m2\repository\org\yaml\snakeyaml\1.19\snakeyaml-1.19.jar com.example.demo.DemoApplication

    . ____ _ __ _ _
    /\\ / ___’_ __ _ _(_)_ __ __ _ \ \ \ \
    ( ( )\___ | ‘_ | ‘_| | ‘_ \/ _` | \ \ \ \
    \\/ ___)| |_)| | | | | || (_| | ) ) ) )
    ‘ |____| .__|_| |_|_| |_\__, | / / / /
    =========|_|==============|___/=/_/_/_/
    :: Spring Boot :: (v2.0.5.RELEASE)

    2018-09-21 10:13:31.570 INFO 1080 — [ main] com.example.demo.DemoApplication : Starting DemoApplication on sol-desktop with PID 1080 (D:\temp\develop\demo\target\classes started by Admin in D:\temp\develop\demo)
    2018-09-21 10:13:31.573 INFO 1080 — [ main] com.example.demo.DemoApplication : No active profile set, falling back to default profiles: default
    2018-09-21 10:13:31.616 INFO 1080 — [ main] s.c.a.AnnotationConfigApplicationContext : Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext@1ab06251: startup date [Fri Sep 21 10:13:31 MSK 2018]; root of context hierarchy

    Process finished with exit code -1073741819 (0xC0000005)

  4. Mariusz says:

    Any updates about Helm support in Kubernetes plugin?

Leave a Reply

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