In a few days, Eclipse Juno will be released. This changes the version number from 3.7 (Indigo) to 4.2 (Juno) and introduces several interesting changes. I scanned through the Trips and tricks section of the Java development user guide and found several interesting points to increase productivity. Not every change is only available in Eclipse Juno, however, these are the ones that I did not know before and will use in future:
NPEis automatically replaced with
CTRL + SPACE. This works for any class in Code Completion! Next, I will only write IAE, ISE, LL, and many more.
- Pressing CTRL during Code Completion does not introduce an additional pair of brackes () that has to be removed when changing a method. Normally, when you have
list.add("ASDF");and change the add method via Code Completion to remove, you get
list.remove(o)("ASDF");. This is quite annoying. If you accept the remove method instead of ENTER with CTRL + ENTER, you will get
- Compare With works on Files and on Directories. So you can compare complete directories including subdirectories and their files with this method.
- Package View: You can provide package abreviations for long package names
- You can configure forbidden and discouraged files for a specific library. This allows for better code quality in huge teams as this prevents the usage of, e.g., internal classes circumventing the appropriate interfaces
- JUnit: You can run a single test by right clicking on the method
Run As -> run as JUnit Test
- Cursor is at a bracket: Quick Fix for deleting the sourrounding statement
ALT + SHIFT + Z: Sourround with can be used to create Runnables, while, if, for, try-catch, etc. blocks around (a) selected line(s).
ALT + SHIFT + UP/DOWN: Structured Selection following the bracket structures
- You can activate the checking of redundant null checks, potential null pointer access and for null pointer access at
Java > Compiler > Errors/Warnings / Null Analysis
- You can activate the validation of the JavaDoc and its corresponding method as warnings in
Java > Compiler > Javadocsettings.
Do you have any Eclipse tips or tricks that you use extensively?