I have a bunch of classes which contain constructors with unused parameters. For example this one:
class Book {
String author;
String title;
public Book(String author, String title, int numberOfPages) {
this.author = author;
this.title = title;
}
}
Does Eclipse offer any way of automatically removing these unused parameters over multiple files? Removing them manually would take hours.
On Eclipse Juno, you can set the compiler to show a warning/error when there's an unused parameter.
Window->PreferencesJava->Compiler->Errors/WarningsUnnecessary codeValue of parameter is not usedtoWarningor (better)Error.This way the compiler will show a warning or will even fail to compile if there are unused method/constructor parameters.
In this case, when you navigate to the
Problemsview, you can apply aQuick Fixwith a mouse right-click.