ReflectionUtil { public static boolean hasRestartMethods(Class<? extends ConfigInstance> configClass) { try { configClass.getDeclaredMethod("containsFieldsFlaggedWithRestart"); configClass.getDeclaredMethod("getChangesRequiringRestart", configClass); return true; } catch (NoSuchMethodException e) { return false; } } private  ReflectionUtil(); static Set<ConfigKey<?>> getAllConfigsProduced(Class<? extends ConfigProducer> producerClass, String configId); static boolean hasRestartMethods(Class<? extends ConfigInstance> configClass); static boolean containsFieldsFlaggedWithRestart(Class<? extends ConfigInstance> configClass); static ChangesRequiringRestart getChangesRequiringRestart(ConfigInstance from, ConfigInstance to); static List<Class<?>> getAllSuperclasses(Class<?> cls);  }
@Test public void requireThatRestartMethodsAreDetectedProperly() { assertFalse(ReflectionUtil.hasRestartMethods(NonRestartConfig.class)); assertTrue(ReflectionUtil.hasRestartMethods(RestartConfig.class)); }