Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@Ladicek
Copy link
Contributor

@Ladicek Ladicek commented Oct 25, 2023

The CDI.setCDIProvider() method has been documented to throw IllegalStateException on repeated calls since version 1.0, but since version 2.0, the implementation in fact didn't honor this documentation. Multiple implementations started to silently depend on repeated setCDIProvider() calls being allowed, especially for testing.

We previously [1][2] fixed the implementation to actually do what it documents, planning to release the fix in CDI 4.1, but it turns out this is very inconvenient. Therefore, this commit makes repeated calls of setCDIProvider() officially allowed. For consistency, it also allows repeated calls of BuildServicesResolver.setBuildServices().

[1] 82ec5d7
[2] 8ead70b

Fixes #695

The `CDI.setCDIProvider()` method has been documented to throw
`IllegalStateException` on repeated calls since version 1.0, but since
version 2.0, the implementation in fact didn't honor this documentation.
Multiple implementations started to silently depend on repeated
`setCDIProvider()` calls being allowed, especially for testing.

We previously [1][2] fixed the implementation to actually do what
it documents, planning to release the fix in CDI 4.1, but it turns out
this is very inconvenient. Therefore, this commit makes repeated calls
of `setCDIProvider()` officially allowed. For consistency, it also
allows repeated calls of `BuildServicesResolver.setBuildServices()`.

[1] jakartaee@82ec5d7
[2] jakartaee@8ead70b
@Ladicek Ladicek added this to the CDI 4.1 milestone Oct 25, 2023
@Ladicek Ladicek requested a review from manovotn October 25, 2023 15:16
@Ladicek
Copy link
Contributor Author

Ladicek commented Nov 7, 2023

No objections against this were raised on the call today, gonna merge :-)

@Ladicek Ladicek merged commit 2c81adf into jakartaee:main Nov 7, 2023
@Ladicek Ladicek deleted the allow-repeatable-spi-set branch November 7, 2023 16:19
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.

CDI.setCDIProvider() throwing on a repeated set is inconvenient

2 participants