scala/scala — pull request #1253 by paulp (2012-09-04 22:58:54+00:00)
Title: Removing duplication from Duration.

I don't know what good it is to have code review if we are checking
in code like this. We must raise the bar, people. When the
justification for code being in the standard library is borderline
at best - as it is here - then the code must be of exceptional
quality. This code is not of exceptional quality.

Mostly these are not behavioral changes, but:

- I removed finite_? as it is a gratuitous deviation from
every isXXX method in the world. This isn't ruby.
- I removed all the regexps, which only made things complicated
- I removed all the unnecessary casts, which is to say, all of them
- I made more things final, sealed, and private
- The unapply structure was all wrong; returning Option[Duration]
on the string unapply meant you'd have to say
case Duration(Duration(x, y)) => ...
So I fixed apply and unapply to be symmetric.
- And I removed the "parse" method, since it was doing what
apply is supposed to do.

Thanks to viktor klang for DurationConversions.