Hi Peter!
There were other cases where one wanted to consolidate duplicated
code, but couldn't easily because of subtle differences among OS
platforms (UNIXProcess is one of such cases). Perhaps we need
something like this:
http://cr.openjdk.java.net/~plevart/misc/OS/webrev/
With this compile-time mechanism, one can use switch or if statements
in common class to cover subtle differences and only divide code into
OS platform specific classes where the bulk of it differs.
I think this mechanism might be useful as a slightly more efficient way
of determining the OS, comparing to reading "os.name" property.
However, grep found only 8 occurrences of "os.name" usage in
src/java.base, so I guess it wouldn't make much difference.
In this particular case, it seems to be easier to just introduce another
helper class, which has only two realizations: for all Unixes, including
MacOS and for Windows.
I named it ClassLoaderHelper2, and I'm open for a better name for it.
Would you please take a look at the updated webrev?
http://cr.openjdk.java.net/~igerasim/8067951/3/webrev/
Sincerely yours,
Ivan