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

PreferredConstructor discovery fails for Kotlin types without primary constructor [DATACMNS-1170] #1612

spring-projects-issues opened this issue Sep 18, 2017 · 2 comments


Copy link

@spring-projects-issues spring-projects-issues commented Sep 18, 2017

Romain Boisselle opened DATACMNS-1170 and commented


I'm working with Spring Boot 2.0.0, Kotlin and Mockito.
Since I upgraded my project from M3 to M4 (Spring 5.0.0-RC3 to RC4) I have some issue with it.

I get a BeanCreationException based on:

java.lang.IllegalArgumentException: Parameter specified as non-null is null: method kotlin.reflect.jvm.ReflectJvmMapping.getJavaConstructor, parameter $receiver

But, I didn't change my code, so can possibility went wrong in the process ?
You can find details and code in the stackoverflow issue.

Thank you

Affects: 2.0 RC3 (Kay)

Reference URL:

Referenced from: pull request #244

Copy link

@spring-projects-issues spring-projects-issues commented Sep 22, 2017

Sébastien Deleuze commented

I have created a repro project from your StackOverflow question and indeed such exception is raised, but the stacktrace seems to be at Spring Data Commons level which calls directly Kotlin API so I am going to move this issue to DATACMS

Copy link

@spring-projects-issues spring-projects-issues commented Sep 22, 2017

Mark Paluch commented

We attempt to look up the preferred constructor for Kotlin classes during initialization. The Kotlin class has multiple constructors but no primary constructor. Since we relied on Kotlin's primary constructor lookup, this lookup failed.

We will fall back to the no-args constructor in such cases

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants