The following code used to compile fine:
optional.orElseThrow(() -> new RuntimeException("Could not create stuff"))
After upgrading to Android Gradle plugin 4.1 it no longer compiles me in android studio:
I followed the answer here:
optional.<RuntimeException>orElseThrow(() -> new RuntimeException("Could not create stuff"))
but still it does not help me.
The build.gradle compiler options are:
compileSdkVersion 29
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
What can be done to solve the issue?
Update: The problem only happens when orElseThrow is in a constructor.