-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Scala 3.3.1: Concrete method inside trait
marked (incorrectly?) as ACC_BRIDGE
and ACC_SYNTHETIC
#19270
Comments
If that is a bug in Scala, is there a chance a fix still makes it into 3.3.2-RC1, as I see there is ? |
I don't we have someone to work on this in the next 2 days. It's not high impacting nor a regression within 3.3.x. |
@dwijnand Is this still on someones list? |
Any update on this issue? While not critical AFAIK, it's still something that many users hit with Play Framework when migrating from Scala 2.13 to 3.x. Play being one of the main Scala frameworks I believe. |
@gaeljw no updates, but I'll try to get someone on it soon. |
Compiler version
3.3.1
Reproducer
(Sorry I don't have time to come up with a minimized code example)
You will see the Play app fails with an exception.
However the exact same application works just fine with Scala 2.13.12 (
++2.x ; run
).Description why the problem occurs:
Our controller class extends from the
InjectedController
trait (line):The
InjectedController
trait defines a concrete methodsetControllerComponents
which should getcomponents
injected by Guice (line)Problem: In Scala 2 Guice does inject
components
and calls the method, in Scala 3 it does not.When decompiling
HomeController.class
(usingjavap -v
) the method signature forsetControllerComponents
is different for Scala 2.13 and Scala 3.Scala 2.13:
Scala 3:
So you see Scala 3 marks the method as synthetic bridge method (
ACC_BRIDGE
andACC_SYNTHETIC
).Guice however ignores such methods:
https://github.com/google/guice/blob/f095cad8aa7b59abafacc4d4461ddfc77be83667/core/src/com/google/inject/spi/InjectionPoint.java#L819-L841
The question I have is: Why is that concrete method marked as
ACC_BRIDGE
andACC_SYNTHETIC
in Scala 3? Is that a bug? If not, how can I make our code work? Are there any docs or notes on that behaviour?Thanks!
Originally posted by @ThomasGrt in playframework/playframework#12272
The text was updated successfully, but these errors were encountered: