The key sentence in your question is
that is recognized by the compiler
Unless you write your own compiler, you cannot make the compiler do anything. The fact that booleanValue()
works is because the Java Language Specification requires it.
If
r
is a reference of typeBoolean
, then unboxing conversion convertsr
intor.booleanValue()