Program: 43338
Project: 43338
Buggy source:
public <T>Entity<T> make(Class<T> type){
  NutEntity<T> en=new NutEntity<T>(type);
  TableInfo ti=_createTableInfo(type);
  if (null != expert.getConf()) {
    for (    String key : expert.getConf().keySet())     en.getMetas().put(key,expert.getConf().get(key));
  }
  if (null != ti.annMeta) {
    Map<String,Object> map=Lang.map(ti.annMeta.value());
    for (    Entry<String,Object> entry : map.entrySet()) {
      en.getMetas().put(entry.getKey(),entry.getValue().toString());
    }
  }
  String tableName=null == ti.annTable ? Strings.lowerWord(type.getSimpleName(),'_') : ti.annTable.value();
  String viewName=null == ti.annView ? tableName : ti.annView.value();
  en.setTableName(tableName);
  en.setViewName(viewName);
  boolean shouldUseColumn=false;
  for (  Field field : en.getMirror().getFields()) {
    if (null != field.getAnnotation(Column.class)) {
      shouldUseColumn=true;
      break;
    }
  }
  List<MappingInfo> infos=new ArrayList<MappingInfo>();
  List<LinkInfo> ones=new ArrayList<LinkInfo>();
  List<LinkInfo> manys=new ArrayList<LinkInfo>();
  List<LinkInfo> manymanys=new ArrayList<LinkInfo>();
  for (  Field field : en.getMirror().getFields()) {
    if (null != field.getAnnotation(One.class)) {
      ones.add(_Infos.createLinkInfo(field));
    }
 else     if (null != field.getAnnotation(Many.class)) {
      manys.add(_Infos.createLinkInfo(field));
    }
 else     if (null != field.getAnnotation(ManyMany.class)) {
      manymanys.add(_Infos.createLinkInfo(field));
    }
 else     if (shouldUseColumn && (null == field.getAnnotation(Column.class) && null == field.getAnnotation(Id.class) && null == field.getAnnotation(Name.class))) {
      continue;
    }
 else {
      infos.add(_Infos.createMappingInfo(ti.annPK,field));
    }
  }
  for (  Method method : en.getType().getMethods()) {
    if (null != method.getAnnotation(One.class)) {
      ones.add(_Infos.createLinkInfo(method));
    }
 else     if (null != method.getAnnotation(Many.class)) {
      manys.add(_Infos.createLinkInfo(method));
    }
 else     if (null != method.getAnnotation(ManyMany.class)) {
      manymanys.add(_Infos.createLinkInfo(method));
    }
 else     if (null == method.getAnnotation(Column.class) && null == method.getAnnotation(Id.class) && null == method.getAnnotation(Name.class)) {
      continue;
    }
 else {
      infos.add(_Infos.createMapingInfo(ti.annPK,method));
    }
  }
  for (  MappingInfo info : infos) {
    NutMappingField ef=new NutMappingField(en);
    _evalMappingField(ef,info);
    en.addMappingField(ef);
  }
  holder.set(en);
  for (  LinkInfo li : ones) {
    en.addLinkField(new OneLinkField(en,holder,li));
  }
  for (  LinkInfo li : manys) {
    en.addLinkField(new ManyLinkField(en,holder,li));
  }
  for (  LinkInfo li : manymanys) {
    en.addLinkField(new ManyManyLinkField(en,holder,li));
  }
  en.checkCompositeFields(null == ti.annPK ? null : ti.annPK.value());
  if (null != datasource && null != expert) {
    _checkupEntityFieldsWithDatabase(en);
  }
  _evalFieldMacro(en,infos);
  if (null != ti.annIndexes)   _evalEntityIndexes(en,ti.annIndexes);
  return en;
}

Fixed version (ground truth):
public <T>Entity<T> make(Class<T> type){
  NutEntity<T> en=new NutEntity<T>(type);
  TableInfo ti=_createTableInfo(type);
  if (null != expert.getConf()) {
    for (    String key : expert.getConf().keySet())     en.getMetas().put(key,expert.getConf().get(key));
  }
  if (null != ti.annMeta) {
    Map<String,Object> map=Lang.map(ti.annMeta.value());
    for (    Entry<String,Object> entry : map.entrySet()) {
      en.getMetas().put(entry.getKey(),entry.getValue().toString());
    }
  }
  String tableName=null == ti.annTable ? Strings.lowerWord(type.getSimpleName(),'_') : ti.annTable.value();
  String viewName=null == ti.annView ? tableName : ti.annView.value();
  en.setTableName(tableName);
  en.setViewName(viewName);
  boolean shouldUseColumn=false;
  for (  Field field : en.getMirror().getFields()) {
    if (null != field.getAnnotation(Column.class)) {
      shouldUseColumn=true;
      break;
    }
  }
  List<MappingInfo> infos=new ArrayList<MappingInfo>();
  List<LinkInfo> ones=new ArrayList<LinkInfo>();
  List<LinkInfo> manys=new ArrayList<LinkInfo>();
  List<LinkInfo> manymanys=new ArrayList<LinkInfo>();
  for (  Field field : en.getMirror().getFields()) {
    if (null != field.getAnnotation(One.class)) {
      ones.add(_Infos.createLinkInfo(field));
    }
 else     if (null != field.getAnnotation(Many.class)) {
      manys.add(_Infos.createLinkInfo(field));
    }
 else     if (null != field.getAnnotation(ManyMany.class)) {
      manymanys.add(_Infos.createLinkInfo(field));
    }
 else     if (shouldUseColumn && (null == field.getAnnotation(Column.class) && null == field.getAnnotation(Id.class) && null == field.getAnnotation(Name.class))) {
      continue;
    }
 else {
      infos.add(_Infos.createMappingInfo(ti.annPK,field));
    }
  }
  for (  Method method : en.getType().getMethods()) {
    if (null != method.getAnnotation(One.class)) {
      ones.add(_Infos.createLinkInfo(method));
    }
 else     if (null != method.getAnnotation(Many.class)) {
      manys.add(_Infos.createLinkInfo(method));
    }
 else     if (null != method.getAnnotation(ManyMany.class)) {
      manymanys.add(_Infos.createLinkInfo(method));
    }
 else     if (null == method.getAnnotation(Column.class) && null == method.getAnnotation(Id.class) && null == method.getAnnotation(Name.class)) {
      continue;
    }
 else {
      infos.add(_Infos.createMapingInfo(ti.annPK,method));
    }
  }
  List<MappingInfo> tmp=new ArrayList<MappingInfo>(infos.size());
  MappingInfo miId=null;
  MappingInfo miName=null;
  for (  MappingInfo mi : infos) {
    if (mi.annId != null)     miId=mi;
 else     if (mi.annName != null)     miName=mi;
 else     tmp.add(mi);
  }
  if (miName != null)   tmp.add(0,miName);
  if (miId != null)   tmp.add(0,miId);
  infos=tmp;
  for (  MappingInfo info : infos) {
    NutMappingField ef=new NutMappingField(en);
    _evalMappingField(ef,info);
    en.addMappingField(ef);
  }
  holder.set(en);
  for (  LinkInfo li : ones) {
    en.addLinkField(new OneLinkField(en,holder,li));
  }
  for (  LinkInfo li : manys) {
    en.addLinkField(new ManyLinkField(en,holder,li));
  }
  for (  LinkInfo li : manymanys) {
    en.addLinkField(new ManyManyLinkField(en,holder,li));
  }
  en.checkCompositeFields(null == ti.annPK ? null : ti.annPK.value());
  if (null != datasource && null != expert) {
    _checkupEntityFieldsWithDatabase(en);
  }
  _evalFieldMacro(en,infos);
  if (null != ti.annIndexes)   _evalEntityIndexes(en,ti.annIndexes);
  return en;
}