Apex WTF #01

Illia Leshchuk
Mar 25, 2022

What would you expect from the following apex statement System.debug(NonExistingOuterClass.class) — an InvalidType exception, right? And that what you will get. However, what will you get for the System.debug(ExistingOuterClass.NonExistingInnerClass.class)? Frankly speaking I would expect it not to compile, but you’ll get a successful execution with ExistingOuterClass in response. WTF Apex?

--

--