assuming I have an abstract type AA and concrete type XXX:
trait AA {
type A = XXX
final type B = XXX
}
In this case in any subclass of AA, both type A and B cannot be overriden, so it appears that the keyword final is completely redundant. Is this statement correct?
It's hard to prove that they're exactly identical, but I'm going to argue that they are, minus a few useless quirks.
Useless quirks
First and most obviously, they give different error messages. But that's not all: it's technically possible to override
A, you just can't override it to anything other thanXXX:On the other hand, you can't ever override
B:Are there any useful differences?
Again, I'm going to argue that there aren't. In a very detailed answer to the question Is it possible to override a type field, StackOverflow user 0__ notes that
and
followed by some explanation of how the type system would be inconsistent if you could override
Tto a different type. See that answer for the details.