Skip to content

Final vals in traits should be disallowed #201

Closed
@scabug

Description

@scabug

Marking a val declared in a trait final does not actually cause the emitted field to be final, due to the way traits are initialised. Therefore the atomicity guarantee of final does not hold. Additionally, the compiler does not permit vals defined in traits to be overridden anyway, so it appears that the final keyword accomplishes nothing at all in this case except to mislead programmers and cause subtle bugs.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions