interface IFoo { fun bar(): Unit fun baz(): Unit } annotation class HasAnnotation object Foo : IFoo { @HasAnnotation override fun bar() { throw IllegalStateException("Should never see this!") } override fun baz() { println("Normal function will run") } } object Bar : IFoo by Foo { override fun bar() { if (Foo::bar.annotations.any { it.annotationClass == HasAnnotation::class }) { println("This code runs instead!") } } } fun main(args: Array) { var foo: IFoo = Foo try { foo.bar() } catch (e: IllegalStateException) { println("Error caught!") } foo.baz() foo = Bar foo.bar() foo.baz() }