I have to remove '@' for annotations to avoid compilation errors


#1

code

 
@NamedQueries(@NamedQuery(name = "query name",
        query = "select o from RentLicense o where o.active = true and o.tenant = ?1"),
    @NamedQuery(name = "another query name",
        query = "select o from RentLicense o where o.expired = ?1"))
public class RentLicense() {}

isn’t compiled with “Expecting an element” error, but

@NamedQueries(NamedQuery(name = "query name",
        query = "select o from RentLicense o where o.active = true and o.tenant = ?1"),
   NamedQuery(name = "another query name",
        query = "select o from RentLicense o where o.expired = ?1"))
public class RentLicense() {}

is compiled fine.

The only one difference is ‘@’ prefix before NamedQuery annotation which should be mandatory, but I have to remove the prefix for errorless compilation

plugin version 0.12.1230.idea142.12


#2

Alot has been changed in M13 especially iin the area of annotations which is discussed in this blogpost. So I think it's wise to update to M13 (0.13.1513)


#3

plugin 0.13.1513.Idea142.1

compilation still failed with the same error

the same for this kind of annotations:

 
@JoinTable(name = "currency_option",
        joinColumns = arrayOf(JoinColumn(name = "currency_id")), inverseJoinColumns = arrayOf(JoinColumn(name = "option_id")))

fine

@JoinTable(name = "currency_option",
        joinColumns = arrayOf(@JoinColumn(name = "currency_id")), inverseJoinColumns = arrayOf(@JoinColumn(name = "option_id")))
error

#4

This is right: when you annotate something (a declaration or an expression), you prefix the annotation with `@`, but when you simple instantiate an annotation class as an argument to another annotation, you are not annotating anything any more, and `@` is not applicable. The error message could be better though