Discussions

News: Reflection on Tiger: Changes in the Reflection API in JDK 1.5

  1. Michael Nascimento Santos discusses the changes made to the Reflection API in J2SE 1.5 (Tiger). Michael walks through the various changes in the API to do with JSR-175 metadata, working with Generics, and changes to the "Old" API.

    Summary

    "Much has been written about the new language features in J2SE 1.5, Tiger. Many, such as the introduction of enums, generics, and metadata, involve changing bytecode. These additions to the language require modifications to existing APIs. One of the APIs most radically affected by these changes is the Reflection API. Reflection has existed since JDK 1.1, and many frameworks, libraries, and utilities have been built upon it. This article examines the modifications to the Reflection API that are now available to the public as part of JDK 1.5 beta 1, and shows how you can take advantage of them in your code."

    Read Reflection on Tiger
  2. It is a good article but the jsr175 spec should be read first http://jcp.org/aboutJava/communityprocess/review/jsr175/index.html, honestly I’ve never seen anything more complicated then this “metadata”, it includes interface, inheritance and some weird syntax that is even hard to read. BTW, is this necessary to deploy the Annotation interface and Impl when shipping the application?
    Any way it might be useful for IDE and other tools such as Rational for example but it is hard to accept as substitution for XDoclet because of its complexity. May be some additional homework needs to be done, but I’m depressed in a meantime.
  3. I’ve never seen anything more complicated then this “metadata”


    I don't find it complicated at all. It is prety simple, if you read the spec. Syntax is somewhat strange, but believe me, if someone is introduced to Java without C/C++ background he/she will find Java syntax strange at the first sight (with all these { } && || ).

    The only problem with JSR 175 is that annotation definition must be present at compile and execution time.

    Mileta
  4. Depressed is an understatement. I think the developers of this
    new "metadata" hybrid API. Is just plain ugly and overly complex.
    You can call them "Annotations" I call them cumbersom and awkward.
    Unfortunately, what we are seeing is C++ creep into the core of the
    language semantics.