Buggy code:
public class ServerStartBatchBuilder implements BatchBuilder { private final BatchBuilder delegate ; private final ServerStartupListener serverStartupListener ; public ServerStartBatchBuilder ( final BatchBuilder delegate , final ServerStartupListener serverStartupListener ) { } @ Override public < T > BatchServiceBuilder < T > addServiceValue ( ServiceName name , Value < ? extends Service < T > > value ) throws IllegalArgumentException { } @ Override public < T > BatchServiceBuilder < T > addService ( ServiceName name , Service < T > service ) throws IllegalArgumentException { } @ Override public < T > BatchServiceBuilder < T > addServiceValueIfNotExist ( ServiceName name , Value < ? extends Service < T > > value ) throws IllegalArgumentException { } @ Override public BatchBuilder addListener ( ServiceListener < Object > listener ) { } @ Override public BatchBuilder addListener ( ServiceListener < Object > ... listeners ) { } @ Override public BatchBuilder addListener ( Collection < ServiceListener < Object > > listeners ) { } @ Override public BatchBuilder addDependency ( ServiceName dependency ) { } @ Override public BatchBuilder addDependency ( ServiceName ... dependencies ) { } @ Override public BatchBuilder addDependency ( Collection < ServiceName > dependencies ) { } @ Override public void install ( ) throws ServiceRegistryException { } @ Override public BatchBuilder subBatchBuilder ( ) { } private class ServerStartBatchServiceBuilder < T > implements BatchServiceBuilder < T > { private final ServiceName serviceName ; final BatchServiceBuilder < T > delegate ; private ServerStartBatchServiceBuilder ( ServiceName serviceName , BatchServiceBuilder < T > delegate ) { } @ Override public BatchServiceBuilder addAliases ( ServiceName ... aliases ) { } @ Override public BatchServiceBuilder setLocation ( ) { } @ Override public BatchServiceBuilder setLocation ( Location location ) { } @ Override public BatchServiceBuilder setInitialMode ( ServiceController . Mode mode ) { if ( mode . equals ( ON_DEMAND ) ) { ServerStartBatchBuilder . this . serverStartupListener . expectOnDemand ( serviceName ) ; } else { <START_BUG> ServerStartBatchBuilder . this . serverStartupListener . expectOnDemand ( serviceName ) ; <END_BUG> } delegate . setInitialMode ( mode ) ; return this ; } @ Override public BatchServiceBuilder addDependencies ( ServiceName ... dependencies ) { } @ Override public BatchServiceBuilder addOptionalDependencies ( ServiceName ... dependencies ) { } @ Override public BatchServiceBuilder addDependencies ( Iterable < ServiceName > dependencies ) { } @ Override public BatchServiceBuilder addOptionalDependencies ( Iterable < ServiceName > dependencies ) { } @ Override public BatchServiceBuilder addDependency ( ServiceName dependency ) { } @ Override public BatchServiceBuilder addOptionalDependency ( ServiceName dependency ) { } @ Override public BatchServiceBuilder addDependency ( ServiceName dependency , Injector < Object > target ) { } @ Override public BatchServiceBuilder addOptionalDependency ( ServiceName dependency , Injector < Object > target ) { } @ Override public BatchServiceBuilder addDependency ( ServiceName dependency , Class type , Injector target ) { } @ Override public BatchServiceBuilder addOptionalDependency ( ServiceName dependency , Class type , Injector target ) { } @ Override public BatchServiceBuilder addInjection ( Injector target , Object value ) { } @ Override public BatchServiceBuilder addInjectionValue ( Injector target , Value value ) { } @ Override public BatchServiceBuilder addListener ( ServiceListener serviceListener ) { } @ Override public BatchServiceBuilder addListener ( ServiceListener ... serviceListeners ) { } @ Override public BatchServiceBuilder addListener ( Collection < ? extends ServiceListener < ? super T > > collection ) { } } }

Fix:
ServerStartBatchBuilder . this . serverStartupListener . unexpectOnDemand ( serviceName ) ;