-
Notifications
You must be signed in to change notification settings - Fork 512
Closed
Labels
Description
When using a tool to detect Feature Envy and perform automated refactoring, if the refactored code contains syntax errors, should I attempt to fix them manually?
Before Refactoring:
import java.util.ArrayList;
import javax.print.attribute.standard.Destination;
import static java.util.stream.Collectors.toList;
public class SourceClass {
TargetClass t;
private static class Config { }
private final Config config = new Config();
public void processData(TargetClass tarClass) {
new ArrayList<Integer>().stream().filter(this::isPositive).collect(toList());
tarClass.m();
}
private boolean isPositive(Integer number) {
return number != null && number > 0;
}
}
public class TargetClass {
public void m() {}
}After Refactoring:
public class TargetClass {
public void processData(SourceClass sourceClass) {
new ArrayList<Integer>().stream().filter(sourceClass::isPositive).collect(toList());
}
}Error: The type SourceClass does not define isPositive(Integer) that is applicable here