Buggy code:
public class AnnotProxyFieldValueFactory implements IFieldValueFactory { private final ISpringContextLocator contextLocator ; private final ConcurrentHashMap < SpringBeanLocator , Object > cache = Generics . newConcurrentHashMap ( ) ; private final ConcurrentHashMap < Class < ? > , String > beanNameCache = Generics . newConcurrentHashMap ( ) ; private final boolean wrapInProxies ; public AnnotProxyFieldValueFactory ( ISpringContextLocator contextLocator ) { } public AnnotProxyFieldValueFactory ( ISpringContextLocator contextLocator , boolean wrapInProxies ) { } public Object getFieldValue ( Field field , Object fieldOwner ) { } private String getBeanName ( final Field field ) { } private final String getBeanNameOfClass ( ApplicationContext ctx , Class < ? > clazz ) { List < String > names = new ArrayList < String > ( Arrays . asList ( BeanFactoryUtils . beanNamesForTypeIncludingAncestors ( ctx , clazz ) ) ) ; if ( ctx instanceof AbstractApplicationContext ) { Iterator < String > it = names . iterator ( ) ; while ( it . hasNext ( ) ) { final String possibility = it . next ( ) ; BeanDefinition beanDef = getBeanDefinition ( ( ( AbstractApplicationContext ) ( ctx ) ) . getBeanFactory ( ) , possibility ) ; if ( ( ( BeanFactoryUtils . isFactoryDereference ( possibility ) ) || ( possibility . startsWith ( "scopedTarget." ) ) ) || ( ! ( beanDef . isAutowireCandidate ( ) ) ) ) { it . remove ( ) ; } } } if ( names . isEmpty ( ) ) { throw new IllegalStateException ( ( ( "bean<seq2seq4repair_space>of<seq2seq4repair_space>type<seq2seq4repair_space>[" + ( clazz . getName ( ) ) ) + "]<seq2seq4repair_space>not<seq2seq4repair_space>found" ) ) ; } else if ( ( names . size ( ) ) > 1 ) { if ( ctx instanceof AbstractApplicationContext ) { List < String > primaries = new ArrayList < String > ( ) ; for ( String name : names ) { BeanDefinition beanDef = getBeanDefinition ( ( ( AbstractApplicationContext ) ( ctx ) ) . getBeanFactory ( ) , name ) ; if ( beanDef instanceof AbstractBeanDefinition ) { if ( ( ( AbstractBeanDefinition ) ( beanDef ) ) . isPrimary ( ) ) { primaries . add ( name ) ; } } } if ( ( primaries . size ( ) ) == 1 ) { return primaries . get ( 0 ) ; } } StringBuilder msg = new StringBuilder ( ) ; msg . append ( "More<seq2seq4repair_space>than<seq2seq4repair_space>one<seq2seq4repair_space>bean<seq2seq4repair_space>of<seq2seq4repair_space>type<seq2seq4repair_space>[" ) ; msg . append ( clazz . getName ( ) ) ; msg . append ( "]<seq2seq4repair_space>found,<seq2seq4repair_space>you<seq2seq4repair_space>have<seq2seq4repair_space>to<seq2seq4repair_space>specify<seq2seq4repair_space>the<seq2seq4repair_space>name<seq2seq4repair_space>of<seq2seq4repair_space>the<seq2seq4repair_space>bean<seq2seq4repair_space>" ) ; msg . append ( "(@SpringBean(name=\"foo\"))<seq2seq4repair_space>in<seq2seq4repair_space>order<seq2seq4repair_space>to<seq2seq4repair_space>resolve<seq2seq4repair_space>this<seq2seq4repair_space>conflict.<seq2seq4repair_space>" ) ; msg . append ( "Matched<seq2seq4repair_space>beans:<seq2seq4repair_space>" ) ; <START_BUG> msg . append ( Strings . join ( "," , names . toArray ( new String [ 0 ] ) ) ) ; <END_BUG> throw new IllegalStateException ( msg . toString ( ) ) ; } else { return names . get ( 0 ) ; } } private BeanDefinition getBeanDefinition ( ConfigurableListableBeanFactory beanFactory , String name ) { } public boolean supportsField ( Field field ) { } }

Fix:
msg . append ( Strings . join ( "," , names . toArray ( new String [ names . size ( ) ] ) ) ) ;