protected IProblem[] getJavaCompilationErrors(CompilationResult result) {
   try {
     Method getErrorsMethod = result.getClass().getMethod("getErrors", null);
     return (IProblem[]) getErrorsMethod.invoke(result, null);
   } catch (SecurityException e) {
     throw new JRRuntimeException("Error resolving JDT methods", e);
   } catch (NoSuchMethodException e) {
     throw new JRRuntimeException("Error resolving JDT methods", e);
   } catch (IllegalArgumentException e) {
     throw new JRRuntimeException("Error invoking JDT methods", e);
   } catch (IllegalAccessException e) {
     throw new JRRuntimeException("Error invoking JDT methods", e);
   } catch (InvocationTargetException e) {
     throw new JRRuntimeException("Error invoking JDT methods", e);
   }
 }