Renaming accessor/mutator methods in Eclipse?

前端 未结 2 628
谎友^
谎友^ 2021-01-11 23:32

Is there any way to automatically rename accessor/mutator when a variable they get/set gets refactored -> renamed (Eclipse 3.4)?

2条回答
  •  栀梦
    栀梦 (楼主)
    2021-01-11 23:48

    By default eclipse will not rename getters and setters when using 'inline' renaming of a variable. However you can change this behaviour by using the 'Rename Field' dialog for a rename once, and selecting 'Rename getter' and 'Rename setter'. (see the answer by idrosid for details only how to open this window).

    After this the 'inline' renames will also update the getter and setter for that field (but not the parameter in the setter).

    Note, I have tested this with Eclipse 4.5

提交回复
热议问题