-
Notifications
You must be signed in to change notification settings - Fork 36
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
Use originating mirror for types instantiated from TypeTag. #27
Conversation
@@ -57,10 +58,10 @@ object TypeUtils { | |||
} | |||
|
|||
def instanceOfType[T](typeTag: ru.TypeTag[T]): T = { | |||
val constructorT = constructorForType(typeTag.tpe).getOrElse { | |||
val clazz = typeTag.mirror.runtimeClass(typeTag.tpe) | |||
Try(clazz.newInstance.asInstanceOf[T]).getOrElse { |
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.
Perhaps we could rework classToType and typeToClass methods to use appropriate mirrors instead?
Tried to minimize changes more than a single type away from TypeUtils. Signed-off-by: Simeon H.K. Fitch <fitch@astraea.io>
@witold-jedrzejewski-codilime I attempted to propagate the use of TypeTags as far as I could without it spreading really far into the core classes. If we want to go that route, we'd have to replace most uses of |
@@ -17,7 +17,7 @@ | |||
package ai.deepsense.deeplang.catalogs.doperable | |||
|
|||
import scala.reflect.runtime.{universe => ru} | |||
|
|||
import ru.{TypeTag, typeTag} |
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?
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.
Sorry. One of those mornings.
import ai.deepsense.deeplang.params.exceptions.NoArgumentConstructorRequiredException | ||
import ai.deepsense.sparkutils | ||
|
||
import scala.util.Try |
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
Signed-off-by: Simeon H.K. Fitch <fitch@astraea.io>
@metasim @witold-jedrzejewski-codilime this change makes testing sdk-example fail (from ./build/build_and_run_tests.sh). I'm working on other issues now but I'll have time tomorrow . We should wait with merge. |
@jaroslaw-osmanski Is this issue you were having the same as #35? If so, it's from something further downstream. |
@metasim it is:
|
@jaroslaw-osmanski Yeh, this PR likely caused that. I'll work on it this weekend. Need to understand why |
I think part of the problem has to do with the API now being a Here's the fuller stack trace (provided by
|
…n ClassLoader. Signed-off-by: Simeon H.K. Fitch <fitch@astraea.io>
@jaroslaw-osmanski I believe the SDK test is fixed now. |
Fix for #26