Live Webinar: Reactive Spring

We’re happy to invite you to our webinar, Reactive Spring, with Josh Long.

Join us Thursday, October 5th, 6:00 PM – 7:00 PM CEST (12:00 PM – 1:00 PM EDT).

This webinar will give an introduction to Spring 5 and focus on one of its most exciting additions – support for reactive programming, building on the Pivotal Reactor project to support message-driven, elastic, resilient and responsive services.

Spring 5 integrates an MVC-like component model adapted to support reactive processing and a new type of web endpoint, functional reactive endpoints. In this talk, we’ll look at the net-new Netty-based web runtime, how existing Servlet code can run on the new world, and how to integrate it with existing Spring-stack technologies.

As a bonus, Josh will show some of the features introduced in IntelliJ IDEA 2017.2, including the new Run Dashboard for Spring Boot.

Please register now to reserve a seat.

We look forward to see you there! And if you’d like to suggest a topic for a future webinar, do let us know! Continue reading

Posted in Webinars | Tagged , , | 7 Comments

Live Webinar: Real World Java 9

Java 9 was released just yesterday! Read about Java 9 support in IntelliJ IDEA in this blog post. If you want to know even more about Java 9, we invite you to join our free webinar, Real World Java 9, with Trisha Gee, taking place Tuesday, October 3, at 16:00 – 17:00 CEST.

In this presentation Trisha will code live to show you:

  • What the Java Platform Module System is and how to make your code modular
  • How we can use the new Flow API to utilize Reactive Programming
  • The improvements to the Streams API that make it easier to control infinite streams
  • How to the Collections convenience methods simplify code

We hope to see you there! Don’t be shy – register now! Continue reading

Posted in Webinars | Tagged | 5 Comments

IntelliJ IDEA 2017.3 EAP: Better Synchronization of your Settings Across Devices and Other improvements

Today we’re publishing a new IntelliJ IDEA 2017.3 EAP build, which includes some very interesting features. Let’s have a look!

Better synchronization of your settings across devices

If you work with JetBrains IDEs on different computers, then you have probably faced an annoying issue. For each computer you use, you need to specify the IDE settings, such as: keyboard shortcuts, syntax highlighting, appearance, plugins and other options.

The problem was partially solved with the built-in plugin, Settings Repository. For the plugin to synchronize the settings, it is not very convenient, you have to create a Git repository (on GitHub or with another service) and specify it in the IDE.

To make the process of synchronizing the settings even safer and more user-friendly, we are developing a new mechanism. This mechanism relies partly on the Settings Repository, but uses the repository on the JetBrains side to store the settings, access to this repository would then be possible through a JetBrains Account (JBA).

With this new approach, you won’t need to spend time on creating and configuring a Git repository. And now, your settings won’t be available to other users.

In addition to this more convenient method of storage, the new mechanism allows you to synchronize not only settings, but also all your installed plugins.

The new plugin will in time be made available for all our paid products (IntelliJ IDEA Ultimate, PhpStorm, PyCharm, CLion, RubyMine, Rider, etc.). Continue reading

Posted in EAP Releases, New Features | Tagged , | 22 Comments

Java 9 and IntelliJ IDEA

Java 9 is released today, so let’s do a quick recap of the existing Java 9 support in IntelliJ IDEA, and have a peek at some of the upcoming features in IntelliJ IDEA 2017.3 for Java 9.  Java 9 has been fully supported in all of the 2017 releases, and most of the features we talk about here are available in the current stable release of IntelliJ IDEA.

Jigsaw & the JPMS

The big feature for Java 9 is, of course, the Java Platform Module System (JPMS), which comes under the umbrella Project Jigsaw.  Jigsaw itself is a much bigger undertaking and includes things like the modularisation of the JDK itself, what’s interesting to us as developers is the JPMS.

IntelliJ IDEA has supported the Java Platform Module System since 2016.3, this support was added to and improved in 2017.1.

You can easily create a module-info.java file for your IntelliJ IDEA modules:

01-new-module-info

This will give you the basic structure of your module declaration, including a module name that matches the name of your IntelliJ IDEA module.  While you’re working in this file you get code highlighting and completion of course.

If you run code from a module with a module-info.java file, IntelliJ IDEA will automatically use the -p argument (module path) instead of -classpath.

03-module-path

IntelliJ IDEA also offers quick fixes for some of the common problems you’ll face as you migrate your code to the JPMS, such as the ability to add a “requires” directive

04-quick-fixes

or detection of duplicate directives or other errors that can be fixed

05-delete-duplicate

IntelliJ IDEA also lets you create module diagrams to help you visualise the modules you’re using.  You can see JDK modules, your own modules and automatic modules in different colours, and transitive requirements are highlighted with a stronger line.

These diagrams are particularly useful when you’re getting started with modularity, as they help you understand which modules you’re using and where they come from.  You can even navigate to the modules from the diagram.

IntelliJ IDEA has inspections to help migrate code to Java 9. For example, you can highlight the use of automatic modules.

07-automatic-modules

This means you can see if you’re dependent on something that isn’t a true Java 9 module. This is important as these automatic modules may change over time.

08-warning-on-automatic-module

Find out more about basic support for modules in IntelliJ IDEA, and module diagrams and additional quick fixes.

Convenience Factory Methods

Java 9 introduces a lot of small API changes that made life easier for developers. One of these is to simplify the creation of Collections with fixed contents.  IntelliJ IDEA 2017.2 introduced an inspection which can show you where you can use this feature.

07-immutable-collections

This will highlight code that can be simplified by using the Java 9 factory methods

Thread.onSpinWait

Java 9 lets you give hints to the JVM that can help performance.  Specifically, if your code is spinning in a loop waiting for something to happen, you can use Thread.onSpinWait to let the runtime know. IntelliJ IDEA locates code where this hint may be useful, and can add it.

10-on-spin-wait

This inspection and the one for Convenience Factory Methods were covered previously in the blog post and video on Java 9 support in IntelliJ IDEA 2017.2.

Enhanced Deprecation

Another seemingly small feature in Java 9 that makes it easier for developers to understand the impact of their code is enhanced deprecation.  Now instead of merely tagging code as deprecated and (possibly) documenting the reasons in the Javadoc, the @Deprecated tag supports two useful new attributes, “since” and “forRemoval”.  There’s a new inspection in IntelliJ IDEA 2017.3 that highlights any use of code that has been marked “forRemoval”.

11-for-removal-inspection

If you’ve got this inspection turned on and set to “Warning” (which is the default), then when you’re using something that’s been tagged as “forRemoval”, IntelliJ IDEA will strike this method through in red, rather than the usual black.

12-deprecated

JShell

Java 9 comes with a REPL for Java for the first time, called JShell.  You can run this REPL from the command line, or from the terminal inside IntelliJ IDEA.  In addition, IntelliJ IDEA 2017.3 also has a basic console that allows you to work with JShell from inside the IDE, similar to the Groovy Console.

13-jshell-menu

You can use this console to try out code snippets, and you will be able to select the module path for running this code.

This is currently available in the 2017.3 EAP.  Please try it out and give us feedback!

Features that don’t need extra support

There are loads of new features in Java 9, including changes to the Streams API, additions to Optional, private methods on interfaces, and more.

15-streams

Of course these new methods are all available during code completion if your project code level is set to Java 9.

16-project-language

In addition, you can use the usual features of IntelliJ IDEA to take advantage of some of the Java 9 features.  For example, you can generate HTML 5 Javadoc by adding a flag when you generate your documentation.

17-html5

You can even use IntelliJ IDEA to create Multi-Release Jar Files.  This is probably something that’s best left to build tools like Gradle, Maven or Ant, but it is possible in IntelliJ IDEA, and will be the subject of a later blog post.

All that remains is to say “Welcome Java 9!  We’re ready for you!”

UPDATE: Join us Tuesday, October 3, at 16:00 – 17:00 CEST, for our free live webinar, Real World Java 9. Register now!

Posted in EAP Releases, New Features, Tips & Tricks | Tagged | 23 Comments

Code Smells: Too Many Problems

Or: argh! Where do I start?!

This is part of a series investigating code that looks suspicious (“code smells”), and exploring possible alternatives.

For the middle articles of this series, we’ve been focusing on a single method, and demonstrating how to improve this method, one smell at a time.  While it has been… useful… that a single method has demonstrated so many smells, if you came across that method in real life it wouldn’t be obvious what to do with it.

Continue reading

Posted in Tips & Tricks | Tagged , | 8 Comments

What IntelliJ IDEA 2017.3 EAP Brings to Database Tools

We’ve recently announced the opening of the EAP for IntelliJ IDEA 2017.3, and we have already even looked at some of the interesting EAP features. However, we didn’t cover changes in the database tools yet. So let’s explore the major changes in this area.

Selecting schema when running SQL file

IntelliJ IDEA 2017.3 now prompts you to choose database/schema along with a datasource when you try to run an SQL file from the Project tool window:

Screen Shot 2017-09-14 at 12.27.17 Continue reading

Posted in EAP Releases, New Features | Tagged , , , | 1 Comment

What’s New in IntelliJ IDEA 2017.3 EAP?

Last week we announced the opening of the EAP for IntelliJ IDEA 2017.3, the upcoming IDE update which will be released this fall. In the announcement we briefly mentioned some of the major changes the update will deliver. Let’s talk about them in a bit more detail.

Continue reading

Posted in EAP Releases, New Features | Tagged , | 15 Comments

Code Smells: If Statements

This is part of a series investigating code that looks suspicious (“code smells”), and exploring possible alternatives.

The article in this series that has so far provoked the most responses was on iteration.  Today, I’m talking about if statements (conditionals). I’m not intending to go after any sacred cows or anything – for loops and if statements are pretty much the first things we learn in many programming languages.  They’re a fundamental part of languages like Java.  But just because these basic building blocks exist doesn’t mean they should be our goto strategy (see what I did there?) every time.  We could program in assembler but we don’t. We could use a hammer for every job around the house, but we don’t (well…).

If statements are very useful, and often the right tool for the job, but they can also be a smell.  Remember that by “smell” I mean “code that you should look carefully at to see if there’s a simpler/easier to understand, approach”. I don’t mean “if statements are evil never use them”.

Continue reading

Posted in Tips & Tricks | Tagged , | 9 Comments

Code Smells: Multi-Responsibility Methods

This is part of a series investigating code that looks suspicious (“code smells”), and exploring possible alternatives.

In the last article I introduced a large and complex method, validateQuery.  The focus of that article was how to simplify the method looking only at the “smell” of mutability, but there’s actually one very simple change that can chop the method nearly in half.

Continue reading

Posted in Tips & Tricks | Tagged , | 4 Comments

Java Annotated Monthly – September 2017

The major news in August was for Android, with the release of Oreo.  Other than that, the rest of the Java world seems to be holding its breath waiting for Java 9, due (finally!) this month. The lull in pure technology news gives us a chance to explore other topics that affect us as developers and members of a larger organisation, so this month we have a whole section on Culture.

JavaAnnotatedMonthly@2x

Continue reading

Posted in News & Events | Tagged | Leave a comment