eclipse-jdt / eclipse-jdt/eclipse.jdt.ui

Code that needs a typehint produces not very helpful Quickfixes

Open
#758 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
59
Forks
127
Avg merge
22h 47m
Merged PRs (30d)
28

Description

This was first described here:

- https://github.com/eclipse-jdt/eclipse.jdt.core/issues/1342

Assume we have the following code:

```
public Optional notWorking() {
return CompletableFuture.completedFuture(Optional.empty()).join();
}
```

what results in an compile error: "Type mismatch: cannot convert from Optional\ to Optional\"

the first suggestion for a quickfix is to change this to an empty optional:

![grafik](https://github.com/eclipse-jdt/eclipse.jdt.ui/assets/1331477/cde1e488-e0ff-4d0c-97ab-6df0041fa8a4)

choosing that quickfix results in **the whole code deleted** and replaced with an empty Optional:

```
public Optional notWorking() {
return Optional.empty();
}
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.