-
Notifications
You must be signed in to change notification settings - Fork 274
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
Equality check fails with KSP2, but not KSP1 #2196
Comments
@ting-yuan with KSP1 the following works, but with KSP2 the @Qualifier
@Target(
CLASS,
ANNOTATION_CLASS,
TYPE_PARAMETER,
PROPERTY,
FIELD,
LOCAL_VARIABLE,
VALUE_PARAMETER,
CONSTRUCTOR,
FUNCTION,
PROPERTY_GETTER,
PROPERTY_SETTER,
TYPE,
FILE,
TYPEALIAS,
)
annotation class QualifiedString
@Component
abstract class MainComponent {
@Provides
@QualifiedString
fun provideString(): String = ""
@QualifiedString
abstract val otherString: String
} To get it to work with KSP2 either |
Looks like this is intentional? |
Seems like that behavior should only be happening for constructor parameters? You example doesn't use them there. |
I checked out to amzn/kotlin-inject-anvil@c8b7009 and enabled KSP2 in gradle.properties as well as the line of useKsp2=... in
So far so good. Then I tried to break at https://github.com/evant/kotlin-inject/blob/6ab3df82aab1bdb4cdd72b259338f12e39f47d12/ast/ksp/src/main/kotlin/me/tatarka/kotlin/ast/KSUtil.kt#L104 and there are only two pairs of annotations ( Or am I using the wrong reproducer? |
@evant that PR changed @vRallev it looks like evant/kotlin-inject#447 is caused by the changes in #1216. Given that, is the equality check failing not related to evant/kotlin-inject#447? |
OK I checked out the test in The underlying problem for both cases is that #1216 made a change to However, I believe there's a bug (or bugs) in the implementation.
and this is happening even on non constructor parameters
However, the behavior change strips out the annotation if any of the targets are @ting-yuan it might make more sense to strip the annotation if the targets contains |
This is related to evant/kotlin-inject#447 and likely #2091.
The kotlin-inject processor compares two
KSAnnotation
instances for equality here. This check works as expected with KSP1, but with KSP2 it fails and produces the error mentioned in the original ticket as side effect.This issue still happens with
2.0.21-1.0.27
.The text was updated successfully, but these errors were encountered: