Skip to main content
xenoveritas.org

Main navigation

  • Categories
  • Home
  • Links
  • Name Generator
  • Scramble
User account menu
  • Log in

Breadcrumb

  1. Home

Java Annotations

By Xenoveritas, 25 August, 2008
Topics
Java
  • Add new comment

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?

Current Games

I'm currently playing:

  • Final Fantasy XIV: Endwalker

I intend to maybe get around to finishing:

  • Literally anything else

Video Games Section

Thought for the Moment

I never have thoughts any more.

Old Thoughts

Has the LHC Destroyed the Earth?

  • Create new account
  • Reset your password
RSS feed
Powered by Drupal