Skip to content

Commit 86a356f

Browse files
Rename deprecated annotation in the doc
[scala.annotation.alpha is deprecated](https://scala-lang.org/api/3.x/scala/annotation/alpha.html) We must use `@targetName` instead
1 parent c8a0eec commit 86a356f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

_overviews/scala3-book/interacting-with-java.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -341,10 +341,10 @@ def +(a: Int, b: Int) = a + b
341341
That method name won’t work well in Java, but what you can do in Scala 3 is provide an “alternate” name for the method---an alias---that will work in Java:
342342

343343
```scala
344-
import scala.annotation.alpha
344+
import scala.annotation.targetName
345345

346346
class Adder:
347-
@alpha("add") def +(a: Int, b: Int) = a + b
347+
@targetName("add") def +(a: Int, b: Int) = a + b
348348
```
349349

350350
Now in your Java code you can use the aliased method name `add`:

0 commit comments

Comments
 (0)