Generics

The wrapper classes for the base types are present in a reduced form. Code like

  Integer intObj = new Integer(15);

translates to Bytecode

  new java/lang/Integer
  dup
  bipush 15
  invokespecial java/lang/Integer(int): void
  astore_0 [intObj]

First an Integer object is created and its constructor is called. It initializes the value to 15.
With auto boxing it's possible to simply write

  Integer intObj = 15;

This leads to

  bipush 15
  invokestatic java/lang/Integer.valueOf(int): Ljava/lang/Integer;
  astore_0 [intObj]

In this case the static method valueOf is called, which also creates an Integer object. Indeed, in the class Integer of the standard library for all small Integer values objects are preallocated and a simple reference to one of this is returned. A call to valueOf for small values is therefore very efficient. In our implementation of the runtime system we omit this cache.