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

Inline produces wrong code when type hint is required

Open
#757 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 initially described here:

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

Use the following code snippet:

```
public Optional inlineme() {
CompletableFuture> future = CompletableFuture.completedFuture(Optional.empty());
return future.join();
}
```

And choose the quickfix to inline `future` variables results in the following code:

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

but this produces a compile error:

> Type mismatch: cannot convert from Optional to Optional

the correct form would be

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

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.