diff --git a/src/main/kotlin/app/revanced/patcher/extensions/AnnotationExtensions.kt b/src/main/kotlin/app/revanced/patcher/extensions/AnnotationExtensions.kt index c01945fa..45a09ddc 100644 --- a/src/main/kotlin/app/revanced/patcher/extensions/AnnotationExtensions.kt +++ b/src/main/kotlin/app/revanced/patcher/extensions/AnnotationExtensions.kt @@ -5,7 +5,10 @@ import app.revanced.patcher.data.Data import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint import app.revanced.patcher.patch.OptionsContainer import app.revanced.patcher.patch.Patch +import app.revanced.patcher.patch.PatchOptions import kotlin.reflect.KClass +import kotlin.reflect.KVisibility +import kotlin.reflect.full.companionObject import kotlin.reflect.full.companionObjectInstance /** @@ -42,9 +45,12 @@ object PatchExtensions { val Class>.description get() = recursiveAnnotation(Description::class)?.description val Class>.dependencies get() = recursiveAnnotation(app.revanced.patcher.patch.annotations.DependsOn::class)?.dependencies val Class>.compatiblePackages get() = recursiveAnnotation(Compatibility::class)?.compatiblePackages - val Class>.options - get() = kotlin.companionObjectInstance?.let { - (it as? OptionsContainer)?.options + val Class>.options: PatchOptions? + get() = kotlin.companionObject?.let { cl -> + if (cl.visibility != KVisibility.PUBLIC) return null + kotlin.companionObjectInstance?.let { + (it as? OptionsContainer)?.options + } } val Class>.deprecated: Pair>?>? get() = recursiveAnnotation(PatchDeprecated::class)?.let {