I'll add a few snippets from the spec to explain why Rex's solution works For Scala on the JVM, arguments to annotations that will be retained within the generated class must be constant expressions: Instances of an annotation class inheriting from trait scala. ClassfileAnnotation will be stored in the generated class files. ... Additionally, on both Java and .
NET, all constructor arguments must be constant expressions What are constant expressions? 6.24 Constant Expressions Constant expressions are expressions that the Scala compiler can evaluate to a constant. The definition of “constant expression†depends on the platform, but they include at least the expressions of the following forms: A literal of a value class, such as an integer A string literal A class constructed with Predef.
ClassOf (§12.4) An element of an enumeration from the underlying platform A literal array, of the form Array(c1, . . .
, cn), where all of the ci ’s are themselves constant expressions An identifier defined by a constant value definition (§4.1) You should also be able to refactor the argument to a final val This doesn't seem to work for Arrays, however. I'll raise a bug class T(value: Any) extends ClassfileAnnotation object Holder { final val as = Array(1, 2, 3) final val a = 1 } @T(Holder. A) @T(Holder.As) // annot.
Scala:9: error: annotation argument needs to be a constant; found: Holder. As class Target.
I'll add a few snippets from the spec to explain why Rex's solution works. For Scala on the JVM, arguments to annotations that will be retained within the generated class must be constant expressions: Instances of an annotation class inheriting from trait scala. ClassfileAnnotation will be stored in the generated class files.... Additionally, on both Java and .
NET, all constructor arguments must be constant expressions. What are constant expressions? 6.24 Constant Expressions Constant expressions are expressions that the Scala compiler can evaluate to a constant.
The definition of “constant expression� Depends on the platform, but they include at least the expressions of the following forms: A literal of a value class, such as an integer A string literal A class constructed with Predef. ClassOf (§12.4) An element of an enumeration from the underlying platform A literal array, of the form Array(c1, .. .
, cn), where all of the ci ’s are themselves constant expressions An identifier defined by a constant value definition (§4.1). You should also be able to refactor the argument to a final val. This doesn't seem to work for Arrays, however.
I'll raise a bug. Class T(value: Any) extends ClassfileAnnotation object Holder { final val as = Array(1, 2, 3) final val a = 1 } @T(Holder. A) @T(Holder.
As) // annot. Scala:9: error: annotation argument needs to be a constant; found: Holder.As class Target.
Doesn't work for me: @BeanProperty @Id @GeneratedValue(strategy=Array(GenerationType. IDENTITY)) var id: Long = _ gives error: found array constant, expected argument of type javax.persistence. GenerationType – Hendy Irawan Apr 13 at 18:11 1 The annotation parameter strategy only accepts a single value, as suggested by the compiler error.Download.oracle.Com/javaee/5/api/javax/persistence/… strategy=GenerationType.
IDENTITY ought to do the trick. – retronym Apr 13 at 20:57.
From Rex Kerr: @OneToMany(mappedBy="passport_id", cascade=Array(CascadeType. PERSIST)) This worked. Thanks.
ClassfileAnnotation will be stored in the generated class files. ... Additionally, on both Java and . NET, all constructor arguments must be constant expressions.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.