Because the type system must resolve user-defined types defined
locally or in other classes, the
Apex parser evaluates types as follows:
- For a type reference TypeN, the parser first looks up that type as a scalar type.
- If TypeN is not found,
the parser looks up locally defined types.
- If TypeN still is not
found, the parser looks up a class of that name.
- If TypeN still is not
found, the parser looks up system types such as sObjects.
For the type T1.T2 this
could mean an inner type T2 in a top-level class T1, or it could mean a top-level class T2 in the namespace T1 (in that order of precedence).