score:1
Accepted answer
the reason is pretty simple. universe
has an implicit method named methodsymboltag
(mixed in from the symbols
trait) defined like this:
implicit val methodsymboltag: classtag[universe.methodsymbol]
the presence of a classtag[universe.methodsymbol]
in scope allows the compiler to curcimvent erasure.
you can verify this by adding this import in your second code snippet:
import ru.methodsymboltag
Source: stackoverflow.com
Related Query
- Scala Reflection - MethodSymbol erasure warning unless importing universe._
- Scala Type Erasure warning in Play Framework Application
- Scala warning erasure in case
- Scala reflection to get List field value by universe apply
- Scala how to fix type erasure warning even though I added ClassTag
- Erasure elimination in scala : non-variable type argument is unchecked since it is eliminated by erasure
- Importing spark.implicits._ in scala
- permanently hidden warning in scala application
- Why won't the Scala compiler apply tail call optimization unless a method is final?
- What reflection capabilities can we expect from Scala 2.10?
- Get companion object instance with new Scala reflection API
- How to suppress "match is not exhaustive!" warning in Scala
- Finding type parameters via reflection in Scala 2.10?
- Is there a tutorial on Scala 2.10's reflection API yet?
- "Dynamic" method invocation with new Scala reflection API
- Why scala uses reflection to call method on structural type?
- Warning about reflective access of structural type member in Scala
- Warning about an unchecked type argument in this Scala pattern match?
- Reflection on a Scala case class
- How to use scala reflection API to get all contained classes
- Scala reflection to access all public fields at runtime
- Reflection API for Scala
- Scala 2.10 and package reflection
- Problems Importing Scala Libraries In Intellij
- Is there a way to get a warning when a Scala Value Class needs to become instantiated?
- SBT Scala Version Warning
- Why does Scala warn about type erasure in the first case but not the second?
- Why this erasure warning with member variables declared as a tuple?
- Scala companion class warning
- Get all the classes that implements a trait in Scala using reflection
More Query from same tag
- Scala parameter type explanation
- Apache Flink WebUI Set Environment Variables
- Scala -jline file completer causes file not found (linux)
- When should I use Scala's Array instead of one of the other collections?
- avoid making a play app for a core module
- Gatling: Get REST resource, change JSON leaf, Post back
- Read spark dataframe based on size(mb/gb)
- Scala for loop yield
- Slick 3 multiple outer joins
- TypeSafe Scala IDE (Eclipse) doesn't show any Scala projects
- Scala Play Json Reads
- Explanation of Scala map function signature?
- UnsatisfiedLinkError: no snappyjava in java.library.path when running Spark MLLib Unit test within Intellij
- How to convert Range to List or Array in Scala
- How to convert a trait expression to single abstract method
- apache flink org.apache.hadoop.ipc.RpcException: RPC response exceeds maximum data length when writing string to HDFS
- How to convert Scala collection Seq[(Int, Seq[String])] to Java collection List[(int, List[String])]?
- Returning tuple with variable number of elements
- Scala: Is ForComprehension a Functional approach or imperative?
- Why does Spark SQL fail, but Spark core works after fresh installation (Scala)?
- Adding default package imports
- Scala: Initialization of var in class
- Adding or changing media types to use when serving files with getFromFile
- Convert a DataFrame to RDD and Split the RDD into the same number of Columns as DataFrame Dynamically
- Scala - Replace text placeholders in a String
- Converting from Long to List[Int]
- how to use typesafe config library just render file content?
- Scala slick left innerjoin for same Postgres Table not working
- Scala converting List of case class to List of another case class
- How to set up jEdit for sbt build error highlighting?