-
Notifications
You must be signed in to change notification settings - Fork 41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Avoid use of Java Reflection (restructure part 5) #870
Conversation
# Conflicts: # build.sbt # graph-ir/src/main/scala/scalan/TypeDescs.scala # graph-ir/src/main/scala/special/sigma/impl/SigmaDslImpl.scala
Codecov Report
@@ Coverage Diff @@
## v5.0.6-RC #870 +/- ##
=============================================
+ Coverage 75.93% 80.56% +4.62%
=============================================
Files 218 220 +2
Lines 13599 13997 +398
Branches 477 473 -4
=============================================
+ Hits 10327 11276 +949
+ Misses 3272 2721 -551
... and 15 files with indirect coverage changes Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
override def getSimpleName: String = value.getSimpleName | ||
override def getName: String = value.getName | ||
|
||
/** A sequence that stores the constructors of this class. */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just "Constructors of this class" ? see https://docs.scala-lang.org/style/scaladoc.html#general-style
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
constructors | ||
} | ||
|
||
/** Helper method that returns a sequence of `JRConstructor` objects that were at least |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"a sequence of" seems to be excessive here as well
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
* @param declaringClass The JRClass that declares this method. | ||
* @param value The [[java.lang.reflect.Method]] instance that this JRMethod represents. | ||
*/ | ||
class JRMethod private (declarigClass: JRClass[_], val value: Method) extends RMethod { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
declaringClass
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
} | ||
} | ||
|
||
/** Creates a new SRMethod instance with the given parameters and handler function. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But what does "a new SRMethod instance" mean? It is obvious from the function signature that the functions returns an RMethod instance, what scaladoc is saying above that ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clarified
@@ -0,0 +1,117 @@ | |||
package scalan.reflection | |||
|
|||
import scala.collection.mutable |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unused import
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
trait WOptionsDefs extends scalan.Scalan with WOptions { | ||
self: WrappersModule => | ||
|
||
object WOption extends EntityObject("WOption") { | ||
class WOptionCls extends EntityObject("WOption") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ScalaDoc missed
Why WOptionCls , not WOptionImpl ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because Impl is usually when some abstract class/interface is implemented. Here it is to:
- avoid name collision
- have a class type where WOption.type doesn't work (in reflection metadata, see usages of WOptionCls)
|
||
object WRType extends EntityObject("WRType") { | ||
class WRTypeCls extends EntityObject("WRType") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ScalaDoc missed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
import scalan.reflection.RClass | ||
|
||
// Abs ----------------------------------- | ||
trait WSpecialPredefsDefs extends scalan.Scalan with WSpecialPredefs { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
scaladocs missed in file
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file is just moved, has not been changed.
import special.collection.Coll | ||
import special.sigma.{SigmaDslBuilder, AvlTree} | ||
|
||
/** Reflection metadata for `interpreter` module. */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Again, this scaladoc does not say much about what is going on here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
class ZLastSpec extends AnyPropSpec with BeforeAndAfterAll { | ||
|
||
property("the last property") { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
???
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clarified
This PR is focused on removing direct usages of Java reflection. Instead
scalan.reflection
package introduced incommon
module.This is a next step towards Scala.js support.
The new reflection-like interface has two implementations:
Also: