Cleanup: fix some compiler warnings (mostly deprecations, javaClass)

This commit is contained in:
Mikhail Glukhikh
2017-02-21 17:38:43 +03:00
parent d0cc1635db
commit b121bf8802
445 changed files with 773 additions and 949 deletions
@@ -47,7 +47,7 @@ class AndroidXmlVisitor(val elementCallback: (ResourceIdentifier, String, XmlAtt
if (idAttribute != null) {
val idAttributeValue = idAttribute.value
if (idAttributeValue != null) {
val xmlType = tag?.getAttribute(AndroidConst.CLASS_ATTRIBUTE_NO_NAMESPACE)?.value ?: localName
val xmlType = tag.getAttribute(AndroidConst.CLASS_ATTRIBUTE_NO_NAMESPACE)?.value ?: localName
val name = androidIdToName(idAttributeValue)
if (name != null) elementCallback(name, xmlType, idAttribute)
}
@@ -83,7 +83,7 @@ class IDEAndroidLayoutXmlFileManager(val module: Module) : AndroidLayoutXmlFileM
val propertyName = propertyDescriptor.name.asString()
val attributes = arrayListOf<PsiElement>()
val visitor = AndroidXmlVisitor { retId, wClass, valueElement ->
val visitor = AndroidXmlVisitor { retId, _, valueElement ->
if (retId.name == propertyName) attributes.add(valueElement)
}
@@ -114,7 +114,7 @@ class IDEAndroidLayoutXmlFileManager(val module: Module) : AndroidLayoutXmlFileM
if (applicationPackage != null) {
val mainVariant = mainSourceProvider.toVariant()
val method = try { javaClass.getMethod("getFlavorSourceProviders") } catch (e: NoSuchMethodException) { null }
val method = try { this::class.java.getMethod("getFlavorSourceProviders") } catch (e: NoSuchMethodException) { null }
val variants: List<AndroidVariant>? = if (method != null) {
val sourceProviders = method.invoke(this) as List<SourceProvider>?
sourceProviders?.map { it.toVariant() } ?: listOf()