title: custom type conversion from string to some object
body: <p>I want to add conversion to class <code>String</code> for object with type <code>Example</code>.</p>
  
  <p>When I do like this</p>
  
  <pre><code>class Example {
      def x = 5
  }
  
  class ExampleConversionCategory {
      static def support = String.&amp;asType
      static Object asType(String self, Class cls) {
          if (cls == Example.class) {
              "convert"
          } else { support(cls) } // argument type mismatch
      }
  }
  
  String.mixin(ExampleConversionCategory)
  
  def x = "5" as int
  println x
  </code></pre>
  
  <p>I get exception </p>
  
  <pre><code>java.lang.IllegalArgumentException: argument type mismatch
  </code></pre>
  
  <p>What is the problem? <code>cls</code> has <code>Class</code> type.</p>