8000 include synthetic accessors for checked exception by neetopia · Pull Request #1967 · google/ksp · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

include synthetic accessors for checked exception #1967

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

Merged
merged 1 commit into from
Jun 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,7 @@ class ResolverAAImpl(

override fun getJvmCheckedException(accessor: KSPropertyAccessor): Sequence<KSType> {
return when (accessor.origin) {
Origin.KOTLIN -> {
Origin.KOTLIN, Origin.SYNTHETIC -> {
extractThrowsAnnotation(accessor)
}
Origin.KOTLIN_LIB, Origin.JAVA_LIB -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,12 @@ class ThrowListProcessor : AbstractTestProcessor() {
val propertyA = klass.declarations.single { it.simpleName.asString() == "a" } as KSPropertyDeclaration
result.add(resolver.getJvmCheckedException(propertyA.getter!!).toResult())
result.add(resolver.getJvmCheckedException(propertyA.setter!!).toResult())
klass.declarations.filter { it.simpleName.asString() == "syntheticAccessors" }.map {
resolver.getJvmCheckedException((it as KSPropertyDeclaration).getter!!).toResult()
}.sorted().forEach { result.add(it) }
klass.declarations.filter { it.simpleName.asString() == "syntheticAccessors" }.map {
resolver.getJvmCheckedException((it as KSPropertyDeclaration).setter!!).toResult()
}.sorted().forEach { result.add(it) }
val jlib = resolver.getClassDeclarationByName("JavaLib")!!
val klib = resolver.getClassDeclarationByName("KtLib")!!
klib.declarations.filter { it.simpleName.asString() == "throwsLibKt" }.map {
Expand All @@ -65,6 +71,12 @@ class ThrowListProcessor : AbstractTestProcessor() {
klib.declarations.filter { it.simpleName.asString() == "bothThrows" }.map {
resolver.getJvmCheckedException((it as KSPropertyDeclaration).setter!!).toResult()
}.sorted().forEach { result.add(it) }
klib.declarations.filter { it.simpleName.asString() == "syntheticAccessors" }.map {
resolver.getJvmCheckedException((it as KSPropertyDeclaration).getter!!).toResult()
}.sorted().forEach { result.add(it) }
klib.declarations.filter { it.simpleName.asString() == "syntheticAccessors" }.map {
resolver.getJvmCheckedException((it as KSPropertyDeclaration).setter!!).toResult()
}.sorted().forEach { result.add(it) }
jlib.declarations.filter { it.simpleName.asString() == "foo" }.map {
resolver.getJvmCheckedException(it as KSFunctionDeclaration).toResult()
}.sorted().forEach { result.add(it) }
Expand Down
12 changes: 12 additions & 0 deletions test-utils/testData/api/throwList.kt
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,17 @@
// ThrowsException.method.T
// java.io.IOException,java.util.NoSuchElementException
// java.lang.IndexOutOfBoundsException
// java.util.NoSuchElementException
// java.lang.IndexOutOfBoundsException
// java.io.IOException
// java.io.IOException,java.lang.IndexOutOfBoundsException
// java.lang.IndexOutOfBoundsException
// java.lang.IllegalArgumentException
// java.lang.IllegalStateException
// java.io.IOException
// java.lang.IllegalStateException,java.lang.IllegalArgumentException
// java.util.NoSuchElementException
// java.lang.IndexOutOfBoundsException
// java.io.IOException
// java.io.IOException,java.lang.IndexOutOfBoundsException
// java.lang.IndexOutOfBoundsException
Expand Down Expand Up @@ -80,6 +84,10 @@ class KtLib {
@get:Throws(IOException::class)
@set:Throws(IllegalStateException::class, IllegalArgumentException::class)
var bothThrows: Int = 3

@set:Throws(java.lang.IndexOutOfBoundsException::class)
@get:Throws(java.util.NoSuchElementException::class)
var syntheticAccessors: Int = 0
}
// MODULE: main(lib)
// FILE: ThrowsException.java
Expand Down Expand Up @@ -107,4 +115,8 @@ class ThrowsKt {
set(a: Int) {

}

@set:Throws(java.lang.IndexOutOfBoundsException::class)
@get:Throws(java.util.NoSuchElementException::class)
var syntheticAccessors: Int
}
Loading
0