eclipse-jdt / eclipse.jdt.ui

Eclipse Public License 2.0
32 stars 79 forks source link

Clean-up quick fix 'Convert to method reference' often adds unncessary cast #1498

Closed HannesWell closed 6 days ago

HannesWell commented 1 week ago

Given one has the following code

Stream<IExecutionEnvironment> ees = Stream.empty();
ees.map(ee -> ee.getId());

if one applies the quick-fix clean up (from pressing Ctrl+1) Convert to method reference to the lambda an unnecessary cast is added:

ees.map((Function<? super IExecutionEnvironment, ? extends String>) IExecutionEnvironment::getId);

I would have expected the resulting code to be:

ees.map(IExecutionEnvironment::getId);

I always have to edit it manually afterwards to be like that.