Annotation Type JsFunction


  • @Retention(RUNTIME)
    @Target(TYPE)
    @Documented
    public @interface JsFunction
    JsFunction marks a functional interface as being the definition of a JavaScript function.

    There are some limitations exists on JsFunction to make them practical and efficient:

    • A JsFunction interface cannot extend any other interfaces.
    • A class may not implement more than one JsFunction interface.
    • A class that implements a JsFunction type cannot be a JsType (directly or indirectly).
    • Fields and defender methods of the interfaces should be marked with JsOverlay and cannot be overridden by the implementations.

    As a best practice, we also recommend marking JsFunction interfaces with FunctionalInterface to get improved checking in IDEs.

    Instanceof and Castability:

    Instanceof and casting for JsFunction is effectively a JavaScript typeof check to determine if the instance is a function.