Terminology update: primitive objects
daniel.smith at oracle.com
Mon Oct 5 19:18:40 UTC 2020
We've been struggling with some uncomfortable rough edges of the "inline class"/"inline type" terminology for awhile. After multiple rounds of bikeshedding, here's an alternative that the Oracle team feels pretty good about:
- A *primitive object* is a new kind of object that lacks identity. It has special behavior with respect to equality, synchronization, and related operations. *Identity object* describes all other objects (including arrays). (The new objects are "primitive" in the sense that they are lighter-weight and represent simple, immutable values.)
- A *primitive class* (formerly *inline class*) is a special class whose instances are primitive objects. Primitive classes are always concrete and final, and their declarations are subject to various restrictions. A class that is not primitive is either an *identity class* or an *abstract class* (or Object, if we don't end up making it abstract).
- A *primitive value type* (formerly *inline type*) is a type whose values are primitive objects—the objects themselves, not *references* to the objects. Each primitive class has a primitive value type, typically denoted by the class name.
- A *primitive reference type* is a type whose values are references to primitive objects, or null. Each primitive class has a primitive reference type, typically denoted as ClassName.ref.
- The general term *primitive type* refers to either a primitive value type or a primitive reference type. The general term *reference type* continues to mean a type whose values are reference to objects (of unspecified kind), or null.
- In the Java language, the existing primitive values will become primitive objects, with java.lang.Integer, etc., acting as their primitive classes. When needed, *built-in primitive value type*, etc., can be used to refer to their types. In the JVM, something like *primitive object type* might be appropriate to distinguish between primitive objects and the built-in numerics.
The type terminology leans on intuitions about "pass by value" and "pass by reference". Some languages pass *variables* by value or reference, but in Java the, er, primitive, is passing *objects* by value or by reference. Similar properties apply in both contexts.
This is a brief sketch, just enough to define the terms. Future documents, including project overviews, JEPs, and specs, will illustrate use of the terms in the broader context of the language and VM.
More information about the valhalla-spec-experts