Just discovered weird behavior of Scala's protected methods: they're actually compiled to public methods in byte-code. Therefore if you try to override them in Java code with another protected method compilation will fail with something like this:
"attempting to assign weaker access privileges; was public"
. After some googling I've discovered that other people
also spotted this issue. I think such weird compiler behavior was needed because of access level mismatch in Scala and Java - but I thought that Scala's
protected
is more restrictive then Java's. So I'm yet to figure out reason of such behavior. By the way, package-level protected (like
protected[yourpackage]
) is also compiled to
public
- at least for Scala 2.10.0