Scala 3 Java interop: method on base class called instead of method on derived class #17073
              
                Unanswered
              
          
                  
                    
                      christian-mibex
                    
                  
                
                  asked this question in
                Compiler internals Q&A
              
            Replies: 0 comments
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
        
    
Uh oh!
There was an error while loading. Please reload this page.
-
Not sure if it's a bug or to be expected. We ran into runtime issues after upgrading to Scala 3.
Basically the class hierarchy of
WebhookCreateRequestlooks like (simplified):Now the inner class
AbstractBuilderis not public, and when the Scala compiler calls the method on it instead of CreateRequest anIllegalAccessExceptionis called.The bytecode output of Scala 2/ Java compilation
Compared to Scala 3 (issue on last line)
Is there a reason the second and all further chained builder calls (here the
url()) call) are compiled to call the base class method?Beta Was this translation helpful? Give feedback.
All reactions