Tutorial by Examples

This sample annotation indicates that the following method is deprecated. @deprecated def anUnusedLegacyMethod(someArg: Any) = { ... } This can also be equivalently written as: @deprecated def anUnusedLegacyMethod(someArg: Any) = { ... }
/** * @param num Numerator * @param denom Denominator * @throws ArithmeticException in case `denom` is `0` */ class Division @throws[ArithmeticException](/*no annotation parameters*/) protected (num: Int, denom: Int) { private[this] val wrongValue = num / denom /** Integer n...
You can create you own Scala annotations by creating classes derived from scala.annotation.StaticAnnotation or scala.annotation.ClassfileAnnotation package animals // Create Annotation `Mammal` class Mammal(indigenous:String) extends scala.annotation.StaticAnnotation // Annotate class Platypus...

Page 1 of 1