Skip to content

Instantly share code, notes, and snippets.

@ignasi35
Created May 16, 2018 09:54
Show Gist options
  • Save ignasi35/5d9f9b78656f8842dacc3c539f9de123 to your computer and use it in GitHub Desktop.
Save ignasi35/5d9f9b78656f8842dacc3c539f9de123 to your computer and use it in GitHub Desktop.
Thin cake deprecation alternatives
trait ACompo {
@deprecated("foo", "1.1")
def foo: String
}
trait BCompo {
def foo: String
}
trait CCompo {
// @deprecated("foo", "1.1")
// def foo: String
}
// This is the only alternative that fails compilation or raises a warning of any kind.
class W extends CCompo {
override lazy val foo: String = "123"
}
class X extends ACompo with BCompo with CCompo {
override lazy val foo: String = "123"
}
class Y extends BCompo with ACompo {
override lazy val foo: String = "123"
}
// This doesn't raise a warning or compilation error despite ACompo#foo being depreacted
class Z extends ACompo {
override lazy val foo: String = "123"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment