今日のEclipse tips

  • static import の * の展開をやめる

eclipseで、たとえば「import static org.junit.Assert.*」とかが、Ctrl+Shift+o で展開されてしまい、

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertThat;


などと展開されてしまい、次からのコード補完がつらい。


そんな場合は、 Preferenceの[Java]-[Code Style]-[Organize Imports] の Number of static imports needed for .* を 1 とかにすると展開されない。


教えてくれた @yuroyoro, @shin1ogawa ありがとう

  • Ctrl + > 、< で次、前ののコンパイルエラーに飛ぶというショートカット
  • Shit + End で、現在のキャレットから行末まで選択
  • eclipse で serialVersionUID を Ctrl+1 で自動生成したときに、/** */ が出るのがうざい

設定から「Java->Code Style->Code Template->Fields」を消すと消える。