DBFlow icon indicating copy to clipboard operation
DBFlow copied to clipboard

error: ';' expected in Generated classes

Open ghost opened this issue 11 years ago • 12 comments

in an example generated class from concrete class called FeedModel, FeedModel$Container.java loadFromCursor() has several errors

there are several errors in these generated classes where a semicolon ';' is placed after 2 closing parenthesis ')' when there should only be 1 closing parenthesis.

ghost avatar Jun 02 '15 11:06 ghost

Same problem here. dk why, when removed private worked perfectly

OptimistNot avatar Jun 02 '15 12:06 OptimistNot

Not sure how that happened but what does your model look like? Just curious about the ; after 2 closing parenthesis issue.

agrosner avatar Jun 02 '15 13:06 agrosner

i've removed usage of dbflow because of a few issues (generated files were causing compile time errors as described above, one to many relationships seemed to work sometimes but not always) but the example model causing issues was:

public class FeedModel extends BaseModel {

    public interface Columns extends BaseColumns {
        String NAME = "col_name";
    }
    @Column(name = Columns._ID)
    @PrimaryKey(autoincrement = true)
    public long id;

    @Column(name = Columns.NAME)
    public String name;
}

i basically had to remove all getters/setters and change the private fields to public which was not fun.

ghost avatar Jun 02 '15 14:06 ghost

my model:

@Table(databaseName = GAUDIDatabase.DB_NAME, tableName = AQL.ENDPOINT) @TableEndpoint(name = AQL.ENDPOINT, contentProviderName = "GAUDIContentProvider") @ModelContainer public class AQL extends BaseModel{

public static final String ENDPOINT = "AQL";

@ContentUri(path = AQL.ENDPOINT,
        type = ContentUri.ContentType.VND_MULTIPLE + ENDPOINT)
public static Uri CONTENT_URI = ContentProviderUtils.buildUri(ENDPOINT);

public interface Columns {
    String AQL_ID = "aql_id";
    String AQL_NAME = "aql_name";
    String AQL_SERVER_ID = "aql_server_id";
    String AQL_TIMESTAMP = "aql_timestamp";
}

@Column(name = Columns.AQL_ID)
@PrimaryKey(autoincrement = true)
Long aql_id;

@Column(name = Columns.AQL_NAME)
String aql_name;

@Column(name = Columns.AQL_SERVER_ID)
Long server_id;

@Column(name = Columns.AQL_TIMESTAMP)
DateTime timestamp;

all were private fields...had to remove them cz of exception

OptimistNot avatar Jun 02 '15 14:06 OptimistNot

If you want you're fields as private, you can add accessors of the fields in the format of: fieldName => getFieldName(), setFieldName()

As long as those methods are accessible.

agrosner avatar Jun 04 '15 13:06 agrosner

so i did what you said and i'm sorry but i don't think it's solves my problem... even with accessors my containers in toModel() using model.fieldName that gives me access error and still getting ; error in modelContainer.put(), it generates more ")" then should. ex: modelContainer.put("aql_id",null)); Thank you!

OptimistNot avatar Jun 05 '15 15:06 OptimistNot

Same issue here. It seems to always happen when I attempt using @ModelContainer

eboissonneault avatar Jun 11 '15 16:06 eboissonneault

Same issue here, as OptimistNot stated, there is an unnecessary ")" that makes this compile error.

R4md4c avatar Jul 01 '15 18:07 R4md4c

will check this out for 2.2

agrosner avatar Jul 01 '15 19:07 agrosner

Are sure that it is fixed in 2.2 ? I've just checked out this version and the same problem happen when I annotate a BaseModel class with @ModelContainer annotation.

R4md4c avatar Jul 03 '15 10:07 R4md4c

Sorry guys! it will be in 2.2.1.

agrosner avatar Jul 03 '15 12:07 agrosner

Hi, this bug still exists in 2.2.1 . It occures with @ModelContainer annotation

0ximDigital avatar Sep 14 '15 10:09 0ximDigital