Currently, the Version class handles strings of the form X.Y.Z only. A recent patch (https://reviews.apache.org/r/27115/) allows for strings of the form X.Y.Z-* by discarding the "-" along with the rest of the string following it. This means that the check `Version("0.20.1") == Version("0.20.1-rc2")` will succeed.
A better fix is to allow arbitrary number of components in the Version string and still do the right thing w.r.t. comparisons. To standardize it a bit, we can consider Semantic Versioning (http://semver.org/).
Semantic Versioning allows for strings of the following tagformat:
An IDENTIFIER must comprise only ASCII alphanumerics and hyphen [0-9A-Za-z-].
One way to implement it in the Version class is to keep a vector of (string) identifiers along with major, minor, and patch variable. Another alternative is to not have the major, minor, and patch variables and just have a single vector of strings.
The comparison can be tricky. One has to consider the pre-release version, etc. as explained in SemVer 2.0.0 RFC.