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

KotlinCopyMethod.findSyntheticCopyMethod(…) does not find default copy method with Kotlin 1.3 [DATACMNS-1400] #1835

Closed
spring-projects-issues opened this issue Sep 27, 2018 · 14 comments

Comments

@spring-projects-issues
Copy link

@spring-projects-issues spring-projects-issues commented Sep 27, 2018

Juergen Zimmermann opened DATACMNS-1400 and commented

When I invoke a reactive mongoTemplate.insert(myObj) then I get the stacktrace below. The entity class is a Kotlin data class with this property:
@Version @JsonIgnore val version: Int? = null
I'm using the invocation in a "dev" profile to initially load some test data.

When I remove @Version then the insert statement works as expected.

Same issue with:

  • repo.save(myObj) where repo is a reactive repository
  • Lifecycle annotation @CreatedDate
  • Lifecycle annotation @LastModifiedDate

Stacktrace: 

java.lang.UnsupportedOperationException: No accessor to set property @org.springframework.data.annotation.Version()private final java.lang.Integer de.hska.kunde.entity.Kunde.version!
 at de.hska.kunde.entity.Kunde_Accessor_qaloks.setProperty(Unknown Source)
 at org.springframework.data.mapping.model.ConvertingPropertyAccessor.setProperty(ConvertingPropertyAccessor.java:61)
 at org.springframework.data.mongodb.core.EntityOperations$AdaptibleMappedEntity.initializeVersionProperty(EntityOperations.java:634)
 at org.springframework.data.mongodb.core.ReactiveMongoTemplate.lambda$doInsert$24(ReactiveMongoTemplate.java:1231)
 at reactor.core.publisher.MonoDefer.subscribe(MonoDefer.java:44)
 at reactor.core.publisher.MonoLift.subscribe(MonoLift.java:45)
 at reactor.core.publisher.MonoOnAssembly.subscribe(MonoOnAssembly.java:76)
 at reactor.core.publisher.Mono.subscribe(Mono.java:3563)
 at reactor.core.publisher.FluxFlatMap$FlatMapMain.onNext(FluxFlatMap.java:389)
 at reactor.core.publisher.FluxOnAssembly$OnAssemblySubscriber.onNext(FluxOnAssembly.java:373)
 at org.springframework.cloud.sleuth.instrument.reactor.ScopePassingSpanSubscriber.onNext(ScopePassingSpanSubscriber.java:81)
 at reactor.core.publisher.FluxOnAssembly$OnAssemblySubscriber.onNext(FluxOnAssembly.java:373)
 at org.springframework.cloud.sleuth.instrument.reactor.ScopePassingSpanSubscriber.onNext(ScopePassingSpanSubscriber.java:81)
 at reactor.core.publisher.FluxConcatArray$ConcatArraySubscriber.onNext(FluxConcatArray.java:176)
 at reactor.core.publisher.FluxOnAssembly$OnAssemblySubscriber.onNext(FluxOnAssembly.java:373)
 at org.springframework.cloud.sleuth.instrument.reactor.ScopePassingSpanSubscriber.onNext(ScopePassingSpanSubscriber.java:81)
 at reactor.core.publisher.FluxArray$ArraySubscription.slowPath(FluxArray.java:126)
 at reactor.core.publisher.FluxArray$ArraySubscription.request(FluxArray.java:99)
 at org.springframework.cloud.sleuth.instrument.reactor.ScopePassingSpanSubscriber.request(ScopePassingSpanSubscriber.java:69)
 at reactor.core.publisher.FluxOnAssembly$OnAssemblySubscriber.request(FluxOnAssembly.java:458)
 at reactor.core.publisher.Operators$MultiSubscriptionSubscriber.set(Operators.java:1804)
 at reactor.core.publisher.Operators$MultiSubscriptionSubscriber.onSubscribe(Operators.java:1678)
 at reactor.core.publisher.FluxOnAssembly$OnAssemblySubscriber.onSubscribe(FluxOnAssembly.java:442)
 at org.springframework.cloud.sleuth.instrument.reactor.ScopePassingSpanSubscriber.onSubscribe(ScopePassingSpanSubscriber.java:63)
 at reactor.core.publisher.FluxArray.subscribe(FluxArray.java:53)
 at reactor.core.publisher.FluxArray.subscribe(FluxArray.java:59)
 at reactor.core.publisher.FluxLiftFuseable.subscribe(FluxLiftFuseable.java:70)
 at reactor.core.publisher.FluxOnAssembly.subscribe(FluxOnAssembly.java:164)
 at reactor.core.publisher.Flux.subscribe(Flux.java:7700)
 at reactor.core.publisher.FluxConcatArray$ConcatArraySubscriber.onComplete(FluxConcatArray.java:207)
 at reactor.core.publisher.FluxOnAssembly$OnAssemblySubscriber.onComplete(FluxOnAssembly.java:383)
 at org.springframework.cloud.sleuth.instrument.reactor.ScopePassingSpanSubscriber.onComplete(ScopePassingSpanSubscriber.java:93)
 at reactor.core.publisher.MonoIgnoreElements$IgnoreElementsSubscriber.onComplete(MonoIgnoreElements.java:81)
 at reactor.core.publisher.FluxOnAssembly$OnAssemblySubscriber.onComplete(FluxOnAssembly.java:383)
 at org.springframework.cloud.sleuth.instrument.reactor.ScopePassingSpanSubscriber.onComplete(ScopePassingSpanSubscriber.java:93)
 at reactor.core.publisher.Operators$MonoSubscriber.complete(Operators.java:1434)
 at reactor.core.publisher.MonoFlatMap$FlatMapInner.onNext(MonoFlatMap.java:241)
 at reactor.core.publisher.FluxOnAssembly$OnAssemblySubscriber.onNext(FluxOnAssembly.java:373)
 at org.springframework.cloud.sleuth.instrument.reactor.ScopePassingSpanSubscriber.onNext(ScopePassingSpanSubscriber.java:81)
 at reactor.core.publisher.Operators$MonoSubscriber.complete(Operators.java:1432)
 at reactor.core.publisher.MonoFlatMap$FlatMapInner.onNext(MonoFlatMap.java:241)
 at reactor.core.publisher.FluxOnAssembly$OnAssemblySubscriber.onNext(FluxOnAssembly.java:373)
 at org.springframework.cloud.sleuth.instrument.reactor.ScopePassingSpanSubscriber.onNext(ScopePassingSpanSubscriber.java:81)
 at reactor.core.publisher.MonoNext$NextSubscriber.onNext(MonoNext.java:76)
 at reactor.core.publisher.FluxOnAssembly$OnAssemblySubscriber.onNext(FluxOnAssembly.java:373)
 at org.springframework.cloud.sleuth.instrument.reactor.ScopePassingSpanSubscriber.onNext(ScopePassingSpanSubscriber.java:81)
 at reactor.core.publisher.FluxOnErrorResume$ResumeSubscriber.onNext(FluxOnErrorResume.java:73)
 at reactor.core.publisher.FluxOnAssembly$OnAssemblySubscriber.onNext(FluxOnAssembly.java:373)
 at org.springframework.cloud.sleuth.instrument.reactor.ScopePassingSpanSubscriber.onNext(ScopePassingSpanSubscriber.java:81)
 at reactor.core.publisher.MonoFlatMapMany$FlatMapManyInner.onNext(MonoFlatMapMany.java:238)
 at com.mongodb.reactivestreams.client.internal.ObservableToPublisher$1.onNext(ObservableToPublisher.java:68)
 at com.mongodb.async.client.AbstractSubscription.onNext(AbstractSubscription.java:135)
 at com.mongodb.async.client.AbstractSubscription.processResultsQueue(AbstractSubscription.java:203)
 at com.mongodb.async.client.AbstractSubscription.tryProcessResultsQueue(AbstractSubscription.java:159)
 at com.mongodb.async.client.SingleResultCallbackSubscription$1.onResult(SingleResultCallbackSubscription.java:48)
 at com.mongodb.async.client.MongoCollectionImpl$6.onResult(MongoCollectionImpl.java:828)
 at com.mongodb.async.client.MongoCollectionImpl$6.onResult(MongoCollectionImpl.java:822)
 at com.mongodb.async.client.MongoCollectionImpl$8.onResult(MongoCollectionImpl.java:887)
 at com.mongodb.async.client.MongoCollectionImpl$8.onResult(MongoCollectionImpl.java:881)
 at com.mongodb.internal.async.ErrorHandlingResultCallback.onResult(ErrorHandlingResultCallback.java:49)
 at com.mongodb.async.client.OperationExecutorImpl$2$1.onResult(OperationExecutorImpl.java:117)
 at com.mongodb.internal.async.ErrorHandlingResultCallback.onResult(ErrorHandlingResultCallback.java:49)
 at com.mongodb.operation.OperationHelper$ReferenceCountedReleasingWrappedCallback.onResult(OperationHelper.java:364)
 at com.mongodb.operation.CreateIndexesOperation$2$1$1.onResult(CreateIndexesOperation.java:205)
 at com.mongodb.operation.CreateIndexesOperation$2$1$1.onResult(CreateIndexesOperation.java:202)
 at com.mongodb.operation.CommandOperationHelper$2.onResult(CommandOperationHelper.java:405)
 at com.mongodb.internal.async.ErrorHandlingResultCallback.onResult(ErrorHandlingResultCallback.java:49)
 at com.mongodb.internal.connection.DefaultServer$DefaultServerProtocolExecutor$2.onResult(DefaultServer.java:227)
 at com.mongodb.internal.async.ErrorHandlingResultCallback.onResult(ErrorHandlingResultCallback.java:49)
 at com.mongodb.internal.connection.CommandProtocolImpl$1.onResult(CommandProtocolImpl.java:85)
 at com.mongodb.internal.connection.DefaultConnectionPool$PooledConnection$1.onResult(DefaultConnectionPool.java:461)
 at com.mongodb.internal.connection.UsageTrackingInternalConnection$2.onResult(UsageTrackingInternalConnection.java:111)
 at com.mongodb.internal.async.ErrorHandlingResultCallback.onResult(ErrorHandlingResultCallback.java:49)
 at com.mongodb.internal.connection.InternalStreamConnection$2$1.onResult(InternalStreamConnection.java:379)
 at com.mongodb.internal.connection.InternalStreamConnection$2$1.onResult(InternalStreamConnection.java:356)
 at com.mongodb.internal.connection.InternalStreamConnection$MessageHeaderCallback$MessageCallback.onResult(InternalStreamConnection.java:651)
 at com.mongodb.internal.connection.InternalStreamConnection$MessageHeaderCallback$MessageCallback.onResult(InternalStreamConnection.java:618)
 at com.mongodb.internal.connection.InternalStreamConnection$5.completed(InternalStreamConnection.java:494)
 at com.mongodb.internal.connection.InternalStreamConnection$5.completed(InternalStreamConnection.java:491)
 at com.mongodb.connection.netty.NettyStream.readAsync(NettyStream.java:236)
 at com.mongodb.internal.connection.InternalStreamConnection.readAsync(InternalStreamConnection.java:491)
 at com.mongodb.internal.connection.InternalStreamConnection.access$1000(InternalStreamConnection.java:74)
 at com.mongodb.internal.connection.InternalStreamConnection$MessageHeaderCallback.onResult(InternalStreamConnection.java:608)
 at com.mongodb.internal.connection.InternalStreamConnection$MessageHeaderCallback.onResult(InternalStreamConnection.java:593)
 at com.mongodb.internal.connection.InternalStreamConnection$5.completed(InternalStreamConnection.java:494)
 at com.mongodb.internal.connection.InternalStreamConnection$5.completed(InternalStreamConnection.java:491)
 at com.mongodb.connection.netty.NettyStream.readAsync(NettyStream.java:236)
 at com.mongodb.connection.netty.NettyStream.handleReadResponse(NettyStream.java:266)
 at com.mongodb.connection.netty.NettyStream.access$600(NettyStream.java:66)
 at com.mongodb.connection.netty.NettyStream$InboundBufferHandler.channelRead0(NettyStream.java:325)
 at com.mongodb.connection.netty.NettyStream$InboundBufferHandler.channelRead0(NettyStream.java:322)
 at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:105)
 at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)
 at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)
 at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340)
 at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1434)
 at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)
 at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)
 at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:965)
 at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:163)
 at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:628)
 at io.netty.channel.nio.NioEventLoop.processSelectedKeysPlain(NioEventLoop.java:528)
 at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:482)
 at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:442)
 at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:884)
 at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
 at java.base/java.lang.Thread.run(Thread.java:834)
 Suppressed: reactor.core.publisher.FluxOnAssembly$OnAssemblyException:
 Assembly trace from producer [reactor.core.publisher.MonoLift] :
 reactor.core.publisher.Mono.defer(Mono.java:198)
 org.springframework.data.mongodb.core.ReactiveMongoTemplate.doInsert(ReactiveMongoTemplate.java:1228)
 org.springframework.data.mongodb.core.ReactiveMongoTemplate.insert(ReactiveMongoTemplate.java:1221)
 org.springframework.data.mongodb.core.ReactiveMongoTemplate.insert(ReactiveMongoTemplate.java:1209)
 de.hska.kunde.config.dev.DbPopulate$dbPopulate$1$2.invoke(DbPopulate.kt:74)
 de.hska.kunde.config.dev.DbPopulate$dbPopulate$1$2.invoke(DbPopulate.kt:54)
 reactor.core.publisher.FluxFlatMap$FlatMapMain.onNext(FluxFlatMap.java:350)
 org.springframework.cloud.sleuth.instrument.reactor.ScopePassingSpanSubscriber.onNext(ScopePassingSpanSubscriber.java:81)
 org.springframework.cloud.sleuth.instrument.reactor.ScopePassingSpanSubscriber.onNext(ScopePassingSpanSubscriber.java:81)
 reactor.core.publisher.FluxConcatArray$ConcatArraySubscriber.onNext(FluxConcatArray.java:176)
 org.springframework.cloud.sleuth.instrument.reactor.ScopePassingSpanSubscriber.onNext(ScopePassingSpanSubscriber.java:81)
 reactor.core.publisher.FluxArray$ArraySubscription.slowPath(FluxArray.java:126)
 reactor.core.publisher.FluxArray$ArraySubscription.request(FluxArray.java:99)
 org.springframework.cloud.sleuth.instrument.reactor.ScopePassingSpanSubscriber.request(ScopePassingSpanSubscriber.java:69)
 reactor.core.publisher.Operators$MultiSubscriptionSubscriber.set(Operators.java:1804)
 reactor.core.publisher.Operators$MultiSubscriptionSubscriber.onSubscribe(Operators.java:1678)
 org.springframework.cloud.sleuth.instrument.reactor.ScopePassingSpanSubscriber.onSubscribe(ScopePassingSpanSubscriber.java:63)
 reactor.core.publisher.FluxArray.subscribe(FluxArray.java:53)
 reactor.core.publisher.FluxArray.subscribe(FluxArray.java:59)
 reactor.core.publisher.FluxLiftFuseable.subscribe(FluxLiftFuseable.java:70)
 reactor.core.publisher.Flux.subscribe(Flux.java:7700)
 reactor.core.publisher.FluxConcatArray$ConcatArraySubscriber.onComplete(FluxConcatArray.java:207)
 org.springframework.cloud.sleuth.instrument.reactor.ScopePassingSpanSubscriber.onComplete(ScopePassingSpanSubscriber.java:93)
 reactor.core.publisher.MonoIgnoreElements$IgnoreElementsSubscriber.onComplete(MonoIgnoreElements.java:81)
 org.springframework.cloud.sleuth.instrument.reactor.ScopePassingSpanSubscriber.onComplete(ScopePassingSpanSubscriber.java:93)
 reactor.core.publisher.Operators$MonoSubscriber.complete(Operators.java:1434)
 reactor.core.publisher.MonoFlatMap$FlatMapInner.onNext(MonoFlatMap.java:241)
 org.springframework.cloud.sleuth.instrument.reactor.ScopePassingSpanSubscriber.onNext(ScopePassingSpanSubscriber.java:81)
 reactor.core.publisher.Operators$MonoSubscriber.complete(Operators.java:1432)
 reactor.core.publisher.MonoFlatMap$FlatMapInner.onNext(MonoFlatMap.java:241)
 org.springframework.cloud.sleuth.instrument.reactor.ScopePassingSpanSubscriber.onNext(ScopePassingSpanSubscriber.java:81)
 reactor.core.publisher.MonoNext$NextSubscriber.onNext(MonoNext.java:76)
 org.springframework.cloud.sleuth.instrument.reactor.ScopePassingSpanSubscriber.onNext(ScopePassingSpanSubscriber.java:81)
 reactor.core.publisher.FluxOnErrorResume$ResumeSubscriber.onNext(FluxOnErrorResume.java:73)
 org.springframework.cloud.sleuth.instrument.reactor.ScopePassingSpanSubscriber.onNext(ScopePassingSpanSubscriber.java:81)
 reactor.core.publisher.MonoFlatMapMany$FlatMapManyInner.onNext(MonoFlatMapMany.java:238)
 com.mongodb.reactivestreams.client.internal.ObservableToPublisher$1.onNext(ObservableToPublisher.java:68)
 com.mongodb.async.client.AbstractSubscription.onNext(AbstractSubscription.java:135)
 com.mongodb.async.client.AbstractSubscription.processResultsQueue(AbstractSubscription.java:203)
 com.mongodb.async.client.AbstractSubscription.tryProcessResultsQueue(AbstractSubscription.java:159)
 com.mongodb.async.client.SingleResultCallbackSubscription$1.onResult(SingleResultCallbackSubscription.java:48)
 com.mongodb.async.client.MongoCollectionImpl$6.onResult(MongoCollectionImpl.java:828)
 com.mongodb.async.client.MongoCollectionImpl$6.onResult(MongoCollectionImpl.java:822)
 com.mongodb.async.client.MongoCollectionImpl$8.onResult(MongoCollectionImpl.java:887)
 com.mongodb.async.client.MongoCollectionImpl$8.onResult(MongoCollectionImpl.java:881)
 com.mongodb.internal.async.ErrorHandlingResultCallback.onResult(ErrorHandlingResultCallback.java:49)
 com.mongodb.async.client.OperationExecutorImpl$2$1.onResult(OperationExecutorImpl.java:117)
 com.mongodb.internal.async.ErrorHandlingResultCallback.onResult(ErrorHandlingResultCallback.java:49)
 com.mongodb.operation.OperationHelper$ReferenceCountedReleasingWrappedCallback.onResult(OperationHelper.java:364)
 com.mongodb.operation.CreateIndexesOperation$2$1$1.onResult(CreateIndexesOperation.java:205)
 com.mongodb.operation.CreateIndexesOperation$2$1$1.onResult(CreateIndexesOperation.java:202)
 com.mongodb.operation.CommandOperationHelper$2.onResult(CommandOperationHelper.java:405)
 com.mongodb.internal.async.ErrorHandlingResultCallback.onResult(ErrorHandlingResultCallback.java:49)
 com.mongodb.internal.connection.DefaultServer$DefaultServerProtocolExecutor$2.onResult(DefaultServer.java:227)
 com.mongodb.internal.async.ErrorHandlingResultCallback.onResult(ErrorHandlingResultCallback.java:49)
 com.mongodb.internal.connection.CommandProtocolImpl$1.onResult(CommandProtocolImpl.java:85)
 com.mongodb.internal.connection.DefaultConnectionPool$PooledConnection$1.onResult(DefaultConnectionPool.java:461)
 com.mongodb.internal.connection.UsageTrackingInternalConnection$2.onResult(UsageTrackingInternalConnection.java:111)
 com.mongodb.internal.async.ErrorHandlingResultCallback.onResult(ErrorHandlingResultCallback.java:49)
 com.mongodb.internal.connection.InternalStreamConnection$2$1.onResult(InternalStreamConnection.java:379)
 com.mongodb.internal.connection.InternalStreamConnection$2$1.onResult(InternalStreamConnection.java:356)
 com.mongodb.internal.connection.InternalStreamConnection$MessageHeaderCallback$MessageCallback.onResult(InternalStreamConnection.java:651)
 com.mongodb.internal.connection.InternalStreamConnection$MessageHeaderCallback$MessageCallback.onResult(InternalStreamConnection.java:618)
 com.mongodb.internal.connection.InternalStreamConnection$5.completed(InternalStreamConnection.java:494)
 com.mongodb.internal.connection.InternalStreamConnection$5.completed(InternalStreamConnection.java:491)
 com.mongodb.connection.netty.NettyStream.readAsync(NettyStream.java:236)
 com.mongodb.internal.connection.InternalStreamConnection.readAsync(InternalStreamConnection.java:491)
 com.mongodb.internal.connection.InternalStreamConnection.access$1000(InternalStreamConnection.java:74)
 com.mongodb.internal.connection.InternalStreamConnection$MessageHeaderCallback.onResult(InternalStreamConnection.java:608)
 com.mongodb.internal.connection.InternalStreamConnection$MessageHeaderCallback.onResult(InternalStreamConnection.java:593)
 com.mongodb.internal.connection.InternalStreamConnection$5.completed(InternalStreamConnection.java:494)
 com.mongodb.internal.connection.InternalStreamConnection$5.completed(InternalStreamConnection.java:491)
 com.mongodb.connection.netty.NettyStream.readAsync(NettyStream.java:236)
 com.mongodb.connection.netty.NettyStream.handleReadResponse(NettyStream.java:266)
 com.mongodb.connection.netty.NettyStream.access$600(NettyStream.java:66)
 com.mongodb.connection.netty.NettyStream$InboundBufferHandler.channelRead0(NettyStream.java:325)
 com.mongodb.connection.netty.NettyStream$InboundBufferHandler.channelRead0(NettyStream.java:322)
 io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:105)
 io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)
 io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)
 io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340)
 io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1434)
 io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)
 io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)
 io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:965)
 io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:163)
 io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:628)
 io.netty.channel.nio.NioEventLoop.processSelectedKeysPlain(NioEventLoop.java:528)
 io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:482)
 io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:442)
 io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:884)
 io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
 Error has been observed by the following operator(s):
|_ Mono.defer ? org.springframework.data.mongodb.core.ReactiveMongoTemplate.doInsert(ReactiveMongoTemplate.java:1228)|
|_ Flux.flatMap ? de.hska.kunde.config.dev.DbPopulate$dbPopulate$1.run(DbPopulate.kt:74)

Affects: 2.1 GA (Lovelace)

Attachments:

Referenced from: pull request #315

Backported to: 2.1.1 (Lovelace SR1)

@spring-projects-issues
Copy link
Author

@spring-projects-issues spring-projects-issues commented Sep 27, 2018

Juergen Zimmermann commented

In the docs I found that I now have to provide a "withVersion" method. Thank you for providing the comprehensive docs!

@spring-projects-issues
Copy link
Author

@spring-projects-issues spring-projects-issues commented Sep 27, 2018

Christoph Strobl commented

Thanks for reporting - would you mind checking if it works once you declare the version property non final using var instead of val

@spring-projects-issues
Copy link
Author

@spring-projects-issues spring-projects-issues commented Sep 28, 2018

Juergen Zimmermann commented

Christoph Strobl Using var (without the wither method) works fine

@spring-projects-issues
Copy link
Author

@spring-projects-issues spring-projects-issues commented Oct 1, 2018

Mark Paluch commented

There are some additional details on this issue: We're natively supporting Kotlin data classes by leveraging the copy method. To do so, you need to declare the properties-to-mutate in your primary constructor as the copy method signature is derived from the primary constructor. Wither methods are not really idiomatic to Kotlin.

We no longer support mutations of truly immutable objects so we cannot change properties without having either a mutable property (which then again contradicts immutability) or a method that creates a new object instance with the changed property value

@spring-projects-issues
Copy link
Author

@spring-projects-issues spring-projects-issues commented Oct 1, 2018

Juergen Zimmermann commented

Mark Paluch Are you saying that such a data class should work without a wither method?

@Document
@TypeAlias("Kunde")
@JsonPropertyOrder(...)
data class Kunde(
...
@Version
@JsonIgnore
val version: Int? = null,
...
@CreatedDate
@JsonIgnore
private val erzeugt: LocalDateTime? = null,

@LastModifiedDate
@JsonIgnore
private val aktualisiert: LocalDateTime? = null

) {...}

@spring-projects-issues
Copy link
Author

@spring-projects-issues spring-projects-issues commented Oct 1, 2018

Mark Paluch commented

Yes. The code above compiles to a synthetic copy$default method. However, the outcome differs between Kotlin 1.2.x and 1.3.x compilation after updating Kotlin to 1.3 (RC). We're expecting the synthetic copy method to be a bridge method having the ACC_BRIDGE flag set.

Can you verify this behavior?
 

@spring-projects-issues
Copy link
Author

@spring-projects-issues spring-projects-issues commented Oct 1, 2018

Mark Paluch commented

I moved this ticket to Commons and adjusted the description to reflect the actual issue

@spring-projects-issues
Copy link
Author

@spring-projects-issues spring-projects-issues commented Oct 1, 2018

Juergen Zimmermann commented

Mark Paluch Frankly spoken: I don't know what yu want me to do. I attach [^Kunde.javap.txt] the output of "javap -c de.hska.kunde.entity.Kunde". Is this what you want/need?

@spring-projects-issues
Copy link
Author

@spring-projects-issues spring-projects-issues commented Oct 2, 2018

Mark Paluch commented

Sorry for the confusion. I originally had asked you to compile and test your code with Kotlin versions 1.3.0-rc-80 and 1.2.61 to see whether the issue happens on both versions. Since we found the causing ticket in the Kotlin issue tracker (see the linked tickets), this isn't necessary anymore

@spring-projects-issues
Copy link
Author

@spring-projects-issues spring-projects-issues commented Oct 2, 2018

Juergen Zimmermann commented

Mark Paluch Now I used the CFR decompiler for the entity class without the wither methods. The output is attached. [^Kunde.java]

@spring-projects-issues
Copy link
Author

@spring-projects-issues spring-projects-issues commented Oct 2, 2018

Mark Paluch commented

Thanks a lot. This output shows that copy$default is only synthetic but not bridge. We're going to drop the bridge requirement on default methods to not obstruct Kotlin 1.3 usage

@spring-projects-issues
Copy link
Author

@spring-projects-issues spring-projects-issues commented Oct 2, 2018

Mark Paluch commented

I pushed the fix onto a bugfix branch and we deployed a fixed artifact with the version 2.2.0.DATACMNS-1400-SNAPSHOT. Care to upgrade Spring Data Commons to the fixed version and retest your case?

@spring-projects-issues
Copy link
Author

@spring-projects-issues spring-projects-issues commented Oct 2, 2018

Juergen Zimmermann commented

Mark Paluch I tried org.springframework.data:spring-data-commons:2.2.0.DATACMNS-1400-SNAPSHOT with Kotlin 1.3.0-rc-131: it works as expected, i.e. no wither methods are necessary

@spring-projects-issues
Copy link
Author

@spring-projects-issues spring-projects-issues commented Oct 2, 2018

Mark Paluch commented

Thanks a lot for verifying

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

Successfully merging a pull request may close this issue.

None yet
2 participants