Do not add TableFieldImpl to table in constructor of TableFieldImpl

This commit is contained in:
Sven Jacobs 2013-04-06 10:48:44 +02:00
parent 740f8f84fe
commit a3b08d6eb0
2 changed files with 8 additions and 6 deletions

View File

@ -265,7 +265,14 @@ abstract class AbstractTable<R extends Record> extends AbstractQueryPart impleme
* @param type The data type of the field
*/
protected static final <R extends Record, T> TableField<R, T> createField(String name, DataType<T> type, Table<R> table) {
return new TableFieldImpl<R, T>(name, type, table);
final TableFieldImpl<R, T> tableField = new TableFieldImpl<R, T>(name, type, table);
// [#1199] The public API of Table returns immutable field lists
if (table instanceof TableImpl) {
((TableImpl<?>) table).fields0().add(tableField);
}
return tableField;
}
// ------------------------------------------------------------------------

View File

@ -59,11 +59,6 @@ class TableFieldImpl<R extends Record, T> extends AbstractField<T> implements Ta
super(name, type);
this.table = table;
// [#1199] The public API of Table returns immutable field lists
if (table instanceof TableImpl) {
((TableImpl<?>) table).fields0().add(this);
}
}
@Override