lundi 3 décembre 2018

How best to call a method that may not exist in the user's JDK version?

what if I want to write a java API method call or field access that should (silently) fail under older JRE versions which don't have the method or field yet? Are there best practices? Is there a more lightweight way than to wrap the call into a class that is loaded and invoked dynamically using reflection, and catch any NoSuchMethodErrors and the like that might get thrown?

I have fixed an annoying issue in Java3D, but my fix may need to call a Java 1.7 method to be effective, and if I submit it to the maintainers of Java3D, it should probably at least not break the bytecode under older platforms.





Aucun commentaire:

Enregistrer un commentaire