Just uncovered a fun bug in one of the Java Compiler / Eclipse (haven’t checked to see which one is behaving exactly correctly).
If you are working Eclipse then the Eclipse compiler believes the following snippet of code is OK:
@org.hibernate.annotations.Table(
appliesTo = "PendingVotes",
indexes = {
@Index(name = "VoteId", columnNames = { "VoteId" }),
})
However, the Java compiler (Version 6, update 12) will report the following error:
annotation.java:6: illegal start of expression }) ^
Now, I’ll display that snippet again and highlight the problem:
@org.hibernate.annotations.Table(
appliesTo = "PendingVotes",
indexes = {
@Index(name = "VoteId", columnNames = { "VoteId" }),
})
See that sneaky little comma at the end? I believe this is valid syntax (it allows someone to add another item later and only alter a single line – useful for generating diffs).
Remove that comma and everything becomes pain free again.
thanks for that tip been going crazy trying to fix the same issue