Permalink
Browse files

Change type parameter names

  • Loading branch information...
pocorall committed Aug 9, 2015
1 parent c8a3171 commit d7827cfbceb0496af191c069240c17b27901d400
@@ -19,12 +19,12 @@ class ScaloidCodeGenerator(cls: AndroidClass, companionTemplate: CompanionTempla
def richClassDef =
s"""$richClassScalaDoc
- |${deprecated}class Rich${cls.name}[V <: ${genType(cls.tpe, erased = true)}](val basis: V) extends $helperTraitName[V]
+ |${deprecated}class Rich${cls.name}[This <: ${genType(cls.tpe, erased = true)}](val basis: This) extends $helperTraitName[This]
|
|$helperTraitScalaDoc
- |${deprecated}trait $helperTraitName[V <: ${genType(cls.tpe, erased = true)}]$extendClause {
+ |${deprecated}trait $helperTraitName[This <: ${genType(cls.tpe, erased = true)}]$extendClause {
|
- | ${if (cls.parentType.isEmpty) "def basis: V" else ""}
+ | ${if (cls.parentType.isEmpty) "def basis: This" else ""}
|
| ${ companionTemplate.safeRender(cls.name + "_traitBody") }
|
@@ -39,7 +39,7 @@ class ScaloidCodeGenerator(cls: AndroidClass, companionTemplate: CompanionTempla
def helperTraitName(name: String): String = "Trait"+ StringUtils.simpleName(name)
def extendClause = {
- val parent = cls.parentType.map(p => helperTraitName(p.name) + "[V]")
+ val parent = cls.parentType.map(p => helperTraitName(p.name) + "[This]")
val mixin = companionTemplate.get(cls.name + "_mixin")
(parent :: mixin :: Nil).flatten match {
case Nil => ""
@@ -199,8 +199,8 @@ class ScaloidCodeGenerator(cls: AndroidClass, companionTemplate: CompanionTempla
def commonListener(l: AndroidListener, args: String = "") = {
val dp = if (l.isDeprecated) deprecatedDecl else ""
dp + "@inline def " + l.name + (
- if (l.retType.name == "Unit") s"[U](f: $args => U): V = {"
- else s"(f: $args => ${genType(l.retType)}): V = {"
+ if (l.retType.name == "Unit") s"[U](f: $args => U): This = {"
+ else s"(f: $args => ${genType(l.retType)}): This = {"
) + s"\n basis.${l.setter}(new ${l.callbackClassName} {"
}
@@ -47,7 +47,7 @@ import scala.concurrent.duration.Duration
import Implicits._
import scala.deprecated
-trait TraitActivity[V <: Activity] {
+trait TraitActivity[+This <: Activity] {
@inline def contentView_=(p: View) = {
basis.setContentView(p)
@@ -99,14 +99,14 @@ trait Registerable {
/**
* Automatically generated enriching class of `[[https://developer.android.com/reference/android/content/Context.html android.content.Context]]`.
*/
-class RichContext[V <: android.content.Context](val basis: V) extends TraitContext[V]
+class RichContext[This <: android.content.Context](val basis: This) extends TraitContext[This]
/**
* Automatically generated helper trait of `[[https://developer.android.com/reference/android/content/Context.html android.content.Context]]`. This contains several property accessors.
*/
-trait TraitContext[V <: android.content.Context] {
+trait TraitContext[This <: android.content.Context] {
- def basis: V
+ def basis: This
implicit val ctx = basis
@@ -275,12 +275,12 @@ trait SContext extends Context with TraitContext[SContext] with TagUtil {
/**
* Automatically generated enriching class of `[[https://developer.android.com/reference/android/content/ContextWrapper.html android.content.ContextWrapper]]`.
*/
-class RichContextWrapper[V <: android.content.ContextWrapper](val basis: V) extends TraitContextWrapper[V]
+class RichContextWrapper[This <: android.content.ContextWrapper](val basis: This) extends TraitContextWrapper[This]
/**
* Automatically generated helper trait of `[[https://developer.android.com/reference/android/content/ContextWrapper.html android.content.ContextWrapper]]`. This contains several property accessors.
*/
-trait TraitContextWrapper[V <: android.content.ContextWrapper] extends TraitContext[V] {
+trait TraitContextWrapper[This <: android.content.ContextWrapper] extends TraitContext[This] {
/**
* Shortcut for `[[https://developer.android.com/reference/android/content/ContextWrapper.html#getBaseContext() getBaseContext()]]`
@@ -177,14 +177,14 @@ object Extra {
/**
* Automatically generated enriching class of `[[https://developer.android.com/reference/android/preference/Preference.html android.preference.Preference]]`.
*/
-class RichPreference[V <: android.preference.Preference](val basis: V) extends TraitPreference[V]
+class RichPreference[This <: android.preference.Preference](val basis: This) extends TraitPreference[This]
/**
* Automatically generated helper trait of `[[https://developer.android.com/reference/android/preference/Preference.html android.preference.Preference]]`. This contains several property accessors.
*/
-trait TraitPreference[V <: android.preference.Preference] {
+trait TraitPreference[This <: android.preference.Preference] {
- def basis: V
+ def basis: This
/**
* Shortcut for `[[https://developer.android.com/reference/android/preference/Preference.html#getContext() getContext()]]`
@@ -501,28 +501,28 @@ trait TraitPreference[V <: android.preference.Preference] {
*/
@inline def widgetLayoutResource_=(p: Int) = { basis.setWidgetLayoutResource(p); basis }
- @inline def onPreferenceChange(f: (android.preference.Preference, Any) => Boolean): V = {
+ @inline def onPreferenceChange(f: (android.preference.Preference, Any) => Boolean): This = {
basis.setOnPreferenceChangeListener(new android.preference.Preference.OnPreferenceChangeListener {
def onPreferenceChange(p1: android.preference.Preference, p2: Any): Boolean = { f(p1, p2) }
})
basis
}
- @inline def onPreferenceChange(f: => Boolean): V = {
+ @inline def onPreferenceChange(f: => Boolean): This = {
basis.setOnPreferenceChangeListener(new android.preference.Preference.OnPreferenceChangeListener {
def onPreferenceChange(p1: android.preference.Preference, p2: Any): Boolean = { f }
})
basis
}
- @inline def onPreferenceClick(f: android.preference.Preference => Boolean): V = {
+ @inline def onPreferenceClick(f: android.preference.Preference => Boolean): This = {
basis.setOnPreferenceClickListener(new android.preference.Preference.OnPreferenceClickListener {
def onPreferenceClick(p: android.preference.Preference): Boolean = { f(p) }
})
basis
}
- @inline def onPreferenceClick(f: => Boolean): V = {
+ @inline def onPreferenceClick(f: => Boolean): This = {
basis.setOnPreferenceClickListener(new android.preference.Preference.OnPreferenceClickListener {
def onPreferenceClick(p: android.preference.Preference): Boolean = { f }
})
@@ -553,12 +553,12 @@ object SPreference {
/**
* Automatically generated enriching class of `[[https://developer.android.com/reference/android/preference/DialogPreference.html android.preference.DialogPreference]]`.
*/
-class RichDialogPreference[V <: android.preference.DialogPreference](val basis: V) extends TraitDialogPreference[V]
+class RichDialogPreference[This <: android.preference.DialogPreference](val basis: This) extends TraitDialogPreference[This]
/**
* Automatically generated helper trait of `[[https://developer.android.com/reference/android/preference/DialogPreference.html android.preference.DialogPreference]]`. This contains several property accessors.
*/
-trait TraitDialogPreference[V <: android.preference.DialogPreference] extends TraitPreference[V] {
+trait TraitDialogPreference[This <: android.preference.DialogPreference] extends TraitPreference[This] {
/**
* Shortcut for `[[https://developer.android.com/reference/android/preference/DialogPreference.html#getDialog() getDialog()]]`
@@ -710,12 +710,12 @@ trait TraitDialogPreference[V <: android.preference.DialogPreference] extends Tr
/**
* Automatically generated enriching class of `[[https://developer.android.com/reference/android/preference/EditTextPreference.html android.preference.EditTextPreference]]`.
*/
-class RichEditTextPreference[V <: android.preference.EditTextPreference](val basis: V) extends TraitEditTextPreference[V]
+class RichEditTextPreference[This <: android.preference.EditTextPreference](val basis: This) extends TraitEditTextPreference[This]
/**
* Automatically generated helper trait of `[[https://developer.android.com/reference/android/preference/EditTextPreference.html android.preference.EditTextPreference]]`. This contains several property accessors.
*/
-trait TraitEditTextPreference[V <: android.preference.EditTextPreference] extends TraitDialogPreference[V] {
+trait TraitEditTextPreference[This <: android.preference.EditTextPreference] extends TraitDialogPreference[This] {
/**
* Shortcut for `[[https://developer.android.com/reference/android/preference/EditTextPreference.html#getEditText() getEditText()]]`
Oops, something went wrong.

0 comments on commit d7827cf

Please sign in to comment.