Source:
<code>public static void registerAvailable(Object provider, Console console, Context context) { Predicate<? super Method> predicate = Predicates.<Method>and(ReflectionUtils.withModifier(Modifier.PUBLIC), ReflectionUtils.withAnnotation(Command.class)); Set<Method> commandMethods = ReflectionUtils.getAllMethods(provider.getClass(), predicate); for (Method method : commandMethods) { final Class[] paramTypes = method.getParameterTypes(); final Annotation[][] paramAnnotations = method.getParameterAnnotations(); boolean hasSenderAnnotation = false; for (int i = 0; i < paramAnnotations.length; i++) { if(paramTypes[i].getTypeName().equals(ENTITY_REF_NAME)) { if(paramAnnotations[i].length == 0) { <START> logger.error("Command provided by contains a EntityRef without @Sender annotation, may cause a NullPointerException", method.getName(), provider.getClass().getSimpleName()); <END> } else { for (Annotation annotation: paramAnnotations[i]) { if (annotation instanceof Sender) { hasSenderAnnotation = true; } } if(!hasSenderAnnotation){ logger.error("Command provided by contains a EntityRef without @Sender annotation, may cause a NullPointerException", method.getName(), provider.getClass().getSimpleName()); } } } } logger.debug("Registering command method in class {}", method.getName(), method.getDeclaringClass().getCanonicalName()); try { SpecificAccessibleObject<Method> specificMethod = new SpecificAccessibleObject<>(method, provider); MethodCommand command = referringTo(specificMethod, context); console.registerCommand(command); logger.debug("Registered command method in class {}", method.getName(), method.getDeclaringClass().getCanonicalName()); } catch (RuntimeException t) { logger.error("Failed to load command method in class {}", method.getName(), method.getDeclaringClass().getCanonicalName(), t); } } }</code><technical_language>replace this line hasSenderAnnotation=false. extract Line 90 102 a method hasSenderAnnotation this method hasSenderAnnotation replaced return statements. this good</technical_language>

Target:
public static void registerAvailable(Object provider, Console console, Context context) { Predicate<? super Method> predicate = Predicates.<Method>and(ReflectionUtils.withModifier(Modifier.PUBLIC), ReflectionUtils.withAnnotation(Command.class)); Set<Method> commandMethods = ReflectionUtils.getAllMethods(provider.getClass(), predicate); for (Method method : commandMethods) { if(!hasSenderAnnotation(method)){ logger.error("Command provided by contains a EntityRef without @Sender annotation, may cause a NullPointerException", method.getName(), provider.getClass().getSimpleName()); } logger.debug("Registering command method in class {}", method.getName(), method.getDeclaringClass().getCanonicalName()); try { SpecificAccessibleObject<Method> specificMethod = new SpecificAccessibleObject<>(method, provider); MethodCommand command = referringTo(specificMethod, context); console.registerCommand(command); logger.debug("Registered command method in class {}", method.getName(), method.getDeclaringClass().getCanonicalName()); } catch (RuntimeException t) { logger.error("Failed to load command method in class {}", method.getName(), method.getDeclaringClass().getCanonicalName(), t); } } }