eclipse-jdt / eclipse-jdt/eclipse.jdt.core

No completions in lambda blocks above return

Open
#1,158 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
237
Forks
195
Avg merge
1d 10h
Merged PRs (30d)
49

Description

```
public static void main(String[] args) {
FutureTask task = new FutureTask<>(() -> {
Sys
return null;
});
}
```

No completion behind `Sys`, Even without the return statement completions doesn't work. But if the code is casted

```
public static void main(String[] args) {
FutureTask task = new FutureTask<>((Callable) () -> {
Sys
return null;
});
}
```

Then it works. So may be we should try to deduce the correct functional type of overloaded methods based on the return value of the lambda.

@stephan-herrmann what do you think ? Is above suggested a good idea to tryout ?

Contributor guide

Open the contributing guide

Research direction

Reproduce the two Java snippets and compare completion behind `Sys` with and without the explicit `Callable` cast, including the version without `return null`. Investigate lambda functional-type deduction as it affects completion; done means completion works in the uncast lambda block as well as the cast case.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
compilers, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.