Remove 'hasDefaultFlag'.

This is the change which broke the compiler until I made the
changes found in 693ecffbaf.
Removing unused code.

Most of this was revealed via -Xlint with a flag which assumes
closed world. I can't see how to check the assumes-closed-world
code in without it being an ordeal. I'll leave it in a branch in
case anyone wants to finish the long slog to the merge.
Merge pull request #3004 from paulp/pr/remove-unused

Remove unused code.