Buggy code:
@ Alpha public class HistoricalDataQuery { public static class Part_Select extends HistoricalDataQuery . Part_AllowsFrom { private Part_Select ( final HistoricalDataQuery query ) { } } public static class Part_From extends HistoricalDataQuery . Part { private Part_From ( final HistoricalDataQuery query ) { } } public static class Part_Where extends HistoricalDataQuery . Part { private Part_Where ( final HistoricalDataQuery query ) { } public HistoricalDataQuery . Part_ClauseColumn epochTime ( ) { } private HistoricalDataQuery . Part_ClauseColumn column ( final HistoricalDataColumn column ) { } } public static class Part_ClauseColumn extends HistoricalDataQuery . Part { private final HistoricalDataColumn m_column ; private Part_ClauseColumn ( final HistoricalDataColumn column , final HistoricalDataQuery query ) { } public HistoricalDataQuery between ( final EpochTimeRange range ) { } } public static class Part_SelectColumn extends HistoricalDataQuery . Part_AllowsFrom { private Part_SelectColumn ( final HistoricalDataQuery query ) { } } public static class Part { protected final HistoricalDataQuery m_query ; private Part ( final HistoricalDataQuery query ) { } } public static class Part_AllowsFrom extends HistoricalDataQuery . Part_AllowsSelectColumn { private Part_AllowsFrom ( HistoricalDataQuery query ) { } public HistoricalDataQuery from ( final UUID uuid ) { } public HistoricalDataQuery from ( final String macAddress , final UUID uuid ) { } } public static class Part_AllowsSelectColumn extends HistoricalDataQuery . Part { private Part_AllowsSelectColumn ( HistoricalDataQuery query ) { } public HistoricalDataQuery . Part_SelectColumn data ( ) { } public HistoricalDataQuery . Part_SelectColumn epochTime ( ) { } private HistoricalDataQuery . Part_SelectColumn column ( final HistoricalDataColumn column ) { } public HistoricalDataQuery . Part_Function min ( final HistoricalDataColumn column ) { } public HistoricalDataQuery . Part_Function max ( final HistoricalDataColumn column ) { } public HistoricalDataQuery . Part_Function avg ( final HistoricalDataColumn column ) { } private HistoricalDataQuery . Part_Function function ( final String function , final HistoricalDataColumn column ) { if ( ! ( m_query . m_select . isEmpty ( ) ) ) { m_query . m_select += "," ; } <START_BUG> m_query . m_select += ( ( ( "<seq2seq4repair_space>" + function ) + "(CAST(" ) + ( column . getColumnName ( ) ) ) + "<seq2seq4repair_space>AS<seq2seq4repair_space>INTEGER))" ; <END_BUG> return new HistoricalDataQuery . Part_Function ( m_query ) ; } } public static class Part_Function extends HistoricalDataQuery . Part_AllowsFrom { private Part_Function ( final HistoricalDataQuery query ) { } } private final BleNode m_node ; private UUID m_uuid = null ; private String m_select = "" ; private String m_where = "" ; private String m_macAddress = "" ; final Backend_HistoricalDatabase m_database ; private HistoricalDataQuery ( final BleNode node , final Backend_HistoricalDatabase database ) { } public static HistoricalDataQuery . Part_Select select ( final BleNode device , final Backend_HistoricalDatabase database ) { } public HistoricalDataQuery . Part_Where where ( ) { } private UUID getUuidOrInvalid ( ) { } private String getTableName ( ) { } private String makeQuery ( ) { } private HistoricalDataQueryEvent go_earlyOut ( ) { } public HistoricalDataQueryEvent go ( ) { } public void go ( final BleDevice . HistoricalDataQueryListener listener ) { } private String getMacAddress ( ) { } }

Fix:
m_query . m_select += ( "<seq2seq4repair_space>" + function ) + "(CAST(\"+column.getColumnName()+\"<seq2seq4repair_space>AS<seq2seq4repair_space>INTEGER))" ;