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:
Vyacheslav Gerasimov
2017-05-24 19:15:15 +03:00
parent 286f82a5c5
commit ca124d1e36
2 changed files with 7 additions and 18 deletions
+7
View File
@@ -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