I've experimented with creating 3 COD files.
1. The main.cod which contains the common code
2. The interface.cod which contains interfaces to OS specific implementation classes
3. The implemenation.cod which contains calls to APIs only supported in more recent OSes
2 and 3 are libraries. And 1 uses Class.fromName() to access and create instance of the classes in 3 but only if the OS is known to support the features implemented in that class (e.g. VirtualKeyboard in 4.7).
The use of a shared interface.cod avoids the needs for reflection.
This appears to work in JDE 4.7 with 4.6 and 4.7 simulators.The 4.6 simulator is happy to load main.cod and run the app (no exceptions from the linker at load time). And the 4.7 simulator is happy to instantiate the classes in implementation.cod and call the APIs only available in 4.7.
The advantage is that I can build one core COD for all platforms. The disadvantage is that I have to create 3 CODs total (but only once). And in the future if I want to take advantage of an even newer API, I'll have to create a 4th COD to implement those classes.
I now have to figure out how to configure the JAD so that OTA will download all three CODs and run! And then test on real devices... Helpful hints welcomed.
Yvon