rewrite
rewrite copied to clipboard
UseLambdaForFunctionalInterface does not handle ambiguous type parameters in method arguments.
Given a functional interface such as this:
@FunctionalInterface
public interface ChangeListener<T> {
void changed(ObservableValue<? extends T> observable, T oldValue, T newValue);
}
And an anonymous inner class that implements this interface (Note how the first argument is a raw type):
class Test {
ChangeListener listener = new ChangeListener<String>() {
@Override
public void changed(ObservableValue ov, String oldState, String newState) {
}
};
}
Results in the correct AST transformation but the type associated with the ov argument is expressed as an INVARIANT when it should be a COVARIANT with a bounds of String.