|
Scheduled public sessions |
Java's 1.5 (Tiger) release, scheduled for beta in a few months, incorporates several significant changes to the language itself. In particular, it adds:
- Constrained types (enums)
- Generics (sort of like C++ templates) and a "generified" collection library.
- Metadata (a.k.a. "Annotations" user-defined attributes for classes, fields, and methods)
- Primitive-type boxing/unboxing
- Static imports
- A "foreach" syntax
- Variable-length argument lists (and printf functionality)
Some of these additions are good, some are not.
Some are easy to grasp, some are not.
Generics, in fact, present an entirely new way of programming in Java, and are implemented in a completely different way than C++ templates. Generics are not just "templates for Java." They are much more capable but easier to manage. They also incorporate the notion a "variance," which is entirely missing from C++.
I'll review all the proposed additions, with emphasis both on what the feature is good for, and more importantly, on how using the features incorrectly (or at all) can get you into trouble and otherwise cause havoc. We'll cover generics — by far the most involved of the new features — in depth.
Based on student interest, the class may include a BYOC (Bring Your Own Laptop) hands-on session. We'll survey you when you sign up, and will do the hand-on session if there's interest.
You Will Come Away With:
- A solid understanding of all the new additions to Java proposed for Tiger.
- A solid understanding of generics, including the proposed "variance" mechanism, and how to use them.
Outline
- Introduction
- Getting and installing the enhanced compiler
- Static imports
- Variable-length argument lists
- Generics
- Using Generics (the new Collection classes)
- Generics and UML
- Writing generic classes
- Bound and Raw types
- Variance
- Covariance
- Contravariance
- Bivariance
- Autoboxing
- Foreach
- Foreach and Generics
- Enum (constrained types)
- The existing idioms
- The new mechanism
- Metadata/Annotations
- Defining annotation classes.
- Accessing annotations via the introspection APIs.