Skip to content

Commit

Permalink
fix java.lang.NoSuchMethodError
Browse files Browse the repository at this point in the history
fix java.lang.NoSuchMethodError: No virtual method getDeclaredAnnotation(Ljava/lang/Class;)L
  • Loading branch information
zhaodice committed Nov 18, 2022
1 parent 372c250 commit b9b2b51
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,12 @@ internal abstract class JvmPluginInternal(
parentPermission
if (!firstRun) refreshCoroutineContext()

val except = javaClass.getDeclaredAnnotation(ConsoleJvmPluginFuncCallbackStatusExcept.OnEnable::class.java)
val except = try {
javaClass.getDeclaredAnnotation(ConsoleJvmPluginFuncCallbackStatusExcept.OnEnable::class.java)
}catch(e: Throwable){
null
}

kotlin.runCatching {
onEnable()
}.fold(
Expand Down Expand Up @@ -244,4 +249,4 @@ internal inline fun AtomicLong.updateWhen(condition: (Long) -> Boolean, update:
}
}

internal val Throwable.rootCauseOrSelf: Throwable get() = generateSequence(this) { it.cause }.lastOrNull() ?: this
internal val Throwable.rootCauseOrSelf: Throwable get() = generateSequence(this) { it.cause }.lastOrNull() ?: this

0 comments on commit b9b2b51

Please sign in to comment.