5.除错.................................................................................................................................................................... 144
5.1 错误的程序 ............................................................................................................................................. 144
5.2 设定岔断点(Breakpoints) ....................................................................................................................... 145
5.3 逐步除错 ................................................................................................................................................. 149
5.3.1 Step Into........................................................................................................................................ 149
5.3.2 Step Over ...................................................................................................................................... 149
5.3.3 Step Return ................................................................................................................................... 149
5.3.4 Drop to Frame............................................................................................................................... 149
5.3.5 Use Step Filters/Step Debug ......................................................................................................... 150
5.4 继续执行 ................................................................................................................................................. 151
5.5 设定岔断点的Hit Count ......................................................................................................................... 153
5.6 岔断点组态设定 ..................................................................................................................................... 160
5.7 监视点(Watchpoint) ................................................................................................................................161
5.8 方法岔断断点(Method Breakpoint)........................................................................................................ 164
5.9 异常岔断点(Exception Breakpoint)........................................................................................................ 166
5.10 Java表示式及变更某些值 .................................................................................................................... 168
6.重构(Refactoring)............................................................................................................................................... 170
6.1 重新命名 ................................................................................................................................................. 170
6.1.1 区域变量(Local Variable) ............................................................................................................ 170
6.1.2 字段(Field) ................................................................................................................................... 171
6.1.3 方法(Method) ............................................................................................................................... 173
6.1.4 类别(Class)或是接口(Interface) .................................................................................................. 174
6.1.5 套件(Package) .............................................................................................................................. 176
6.2 撷取(Extracting)...................................................................................................................................... 177
6.2.1 撷取常数(Extracting a Constant) ................................................................................................. 177
6.2.2 撷取区域变量(Extracting a Local Variable) ................................................................................ 180
6.2.3 撷取方法(Extracting a Method)................................................................................................... 182
6.3 列入(Inlining).......................................................................................................................................... 187
6.3.1 列入常数(Inlining a Constant) ..................................................................................................... 187
6.3.2 列入区域变量(Inlining a Local Variable) .................................................................................... 189
6.3.3 列入方法(Inlining a Method)....................................................................................................... 191
6.4 变更方法签章(Signature) ....................................................................................................................... 193
6.5 移动Java元素(Moving Java Elements) ................................................................................................... 196
6.5.1 字段(Field) ................................................................................................................................... 197
6.5.2 Static Members ............................................................................................................................. 198
6.6 自行封装字段(Self Encapsulating a Field)............................................................................................. 200
7.要诀和技巧(Tips and Tricks)............................................................................................................................. 203
7.1 编辑程序文件(Editing Source)............................................................................................................... 203
Eclipse 中文教程.doc 第 5 页,共 221 页