Added missing final modifiers and @NotNull annotations where needed.