This page is no longer maintained — Please continue to the home page at www.scala-lang.org

Annotation problem with Scala 2.8

No replies
Rodrigo Cano
Joined: 2009-03-22,
User offline. Last seen 42 years 45 weeks ago.
Hi, I have a problem trying to specify a class in the argument of an annotation.
The class is also written in java and is something like:


public class MyClass {

public static class A{}
public static class B{}
}

I want, for instance, to pass A as class to my annotation as follows:

@Annoation(clazz = classOf[MyClass.A])

But it complains that the value must be constant. And don't realise how to pass this argument, and it's critical for my application.

Thanks, cheers.

Copyright © 2012 École Polytechnique Fédérale de Lausanne (EPFL), Lausanne, Switzerland