Package

com.avsystem.commons

annotation

Permalink

package annotation

Visibility
  1. Public
  2. All

Type Members

  1. class atLeast extends Annotation with StaticAnnotation

    Permalink

    When applied on varargs parameter, indicates that at least some number of parameters is required.

    When applied on varargs parameter, indicates that at least some number of parameters is required. This is later checked by the static analyzer.
    WARNING: implementation of method which takes a varargs parameter may NOT assume that given number of arguments will always be passed, because it's still possible to pass a Seq where varargs parameter is required using the : _* ascription, e.g.

    varargsMethod(List(): _*)

    and that is not checked by the static analyzer.

  2. class checkKnownSubtypes[T] extends Annotation with StaticAnnotation

    Permalink

    Used in code generated by macros which traverse sealed hierarchies using knownDirectSubclasses.

    Used in code generated by macros which traverse sealed hierarchies using knownDirectSubclasses. Allows the static analyzer to determine if knownDirectSubclasses used in macro returned correct result (see SI-7046).

  3. class explicitGenerics extends Annotation with StaticAnnotation

    Permalink

    When applied on generic method, requires that all the type parameters are given explicitly (cannot be inferred by the compiler).

    When applied on generic method, requires that all the type parameters are given explicitly (cannot be inferred by the compiler). This is meant primarily for methods whose generics cannot be inferred from method arguments. Requiring that the programmer specifies them explicitly is a protection against the compiler inferring Nothing or Null.

    @explicitGenerics
    def readJson[T: GenCodec](json: String): T = ...
    
    // raise error, because otherwise we have a hidden bug - the compiler infers `Nothing` in place of `T`
    val x: MyType = readJson("{}")
    // ok
    val x = readJson[MyType]("{}")
  4. class macroPrivate extends Annotation with StaticAnnotation

    Permalink

    Symbols annotated with this annotation can only be used in macro-generated code.

Ungrouped