Source:
<code>void addService(final Service service, final boolean expectsAbstractRegistration) { final Lock lock = runningLock.readLock(); lock.lock(); try { Set<Class<? extends Service>> serviceClazzes = new HashSet<Class<? extends Service>>(); for (Class<?> i : getAllInterfaces(service.getClass())) { if (Service.class != i && Service.class.isAssignableFrom(i)) { @SuppressWarnings("unchecked") Class<? extends Service> serviceClass = (Class<? extends Service>) i; serviceClazzes.add(serviceClass); } } if (services.putIfAbsent(service.getClass(), service) != null) { throw new IllegalStateException("Registration of duplicate service " + service.getClass()); } if (!service.getClass().isAnnotationPresent(SupplementaryService.class)) { boolean registered = false; for (Class<? extends Service> serviceClazz : serviceClazzes) { if (services.putIfAbsent(serviceClazz, service) == null && !registered) { registered = true; } } if (!registered) { final StringBuilder message = new StringBuilder("Duplicate service implementation found for ").append(serviceClazzes) .append(" by ") .append(service.getClass()); for (Class<? extends Service> serviceClass : serviceClazzes) { final Service declaredService = services.get(serviceClass); if (declaredService != null) { message .append("\n\t\t- ") .append(serviceClass) .append(" already has ") .append(declaredService.getClass()); } } if (expectsAbstractRegistration) { throw new IllegalStateException(message.toString()); } LOGGER.debug(message.toString()); } } <START> if (service.getClass().isAnnotationPresent(ServiceDependency.class)) { <END> ServiceDependency annotation = service.getClass().getAnnotation(ServiceDependency.class); for (Class aClass : annotation.services()) { if (getOrCreateService(aClass) == null) { throw new IllegalStateException("Unable to resolve dependent service: " + aClass.getSimpleName()); } } } if (running.get()) { service.start(this); } } finally { lock.unlock(); } }</code><technical_language>this getAnnotation call a null check</technical_language>

Target:
void addService(final Service service, final boolean expectsAbstractRegistration) { final Lock lock = runningLock.readLock(); lock.lock(); try { Set<Class<? extends Service>> serviceClazzes = new HashSet<Class<? extends Service>>(); for (Class<?> i : getAllInterfaces(service.getClass())) { if (Service.class != i && Service.class.isAssignableFrom(i)) { @SuppressWarnings("unchecked") Class<? extends Service> serviceClass = (Class<? extends Service>) i; serviceClazzes.add(serviceClass); } } if (services.putIfAbsent(service.getClass(), service) != null) { throw new IllegalStateException("Registration of duplicate service " + service.getClass()); } if (!service.getClass().isAnnotationPresent(SupplementaryService.class)) { boolean registered = false; for (Class<? extends Service> serviceClazz : serviceClazzes) { if (services.putIfAbsent(serviceClazz, service) == null && !registered) { registered = true; } } if (!registered) { final StringBuilder message = new StringBuilder("Duplicate service implementation found for ").append(serviceClazzes) .append(" by ") .append(service.getClass()); for (Class<? extends Service> serviceClass : serviceClazzes) { final Service declaredService = services.get(serviceClass); if (declaredService != null) { message .append("\n\t\t- ") .append(serviceClass) .append(" already has ") .append(declaredService.getClass()); } } if (expectsAbstractRegistration) { throw new IllegalStateException(message.toString()); } LOGGER.debug(message.toString()); } } loadDependenciesOf(service.getClass()); if (running.get()) { service.start(this); } } finally { lock.unlock(); } }