- Companion
- object
Value members
Concrete methods
The below representation for constructor invocations and object creations was chosen for
the sake of consistency with the Java frontend. It follows the bytecode approach of
splitting a constructor call into separate alloc
and init
calls.
The below representation for constructor invocations and object creations was chosen for
the sake of consistency with the Java frontend. It follows the bytecode approach of
splitting a constructor call into separate alloc
and init
calls.
There are two cases to consider. The first is a constructor invocation in an assignment, for example:
Foo f = new Foo(42);
is represented as
Foo f =
The second case is a constructor invocation not in an assignment, for example as an argument to a method call. In this case, the representation does not stay as close to Java as in case
- In particular, a new BLOCK is introduced to contain the constructor invocation. For example:
foo(new Foo(42));
is represented as
foo({ Foo temp = alloc(); temp.init(42); temp })
This is not valid Java code, but this representation is a decent compromise between staying faithful to Java and being consistent with the Java bytecode frontend.