Skip to main content

Reflections in Tiger

Posted by daniel on March 8, 2004 at 5:06 AM PST

There's been a lot of attention for Tiger's support for Generics, metadata, and other changes to the Java language. Other changes include a reworked Reflections API.

Take a look at the additions to the Reflections API in today's Featured articles . Michael Nascimento Santos begins Reflection on Tiger with a look at what's been added to java.lang.reflect to work with metadata. The isAnnotationPresent() and getAnnotations() methods can be used to discover and retrieve metadata.

Many of the changes to the Reflection APIs are the result of the addition of generics to the language. You will find nine new classes and interfaces: Type, TypeVariable, GenericDeclaration,
ParametrizedType, GenericArrayType, WildcardType, MalformedParametrizedTypeException, GenericSignatureFormatError, and TypeNotPresentException. Michael provides an introductory example of using some of these new entities to reflect on code that uses generics.

In addition to these new classes and interfaces, some of the existing classes had to be retrofitted to reflect on some of the other new language features. The isSynthetic() method indicates if a member was introduced by the compiler. Several methods have been changed to support varargs including getConstructor() and getMethod().

Also in Java Today
, Bruce Perry adds two more tips in Cooking with Java Servlets & JSP, Part 2 . In this second set of excerpts from his book "Java Servlets & JSP Cookbook", he covers Accessing an EJB Using the WebLogic JNDI Tree and Getting Set Up with Amazon's Web Services API.

In his discussion of C++ vs. Java: Mutability , Manish Jethani writes that "one of C++'s features that I haven't yet learnt to live without in Java is the ability to have const references to objects, rendering the objects immutable through those references. In Java, either all instances of a class are immutable (e.g. java.lang.String), or none of them are immutable. Mutability of an object is determined by the design of its class and is in no way influenced by the way it is being referenced in the system. So all String objects in Java are immutable, whereas all ArrayLists are mutable."

There's another cool blog entry from Crazy Bob in today's
Weblogs . In his post Patch Leaky Connections with AOP , Bob Lee follows up on thread from TheServerSide on compensating for broken JDBC drivers and connection pools that leak resources. Bob notes that the code needed to close these ResultSets is a cross-cutting concern that can be addressed in using Aspect Oriented Programming. Compare his two versions of the code and let him know what you think.

In today's Projects and Communities , check out the latest Java Desktop community Tip of the Week, Jim Graham advises that "Areas aren't ordinary shapes" and you shouldn't "expect an Area to look or act the same as the Shape it's created from".

The JPCSI project in the JDDAC community is working to "Design and specify a java based management interface to an IEEE 1588 compliant clock [to] be used by those building applications managing 1588 clocks."

In today's News Headlines

Registered users can submit news items for the href=""> News Page using
our news submission
. All submissions go through an editorial review by news director
Steve Mallet before being posted to the site. You can also subscribe to
News RSS feed

Current and upcoming
Java Events

Registered users can submit event listings for the href=""> Events Page using our href=""> events submission
form. All submissions go through an editorial review before being
posted to the site.

Archives and Subscriptions: This blog is delivered weekdays as the
Today RSS feed
. All members can subscribe to the email
updates for the site at the href="">
java-net Mailing Lists page. You must be logged in to subscribe
the javanet_Daily and javanet_Weekly lists. Also, once this page
is no longer featured as the front page of
it will be archived along with other past issues in the href=""> Archive.