Skip to content

Conversation

@lrytz
Copy link
Member

@lrytz lrytz commented Jun 13, 2024

With a self type self: J =>, calling a method this.p which is protected and defined in Java is not valid and results in an IllegalAccessError at runtime.

If the class with the self type overrides the method, use that class as the receiver type. Otherwise issue an error.

Fixes scala/bug#13007

@scala-jenkins scala-jenkins added this to the 2.13.15 milestone Jun 13, 2024
@som-snytt
Copy link
Contributor

som-snytt commented Jun 13, 2024

TIL scala-dev#143.

This changes super invocation of java interface

         1: invokespecial #15                 // InterfaceMethod T.f:()I

to

         1: invokespecial #15                 // Method B.f:()I

in the run test in t1.

With a self type `self: J =>`, calling a method `this.p` which is
protected and defined in Java is not valid and results in an
`IllegalAccessError` at runtime.

If the class with the self type overrides the method, use that class
as the receiver type. Otherwise issue an error.
@lrytz
Copy link
Member Author

lrytz commented Jun 14, 2024

Moved my change to be more local, le compilateur is a bit touchy around here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Call on self type leads to IllegalAccessError

4 participants