Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Pico] Fixed UnsatisfiableDependencyException with Component dependencies #2764

Merged
merged 3 commits into from
Jun 1, 2023

Conversation

jkronegg
Copy link
Contributor

🤔 What's changed?

Classes registration in picoccontainer have changed from order top->down to bottom-up, which is required when one class in the hierarchy implements Disposable.

⚡️ What's your motivation?

Fixes #2762

🏷️ What kind of change is this?

  • 🐛 Bug fix (non-breaking change which fixes a defect)

♻️ Anything particular you want feedback on?

N/A

📋 Checklist:

  • I agree to respect and uphold the Cucumber Community Code of Conduct
  • I've changed the behaviour of the code
    • I have added/updated tests to cover my changes.
  • My change requires a change to the documentation.
    • I have updated the documentation accordingly.
  • Users should know about my change
    • I have added an entry to the "Unreleased" section of the CHANGELOG, linking to this pull request.

@codecov
Copy link

codecov bot commented May 26, 2023

Codecov Report

Merging #2764 (531d961) into main (383ab6d) will not change coverage.
The diff coverage is 100.00%.

@@            Coverage Diff            @@
##               main    #2764   +/-   ##
=========================================
  Coverage     84.98%   84.98%           
  Complexity     2725     2725           
=========================================
  Files           331      331           
  Lines          9537     9537           
  Branches        914      914           
=========================================
  Hits           8105     8105           
  Misses         1108     1108           
  Partials        324      324           
Impacted Files Coverage Δ
...in/java/io/cucumber/picocontainer/PicoFactory.java 95.65% <100.00%> (ø)

@jkronegg jkronegg requested a review from mpkorstanje May 26, 2023 19:21
Copy link
Contributor

@mpkorstanje mpkorstanje left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code wise, no remarks.

I suppose you have to register bottom up now because the container has been started already?

@jkronegg
Copy link
Contributor Author

jkronegg commented May 26, 2023

I suppose you have to register bottom up now because the container has been started already?

Yes, exactly. As the container has already been started, it tries to create a component instance of the FirstComponent, but this doesn't work because the SecondComponent class is not yet registered. By registering the classes from the constructor parameters first, the SecondComponent is registered when the container creates the FirstComponent instance.

I don't know why is the behaviour different depending on whether the Disposable interface is implemented or not...

@mpkorstanje mpkorstanje changed the title Corrected UnsatisfiableDependencyException with disposables dependencies [Pico] Fixed UnsatisfiableDependencyException with Component dependencies May 26, 2023
@jkronegg
Copy link
Contributor Author

jkronegg commented Jun 1, 2023

@mpkorstanje can you merge the pull request if everything is fine please ?

@mpkorstanje mpkorstanje merged commit 705f0ff into main Jun 1, 2023
@mpkorstanje mpkorstanje deleted the unsatisfied-dependency-picocontainer branch June 1, 2023 08:37
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.

UnsatisfiableDependenciesException with Components in Picocontainer after update to version 7.12.0
2 participants