Reputation: 9103
When I define Room's database with @Database
in Java:
@Database(entities = {JustSomeEntity.class}, version = 1)
When I define Room's database with @Database
in Kotlin:
@Database(entities = arrayOf(JustSomeEntity::class), version = 1)
Please note the arrayOf
in Kotlin version.
See official docs for reference - you can toggle Java/Kotlin there and see.
Is this some kind of Java / Kotlin / annotations quirk? Why is that? Where it comes from?
Upvotes: 1
Views: 196
Reputation: 616
In Java curly braces define an array of values. See the docs:
Alternatively, you can use the shortcut syntax to create and initialize an array:
int[] anArray = {
100, 200, 300,
400, 500, 600,
700, 800, 900, 1000
};
https://docs.oracle.com/javase/tutorial/java/nutsandbolts/arrays.html
Upvotes: 1