[英]remove unused tag library (prize tag) from Eclipse Java project
[英]Automatically remove unused parameters from constructor (Eclipse, Java)
我有一堆包含未使用参数的构造函数的类。 例如这个:
class Book {
String author;
String title;
public Book(String author, String title, int numberOfPages) {
this.author = author;
this.title = title;
}
}
Eclipse是否提供自动删除多个文件中这些未使用参数的方法? 手动删除它们将花费几个小时。
在Eclipse Juno上,您可以将编译器设置为在有未使用的参数时显示警告/错误。
Window
-> Preferences
Java
> Compiler
-> Errors/Warnings
Unnecessary code
的节点 Value of parameter is not used
设置Value of parameter is not used
Warning
或(更好) Error
。 这样,如果有未使用的方法/构造函数参数,编译器将显示警告,甚至无法编译。
在这种情况下,当导航到“ Problems
视图时,可以用鼠标右键单击来应用Quick Fix
。
转到Windows->Preference->Java->Compiler->Errors/Warnings
在“不必要的代码”选项卡中。 Value of Parameter is not used
作“ Ignore
或Warning
Error
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.