Why wasn't transient
solved by using annotations instead of introducing a keyword?
It seems like the transient keyword doesn't really provide any native functionality to the language, and seems to be more syntactic-sugar to prevent accidental serialization.
Am I missing something?
Java transient keyword was added from the first java version, while Annotations was added later in 1.5 version
Actually transient uses ad hoc annotation mechanism:
Java platform has always had various ad hoc annotation mechanisms. For example the transient modifier is an ad hoc annotation indicating that a field should be ignored by the serialization subsystem
Notice the Scala has @transient and also volatile:
@transient Marks a field to be non-persistent; this is equivalent to the transient modifier in Java.
@volatile Marks a field which can change its value outside the control of the program; this is equivalent to the volatile modifier in Java.