1

我使用 jalopy(免费版)进行代码格式化,但我想转换为 eclipse。有两个 jalopy 功能,不过,我非常喜欢,是否可以在 eclipse 中使用它们?

首先是能够创建这样的部分:

public final class Credit extends ArticleAccountingentry implements Serializable {

//~ Enumerations ---------------------------------------------------------------------------------------------------

public enum Status {CREATED, CANCELLED;
}

//~ Static fields/initializers -------------------------------------------------------------------------------------

private static final long serialVersionUID = 1L;

//~ Instance fields ------------------------------------------------------------------------------------------------

private final Invoice invoice;
private final ImmutableSet<StatusChange<Status>> statushistory;

//~ Constructors ---------------------------------------------------------------------------------------------------

public Credit() {
}

//~ Methods --------------------------------------------------------------------------------------------------------

public StatusChange<Status> getLatestStatusChange() {
}

第二个功能是自动将 final 关键字添加到参数列表中。

4

1 回答 1

1

至少可以使用如下方式启用自动插入最终关键字:

Window -> Preference -> Java -> Code Style -> Clean Up -> Edit -> Code Style

它会引导你Variable Declarations -> Use final where possible

如果在保存文件时执行这样的操作:

Window -> Preference -> Java -> Editor -> Save Action -> Edit

使能够Perform the selected on save -> Additional Actions -> Configure -> Code Style

和之前一样。

于 2011-12-11T14:13:48.503 回答