mirror of
https://github.com/github/codeql.git
synced 2025-12-19 18:33:16 +01:00
Kotlin: Catch exception thrown by kotlinc
This commit is contained in:
@@ -97,8 +97,15 @@ open class KotlinFileExtractor(
|
||||
if (d.isFakeOverride) {
|
||||
return true
|
||||
}
|
||||
if ((d as? IrFunction)?.descriptor?.isHiddenToOvercomeSignatureClash == true) {
|
||||
return true
|
||||
try {
|
||||
if ((d as? IrFunction)?.descriptor?.isHiddenToOvercomeSignatureClash == true) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
catch (e: NotImplementedError) {
|
||||
// `org.jetbrains.kotlin.ir.descriptors.IrBasedClassConstructorDescriptor.isHiddenToOvercomeSignatureClash` throws the exception
|
||||
logger.warnElement("Couldn't query if element is fake, deciding it's not.", d, e)
|
||||
return false
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
@@ -248,15 +248,15 @@ open class Logger(val loggerBase: LoggerBase, open val tw: TrapWriter) {
|
||||
}
|
||||
|
||||
class FileLogger(loggerBase: LoggerBase, override val tw: FileTrapWriter): Logger(loggerBase, tw) {
|
||||
fun warnElement(msg: String, element: IrElement) {
|
||||
fun warnElement(msg: String, element: IrElement, exn: Throwable? = null) {
|
||||
val locationString = tw.getLocationString(element)
|
||||
val mkLocationId = { tw.getLocation(element) }
|
||||
loggerBase.diagnostic(tw, Severity.Warn, msg, null, locationString, mkLocationId)
|
||||
loggerBase.diagnostic(tw, Severity.Warn, msg, exn?.stackTraceToString(), locationString, mkLocationId)
|
||||
}
|
||||
|
||||
fun errorElement(msg: String, element: IrElement) {
|
||||
fun errorElement(msg: String, element: IrElement, exn: Throwable? = null) {
|
||||
val locationString = tw.getLocationString(element)
|
||||
val mkLocationId = { tw.getLocation(element) }
|
||||
loggerBase.diagnostic(tw, Severity.Error, msg, null, locationString, mkLocationId)
|
||||
loggerBase.diagnostic(tw, Severity.Error, msg, exn?.stackTraceToString(), locationString, mkLocationId)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user