title: Android - Kotlin - object must be declared abstract or implement abstract member
body: <p>I have set an ItemClickLister for my RecyclerView like this:</p>
  
  <pre><code>ItemClickSupport.addTo(recyclerView!!).setOnItemClickListener(
                      object : ItemClickSupport.OnItemClickListener {
                          override fun onItemClicked(recyclerView: RecyclerView?, position: Int, v: View?) {
                              val row = recyclerView!!.getChildAt(position)
                              val el = row.findViewById(R.id.active_expandablelayout) as ExpandableLayout
  
                              if (el.isExpanded) {
                                  el.collapse()
                              } else {
                                  el.expand()
                              }
                          }
                      }
              )
  </code></pre>
  
  <p>using the ItemClickSupport library which I translated into Kotlin.</p>
  
  <p>I get an error on <code>object</code> (line 2) that says:</p>
  
  <blockquote>
    <p>object must be declared abstract or implement abstract member.</p>
  </blockquote>
  
  <p>I'm really new to Kotlin and I couldn't find any solution here on SO either.</p>
  
  <p>Any help is greatly appreciated.</p>
  
  <p>Edit:</p>
  
  <p>Here is my <code>ItemClickSupport.kt</code>:</p>
  
  <pre><code>class ItemClickSupport private constructor(private val mRecyclerView: RecyclerView) {
      private var mOnItemClickListener: OnItemClickListener? = null
      private var mOnItemLongClickListener: OnItemLongClickListener? = null
      private val mOnClickListener = View.OnClickListener { v -&gt;
          if (mOnItemClickListener != null) {
              val holder = mRecyclerView.getChildViewHolder(v)
              mOnItemClickListener!!.onItemClicked(mRecyclerView, holder.adapterPosition, v)
          }
      }
      private val mOnLongClickListener = View.OnLongClickListener { v -&gt;
          if (mOnItemLongClickListener != null) {
              val holder = mRecyclerView.getChildViewHolder(v)
              return@OnLongClickListener mOnItemLongClickListener!!.onItemLongClicked(mRecyclerView, holder.adapterPosition, v)
          }
          false
      }
      private val mAttachListener = object : RecyclerView.OnChildAttachStateChangeListener {
          override fun onChildViewAttachedToWindow(view: View) {
              if (mOnItemClickListener != null) {
                  view.setOnClickListener(mOnClickListener)
              }
              if (mOnItemLongClickListener != null) {
                  view.setOnLongClickListener(mOnLongClickListener)
              }
          }
  
          override fun onChildViewDetachedFromWindow(view: View) {
  
          }
      }
  
      init {
          mRecyclerView.setTag(R.id.item_click_support, this)
          mRecyclerView.addOnChildAttachStateChangeListener(mAttachListener)
      }
  
      fun setOnItemClickListener(listener: OnItemClickListener): ItemClickSupport {
          mOnItemClickListener = listener
          return this
      }
  
      fun setOnItemLongClickListener(listener: OnItemLongClickListener): ItemClickSupport {
          mOnItemLongClickListener = listener
          return this
      }
  
      private fun detach(view: RecyclerView) {
          view.removeOnChildAttachStateChangeListener(mAttachListener)
          view.setTag(R.id.item_click_support, null)
      }
  
      interface OnItemClickListener {
  
          fun onItemClicked(recyclerView: RecyclerView, position: Int, v: View)
      }
  
      interface OnItemLongClickListener {
  
          fun onItemLongClicked(recyclerView: RecyclerView, position: Int, v: View): Boolean
      }
  
      companion object {
  
          fun addTo(view: RecyclerView): ItemClickSupport {
              var support: ItemClickSupport? = view.getTag(R.id.item_click_support) as ItemClickSupport
              if (support == null) {
                  support = ItemClickSupport(view)
              }
              return support
          }
  
          fun removeFrom(view: RecyclerView): ItemClickSupport {
              val support = view.getTag(R.id.item_click_support) as ItemClickSupport
              support?.detach(view)
              return support
          }
      }
  }
  </code></pre>
  
  <p>This is a screenshot with the whole error and where it happens:</p>
  
  <p><a href="https://i.stack.imgur.com/6oAtB.png" rel="noreferrer"><img src="https://i.stack.imgur.com/6oAtB.png" alt="screenshot"></a></p>