mapstruct / mapstruct/mapstruct-idea

Report error for result types with wildcard extends bound

Open
#266 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

feature hack.commit.push
Dominant language
Java
Stars
168
Forks
41
PR merge metrics
No merged PRs in 30d

Description

MapStruct does not support result types with an extends bound. For example
```
import java.util.List;
import org.mapstruct.Mapper;

@Mapper
public interface BoundMapper {
List toExtends(List in);
}
```
is invalide, because of the wildcard extends bound `? extends `. MapStruct reports this as

> Can't generate mapping method for a wildcard extends bound result.

Currently the plugin doesn't report this as an error.

One possible QuickFix could be removing the wildcard extends bound `? extends `.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the issue with the BoundMapper example in IntelliJ and inspect how the plugin handles result types with wildcard extends bounds. Done means the plugin reports an error for this case, with removing the `? extends` bound as a possible QuickFix; the payload names no source file or test.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.