Android: Add intention to generate View constructor convention

Fixes #KT-15150
This commit is contained in:
Kirill Rakhman
2017-01-16 23:06:55 +01:00
committed by Vyacheslav Gerasimov
parent f74c0950d2
commit ca86dbee72
14 changed files with 258 additions and 0 deletions
@@ -0,0 +1,13 @@
// "Add Android View constructors using '@JvmOverloads'" "true"
// ERROR: This type has a constructor, and thus must be initialized here
// WITH_RUNTIME
package com.myapp.activity
import android.content.Context
import android.util.AttributeSet
import android.view.TextView
class Foo @JvmOverloads constructor(
context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0
) : TextView<caret>(context, attrs, defStyleAttr)
@@ -0,0 +1,19 @@
// "Add Android View constructors using '@JvmOverloads'" "true"
// ERROR: The type has a constructor, and thus must be initialized here
package android.view
import android.util.AttributeSet
import android.content.Context
public open class View {
constructor(context: Context)
constructor(context: Context, attrs: AttributeSet?)
constructor(context: Context, attrs: AttributeSet?, defStyleAttr: Int)
}
public open class TextView : View {
constructor(context: Context) super(context)
constructor(context: Context, attrs: AttributeSet?) super(context, attrs)
constructor(context: Context, attrs: AttributeSet?, defStyleAttr: Int) super(context, attrs, defStyleAttr)
}
@@ -0,0 +1,6 @@
// "Add Android View constructors using '@JvmOverloads'" "true"
// ERROR: The type has a constructor, and thus must be initialized here
package android.content
public class Context
@@ -0,0 +1,6 @@
// "Add Android View constructors using '@JvmOverloads'" "true"
// ERROR: The type has a constructor, and thus must be initialized here
package android.util
public class AttributeSet
@@ -0,0 +1,9 @@
// "Add Android View constructors using '@JvmOverloads'" "true"
// ERROR: This type has a constructor, and thus must be initialized here
// WITH_RUNTIME
package com.myapp.activity
import android.view.TextView
class Foo : TextView<caret>
@@ -0,0 +1,13 @@
// "Add Android View constructors using '@JvmOverloads'" "true"
// ERROR: This type has a constructor, and thus must be initialized here
// WITH_RUNTIME
package com.myapp.activity
import android.content.Context
import android.util.AttributeSet
import android.view.View
class Foo @JvmOverloads constructor(
context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0
) : View<caret>(context, attrs, defStyleAttr)
@@ -0,0 +1,13 @@
// "Add Android View constructors using '@JvmOverloads'" "true"
// ERROR: The type has a constructor, and thus must be initialized here
package android.view
import android.util.AttributeSet
import android.content.Context
public open class View {
constructor(context: Context)
constructor(context: Context, attrs: AttributeSet?)
constructor(context: Context, attrs: AttributeSet?, defStyleAttr: Int)
}
@@ -0,0 +1,6 @@
// "Add Android View constructors using '@JvmOverloads'" "true"
// ERROR: The type has a constructor, and thus must be initialized here
package android.content
public class Context
@@ -0,0 +1,6 @@
// "Add Android View constructors using '@JvmOverloads'" "true"
// ERROR: The type has a constructor, and thus must be initialized here
package android.util
public class AttributeSet
@@ -0,0 +1,9 @@
// "Add Android View constructors using '@JvmOverloads'" "true"
// ERROR: This type has a constructor, and thus must be initialized here
// WITH_RUNTIME
package com.myapp.activity
import android.view.View
class Foo : View<caret>