DBFlow icon indicating copy to clipboard operation
DBFlow copied to clipboard

Bug? Error on Comple "<identifier> expected" in generated *_Table.java

Open paraqles opened this issue 10 years ago • 1 comments

Setup:

  • DBFlow Version: 4.0.0-beta1
  • Target Platform: Android 23
  • Gradle/Maven: Gradle v2.10 Android Gradle Plugin v2.0.0
  • Build Tools: 24.0.3
  • Kotlin: 1.0.3 with kapt

Issue Kind: Probably Bug

Problem Description: Error is occuring on build: Error:(151, 27) Gradle: error: <identifier> expected Corresponding generated *_Table.java file, error is reported in 151, but highlighting is showing it in 152.

150    int index_from = cursor.getColumnIndex("from");
151    if (index_from != -1 && !cursor.isNull(index_from)) {
152      model.setFrom(cursor.(index_from));
153    } else {
154      model.setFrom(null);
155    }

Below you find the corresponding annotated class.

@Table(database = MMHDatabase::class)
class Transaction(from: Account, value: Float = 0.0f, to: Account? = null, id: Long? = null) : BaseModel() {
    companion object {
        fun get(id: Long) : Transaction? {
            return (select
                    from Transaction::class
                    where (Transaction_Table.id eq id)).result
        }
    }

    @PrimaryKey
    var id: Long? = null

    @Column
    var from: Account? = null

    @Column
    var value: Float = 0.0f

    @ForeignKey(tableClass = Account::class)
    var to: Account? = null
}

Did I do something wrong or is this a bug?

paraqles avatar Oct 24 '16 11:10 paraqles

Never mind. I made a mistake, delaring a refence class Account as column and not foreign key.

paraqles avatar Oct 24 '16 11:10 paraqles