Comments (6)
I pulled your z/ksp
branch to my local and ran ./gradlew :sample:compileKotlin
, build is passing.
from ksp.
I am able to reproduce with :sample:build
though.
from ksp.
Strange... I was running from IntelliJ, but that should be similar. I wonder if maybe there's some sort of stale state issue with local projects or incremental reruns?
from ksp.
Actually now I am no longer able to reproduce the issue again even with --no-build-cache clean
...
:sample:build
now fails at test assertions.
from ksp.
Away from my computer now, but what if you try an incremental build? That would be consistent with trying compileKotlin first followed by build, and similar to my workflow when I encountered it
from ksp.
I was able to reproduce after configured IDE to run Gradle build, AND disable incremental compilation in gradle properties. Even if I added one line in MoshiSealedSymbolProcessor
incremental compilation is still not invalidated and I have to disable it in properties. Somehow command line still not work for me.
This is actually not a complete regression. There is a major issue (see android/kotlin-for-ksp#46), so in 20200626 build you should be getting No member name found for 'generator'. All arguments: [generateAdapter]
for your repro repo, since KSP wasn't able to see the default annotation value at all.
There are some major efforts to address this issue, unfortunately in latest release we didn't include a fix that will address the use case of inspecting default annotation argument from Java library android/kotlin#67 . I tried the locally built KSP and it is producing the following result.
// Code generated by moshi-sealed. Do not edit.
package dev.zacsweers.moshisealed.sample
import com.squareup.moshi.JsonAdapter
import com.squareup.moshi.JsonReader
import com.squareup.moshi.JsonWriter
import com.squareup.moshi.Moshi
import com.squareup.moshi.adapters.PolymorphicJsonAdapterFactory
import kotlin.Suppress
import kotlin.collections.emptySet
class MessageJsonAdapter(
moshi: Moshi
) : JsonAdapter<Message>() {
@Suppress("UNCHECKED_CAST")
private val runtimeAdapter: JsonAdapter<Message> =
PolymorphicJsonAdapterFactory.of(Message::class.java, "type")
.withSubtype(Message.Success::class.java, "success")
.withSubtype(Message.Error::class.java, "error")
.withDefaultValue(Message.Unknown)
.create(Message::class.java, emptySet(), moshi) as JsonAdapter<Message>
override fun fromJson(reader: JsonReader): Message? = runtimeAdapter.fromJson(reader)
override fun toJson(writer: JsonWriter, value: Message?) {
runtimeAdapter.toJson(writer, value)
}
}
Let me know if you need help on how to build KSP locally, it should also work if you just treat null
value from annotation argument since you know what the default value is (for now).
from ksp.
Related Issues (20)
- Project Isolation: Project cannot access task dependencies directly
- Kotlin 2.0.0 and ksp 2.0.0-1.0.21: UnsatisfiedLinkError: Can't load library: .../native/jansi/1.18/osx/libjansi.jnilib HOT 1
- KSP2 default annotation KClass values for built-in types use java.lang.* versions HOT 3
- [KSP2] Resolver.getDeclarationsFromPackage() couldn't find Java declarations
- `IllegalAccessError` in Dagger with KSP2.0.0-1.0.22 and KSP2 HOT 1
- "KSTypeArgument.type should not have been null, please file a bug. STAR null" with KSP2.0.0-1.0.22 and KSP2 HOT 2
- [KSP2] Property getter JVM names in data classes become componentN instead of getXXX
- Got IllegalStateException when calling replace() on error types
- Annotations on enum entires on K2 are missing HOT 2
- [KSP2] NullPointerException when getting name of nested annotation HOT 1
- Problematic use of Project.detachedConfiguration for KSP2 HOT 1
- KSP2: IllegalArgumentException: Failed requirement. HOT 9
- A failure occurred while executing com.google.devtools.ksp.gradle.KspAAWorkerAction HOT 3
- Variance is missing after asMemberOf call
- Pass JSON string to processor options HOT 1
- Generate KSP Dependency Classes for iOSMain Module inside a Kotlin Multiplatform project
- java.lang.NoSuchMethodError: 'java.util.List org.jetbrains.kotlin.load.java.JvmAnnotationNamesKt.getNOT_NULL_ANNOTATIONS()'
- Cannot properly control the order of execution of two processors HOT 4
- Your project may be using a third-party plugin which is not compatible with the other plugins in the project or the version of Gradle requested by the project.
- Better diagnostics in case of error
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ksp.