In the context of a previous blog post about JUnit 5, Maaartinus, one of our readers, has brought up a very interesting idea: The only problem with try-catch is its verbosity, which is something I can live with (IMHO a lone catch would do better, the implicit try would apply to all preceding code in … Continue reading Would We Still Criticise Checked Exceptions, If Java had a Better try-catch Syntax?
Tag: methods
A neater way to use reflection in Java
Reflection in Java really feels awkward. The java.lang.reflect API is very powerful and complete, and in that sense also very verbose. Unlike in most scripting languages, there is no convenient way to access methods and fields dynamically using reflection. By convenient, I mean things like this // PHP $method = 'my_method'; $field = 'my_field'; // … Continue reading A neater way to use reflection in Java