Skip to content

Commit

Permalink
Test functional interface
Browse files Browse the repository at this point in the history
  • Loading branch information
kuanyingchou committed Apr 24, 2024
1 parent c262051 commit 67afc25
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
8 changes: 8 additions & 0 deletions kotlin-analysis-api/testData/javaModifiers.kt
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,10 @@
// OuterKotlinClass: OPEN : PUBLIC
// END
// MODULE: module1
// FILE: ALib.kt
fun interface ALib {
fun test(): Boolean
}
// FILE: DependencyOuterJavaClass.java
public class DependencyOuterJavaClass {
public class DependencyInnerJavaClass {}
Expand Down Expand Up @@ -152,6 +156,10 @@ open class DependencyOuterKotlinClass {
fun synchronizedFun(): String = ""
}
// MODULE: main(module1)
// FILE: ASrc.kt
fun interface ASrc {
fun test(): Boolean
}
// FILE: a.kt
annotation class Test

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
package com.google.devtools.ksp.processor

import com.google.devtools.ksp.KspExperimental
import com.google.devtools.ksp.getClassDeclarationByName
import com.google.devtools.ksp.processing.Resolver
import com.google.devtools.ksp.symbol.*
import com.google.devtools.ksp.symbol.KSPropertyDeclaration
Expand All @@ -31,6 +32,12 @@ class JavaModifierProcessor : AbstractTestProcessor() {
}

override fun process(resolver: Resolver): List<KSAnnotated> {
listOf("ALib", "ASrc").forEach { clsName ->
resolver.getClassDeclarationByName(clsName)!!.let { cls ->
println(cls.modifiers.contains(Modifier.FUN))
}
}

resolver.getSymbolsWithAnnotation("Test")
.map {
it as KSClassDeclaration
Expand Down

0 comments on commit 67afc25

Please sign in to comment.