Thanks Ignas for the question.
Bazel does not hash the JDK version.
It does allow to define which jdk will be used for compilation, etc… by the javabase flag (https://docs.bazel.build/versions/master/command-line-reference.html#flag--javabase)
At Wix we point javabase to a jdk installation in our remote binaries repository (one for each OS), and thus ensure all developers get the same jdk.
I think the reason the JDK version is not part of the hash is that the same version can be implemented in many ways on different platforms. Also a specific installation can have more/less modules that are maybe needed for some build action.
But I’m not sure why.
I’ve posted a SO question to get an official answer from someone in the bazel team:
https://stackoverflow.com/questions/55183435/why-doesnt-bazel-hash-the-jdk-version-used-by-build-tools-as-part-of-cache-key