Matt RaibleMatt Raible is a Java Champion and Developer Advocate at Okta. developer.okta.com

The JHipster Mini-Book The JHipster Mini-Book is a guide to getting started with hip technologies today: Angular, Bootstrap, and Spring Boot. All of these frameworks are wrapped up in an easy-to-use project called JHipster.

This book shows you how to build an app with JHipster, and guides you through the plethora of tools, techniques and options you can use. Furthermore, it explains the UI and API building blocks so you understand the underpinnings of your great application.

For book updates, follow @jhipster-book on Twitter.

10+ YEARS


Over 10 years ago, I wrote my first blog post. Since then, I've authored books, had kids, traveled the world, found Trish and blogged about it all.

[JavaOne] Experiences with the 1.5 Language Features

This is the last session I plan on attending today, and it's titled "Experiences with the 1.5 Language Features: Tips and Techniques" by Tim Hanson and Jess Garms of BEA. Tonight looks to be a good time with the JBoss Party, Java Blogger Meetup (@ Thirsty Bear), the Pavilion Party. Times for the events are 5-9, 6-8 and 6:30-8. This conference is definitely packed, and I expect the parties to be the same. In other words, the best part of this shindig is yet to begin. ;-)

This talk is about how to make effective use of the new 1.5 Language Features in your applications.

For Each Loop: Initialization expression is evaluated once (unlike former). Major limitation of using the new for each loop is you don't have access to the index or the iterator.

Annotations: Built-in annotations - i.e. @SuppressWarnings("deprecation"). Possible values: all, deprecation, unchecked, fallthrough, path, serial, finally. This annotation is not supported in the latest version of Java 5, it is supported in Mustang and Eclipse 3.1. @Deprecated is another built-in annotations. If you use this tag, you should use the @deprecated javadoc tag as well. Last one is @Override, which is used to indicate that a method declaration is intended to override a method declaration in a superclass. If the superclass signature changes, this annotation will make sure you change it in child classes.

Annotations are especially useful for frameworks (i.e. EJBs, Web Services, etc.). Not a preprocessor, not a silver bullet.

Enums: Better than static final int. Type-safe. Utility classes: java.util.EnumMap and EnumSet. Public static final int-like behavior: Comparable, statically importable (even as an inner class).

Varargs: Special syntax for cleaning up code. Allows you to use "String... args" instead of a whole slew of methods that take multiple arguments. Use them sparingly - avoid code that casts.

Covariant Returns: Replaces three anti-patterns.

Using Generics: Example from Collections - static List Collections.singletonList(T o). There is a two-pass inferencing process to determine what T is. Other Generified classes: Class (public T newInstance()), Comparable (public int compareTo(T o)), Enum> (public Class getDeclaringClass()). You can also use wildcards with generics, which has a syntax of List instead of List. This allows you to specify subtypes, and not be tied to a strictly typed solution. Wildcards are great to use in APIs and to hide implementations from users.

I give up - this guy has been going on about Generics for far too long. Time to go hunt down some parties.

Posted in JavaOne at Jun 27 2005, 06:20:51 PM MDT 1 Comment
Comments:

So @SuppressWarnings doesn't work in tiger? That'd explain the problems I've been having with it. Who thought it'd be a good idea to put in an annotation that isn't used?

Posted by Justin Lee on June 28, 2005 at 12:38 PM MDT #

Post a Comment:
  • HTML Syntax: Allowed