如何配置 Eclipse Formatter 来添加这个。在 class 名成员面前
How to configure Eclipse Formatter to add this. in front of class members
如何配置 Eclipse Formatter 以在每个 class 成员使用前添加 this.
?我在 Formatter 配置中找不到这个,Google 没有给我合理的答案。
我需要这个:
public class Foo {
private int bar;
public void methodUsingBar(){
bar = 1;
}
}
要格式化为:
public class Foo {
private int bar;
public void methodUsingBar(){
this.bar = 1;
}
}
在 Eclipse 首选项中转到 Java -> 代码样式 -> 清理。创建或编辑(活动)配置文件。在个人资料编辑对话框中,转到 成员访问 。根据需要配置 非静态访问 组中的设置。在您的情况下,启用 Use 'this' 字段访问限定符 并选中 Always.
如何配置 Eclipse Formatter 以在每个 class 成员使用前添加 this.
?我在 Formatter 配置中找不到这个,Google 没有给我合理的答案。
我需要这个:
public class Foo {
private int bar;
public void methodUsingBar(){
bar = 1;
}
}
要格式化为:
public class Foo {
private int bar;
public void methodUsingBar(){
this.bar = 1;
}
}
在 Eclipse 首选项中转到 Java -> 代码样式 -> 清理。创建或编辑(活动)配置文件。在个人资料编辑对话框中,转到 成员访问 。根据需要配置 非静态访问 组中的设置。在您的情况下,启用 Use 'this' 字段访问限定符 并选中 Always.