Skip to content

Mixin forwarders can illegally access package-private methods #12457

Open
@lrytz

Description

@lrytz
package p

package u {
  trait T {
    private[u] def f = 1
  }
}

package v {
  class C extends u.T
}

generates, after mixin:

[[syntax trees at end of                     mixin]] // Test.scala
package p {
  ...
  package v {
    class C extends Object with p.u.T {
      private[u] def f(): Int = C.super.f();

private[u] is wrong (u is not in scope), and C.super.f is an illegal access. So this code should be rejected.

This doesn't result in invalid bytecode, everything will be public anyway.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions