I think it is a bug in Android Studio. As we know, Android Studio is based on the IntelliJ Platform and the existing functionality of IntelliJ IDEA Community Edition.
Google has developed it in cooperation with JetBrains. And same bug is reported to happen in IntelliJ as well.
Have a look at the Error report
The only workaround to this issue is to cast the instance you call getClass() on, to Object as follows:
((Object) this).getClass()