Using newly released feature on an apex class having older API version

Switch is not a versioned feature, presumably because they didn't want to force developers to upgrade to the latest API just to take advantage of this (and potentially trigger a large number of other required changes). As I've said before (in a another answer on this site), consider keeping all your classes the same version to avoid bugs. Only upgrade your API version when you have time to commit to a full upgrade/regression testing cycle.


I've noticed the same thing and can only assume that while there is a versioning layer in APIs, the compiler may just always grow its syntax and not shrink its syntax. Or it could be that there is a versioning mechanism there and the addition of that logic has just been missed.

I've moved to version 43.0 to be on the safe side.