Chapter 4. Autoboxing and Unboxing
Prev |  | Next

## Chapter 4. Autoboxing and Unboxing

## Autoboxing and Unboxing in Java 5

Java 5 (and hence AspectJ 1.5) supports automatic conversion of primitive types (int, float, double etc.) to their object equivalents (Integer, Float, Double,...) in assignments and method and constructor invocations. This conversion is know as autoboxing.

Java 5 also supports automatic unboxing, where wrapper types are automatically converted into their primitive equivalents if needed for assignments or method or constructor invocations.

For example:

    		int i = 0;
    		i = new Integer(5); // auto-unboxing

    		Integer i2 = 5;  // autoboxing

Prev | Home | Next
Generics in AspectJ 5 | Up | Autoboxing and Join Point matching in AspectJ 5