Skip to content
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

Regression: scala fails to extend a Java class #15199

Closed
rcano opened this issue May 17, 2022 · 2 comments
Closed

Regression: scala fails to extend a Java class #15199

rcano opened this issue May 17, 2022 · 2 comments

Comments

@rcano
Copy link

rcano commented May 17, 2022

Compiler version

3.1.+ all the way to 3.1.3RC

Minimized code

class MyTabbedPaneUI extends javax.swing.plaf.metal.MetalTabbedPaneUI {}

Output

bridge generated for member object TabbedPaneLayoutMetalTabbedPaneUI.this.TabbedPaneLayout in class MetalTabbedPaneUI
which overrides object TabbedPaneLayoutBasicTabbedPaneUI.this.TabbedPaneLayout in class BasicTabbedPaneUI
clashes with definition of the member itself; both have erased type MetalTabbedPaneUI.this.TabbedPaneLayout."

Expectation

It should compile.

@rcano rcano added itype:bug stat:needs triage Every issue needs to have an "area" and "itype" label labels May 17, 2022
@bishabosha bishabosha added area:erasure and removed stat:needs triage Every issue needs to have an "area" and "itype" label labels May 17, 2022
@sjrd
Copy link
Member

sjrd commented Jun 22, 2022

This already fails in 3.0.0 and 3.0.2. It's a regression wrt. Scala 2.x. 2.13.8 successfully compiles this snippet.

The TabbedPaneLayout it complains about is an inner class of two superclasses: MetalTabbedPaneUI#TabbedPaneLayout, but also BasicTabbedPaneUI#TabbedPaneLayout. Hence the clash. But no bridge should be generated for those things in the first place, since they're Java inner classes, not terms.

@rcano
Copy link
Author

rcano commented Jun 22, 2022

This already fails in 3.0.0 and 3.0.2. It's a regression wrt. Scala 2.x. 2.13.8 successfully compiles this snippet.

The TabbedPaneLayout it complains about is an inner class of two superclasses: MetalTabbedPaneUI#TabbedPaneLayout, but also BasicTabbedPaneUI#TabbedPaneLayout. Hence the clash. But no bridge should be generated for those things in the first place, since they're Java inner classes, not terms.

Interesting, it did compile on 3.0.0-RC1, I had a project at that version and found the issue when updating.

@odersky odersky closed this as completed in cf21a07 Jul 5, 2022
odersky added a commit that referenced this issue Jul 5, 2022
…-inner-class

Fix #15199: Exclude JavaDefined Modules from bridge generation.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants