quantummaid / injectmaid

Lightweight dependency injection framework that does not rely on annotations.
https://quantummaid.de
Apache License 2.0
9 stars 0 forks source link

[BUG] StackOverflowError when calling InjectMaidBuilder.toString() #44

Closed lestephane closed 3 years ago

lestephane commented 4 years ago

Describe the bug

I'm getting StackOverflowErrors in the variable watches when debugging in my IDE. I need to be able to see what's going on in a debugger because of the other issue preventing me from seeing the root cause of an injection error (#19).

To Reproduce

public class BuilderSpecs {
    interface IDependency {};
    class DependencyImpl implements IDependency {};

    @Test
    void toStringDoesNotCauseStackOverflow() {
        InjectMaid.anInjectMaid()
            .withImplementation(IDependency.class, DependencyImpl.class)
            .toString();
    }
}

(there might be a simpler reproduction, but this is the shortest I could come up with)

Here is an example screenshot of what the user experiences in the IDE. Each of the collecting data... eventually turns out to yield StackOverflowError. Sometimes it is immediate, sometimes is takes a few seconds.

image

I suspect this problem is also the reason that I cannot debug the stream in States.update()

image

Expected behavior

Environment description N/A

Additional context N/A