IntelliJ IDEA 2017.1 EAP is Open

It’s only been a month since we released IntelliJ IDEA 2016.3, but we’re already starting the IntelliJ IDEA 2017.1 EAP (Early Access Program). This EAP offers a glimpse into the update planned for next spring. Read on to learn about the major new features available in the EAP, or go ahead and grab the build.

Continue reading

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

IntelliJ IDEA 2016.3.2 RC is Out

The IntelliJ IDEA 2016.3.2 update is almost here. We’ve just made available its RC build. Among the bugfixes that come with this build, there’s a fix that addresses the out-of-memory problem that might occur when applying a patch. The problem should be gone none.

Please give the RC a thorough try, and let us know if all is working fine. Report all found issues to our issue tracker.

Develop with Pleasure!

Posted in Release Candidates | Tagged , , | Leave a comment

Live Webinar: The Three Laws of TDD

Join us Wednesday, January 18th, at 10:00 AM – 11:00 AM EST (New York) / 3:00 PM – 4:00 PM GMT (London) (check other time zones) for our free live webinar The Three Laws of TDD, featuring Robert Martin (Uncle Bob).

Test Driven Development continues to grow in popularity as a discipline that exemplifies professional care and diligence. In this webinar, Uncle Bob will describe the three laws of TDD, and will demonstrate the discipline using (sic!) the Kotlin language.

There will be an opportunity to ask questions during the webinar.

Register now!

Speaking to you

Robert Martin (Uncle Bob) Robert Martin (Uncle Bob) has been a programmer since 1970. He is co-founder of the online video training company: cleancoders.com, and founder of Uncle Bob Consulting LLC. He served as Master Craftsman at 8th Light inc, is an acclaimed speaker at conferences worldwide, and the author of many books including: The Clean Coder, Clean Code, Agile Software Development: Principles, Patterns, and Practices, and UML for Java Programmers. He is a prolific writer and has published hundreds of articles, papers, and blogs. He served as the Editor-in-chief of the C++ Report, and as the first chairman of the Agile Alliance.

Develop with Pleasure!

Posted in News & Events | Tagged , , | 12 Comments

IDE Features Trainer: a New Way to Learn Your IDE

The family of education resources for IntelliJ IDEA welcomes a new member! Now, in addition to “What’s new” videos, documentation, blog posts and screencasts, the IDE Features Trainer plugin is available to help you learn the shortcuts for the most used IDE actions. The current version includes 5 modules: Editor Basics, Completion, Refactoring, Code Assistance and Navigation, each consisting of several lessons.

Let’s take a look at how this works. All plugin info and controls (like tasks and learning progress) are located in the Learn tool window, located near the 1: Project stripe button. To begin learning, set focus to this tool window and choose a module. You will be automatically redirected to the task of the first lesson (or, if you’re resuming learning, the task where you left off). Continue reading

Posted in Featured Plugins, Tutorials | Tagged , , | 7 Comments

IntelliJ IDEA 2016.3.1 is Out

If you haven’t tried the new and shiny IntelliJ IDEA 2016.3 yet, there’s a good reason to do it right now. Welcome IntelliJ IDEA 2016.3.1, an update that brings lots of important bugfixes.

One of the most notable changes in this build is the long-awaited support for JUnit 5 M3, so if you plan to keep running JUnit 5 M2, you have to either use IntelliJ IDEA 2016.3 (or earlier), or manually include JUnit 5 M2 dependencies in your classpath (junit-platform-launcherjunit-platform-commons, junit-platform-engine; junit-jupiter-api and junit-jupiter-engine for Jupiter; and junit-vintage-engine for Vintage).

Speaking of JDK 9, IntelliJ IDEA 2016.3 won’t support builds 148 and up because they contain code that breaks things. Of course, we’re working to resolve this, and will support the latest JDK 9 builds in 2017.1 (its EAP may well start within the next few weeks).

In other news:

  • Move Element Right/Left actions are now available for Groovy
  • WebSphere support has been updated to v9

For the complete list of changes in this update, see the release notes.

Develop with Pleasure!

Posted in New Features | Tagged , , , , | 7 Comments

IntelliJ IDEA 2016.3.1 RC Updates JUnit 5 Support to M3

Great news! A fresh update for IntelliJ IDEA 2016.3 is coming soon. Today we’ve published its RC build.

In addition to bugfixes, this build updates JUnit 5 support to M3. Note that if you plan to run JUnit 5 M2, you have to either use an earlier version of IntelliJ IDEA, or manually include JUnit 5 M2 dependencies in your classpath (junit-platform-launcherjunit-platform-commons, junit-platform-engine; junit-jupiter-api and junit-jupiter-engine for Jupiter; and junit-vintage-engine for Vintage).

As always, your feedback is very welcome in our issue tracker.

Develop with Pleasure!

Posted in New Features, Release Candidates | Tagged , , | Leave a comment

Java Annotated Monthly – December 2016

The holidays are coming but the news never stops. This month we have articles about Java 8, 9 and beyond as usual, and a mixed bag of fundamentals, popular libraries and other JVM languages. As the end of the year is a good time for retrospectives (or it would be, if we weren’t so busy trying to finish everything before all the parties), we’re also taking a look at what it means to be a competent developer.

JavaAnnotatedMonthly@2x

Continue reading

Posted in News & Events | Tagged | 3 Comments

IntelliJ IDEA Inspection Settings for Refactoring to Java 8

I’ve been giving a talk this year showcasing how to use IntelliJ IDEA inspections to help you refactor existing code to Java 8. The initial version of this, the one I gave at DevoxxUK (video), is based on my Migrating to Java 8 Tutorial. I’ve also written before about how IntelliJ IDEA can help you write more idiomatic Java 8 code.

I’m revisiting the topic now that IntelliJ IDEA 2016.3 has added even more support for
identifying areas of code that can utilise Java 8 idioms and APIs, and making better use of those areas that already use Java 8. I’ve updated the presentation to use these new inspections, and performance tested the results when applied to a specific codebase. Let’s take a look at which inspections are used, how you configure them, and go into detail about what some of them do.

1-inspectionsselected

Here are the inspections that I’ve turned on for the presentation. Not all of them feature in
the specific code that I highlight, but they’re all valuable for locating areas of code that can
be migrated to Java 8.  We’ll look at a few of them in a bit more detail.

Firstly, in IntelliJ IDEA 2016.3 note that the “foreach loop can be collapsed with Stream API” inspection has been updated – see the checkbox in the bottom right? “Suggest to replace with forEach or forEachOrdered”?

Foreach Inspection Updated in IntelliJ IDEA 2016.3

By default this is not ticked. Which means code that originally was highlighted by this inspection when using 2016.2 may not be flagged in 2016.3 if you haven’t selected the checkbox. For example, IntelliJ IDEA will only give a warning about the code below if this checkbox is ticked:

If you apply the change, the code is simplified to use the forEach() method from Iterable, since Set implements Iterable

My preference is to inline variables where they’re not really adding anything (sometimes variable names are useful to document intermediate steps, but that’s not really necessary in this case), so the code simplifies further if you use Ctrl + Alt + N on the variable:

This inspection “foreach loop can be collapsed” identifies numerous places which use a traditional for loop but suggests a number of different alternatives to replace it with, including forEach (with and without the Streams API), and collect. This is covered in more detail in the Migrating to Java 8 Tutorial.

This inspection was around in IntelliJ IDEA 2016.2, but has been updated in 2016.3 – not only with the ability to turn on or off the suggestion to use forEach, but also to provide better alternatives to refactor to, and suggest new places that can use the Streams API.

By better alternatives, I mean that IntelliJ IDEA has become even smarter with how it refactors code. Take a look at this example:

In IntelliJ IDEA 2016.2, this would have been refactored to:

But in IntelliJ IDEA 2016.3 both for loops are folded into the stream operation via flatMap

In this specific case the code is still not a perfect example of using streams, as we have a if/else which cannot be folded into the stream, and an initial null check. Also remember that although using forEach is a good first step towards understanding and using streams, it’s often a sign that the operation could perhaps be redesigned to use a more efficient stream operation that doesn’t need to process every item.

Another example of the improvements is how IntelliJ IDEA has become smarter about identifying code that sorts Collections, and suggesting alternatives. For example, this is typical pre-Java-8 code:

Previously, IntelliJ IDEA suggested this could be simplified to:

It took a vigilant developer to notice that the sort method can actually be folded into the stream operation. Now, IntelliJ IDEA does this for you:

 

As well as improved suggestions for refactoring, IntelliJ IDEA 2016.3 also identifies more areas that can use Stream operations. In particular, it can suggest that areas that iterate over arrays or use indexed loops can be refactored. For example, consider this code that loops over an array:

The inspection suggests that this can be refactored to:

We can refactor more to improve the readability further. Firstly by inlining the validFields  variable, and then by extracting a method for the complex filter logic. This final step has the nice side effect of letting us remove the comment, since the method name combined with the filter is descriptive enough to show what the code is trying to do

But you do need to take care with refactoring code like this. The updated code is easier to read, as it expresses the intention nicely, but iterating over arrays with a traditional for loop is an operation that is efficient for computers. Using Arrays.stream() to turn the array into a Stream will probably have some performance impact. In the grand scheme of things this is likely to be negligible, but if performance matters in your application you should test this impact.

One of the new inspections available in 2016.3 is the ability to locate places where Collections.removeIf  can be used. If, for example, you have a Set  of values and you want to remove some items that meet some criteria, you may have code that looks like this:

The “Loop can be replaced with Collection.removeIf” inspection suggests this can be refactored to:

This code is clearly much simpler, the boilerplate for managing the iteration has disappeared and we’re left with only the condition to check each item against.

Another new inspection is around Comparators. Of course, Comparators can now be implemented as lambda expressions rather than the traditional anonymous inner class, but what is less obvious is that there are new helpers on the Comparator class than can simplify many of these even further. Consider the following code:

The “Use Comparator combinators” inspection suggests we change this to

It’s less code, but more usefully the important information now stands out more – the Constraint values in the TreeSet will be ordered by their Level.

There are more new inspections, and more examples of improvements to the existing inspection suggestions. To see some of those mentioned here in action, and some more new ones, check out the Java 8 Inspections Screencast.

And to see these inspections being used against a real code base, with details of the performance implications of these changes, take a look at my Refactoring to Java 8 presentation from Devoxx Belgium last month

Whether you’re only just considering enabling the Java 8 inspections, or have previously checked them out but not felt compelled to use them, do take a look at them in IntelliJ IDEA 2016.3, you may be surprised at how much they can simplify your code.

Posted in Tips & Tricks | Tagged , , | 6 Comments

IntelliJ IDEA 2016.3 GA: Java 8 and ES6, Debugger and UI improvements, and a Ton More

Please meet IntelliJ IDEA 2016.3, the third massive IDE update planned for this year. Two years ago we used to have one major release per year. Now we have three and all feature-rich – not to mention tons of minor bugfix releases.

ij_2016_3_1280x800

Read below to see the highlights of this update: Continue reading

Posted in New Features, Releases | Tagged , | 39 Comments

IntelliJ IDEA 2016.3 RC: Frameworks, Application Servers and Clouds

Earlier today we’ve published the first IntelliJ IDEA 2016.3 RC. Now it is a good timing to give you an update on what’s been improved in this release with regard to supported frameworks, application servers and clouds.

Spring

  • Performance. Better performance of handling large projects with numerous beans, regardless of the way they’re configured–via XML descriptors or annotations.
  • Meta annotations. Annotations based on @Autowired and @RequestMapping (including user-based and the built-in annotations such as @GetMapping and @PostMapping) are now supported and correctly resolved.
  • Properties. If any of your meta annotations accepts a property placeholder in its constructor, you can now inject the property placeholders language there to get coding assistance for its values: highlighting, completion, navigation, and validation. Also, support for @PropertySources annotation has been added.
  • Spring Boot. The layout of the Spring Initializr (Project Wizard) has been reworked to fit more items, provide search and additional information.

Grails

  • Grails view.  It’s back for Grails 3.x. Now instead of a tool window, it’s a tab inside the Project tool window. Artifacts are grouped by their type and reside outside of the sources folder. Items under the Plugins node (always the last in the list) navigate to the corresponding GrailsPlugin class.

Persistence

  • Hibernate. Support for queries has been updated according to the changes introduced with Hibernate 5.2
  • Spring. In Spring Boot projects the Console now doesn’t require perstistence.xml in the JPA facet.  Also, the IDE now respect the naming strategies provided with Spring configuration files.

Thymeleaf

  • The support for Thymeleaf 3 has been further improved and now is more complete.

Clouds

  • Google Cloud Tools. Google has introduced their own IDE plugin for deploying to Google App Engine. Eventually this plugin will replace the Google App Engine plugin provided with us.
  • OpenShift Origin (V3). The updated integration lets create OpenShift 3 applications and manage their resources such as projects, services and pods.

Application Servers

  • TomEE 7. The support for TomEE has been updated to its major version.
  • Liberty. Loose applications are now supported and can be run from the IDE. To run a loose application, open the Deployment tab of your WebSphere Run configuration and select the loose application XML file–instead of an artifact.

Stay tuned to our blog for more details on these and other new features coming in the update. Meanwhile, make also sure to check out the public preview (along with the list of new features), or download the RC build.

Develop with pleasure!

Posted in Beta Releases | Tagged , , , , | 4 Comments