Source:
public ServiceRegistrationResult registerServices(Class<?> newServices) throws InvalidAcceleoPackageException { final ServiceRegistrationResult result = new ServiceRegistrationResult(); if (newServices == null) { throw new InvalidAcceleoPackageException("the service class can't be null"); } else if (!isRegisteredService(newServices)) { try { Constructor<?> cstr = null; Object instance = null; try { cstr = newServices.getConstructor(new Class[] {}); instance = cstr.newInstance(new Object[] {}); } catch (NoSuchMethodException e) { try { cstr = newServices.getConstructor(new Class[] {IReadOnlyQueryEnvironment.class }); instance = cstr.newInstance(new Object[] {queryEnvironment }); } catch (NoSuchMethodException e1) { } } if (instance instanceof IServiceProvider) { result.merge(registerServices((IServiceProvider)instance)); } else { Method[] methods = newServices.getMethods(); result.merge(getServicesFromInstance(newServices, instance, methods)); } } catch (SecurityException e) { throw new InvalidAcceleoPackageException( PACKAGE_PROBLEM_MSG + newServices.getCanonicalName(), e); } catch (InstantiationException e) { throw new InvalidAcceleoPackageException(INSTANTIATION_PROBLEM_MSG + newServices.getCanonicalName(), e); } catch (IllegalAccessException e) { throw new InvalidAcceleoPackageException(INSTANTIATION_PROBLEM_MSG + newServices.getCanonicalName(), e); } catch (IllegalArgumentException e) { throw new InvalidAcceleoPackageException(INSTANTIATION_PROBLEM_MSG + newServices.getCanonicalName(), e); } catch (InvocationTargetException e) { throw new InvalidAcceleoPackageException(INSTANTIATION_PROBLEM_MSG + newServices.getCanonicalName(), e); } } return result; }

Target:
public ServiceRegistrationResult registerServices(Class<?> newServices) throws InvalidAcceleoPackageException { final ServiceRegistrationResult result = new ServiceRegistrationResult(); if (newServices == null) { throw new NullPointerException("the service class can't be null"); } else if (!isRegisteredService(newServices)) { try { Constructor<?> cstr = null; Object instance = null; try { cstr = newServices.getConstructor(new Class[] {}); instance = cstr.newInstance(new Object[] {}); } catch (NoSuchMethodException e) { try { cstr = newServices.getConstructor(new Class[] {IReadOnlyQueryEnvironment.class }); instance = cstr.newInstance(new Object[] {queryEnvironment }); } catch (NoSuchMethodException e1) { } } if (instance instanceof IServiceProvider) { result.merge(registerServices((IServiceProvider)instance)); } else { Method[] methods = newServices.getMethods(); result.merge(getServicesFromInstance(newServices, instance, methods)); } } catch (SecurityException e) { throw new InvalidAcceleoPackageException( PACKAGE_PROBLEM_MSG + newServices.getCanonicalName(), e); } catch (InstantiationException e) { throw new InvalidAcceleoPackageException(INSTANTIATION_PROBLEM_MSG + newServices.getCanonicalName(), e); } catch (IllegalAccessException e) { throw new InvalidAcceleoPackageException(INSTANTIATION_PROBLEM_MSG + newServices.getCanonicalName(), e); } catch (IllegalArgumentException e) { throw new InvalidAcceleoPackageException(INSTANTIATION_PROBLEM_MSG + newServices.getCanonicalName(), e); } catch (InvocationTargetException e) { throw new InvalidAcceleoPackageException(INSTANTIATION_PROBLEM_MSG + newServices.getCanonicalName(), e); } } return result; }