Our reference guide has a mix and match of code snippets and actual code that's imported in the reference documentation. To make sure code snippet stays accurate in case of an API change, we'd like to make sure they all move to actual code that's compiled prior to reference doc generation.

This is also a prerequisite for adding a Kotlin variant alongside the Java examples we have at the moment.

Comment From: snicoll

Gah. We already have an issue for this. Sorry for the noise.

Duplicate of #6313