Skip to content

Commit a54c61a

Browse files
authored
Merge pull request #2412 from artemkorsakov/patch-1
Renamed deprecated annotation in the doc
2 parents c8a0eec + 86a356f commit a54c61a

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)