Scala Programming Language
  1. Scala Programming Language
  2. SI-6175

reflectMethod crashes for List.removeDuplicates

    Details

      Description

      object Test extends App {
        import reflect.runtime._
        val m = universe.typeOf[List[_]].members.head.asMethod
        // doesn't work
        // currentMirror.reflect (List (2, 3, 1)).reflectMethod(m)
        // works if called twice
        try { currentMirror.reflect (List (2, 3, 1)).reflectMethod(m) } catch { case _ => ; }
        currentMirror.reflect (List (2, 3, 1)).reflectMethod(m)
      }
      
      java.lang.AssertionError: assertion failed: List(object ::, object ::)
              at scala.Predef$.assert(Predef.scala:170)
              at scala.reflect.internal.Symbols$Symbol.suchThat(Symbols.scala:1525)
              at scala.reflect.internal.Symbols$ClassSymbol.companionModule0(Symbols.scala:2815)
              at scala.reflect.internal.Symbols$ClassSymbol.companionModule(Symbols.scala:2818)
              at scala.reflect.runtime.JavaMirrors$JavaMirror.followStatic(JavaMirrors.scala:546)
              at scala.reflect.runtime.JavaMirrors$JavaMirror.sOwner(JavaMirrors.scala:620)
              at scala.reflect.runtime.JavaMirrors$JavaMirror.scala$reflect$runtime$JavaMirrors$JavaMirror$$jfieldAsScala1(JavaMirrors.scala:890)
              at scala.reflect.runtime.JavaMirrors$JavaMirror$$anonfun$scala$reflect$runtime$JavaMirrors$JavaMirror$$jfieldAsScala$1.apply(JavaMirrors.scala:887)
              at scala.reflect.runtime.JavaMirrors$JavaMirror$$anonfun$scala$reflect$runtime$JavaMirrors$JavaMirror$$jfieldAsScala$1.apply(JavaMirrors.scala:887)
              at scala.reflect.runtime.JavaMirrors$JavaMirror$$anonfun$toScala$1.apply(JavaMirrors.scala:100)
              at scala.reflect.runtime.TwoWayCache.toScala(TwoWayCache.scala:38)
              at scala.reflect.runtime.JavaMirrors$JavaMirror.toScala(JavaMirrors.scala:98)
              at scala.reflect.runtime.JavaMirrors$JavaMirror.scala$reflect$runtime$JavaMirrors$JavaMirror$$jfieldAsScala(JavaMirrors.scala:887)
              at scala.reflect.runtime.JavaMirrors$JavaMirror$FromJavaClassCompleter$$anonfun$3$$anonfun$apply$mcV$sp$1.apply(JavaMirrors.scala:515)
              at scala.reflect.runtime.JavaMirrors$JavaMirror$FromJavaClassCompleter$$anonfun$3$$anonfun$apply$mcV$sp$1.apply(JavaMirrors.scala:514)
              at scala.collection.IndexedSeqOptimized$class.foreach(IndexedSeqOptimized.scala:34)
              at scala.collection.mutable.ArrayOps.foreach(ArrayOps.scala:39)
              at scala.reflect.runtime.JavaMirrors$JavaMirror$FromJavaClassCompleter$$anonfun$3.apply$mcV$sp(JavaMirrors.scala:514)
              at scala.reflect.runtime.JavaMirrors$JavaMirror$FromJavaClassCompleter.completeRest(JavaMirrors.scala:529)
              at scala.reflect.runtime.JavaMirrors$JavaMirror$FromJavaClassCompleter.complete(JavaMirrors.scala:486)
              at scala.reflect.internal.Symbols$Symbol.info(Symbols.scala:1143)
              at scala.reflect.runtime.JavaMirrors$JavaMirror.scala$reflect$runtime$JavaMirrors$JavaMirror$$checkMemberOf(JavaMirrors.scala:156)
              at scala.reflect.runtime.JavaMirrors$JavaMirror$JavaInstanceMirror.reflectMethod(JavaMirrors.scala:177)
              at scala.reflect.runtime.JavaMirrors$JavaMirror$JavaInstanceMirror.reflectMethod(JavaMirrors.scala:158)
              at Test$delayedInit$body.apply(Test.scala:4)
              at scala.Function0$class.apply$mcV$sp(Function0.scala:40)
              at scala.runtime.AbstractFunction0.apply$mcV$sp(AbstractFunction0.scala:12)
              at scala.App$$anonfun$main$1.apply(App.scala:61)
              at scala.App$$anonfun$main$1.apply(App.scala:61)
              at scala.collection.LinearSeqOptimized$class.foreach(LinearSeqOptimized.scala:59)
              at scala.collection.immutable.List.foreach(List.scala:78)
              at scala.collection.generic.TraversableForwarder$class.foreach(TraversableForwarder.scala:32)
              at scala.collection.mutable.ListBuffer.foreach(ListBuffer.scala:45)
              at scala.App$class.main(App.scala:61)
              at Test$.main(Test.scala:1)
              at Test.main(Test.scala)
              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
              at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
              at java.lang.reflect.Method.invoke(Method.java:597)
              at scala.tools.nsc.util.ScalaClassLoader$$anonfun$run$1.apply(ScalaClassLoader.scala:71)
              at scala.tools.nsc.util.ScalaClassLoader$class.asContext(ScalaClassLoader.scala:31)
              at scala.tools.nsc.util.ScalaClassLoader$URLClassLoader.asContext(ScalaClassLoader.scala:139)
              at scala.tools.nsc.util.ScalaClassLoader$class.run(ScalaClassLoader.scala:71)
              at scala.tools.nsc.util.ScalaClassLoader$URLClassLoader.run(ScalaClassLoader.scala:139)
              at scala.tools.nsc.CommonRunner$class.run(ObjectRunner.scala:28)
              at scala.tools.nsc.ObjectRunner$.run(ObjectRunner.scala:45)
              at scala.tools.nsc.CommonRunner$class.runAndCatch(ObjectRunner.scala:35)
              at scala.tools.nsc.ObjectRunner$.runAndCatch(ObjectRunner.scala:45)
              at scala.tools.nsc.MainGenericRunner.runTarget$1(MainGenericRunner.scala:70)
              at scala.tools.nsc.MainGenericRunner.process(MainGenericRunner.scala:92)
              at scala.tools.nsc.MainGenericRunner$.main(MainGenericRunner.scala:101)
              at scala.tools.nsc.MainGenericRunner.main(MainGenericRunner.scala)
      

        Activity

        Show
        Eugene Burmako added a comment - Discussion: http://groups.google.com/group/scala-internals/browse_thread/thread/10855403bbf04298
        Show
        Eugene Burmako added a comment - https://github.com/scala/scala/commit/ce4bcb536279d97617f85da3f66b5296c6ee2b96

          People

          • Assignee:
            Eugene Burmako
            Reporter:
            Eugene Burmako
          • Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development