I've seen this nice trivia in the scala mailing list. Zang was asking "how do I access a final static variable of a java class ?", such as:
public class Foo { public class Bar { public static final String MY_STRING = "myString"; } }
Som brought the answer quickly, using:
null.asInstanceOf[Foo].Bar.MY_STRING
No comments:
Post a Comment