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

Dotty ignores bridges for package-private Java methods exposed via public classes #6546

Closed
anatoliykmetyuk opened this issue May 22, 2019 · 1 comment

Comments

@anatoliykmetyuk
Copy link
Contributor

See #6152 (comment).

@molikto
Copy link
Contributor

molikto commented Jan 13, 2020

related bug from Scala bug tracker (which is still open, but a more complex one scala/bug#10249

smarter added a commit to dotty-staging/dotty that referenced this issue Mar 10, 2020
This is a port of
scala/scala@765eb29:

  When emitting a virtual call, the receiver in the bytecode cannot just
  be the method's owner (the class in which it is declared), because that
  class may not be accessible at the callsite. Instead we use the type
  of the receiver. This was basically done to fix
  - aladdin bug 455 (9954eaf)
  - SI-1430 (0bea2ab) - basically the same bug, slightly different
  - SI-4283 (8707c9e) - the same for field reads

In Dotty, we rarely encountered this issue because under separate
compilation, we see the bridge symbols generated by javac and use their
owner as the receiver, but under joint compilation of .java and .scala
sources this doesn't happen, in particular this commit fixes scala#6546. It
also means that we should now be able to stop creating symbols in the
ClassfileParser for Java bridges, this would make joint and separate
compilation more similar and thus should reduce the number of bugs which
appear in one but not the other as discussed in
scala#6266.

After this commit, some more changes are necessary to get the updated
backend to work correctly with dotty, these are implemented in the
later commits of this PR.

Co-Authored-By: Lukas Rytz <[email protected]>
smarter added a commit to dotty-staging/dotty that referenced this issue Mar 10, 2020
This is a port of
scala/scala@765eb29:

  When emitting a virtual call, the receiver in the bytecode cannot just
  be the method's owner (the class in which it is declared), because that
  class may not be accessible at the callsite. Instead we use the type
  of the receiver. This was basically done to fix
  - aladdin bug 455 (9954eaf)
  - SI-1430 (0bea2ab) - basically the same bug, slightly different
  - SI-4283 (8707c9e) - the same for field reads

In Dotty, we rarely encountered this issue because under separate
compilation, we see the bridge symbols generated by javac and use their
owner as the receiver, but under joint compilation of .java and .scala
sources this doesn't happen, in particular this commit fixes scala#6546. It
also means that we should now be able to stop creating symbols in the
ClassfileParser for Java bridges, this would make joint and separate
compilation more similar and thus should reduce the number of bugs which
appear in one but not the other as discussed in
scala#6266.

After this commit, some more changes are necessary to get the updated
backend to work correctly with dotty, these are implemented in the
later commits of this PR.

Co-Authored-By: Lukas Rytz <[email protected]>
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