micronaut-data
micronaut-data copied to clipboard
Reactor Repository generation fails with micronaut 3.8.1
Expected Behavior
Reactor repositories continue to work like with micronaut 3.8.0
Example: @JdbcRepository(dialect = Dialect.H2) interface DemoReactorRepository : ReactorCrudRepository<DemoEntity, Long> { // the following line fails to compile/generate with kaptKotlin with micronaut 3.8.1 (until 3.8.0 it worked fine): fun findMaxPublishedDateByName(name: String): Mono<LocalDateTime> }
@Introspected @MappedEntity data class DemoEntity( @field:Id val id: Long, val name: String, val publishedDate: LocalDateTime?, )
Actual Behaviour
kaptKotlin fails with the following error duing the build: error: Unable to implement Repository method: DemoReactorRepository.findMaxPublishedDateByName(String name). Cannot project on non-existent property publishedDateByName public abstract reactor.core.publisher.Mono<java.time.LocalDateTime> findMaxPublishedDateByName(@org.jetbrains.annotations.NotNull() ^
Steps To Reproduce
Create a findMaxXXXByYYY on a ReactorCrudRepository using micronaut 3.8.1
Environment Information
Ubuntu 22.04 JDK 17 Kotlin 1.6.10
Example Application
https://github.com/StefanSrf/micronaut-3-8-repository-bug
Version
3.8.1
Could be broken by fix for this https://github.com/micronaut-projects/micronaut-data/issues/1898 I will take a look
Looks like it is caused by this commit @dstepanov
Changes in FindMethodMatcher
are causing this because this should return Mono<LocaleDateTime>
and your change is to check actual type that Mono will hold and it fails for LocaleDateTime
. I am not sure what I can revert back and avoid breaking your changes, so if you can please have a look.
@dstepanov any progress here? We are stuck with version 3.8.0 until this is fixed
Going to look at it soon
Looks like it was fixed, I have added a test to validate it. Please reopen if it occurs
@dstepanov: I tried using micronaut-data-processor:3.10.0, but the problem still exists. It's not a runtime problem, it's a code generation problem. The referenced example application (https://github.com/StefanSrf/micronaut-3-8-repository-bug) easily reproduces the compile-issue.