Remove Android api diagnostic error on Kotlin interface default methods
They don't require java 8 or any other special support to work on Android #KT-18059 Fixed
This commit is contained in:
+7
@@ -476,4 +476,11 @@ fun testJava8() {
|
||||
|
||||
// Ok, Kotlin
|
||||
mapOf(1 to 2).forEach { (key, value) -> key + value }
|
||||
}
|
||||
|
||||
interface WithDefault {
|
||||
// Should be ok
|
||||
fun methodWithBody() {
|
||||
return
|
||||
}
|
||||
}
|
||||
@@ -982,24 +982,6 @@ public class ApiDetector extends ResourceXmlDetector
|
||||
mContext.report(UNSUPPORTED, location, message);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean visitMethod(@NotNull UMethod method) {
|
||||
// API check for default methods
|
||||
if (method.getModifierList().hasExplicitModifier(PsiModifier.DEFAULT)) {
|
||||
int api = 24; // minSdk for default methods
|
||||
int minSdk = getMinSdk(mContext);
|
||||
|
||||
if (!isSuppressed(api, method, minSdk, mContext, UNSUPPORTED)) {
|
||||
Location location = mContext.getLocation(method);
|
||||
String message = String.format("Default method requires API level %1$d "
|
||||
+ "(current min is %2$d)", api, minSdk);
|
||||
mContext.reportUast(UNSUPPORTED, method, location, message);
|
||||
}
|
||||
}
|
||||
|
||||
return super.visitMethod(method);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean visitClass(@NotNull UClass aClass) {
|
||||
// Check for repeatable annotations
|
||||
|
||||
Reference in New Issue
Block a user