rewrite icon indicating copy to clipboard operation
rewrite copied to clipboard

UseLambdaForFunctionalInterface does not handle ambiguous type parameters in method arguments.

Open tkvangorder opened this issue 3 years ago • 0 comments

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.

tkvangorder avatar May 26 '22 20:05 tkvangorder