Update StaleDataclassProcessor for JDK 17
JDK 17 no longer allows access to com.sun.tools.javac.code by default, use the public APIs instead. Bug: 219098645 Test: m checkbuild Change-Id: If379935cc4ab9e5c809cc9fbfccbacfd8d87e8c8
This commit is contained in:
parent
7ee20f2830
commit
4d7c2941c1
@ -21,8 +21,6 @@ import com.android.codegen.BASE_BUILDER_CLASS
|
||||
import com.android.codegen.CANONICAL_BUILDER_CLASS
|
||||
import com.android.codegen.CODEGEN_NAME
|
||||
import com.android.codegen.CODEGEN_VERSION
|
||||
import com.sun.tools.javac.code.Symbol
|
||||
import com.sun.tools.javac.code.Type
|
||||
import java.io.File
|
||||
import java.io.FileNotFoundException
|
||||
import javax.annotation.processing.AbstractProcessor
|
||||
@ -33,6 +31,7 @@ import javax.lang.model.element.AnnotationMirror
|
||||
import javax.lang.model.element.Element
|
||||
import javax.lang.model.element.ElementKind
|
||||
import javax.lang.model.element.TypeElement
|
||||
import javax.lang.model.type.ExecutableType
|
||||
import javax.tools.Diagnostic
|
||||
|
||||
private const val STALE_FILE_THRESHOLD_MS = 1000
|
||||
@ -102,14 +101,13 @@ class StaleDataclassProcessor: AbstractProcessor() {
|
||||
append(" ")
|
||||
append(elem.annotationMirrors.joinToString(" ", transform = { annotationToString(it) }))
|
||||
append(" ")
|
||||
if (elem is Symbol) {
|
||||
if (elem.type is Type.MethodType) {
|
||||
append((elem.type as Type.MethodType).returnType)
|
||||
} else {
|
||||
append(elem.type)
|
||||
}
|
||||
append(" ")
|
||||
val type = elem.asType()
|
||||
if (type is ExecutableType) {
|
||||
append(type.returnType)
|
||||
} else {
|
||||
append(type)
|
||||
}
|
||||
append(" ")
|
||||
append(elem)
|
||||
}
|
||||
}
|
||||
@ -234,4 +232,4 @@ class StaleDataclassProcessor: AbstractProcessor() {
|
||||
override fun getSupportedSourceVersion(): SourceVersion {
|
||||
return SourceVersion.latest()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user