[SOLVED] Scala 3: Universal Apply Methods

I have a question regarding Scala 3’s Universal Apply Methods feature.

Here we can read, that it Universal Apply Methods work because “[…] a companion object with two apply methods is generated together with the class […]”.

What does this mean for already compiled Scala 2 code and Java-interop? Does the compiler create companion objects for those as well? Will it only work with Scala 3 code?

From the document you linked to:

The synthetic object StringBuilder and its apply methods are called constructor proxies. Constructor proxies are generated even for Java classes and classes coming from Scala 2.

2 Likes

I read this document twice and did not realize that this was described there. Thank you for pointing it out!