Jack编译器和泛型的编译错误

时间:2016-12-27 13:43:10

标签: java android android-jack-and-jill

我使用ORM for android调用Squeaky并生成代码以避免使用反射。当我没有使用新的jack编译器时生成的代码工作正常,但是我得到了这些错误:

  

错误:C:\ ... \ app \ build \ generated \ source \ apt \ prod \ debug \ ... \ domain \ model \ WeatherForecast $ Configuration.java:24.20:类型WeatherForecast $ Configuration必须实现继承抽象方法GeneratedTableMapper.fillRow(WeatherForecast,Cursor,ModelDao,Dao.ForeignRefresh [],TransientCache)

     

错误:C:\ ... \ app \ build \ generated \ source \ apt \ prod \ debug \ ... \ domain \ model \ WeatherForecast $ Configuration.java:43.15:   方法fillRow(WeatherForecast,Cursor,ModelDao,   Dao.ForeignRefresh [],TransientCache)的类型   WeatherForecast $ Configuration必须覆盖或实现超类型   方法

这实际上是生成的代码中的错误还是编译器的错误?

这是生成的带有问题的类方法

public final class WeatherForecast$Configuration implements GeneratedTableMapper<WeatherForecast> {
  public static final WeatherForecast$Configuration instance = new WeatherForecast$Configuration();

  FieldsEnum[] fields;

  ForeignCollectionInfo[] foreignConfigs;

  public WeatherForecast$Configuration() {
    this.fields = getFields();
    this.foreignConfigs = getForeignConfigs();
  }

  @Override
  public WeatherForecast createObject(Cursor results) throws SQLException {
    WeatherForecast data = new WeatherForecast();
    return data;
  }

  @Override
  public void fillRow(WeatherForecast data, Cursor results, ModelDao<WeatherForecast> modelDao, Dao.ForeignRefresh[] foreignRefreshMap, TransientCache objectCache) throws SQLException {
    if(!results.isNull(0))data.setStationId(results.getInt(0));
    if(!results.isNull(1))data.setTemperature(results.getFloat(1));
    if(!results.isNull(2))data.setHumidity(results.getInt(2));
    if(!results.isNull(3))data.setForecastCode(results.getInt(3));
    if(!results.isNull(4))data.setStartTime(results.getLong(4));
    if(!results.isNull(5))data.setEndTime(results.getLong(5));
    data.setIcon(results.getString(6));
  }

...
}

继承/正在使用的2个接口:

GeneratedTableMapper.java

public interface GeneratedTableMapper<T> {
    T createObject(Cursor results) throws SQLException;

    void fillRow(T data, Cursor results, ModelDao<T> modelDao, Dao.ForeignRefresh[] foreignRefreshMap, TransientCache objectCache) throws SQLException;

    void assignId(T data, Object val);

    Object extractId(T data);

    void bindVals(SQLiteStatement stmt, T data) throws SQLException;

    void bindCreateVals(SQLiteStatement stmt, T data) throws SQLException;

    String objectToString(T data) throws SQLException;

    boolean objectsEqual(T d1, T d2) throws SQLException;

    TableInfo<T> getTableConfig() throws SQLException;

    void fillForeignCollection(T data, ModelDao<T> modelDao, String fieldName) throws SQLException;

    //Foreign

}

Dao.java

public interface Dao<T> {
    class ForeignRefresh {
        public final String field;
        public final ForeignRefresh[] refreshFields;

        public ForeignRefresh(String field) {
            this(field, null);
        }

        public ForeignRefresh(String field, ForeignRefresh[] refreshFields) {
            this.field = field;
            this.refreshFields = refreshFields;
        }
    }

    interface QueryModifiers<T> {
        QueryModifiers<T> orderBy(String s);

        QueryModifiers<T> limit(Integer i);

        QueryModifiers<T> offset(Integer i);

        QueryModifiers<T> foreignRefreshMap(ForeignRefresh[] foreignRefreshMap);

        List<T> list() throws SQLException;
    }

    T queryForId(Object id) throws SQLException;

...

    void refresh(T data) throws SQLException;

    void refresh(T data, ForeignRefresh[] foreignRefreshMap) throws SQLException;
...
}

0 个答案:

没有答案