KAPT: Use reflection to access code, changed in JDK 21
#KT-57389 Fixed
This commit is contained in:
committed by
Space Team
parent
4f7c96ae43
commit
37417f7919
@@ -6,6 +6,7 @@
|
||||
package org.jetbrains.kotlin.kapt3.base.javac
|
||||
|
||||
import com.sun.tools.javac.tree.JCTree
|
||||
import com.sun.tools.javac.tree.JCTree.JCImport
|
||||
import com.sun.tools.javac.util.*
|
||||
import com.sun.tools.javac.util.JCDiagnostic.DiagnosticType
|
||||
import org.jetbrains.kotlin.kapt3.base.KaptContext
|
||||
@@ -55,6 +56,8 @@ class KaptJavaLog(
|
||||
|
||||
private val _reportedDiagnostics = mutableListOf<JCDiagnostic>()
|
||||
|
||||
private val jcImportQualidField = JCImport::class.java.declaredFields.single { it.name == "qualid" }
|
||||
|
||||
override fun flush(kind: WriterKind?) {
|
||||
super.flush(kind)
|
||||
|
||||
@@ -197,7 +200,7 @@ class KaptJavaLog(
|
||||
val visitor = object : JCTree.Visitor() {
|
||||
override fun visitImport(that: JCTree.JCImport) {
|
||||
super.visitImport(that)
|
||||
if (!found) that.qualid.accept(this)
|
||||
if (!found) (jcImportQualidField.get(that) as JCTree).accept(this)
|
||||
}
|
||||
|
||||
override fun visitSelect(that: JCTree.JCFieldAccess) {
|
||||
|
||||
Reference in New Issue
Block a user