Java Annotated Monthly – October 2016

September is a busy conference month, in particular a number of the Java-related JetBrains team were at JavaZone and JavaOne.  To save you some time, cash, and pain, October’s annotated monthly is going to be a little heavy on links to videos and slides – we go to conferences so that you don’t have to.

JavaAnnotatedMonthly@2x

Continue reading

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

Fresh EAP with Refactorings to Java 8, Better VCS and Gradle Integrations

A new IntellIJ IDEA 2016.3 EAP build is out and ready to try. Other than the usual amount of bugfixes, it brings a couple of noticeable improvements.

More Refactorings to Java 8

First of all, we continue with tuning the inspections that help refactor regular code into idiomatic Java 8.

Continue reading

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

IntelliJ IDEA 2016.3 EAP: Faster Git Log, Parameter Hints and More

Hooray! Fresh IntelliJ IDEA 2016.3 EAP build is out! Among the numerous bugfixes, this build addresses one of the issues that prevented it from being used on macOS Sierra. Users of macOS Sierra, we’re kindly asking you to thoroughly test this build and let us know if the problem is gone.

Faster Search in Git Log

The new build brings a dramatic speed improvement to searching thru Git Logs, particularly for the Text, Author and Path filters.

Now, after the project has been opened (for the first time) and all the important startup tasks are completed, IntelliJ IDEA scans all repositories and builds indexes for all commits. This takes a while (for a large project like IntelliJ IDEA itself, it takes approx. 15 mins). During this time the search speed is the same as before, but after the index is built, the search results appear almost immediately. Each refresh triggers an incremental update of the index, so you won’t be spending much time on it.

Managing Git remotes

Also, we’ve finally added a way to manage Git remotes: via VCSGitConfigure Remotes. Now you can add, edit and remove remotes for every repo in the project:

Note that adding a remote is also available in the Push dialog.

Parameter hints

The editor has also got a notable improvement—parameter hints for literals and nulls used as method arguments. These hints make code much more readable:

Without these hints, understanding the semantics methods like this would be much harder:

Note that these hints are not displayed for:

  • Methods with one or less arguments.
  • Arguments shorter than 3 characters.
  • Paired arguments: e.g beginIndex and endIndexstartOffset and endOffset, etc.

This feature is still experimental and we appreciate your feedback on it very much.

More accurate inspections for the Optional type

Inspections that check for the correct use of the Optional type have been rewritten to use data flow analysis for better accuracy:

Conditional breakpoints

The icon for conditional breakpoints has slightly changed and now has a small question mark:

Spring

Spring-wise, we’ve added support for meta-annotations based on @RequestMapping: e.g. @GetMapping, @PostMapping and custom user annotations.

Hibernate

The last but not least, the support for Hibernate has been updated to 5.2.

Download the EAP build if you want to give these new features a try. Your feedback as always is very welcome in our issue tracker.

Develop with Pleasure!

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

IntelliJ IDEA 2016.3 EAP: Polyglot Maven, Grails View, Inspections and More

Say hello to the fresh IntelliJ IDEA 2016.3 EAP build, which brings several new features worth checking out.

Support for Polyglot Maven

First of all, we’ve added the support for Polyglot Maven. In case you don’t know, this is a set of Maven extensions that allows the POM file to be written in Groovy, Scala, Ruby and other languages.

While project import works for any language, coding assistance within POM files is available only for Groovy.

Apart from that you can work with the projects that use Polyglot Maven just as with any other Maven projects.

The Show Effective POM action works as usual and is especially useful if you want to see how Maven interprets the DSL.

Building Groovy resources

Speaking about Groovy, we’ve added actions that build Groovy files located in resource folders. They’re available via the main menu BuildGroovy Resources. Build Resources is incremental while Rebuild Resources builds from the scratch.

Grails view

The Grails developers will be happy to know that the Grails view is back for Grails 3. Now, instead of a tool window, it’s tab inside of the Project tool window:

Artifacts are grouped by their type and reside outside of the sources folder. If you define a class within the src/main/groovy source folder and annotate it with @Artifact(“Controller”), the Grails view will show it under the Controllers node.

All the Project tool window settings are applicable to the Grails view as well, including Flatten Packages.

Items under the Plugins node (always the last in the list) navigate to the corresponding GrailsPlugin class.

Inspection that inlines local variables used only by return statements

IntelliJ IDEA has many inspections aimed at making code shorter and simpler. In this EAP build, we’ve added one more that we hope you’ll find useful.

The new inspection finds local variables used only by return statements, and provides a quick fix that inlines these variables–by replacing their assignments with return statements.

When the returned value can’t be inlined into return statement, the quick fix attempts to move the return statement as close to the computation of the returned value as possible:

Adding runtime assertions for not-null-annotated code

IntelliJ IDEA’s compiler (Settings → Build, Execution, DeploymentCompiler) has an option to generate runtime assertions for the methods and parameters annotated with org.jetbrains.annotations.NotNull.

screen-shot-2016-09-21-at-18-57-12

Starting now it supports non-JetBrains annotations as well–JSR-305 in particular. Click Configure annotations to change the default behaviour:

The blue arrows indicate which annotation is be used by the IDE in inspections. Use the Check button to change them.

Here we’d like to thank Vladimir Dolzhenko who contributed to this improvement.

Resource bundle editor showing unused properties

The Resource Bundle editor now tells which properties are unused in the project:

Spring Initializr

Layout of the Spring Initializr has been reworked to fit more items and provide additional information. As a bonus, it now has the Search field.

Download the EAP build, give it a try and share your feedback with us. If you see something works not as it’s intended, write to our issue tracker.

Develop with Pleasure!

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

Share Your Stats to Improve Code Completion via Machine Learning

Code completion is, no doubt, one of the most useful features of any IDE. This is why IntelliJ IDEA offers it in so many flavors: Basic Completion, Smart Completion, Second Completion, Second Smart Completion, Statement Completion, and Hippie Completion.

Each of these completion types already uses different algorithms and heuristics, but we’d like take them even further with machine learning, which we believe can be a huge improvement to the completion efficiency. However, to really implement it, we need more data from you.

Here comes the idea of our new plugin: Completion Stats Collector. What this plugin does is it collects data about how you’re using code completion, anonymizes it and sends to us. Again, the plugin doesn’t send any of your personal data or code, just generic info about how code completion is used.

What are the benefits of installing this plugin? Mainly, of course, helping us to improve code completion. Less important, yet nice, you’ll always use the latest and most efficient completion algorithms tuned personally for you. In the beginning you won’t notice any big improvements (the opposite in theory may be possible sometimes). Later, as we keep improving the algorithm, we bet you’ll start noticing the difference.

The downside of using the plugin is a slight outgoing traffic—with the maximum around 20KB/hour, based on how heavily you use code completion. In future we’ll do our best to keep the traffic as low as possible.

Like the idea of helping us improve the completion? Install the plugin! Meanwhile, we’ll be happy to answer questions, get suggestions or feedback.

Develop with Pleasure!

Posted in New Features, News & Events | Tagged , | 6 Comments

Webinar Recording: Introduction to Akka Actors with Java 8

Last week we had a pleasure of hosting a webinar in partnership with Lightbend about Akka Actors and Java 8. In it, Johan gave an introduction into how to write Actors and also answered a great number of questions. If you missed the webinar, but the topic is interesting to you, you’re welcome to watch the recording:

Jump directly to a topic you’re most interested in using the following links:

The sources of the project used by Johan can be found on GitHub.

For slides, use this link.

Also, please suggest other topics you’d like us to cover in our further webinars and the authors you’d like to have as webinar guests. In case you’d like to be such guest yourself, write to me about it.

Speaking to you

Johan AndrénJohan Andrén is a member of the Akka team at Lightbend. He has been working professionally with tech on the JVM since 2005, focused on Scala and Lightbend technologies the last five years. He is located in Stockholm, Sweden. Follow Johan on Twitter.

Develop with Pleasure!

Posted in Webinars | Tagged , | Leave a comment

IntelliJ IDEA 2016.3 EAP Makes Unused Code Detection More Flexible

Have you ever seen a project with no unused symbols? If so, you are really lucky! Jokes aside, finding unused code is difficult because of things like dependency injection, reflection, and countless frameworks. Luckily we have IntelliJ IDEA that provides instance editor highlighting and batch inspection that are a great aid in this task. Unfortunately, sometimes static information is not enough to detect that code is implicitly used by a framework or called through reflection, or your project is a library and all public methods are therefore implicitly used. To make the inspection more flexible and support all that cases, we’ve introduced the following settings.

Continue reading

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

IntelliJ IDEA 2016.3 EAP Helps Migrate to Java 8’s Stream APIs

In one of her recent articles, Trisha Gee wrote about refactoring to Java 8. Among many great tips about Java 8, the article also showed how IntelliJ IDEA helps write correct and idiomatic Java 8. With IntelliJ IDEA 2016.3, we’ve gone further and extended our existing inspections to support non-trivial cases.

Continue reading

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

IntelliJ IDEA 2016.2.4 Update is Out

TGIF! The good news today (apart from that it’s Friday) is that IntelliJ IDEA 2016.2.4 is out. Inside you’ll find a number of important bugfixes.

Feel free to download and install the new version from scratch, or (if you’re running IntelliJ IDEA 2016.2.3), apply the patch by clicking Check for Updates and then Download and Install.

Enjoy your weekend!

Posted in Releases | Tagged , , | 17 Comments

Java Annotated Monthly – September 2016

The sad news is, it’s the end of summer. On the other hand, maybe you need a break from the kids and you’re happy to shift your work-life balance towards passionate-developer-mode. The good news is it’s conference season. If you are going to be at JavaZone, JavaOne or Devoxx, not only will you be brought up to speed on what’s going on in the Java world, you can meet JetBrains people! Come and say Hi at our booth, we love chatting to people. Personally, I’ll also be appearing as close to home as Cádiz and as far away as Australia! If you can’t make it to any conferences, we will (of course) be sharing the most interesting developments through Java Annotated Monthly.

JavaAnnotatedMonthly@2x

Continue reading

Posted in News & Events | Tagged | 4 Comments