show "." files in package explorer |
"Package Explorer → View Menu → Filters → uncheck .*" or "Package Explorer → Customize View… → Filters → uncheck .*" |
Package Explorer Option "Link with editor" |
Link file to package explorer |
Favorites Imports |
Windows → Preferences → Java → Editor → Content Assist → Favorites, New Type... |
x¹ |
|
|
Show line numbers |
Window → Preferences → General → Editors → Text Editors → "Show line numbers" |
Show print margin |
Window → Preferences → General → Editors → Text Editors → "Show print margin" |
Paste multiline strings |
Window → Preferences → Java → Editor → Typing → "Escape text when pasting into a string literal" |
|
|
x² |
|
|
x² |
MoreUnit Configuration |
Test source folder: "src/test/java" |
|
Test Type: "Junit4" |
|
uncheck "Use test-prefix for test-methods" |
|
Rule for naming test files → Pattern: ${srcFile}(Test|IT|ITCase) |
|
if you have legacy tests with Test prefix: Rule for naming test files → Pattern: (Test)${srcFile}(Test|IT|ITCase) |
Formatter Options |
Window → Preferences → Java → Code Style → Formatter → Off/On Tags for //@formatter:off and //@formatter:on |
|
|
Check the Never join lines preference accessible on the Line Wrapping and the Comments tabs of the Java Formatter preference page |
|
Improve Performance |
Window → Preferences → Validation, Disable All |
|
Add -Xverify:none to eclipse.ini |
tell the VM not to validated all the .class files it is loading |
|
Window → Preferences →General → Startup and Shutdown |
remove plugins not needed |
|
increase -Xms and -Xmx heap memory options (start and max) in eclipse.ini |
e.g. -Xms512m -Xmx2048m |
|
increase -XX:MaxPermSize option (if java < 1.8) |
e.g. -XX:MaxPermSize=512m |
Enable informative Eclipse Compiler Warnings |
Window → Preferences → Java → Compiler → Errors/Warnings |
set to Warning and keep sub checkboxes checked (if any) |
|
Potential Programming problems |
Potential resource leak |
|
Unnecessary code |
Value of parameter is not used |
|
|
Unused type parameter |
|
|
Unnecessary declaration of thrown exception |
|
|
Unnecessary 'else' statement |
|
|
Unnecessary cast of 'instanceof' operation |
|
Generic types |
Redundant type arguments (1.7 and higher) |
|
Annotations |
Unhandled token in '@SuppressWarnings' set to "Ignore" |
|
Null analysis |
Redundant null check |
|
Window → Preferences → XML Files → Editor |
Select "Indent using spaces" and set "Indentation Size: 4" |
|
Window → Preferences → General → Editors → Text Editors |
Set "Displayed tab width: 4" and select "Insert spaces for tabs" |
Save Actions |
Window → Preferences →Java →Editor → Save Actions |
|
check "Perform the selected actions on save" |
|
check "Format source code", "Format all lines" |
|
check "Organize imports" |
|
check "Additional actions" and add the following: |
Code Style |
• "Use blocks in if/while/for/do statements" |
|
• Use lambda where possible |
if you use Java >= 8 |
Add final modifier to private fields* |
• Add final modifier to private fields |
|
• Add final modifier to local parameter |
|
• Add final modifier to local variables |
Unused Code |
• Remove unused imports |
|
• Add missing '@Override' annotations |
|
• Add missing '@Override' annotations to implementations of interface methods |
|
• Add missing '@Deprecated' annotations |
|
• Remove unnecessary casts |
|
• Remove unnecessary '$NON-NLS$' tags |
Limit maximum number of open editors |
Window → Preferences → General → Editors |
|
check "Close editors automatically" |
|
choose value (e.g. 20) for "Number of opened editors before closing" |
|
Window → Preferences → Java → Compiler → Errors/Warnings, Section Null analysis |
|
|
check "Enable annotation-based null analysis" |
|
Maven |
Window → Preferences → Maven → User Interface |
|
check "Open XML page in the POM editor by default" |
Reason: show pom.xml source code is faster than loading the "Overview" tab all the time |
JUnit |
Window → Preferences → Java → JUnit enable "Add 'ea' to VM arguments when creating new JUnit launch configuration" |
|
Show heap memory status |
Window → Preferences → General |
enable "Show heap status" |
|
Window → Preferences → General → Editors → Text Editors → Quick Diff |
enable checkboxes and select correct reference source option |
Created By
www.code-project.org
Metadata
Favourited By
Comments
No comments yet. Add yours below!
Add a Comment
Related Cheat Sheets