Package import statements do not match package declarations
decubate opened this issue · 6 comments
I have a configuration file, named entity_name.json
:
{
"fields": [
{
"name": "entity_name_field",
"type": "String"
}
]
}
When the entity_name
classes are generated, their package names lack underscores:
package com.app.provider.entityname;
However, in the generated classes that import the generated entity_name
classes, the import statements include underscores:
import com.app.provider.entity_name.*;
I'm using version 1.8.0.
Woops! Thanks for the report, I'll have a look ASAP.
I cannot reproduce this issue with the 1.8.1 version that I just released. Please comment if you stil have the issue, but I believe it's fixed :)
I tried it again with the latest release (1.8.2) and the problem still persists. Including minimal example below:
_config.json:
{
"syntaxVersion": "2",
"projectPackageId": "com.test.testapp",
"authority": "com.test.testapp.provider",
"providerJavaPackage": "com.test.testapp.provider",
"providerClassName": "TestProvider",
"sqliteOpenHelperClassName": "TestSQLiteOpenHelper",
"sqliteOpenHelperCallbacksClassName": "TestSQLiteOpenHelperCallbacks",
"databaseFileName": "Test.db",
"databaseVersion": 1,
"enableForeignKeys": true
}
test.json:
{
"fields": [
{
"name": "test_entity_underscores_id",
"type": "Long",
"nullable": true,
"foreignKey": {
"table": "test_entity_underscores",
"onDelete": "CASCADE"
}
}
]
}
test_entity_underscores.json:
{
"fields": [
{
"name": "testField",
"type": "String"
}
]
}
This generates this package declaration in the TestEntityUnderscores classes:
package com.test.testapp.provider.testentityunderscores;
and this import statement in TestCursor.java:
import com.test.testapp.provider.test_entity_underscores.*;
Am I doing something wrong or is this still an issue?
Ooooh, I realize now that I misunderstood the exact problem you're seeing.
I did test with entities containing underscores, but not foreign keys pointing to them, as in your example.
Sorry about that, I will have a look ASAP.
Great, thank you for the swift fix! :)