I went looking for answers to some fairly basic questions (or so I thought) about Java annotations, and wound up having to go look through the actual language specification. It's never a good thing to wind up looking at the language specification for answers. I did find my answer, but the examples were a bit on the strange side.
// Array-valued single-element annotation
@Endorsers({"Children", "Unscrupulous dentists"})
public class Lollipop { ... }
Lollipops are endorsed by children and unscrupulous dentists - cute.
// Single-element array-valued single-element annotation
@Endorsers("Epicurus")
public class Pleasure { ... }
This one I had to look up, apparently Epicurus was a Greek philosopher. I'm entirely sure I'd say that he "endorsed pleasure" based on the Wikipedia article, but whatever.
// Normal annotation with default values
@RequestForEnhancement(
id = 4561414,
synopsis = "Balance the federal budget"
)
public static void balanceFederalBudget() {
throw new UnsupportedOperationException("Not implemented");
}
Haha, it's a political joke! The method is marked as a "request for enhancement" that would balance the federal budget. Sadly, it's not implemented, and invoking it would immediately throw an exception.
Not exactly what I expected in the Java language specification. An open source language, sure, but a corporate one?