Skip to content

separate accessibility and lifting #7085

Open
@scabug

Description

@scabug

when java needs to give access to an inaccessible method, it doesn't change the method itself, but generates a synthetic static accessor that takes the same arguments, plus the this pointer for that method

this scheme makes it easier to stay binary compatible in the presence of changing access patterns, because it doesn't involve making private, non-synthetic, methods public when the need arises for them to be accessible from somewhere

as the static accessor is synthetic, it doesn't affect binary compatibility

This might give us a chance at fixing:

trait A {
  def foo: Long
}
 
object Main {
  def a(): A = new A {
    var foo: Long = 1000L
 
    val test = () => {
      foo = 28
    }
  }
  def main(args: Array[String]) {
    println(a().foo)
  }
}

which, as reported in #6387 (now marked as a duplicate), gives an AbstractMethodError

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions