Java 1.5 == 5.0 ==Tiger is loose (Sun releases J2SE 5.0)

0

All the news etc. starts here: J2SE 5.0 Home

For new features see here (new features). and here (release notes). Then there is the article: Java 5.0 in a Nutshell.

For download, go here.

The J2SE 5.0 release is focused along certain key themes:

* Ease of Development
* Scalability and Performance
* Monitoring and Manageability
* Desktop Client

How we will have to see how fast vendors will bring their IDE up to speed. For example, when will Oracle 10g JDeveloper certify against/benefit from Tiger.

I have not really dived into it, but I feel that the meta-data facilities could be very interesting.
Metadata

The metadata feature in J2SE 5.0 provides the ability to associate additional data alongside Java classes, interfaces, methods, and fields. This additional data, or annotation, can be read by the javac compiler or other tools, and depending on configuration can also be stored in the class file and can be discovered at runtime using the Java reflection API.

One of the primary reasons for adding metadata to the Java platform is to enable development and runtime tools to have a common infrastructure and so reduce the effort required for programming and deployment. A tool could use the metadata information to generate additional source code, or to provide additional information when debugging.

In beta2 we are pleased to announce the availability of an annotation processing tool called apt. Apt includes a set of new reflective APIs and supporting infrastructure to process program annotations. The apt reflective APIs provide a build-time, source-based, read-only view of program structure which cleanly models the Java programming language’s type system. First, apt runs annotation processors that can produce new source code and other files. Next, apt can cause compilation of both original and generated source files, easing development. For more information on apt refer to the apt guide.

In the following example code you can additionally create an AnnotationFactory processor for apt to generate code or documentation when finding the debug annotation tag.

import java.lang.annotation.*;
import java.lang.reflect.*;

@Retention(java.lang.annotation.RetentionPolicy.RUNTIME) @interface debug  {
    boolean  devbuild() default false;
    int counter();
}

public class MetaTest {
    final boolean production=true;

    @debug(devbuild=production,counter=1) public void testMethod()  {
    }


    public static void main(String[] args) {

        MetaTest mt = new MetaTest();
        try {
            Annotation[] a = mt.getClass().getMethod("testMethod").getAnnotations();
            for (int i=0; i<a .length ; i++)  {
                 System.out.println("a["+i+"]="+a[i]+" ");
             }
         } catch(NoSuchMethodException e) {
             System.out.println(e);
         }
     }
 }

With a metadata processing tool, many repetitive coding steps could be reduced to a concise metadata tag. For example, the remote interface required when accessing a JAX-RPC service implementation could be implemented as follows:

Before

public interface PingIF extends Remote {
      public void ping() throws RemoteException;
  }

  public class Ping implements PingIF {
     public void ping() {
     }
  }

After

public class Ping {
     public @remote void ping() {
     }
  }

Though I am not sure at this point what it all means. See this article: Annotations in Tiger, Part 1: Add metadata to Java code, How to use Java 5’s built-in by Brett McLaughlin (brett@newInstance.com). Also see Taming Tiger, Part 3 Decorate your code with Java annotations, by Tarak Modi

Share.

About Author

Lucas Jellema, active in IT (and with Oracle) since 1994. Oracle ACE Director for Fusion Middleware. Consultant, trainer and instructor on diverse areas including Oracle Database (SQL & PLSQL), Service Oriented Architecture, BPM, ADF, Java in various shapes and forms and many other things. Author of the Oracle Press book: Oracle SOA Suite 11g Handbook. Frequent presenter on conferences such as JavaOne, Oracle OpenWorld, ODTUG Kaleidoscope, Devoxx and OBUG. Presenter for Oracle University Celebrity specials.

Comments are closed.