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

Kotlin & KSP 2.1.0 #2029

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Kotlin & KSP 2.1.0 #2029

wants to merge 3 commits into from

Conversation

Egorand
Copy link
Collaborator

@Egorand Egorand commented Nov 27, 2024

No description provided.

@@ -202,7 +202,7 @@ public class AnnotationSpec private constructor(
@Suppress("PLATFORM_CLASS_MAPPED_TO_KOTLIN")
val javaAnnotation = annotation as java.lang.annotation.Annotation
val builder = builder(javaAnnotation.annotationType())
.tag(annotation)
.tag<Annotation>(annotation)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixes the following warning:

e: warnings found and -Werror specified
w: file:///Users/egor/Development/block-workspace/kotlinpoet/kotlinpoet/src/jvmMain/kotlin/com/squareup/kotlinpoet/AnnotationSpec.kt:205:12 
Type argument for reified type parameter 'T' was inferred to the intersection 
of ['java.lang.annotation.Annotation' & 'kotlin.Annotation']. 
Reification of an intersection type results in the common supertype being used. 
This may lead to subtle issues and an explicit type argument is encouraged. 
This will become an error in a future release.

@Egorand
Copy link
Collaborator Author

Egorand commented Nov 28, 2024

@ZacSweers there's a bunch of TestProcessorTest failures specifically on JDK 8 which look like this:

> Task :interop:ksp:test-processor:testJdk8

TestProcessorTest > smokeTest[useKsp2=false] FAILED
    expected: OK
    but was : INTERNAL_ERROR
        at com.squareup.kotlinpoet.ksp.test.processor.TestProcessorTest.smokeTest(TestProcessorTest.kt:188)

I discovered that if I simply comment out the assertThat(result.exitCode).isEqualTo(KotlinCompilation.ExitCode.OK) asserts all tests pass, suggesting that annotation processing and codegen execute correctly, even though compilation fails. Any thoughts on what might be causing this?

public fun <T : Alias41<Alias23, out Alias77<Alias73<Int>>>> bar(vararg arg1: T): Unit = TODO()
}
public class TestTransitiveAliases {
public fun <T : Alias41<Alias43<Alias23>, Alias47<out Alias77<Alias73<Int>>>>> bar(vararg arg1: T): Unit = TODO()
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure why this started behaving differently with KSP. @ZacSweers any thoughts?

@ZacSweers
Copy link
Collaborator

I'll look after vacation!

@Egorand Egorand mentioned this pull request Dec 4, 2024
1 task
@Egorand Egorand mentioned this pull request Dec 4, 2024
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants