diff --git a/docs/content/docs/reference/visibility.md b/docs/content/docs/reference/visibility.md index d09975728d..d7d4b3e11c 100644 --- a/docs/content/docs/reference/visibility.md +++ b/docs/content/docs/reference/visibility.md @@ -21,6 +21,11 @@ Exporting a declaration makes it accessible to other modules. Some declarations Types that are transitively referenced by an exported declaration will be automatically exported unless they were already defined but unexported. In this case, an error will be raised and the type must be explicitly exported. + +{% code_selector() %} + + + The following table describes the go directives used to export the corresponding declaration: | Symbol | Export syntax | @@ -30,14 +35,6 @@ The following table describes the go directives used to export the corresponding | Enum/Sum type | `//ftl:enum export` | | Typealias | `//ftl:typealias export` | | Topic | `//ftl:export` [^1] | - -For JVM languages the `@Export` annotation can be used to export a declaration. - -eg. - -{% code_selector() %} - - ```go //ftl:verb export func Verb(ctx context.Context, in In) (Out, error) @@ -45,8 +42,14 @@ func Verb(ctx context.Context, in In) (Out, error) //ftl:typealias export type UserID string ``` + +[^1]: By default, topics do not require any annotations as the declaration itself is sufficient. + -```kotlin + +For Kotlin the `@Export` annotation can be used to export a declaration: + +```kotlin @Verb @Export fun time(): TimeResponse { @@ -54,6 +57,9 @@ fun time(): TimeResponse { } ``` + +For Java the `@Export` annotation can be used to export a declaration: + ```java @Verb @Export @@ -62,5 +68,3 @@ TimeResponse time() { } ``` {% end %} - -[^1]: By default, topics do not require any annotations as the declaration itself is sufficient.