You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@Component
@Tag(Json::class)
classJsonJdbcParameterColumnMapper<T>(privatevalwriter:JsonWriter<T>) : JdbcParameterColumnMapper<T> {
@Throws(SQLException::class)
overridefunset(stmt:PreparedStatement, index:Int, value:T?) {
try {
stmt.setString(index, String(writer.toByteArray(value), StandardCharsets.UTF_8))
} catch (e:IOException) {
throwSQLException(e)
}
}
}
@Repository
interfaceFooRepository {
@Query(""" INSERT INTO foo (bar) VALUES (:foo.bar::jsonb)""")
funinsert(foo:Foo)
@Query(""" UPDATE foo SET bar = :bar::jsonb""")
funupdateBar(@Json bar:Foo.Bar)
}
data classFoo(
// @Json// should be added to make everything workvalbar:Bar
) {
data classBar(vals:String)
}
If I uncomment // @Json:kspKotlin task fails with message:
> Task :kspKotlin FAILED
2 actionable tasks: 2 executed
e: [ksp] java.lang.NullPointerException
at ru.tinkoff.kora.ksp.common.FieldFactory.get(FieldFactory.kt:26)
at ru.tinkoff.kora.database.symbol.processor.jdbc.StatementSetterGenerator.generate(StatementSetterGenerator.kt:96)
at ru.tinkoff.kora.database.symbol.processor.jdbc.JdbcRepositoryGenerator.generate(JdbcRepositoryGenerator.kt:89)
at ru.tinkoff.kora.database.symbol.processor.jdbc.JdbcRepositoryGenerator.generate(JdbcRepositoryGenerator.kt:55)
at ru.tinkoff.kora.database.symbol.processor.RepositoryBuilder.build(RepositoryBuilder.kt:50)
at ru.tinkoff.kora.database.symbol.processor.RepositorySymbolProcessor.processClass(RepositorySymbolProcessor.kt:45)
at ru.tinkoff.kora.database.symbol.processor.RepositorySymbolProcessor.access$processClass(RepositorySymbolProcessor.kt:15)
at ru.tinkoff.kora.database.symbol.processor.RepositorySymbolProcessor$processRound$1.invoke(RepositorySymbolProcessor.kt:26)
at ru.tinkoff.kora.database.symbol.processor.RepositorySymbolProcessor$processRound$1.invoke(RepositorySymbolProcessor.kt:26)
at ru.tinkoff.kora.ksp.common.KspCommonUtilsKt$visitClass$1.visitClassDeclaration(KspCommonUtils.kt:208)
at com.google.devtools.ksp.symbol.impl.kotlin.KSClassDeclarationImpl.accept(KSClassDeclarationImpl.kt:136)
at ru.tinkoff.kora.ksp.common.KspCommonUtilsKt.visitClass(KspCommonUtils.kt:204)
at ru.tinkoff.kora.database.symbol.processor.RepositorySymbolProcessor.processRound(RepositorySymbolProcessor.kt:26)
at ru.tinkoff.kora.ksp.common.BaseSymbolProcessor.process(BaseSymbolProcessor.kt:87)
at com.google.devtools.ksp.AbstractKotlinSymbolProcessingExtension$doAnalysis$6$1.invoke(KotlinSymbolProcessingExtension.kt:291)
at com.google.devtools.ksp.AbstractKotlinSymbolProcessingExtension$doAnalysis$6$1.invoke(KotlinSymbolProcessingExtension.kt:289)
at com.google.devtools.ksp.AbstractKotlinSymbolProcessingExtension.handleException(KotlinSymbolProcessingExtension.kt:394)
at com.google.devtools.ksp.AbstractKotlinSymbolProcessingExtension.doAnalysis(KotlinSymbolProcessingExtension.kt:289)
at org.jetbrains.kotlin.cli.jvm.compiler.TopDownAnalyzerFacadeForJVM.analyzeFilesWithJavaIntegration(TopDownAnalyzerFacadeForJVM.kt:123)
at org.jetbrains.kotlin.cli.jvm.compiler.TopDownAnalyzerFacadeForJVM.analyzeFilesWithJavaIntegration$default(TopDownAnalyzerFacadeForJVM.kt:99)
at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler$analyze$1.invoke(KotlinToJVMBytecodeCompiler.kt:257)
at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler$analyze$1.invoke(KotlinToJVMBytecodeCompiler.kt:42)
at org.jetbrains.kotlin.cli.common.messages.AnalyzerWithCompilerReport.analyzeAndReport(AnalyzerWithCompilerReport.kt:115)
at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler.analyze(KotlinToJVMBytecodeCompiler.kt:248)
at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler.compileModules$cli(KotlinToJVMBytecodeCompiler.kt:88)
at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler.compileModules$cli$default(KotlinToJVMBytecodeCompiler.kt:47)
at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.doExecute(K2JVMCompiler.kt:168)
at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.doExecute(K2JVMCompiler.kt:53)
at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.kt:100)
at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.kt:46)
at org.jetbrains.kotlin.cli.common.CLITool.exec(CLITool.kt:101)
at org.jetbrains.kotlin.daemon.CompileServiceImpl.compile(CompileServiceImpl.kt:1486)
at jdk.internal.reflect.GeneratedMethodAccessor52.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at java.rmi/sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:360)
at java.rmi/sun.rmi.transport.Transport$1.run(Transport.java:200)
at java.rmi/sun.rmi.transport.Transport$1.run(Transport.java:197)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:712)
at java.rmi/sun.rmi.transport.Transport.serviceCall(Transport.java:196)
at java.rmi/sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:587)
at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:828)
at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:705)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:704)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
at java.base/java.lang.Thread.run(Thread.java:833)
e: Error occurred in KSP, check log for detail
FAILURE: Build failed with an exception.
The text was updated successfully, but these errors were encountered:
mitasov-ra
changed the title
NPE in KSP when trying to add @Json to data-class field
NPE in KSP when trying to add @Json to data-class property
Jun 20, 2023
If I uncomment
// @Json
:kspKotlin
task fails with message:The text was updated successfully, but these errors were encountered: