Giter VIP home page Giter VIP logo

Comments (9)

mkurz avatar mkurz commented on May 24, 2024 2

Pretty sure I nailed it down:
When decompiling HomeController.class (using javap -v) the method signature for setControllerComponents is different for Scala 2.13 and Scala 3.

Scala 2.13:

  public void setControllerComponents(play.api.mvc.ControllerComponents);
    descriptor: (Lplay/api/mvc/ControllerComponents;)V
    flags: (0x0001) ACC_PUBLIC

Scala 3:

  public void setControllerComponents(play.api.mvc.ControllerComponents);
    descriptor: (Lplay/api/mvc/ControllerComponents;)V
    flags: (0x1041) ACC_PUBLIC, ACC_BRIDGE, ACC_SYNTHETIC

So you see Scala 3 marks the method as synthetic bridge method (ACC_BRIDGE and ACC_SYNTHETIC).

Guice however ignores such methods:
https://github.com/google/guice/blob/f095cad8aa7b59abafacc4d4461ddfc77be83667/core/src/com/google/inject/spi/InjectionPoint.java#L819-L841

Need to find a workaround...

from playframework.

mkurz avatar mkurz commented on May 24, 2024 2

So according to scala/scala3#19270 (comment) this is a problem in the Scala 3 compiler. Let's leave the things how they are currently and let's hope they fix it with Scala 3.3.3 (3.3.2 is in RC phase already, so no chance anymore)

from playframework.

ThomasGrt avatar ThomasGrt commented on May 24, 2024 1

Thanks for the quick feedback and for your work on Play! 👏🏻

Seems pretty low level stuff (scala compiler...), I don't know why they changed this in scala 3.
Hope that, as you said, you can find a workaround.

One can still use AbstractController instead of InjectedController but if there's a way to make it work that would be better.

from playframework.

mkurz avatar mkurz commented on May 24, 2024 1

If there's interest I would open a doc pull-request to add a short warning

@aumann Yes sure, please go for it, thanks!

from playframework.

mkurz avatar mkurz commented on May 24, 2024

Can confirm, taking a look already. Thanks a lot for the report!

from playframework.

PromanSEW avatar PromanSEW commented on May 24, 2024

This is definitely regression / breaking change in Scala 3 compiler

from playframework.

mkurz avatar mkurz commented on May 24, 2024

So I tried lots of stuff, but couldn't make it work, and at this point I also believe this is a bug in the Scala 3 compiler, but I am not 100% sure, so I leave the judgment to the experts:

from playframework.

ThomasGrt avatar ThomasGrt commented on May 24, 2024

Thanks for the follow up!
Let's wait for the fix.

from playframework.

aumann avatar aumann commented on May 24, 2024

Should this be added to the migration notes? It hit us in production (we only used the InjectedController in one rarely visited spot 🙈 ), and might hit others migrating to play 2.9/3.0.

If there's interest I would open a doc pull-request to add a short warning to: https://www.playframework.com/documentation/2.9.x/Scala3Migration

from playframework.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.