Skip to content

Conversation

@rbygrave
Copy link
Contributor

Example:

@Bean
Optional<CFace> optional() { ... }

The generated isBeanAbsent() method should include all the types that CFace extends such as interfaces. If CFace extends C2Face then both should be there like:

.isBeanAbsent(CFace.class, C2Face.class)

The bug was that only the top type of CFace was included like:

.isBeanAbsent(CFace.class)

This was due to a bug in MethodReader determining the incorrect returnElement for the optionalType = true case. The returnElement was the Optional type rather than the parameter type CFace.

Example:
```
@bean
Optional<CFace> optional() { ... }
```

The generated isBeanAbsent() method should include all the types that CFace extends such as interfaces. If CFace extends C2Face then both should be there like:

.isBeanAbsent(CFace.class, C2Face.class))

The bug was that only the top type of CFace was included like:

```
.isBeanAbsent(CFace.class))
```

This was due to a bug in MethodReader determining the incorrect returnElement for the optionalType = true case. The returnElement was the Optional type rather than the parameter type CFace.
@rbygrave rbygrave requested a review from SentryMan March 26, 2025 08:04
@rbygrave rbygrave self-assigned this Mar 26, 2025
@rbygrave rbygrave enabled auto-merge (squash) March 26, 2025 08:06
@rbygrave rbygrave merged commit afab32d into master Mar 26, 2025
13 checks passed
@SentryMan SentryMan deleted the feature/fix-optional-extends branch March 26, 2025 17:02
@SentryMan SentryMan added this to the 11.4 milestone Mar 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants