The following code throws ClassCastException:
The culprit is this return statement:
The copyOf variant used here assumes that result contains Comparable elements, but that's not the case for Map.Entry. Therefore the method throws CCE as soon as results contains more than one element.
We didn't detect this because CompositeDriverConfigTest is not testing the CompositeDriverExecutionProfil.entrySet method.
The fix is trivial:
Turns out there is also a NullPointerException possible in CompositeDriverExecutionProfile.entrySet() when one of the profiles is null.
And speaking of profiles, they are nullable and volatile, so there is a possible race condition in a few places in CompositeDriverExecutionProfile.
Will fix those as well.