Good curiosity.
I'm afraid there is no other way than using try catch in Java, but if Java was an OTF (on the fly) compiler, and the exception mechanism actually used the method (if-responses_to?), Which was supposed to be declared at the top of the hierarchical pyramid of class inheritance, like Object in Java, which could override this method on your DynamicClass.
However, Java does not use the above mechanism to control if responses_to? and messages that are sent to an object (class) are tested somewhere else in the compiler, but not as a method that you can override.
I know a language called (Magik), which has the above mechanism, which is very good, and it is an OTF compiler.
The Object class in Magik has a method called do_not_responds_to () and whenever a message is sent to an object, it is checked for the state and behavior of the class and, finally, raises or better tells run the do_not_responds_to () method if the method is name (message) not valid.
Is this a very neat solution for implementing do_not_responds_to? method in the class (DynamicClass) to handle the exception before raising it. however, after 10 years of experience with the Magician, this never happened.
Sorry, my English is not very good, I hope I could explain this problem.
Zich source share