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
@@ -86,7 +86,7 @@ class ClasspathBasedKapt3Extension(
if (processors.isEmpty()) {
logger.info("No annotation processors available, aborting")
} else {
logger.info { "Annotation processors: " + processors.joinToString { it.javaClass.canonicalName } }
logger.info { "Annotation processors: " + processors.joinToString { it::class.java.canonicalName } }
}
return processors
@@ -79,7 +79,7 @@ class KaptJavaFileObject(
override fun equals(other: Any?): Boolean {
if (this === other) return true
if (other?.javaClass != javaClass) return false
if (other == null || other::class.java != this::class.java) return false
other as KaptJavaFileObject
@@ -632,7 +632,7 @@ class ClassFileToSourceStubConverter(
is Type -> treeMaker.Select(treeMaker.Type(value), treeMaker.name("class"))
is AnnotationNode -> convertAnnotation(value, packageFqName = null, filtered = false)!!
else -> throw IllegalArgumentException("Illegal literal expression value: $value (${value.javaClass.canonicalName})")
else -> throw IllegalArgumentException("Illegal literal expression value: $value (${value::class.java.canonicalName})")
}
}
@@ -70,7 +70,7 @@ abstract class AbstractKotlinKapt3IntegrationTest : CodegenTestCase() {
name: String,
vararg supportedAnnotations: String,
options: Map<String, String> = emptyMap()
) = testAP(false, name, options, { set, roundEnv, env -> fail("Should not run") }, *supportedAnnotations)
) = testAP(false, name, options, { _, _, _ -> fail("Should not run") }, *supportedAnnotations)
protected fun testAP(
shouldRun: Boolean,
@@ -26,7 +26,7 @@ import javax.lang.model.element.ExecutableElement
class KotlinKapt3IntegrationTests : AbstractKotlinKapt3IntegrationTest() {
@Test
fun testSimple() = test("Simple", "test.MyAnnotation") { set, roundEnv, env ->
fun testSimple() = test("Simple", "test.MyAnnotation") { set, roundEnv, _ ->
assertEquals(1, set.size)
val annotatedElements = roundEnv.getElementsAnnotatedWith(set.single())
assertEquals(1, annotatedElements.size)
@@ -63,7 +63,7 @@ class KotlinKapt3IntegrationTests : AbstractKotlinKapt3IntegrationTest() {
}
private fun bindingsTest(name: String, test: (File, File, Map<String, KaptJavaFileObject>) -> Unit) {
test(name, "test.MyAnnotation") { set, roundEnv, env ->
test(name, "test.MyAnnotation") { _, _, _ ->
val kaptExtension = AnalysisHandlerExtension.getInstances(myEnvironment.project).firstIsInstance<Kapt3ExtensionForTests>()
val stubsOutputDir = kaptExtension.stubsOutputDir
@@ -79,14 +79,14 @@ class KotlinKapt3IntegrationTests : AbstractKotlinKapt3IntegrationTest() {
fun testOptions() = test(
"Simple", "test.MyAnnotation",
options = mapOf("firstKey" to "firstValue", "secondKey" to "")
) { set, roundEnv, env ->
) { _, _, env ->
val options = env.options
assertEquals("firstValue", options["firstKey"])
assertTrue("secondKey" in options)
}
@Test
fun testOverloads() = test("Overloads", "test.MyAnnotation") { set, roundEnv, env ->
fun testOverloads() = test("Overloads", "test.MyAnnotation") { set, roundEnv, _ ->
assertEquals(1, set.size)
val annotatedElements = roundEnv.getElementsAnnotatedWith(set.single())
assertEquals(1, annotatedElements.size)