portable-scala / portable-scala-reflect

Platform independent reflection for Scala
BSD 3-Clause "New" or "Revised" License
42 stars 14 forks source link

Initial implementation for the JVM and JavaScript. #1

Closed sjrd closed 6 years ago

sjrd commented 6 years ago

The Scala Native version is not there yet, as Scala Native does not have yet the necessary mechanisms to implement the API.

The only discrepancy between JVM and JS is the behavior of protected constructors. The JVM version considers that they are visible, because they are compiled to public in the bytecode, while Scala.js explicitly excludes them. It seems that the most reasonable fix would be to allow access to protected constructors in Scala.js' core Reflect mechanism.

sjrd commented 6 years ago

Ready for review, mainly @gzm0.

@densh It would be good if you could have a look as well, mostly to tell us whether any of it is unreasonable for Scala Native. But from our earlier discussions, it should be fine.

sjrd commented 6 years ago

Updated with fixes to make the CI pass on 2.10 and 2.11 (I had misconfigured Travis so I wouldn't actually test with those versions).

And with an additional commit that uses macros on the JVM to get the caller's class loader.