• Home
  • RSS Feed
  • Log in

IntelliJ 8: Even smarter code completion!
Posted by Erik Pragt around lunchtime: November 11th, 2008

Smart code completion has been improved in IntelliJ 8. In the new version of JetBrains' IDE 'even smarter' code completion is added. But first I'll explain what smart code completion is! Basically, it's code completion on steroids, which takes the type of the variable into account too which the new value is assigned to. So, if your assigning a value to a variable of type String, smart code completion will only display methods which are compatible with a String type, and filters the list of methods accordingly. It does even a lot more than this, which you can read about here

The 'even smarter' code completion extends this smart behiour to objects two steps away. This best explained with some code samples:

 
public class Person {
   private Address address;
 
   // getters & setters
}
 
public class Address {
   private StreetName streetName;
 
   // getters & setters
}
 
public class StreetName {
   private String name;
}
 

And you type the following:

 
StreetName streetName = person.<cursor here>
 

When pressing Ctrl+Shift+Space once, nothing will happen, since no methods on person exists which are compatible with the StreetName type. However, pressing it twice will automatically find the getStreetName in the Address class, so the final result will look like this, which is a real timesaver, especially in an environment with loads of domain classes (instead of using Strings for names, etc). The final result is shown below!

 
StreetName streetName = person.getAddress().getStreetName()
 
  • Share/Bookmark

Tags: code completion, ide, IntelliJ
Filed under IntelliJ, Java | 1 Comment »



One Response to “IntelliJ 8: Even smarter code completion!”



    Matt Says:
    Posted at: November 12, 2008 at 9:42 pm

    I’m not an IntelliJ user, but that looks pretty cool. A good IDE should work hard to guess what we might mean (and I’ve certainly wished that Eclipse would put in more effort.)

    Whoever came up with the “Law of Demeter” is probably rolling in their grave, though!



Leave a Reply

Click here to cancel reply.

Deployment automation for Java application running on Websphere, WebLogic and JBoss

Archives

  • March 2010
  • February 2010
  • January 2010
  • December 2009
  • November 2009
  • October 2009
  • September 2009
  • August 2009
  • July 2009
  • June 2009
  • May 2009
  • April 2009

Xebia Sites

  • Xebia Corporate
  • Xebia France
  • Xebia India

Categories

  • Java (282)
  • Agile (109)
  • General (50)
  • Testing (42)
  • Performance (42)
  • Hibernate (36)
  • Scrum (33)
  • Podcast (31)
  • Architecture (31)
  • Spring (28)
  • SOA (24)
  • Maven (22)
  • Project Management (22)
  • Middleware (23)
    • Deployment (14)
  • Flex (17)
  • JPA (17)
  • Eclipse (15)
  • Xebia Labs (15)
  • Quality Assurance (14)

Tag Cloud

    Closures Performance Seam JavaOne Grails Semantic Web fitnesse Architecture Spring Groovy Agile Java Functional Programming Maven Ajax product owner XML esb Agile Awareness Workshop IntelliJ Scala Xebia qcon SOA Hibernate Testing Scrum Lean Poppendieck Introduction to Agile