Skip to main content
Filter by
Sorted by
Tagged with
0 votes
0 answers
28 views

Consider the following code. When I run it, I see Flag -experimental set repeatedly message (the functionality seems correct otherwise). What should I do so it won't be displayed? (without (using ...
Koosha's user avatar
  • 1,584
0 votes
1 answer
44 views

I'm trying to write a compiler plugin that would inject a call to a base class method in a trait in Scala. For the following input source: class Component { def valCallback[T](ref: T, name: String):...
KireinaHoro's user avatar
0 votes
2 answers
2k views

I used scala-compiler.jar to compile an embedded Scala program This scala program imports a class written using jni The code is as follows class test{ def test(ctx: ContractContext): ActionResult =...
tony's user avatar
  • 81
0 votes
0 answers
91 views

During my involvement of an project that heavily relies on type-checked binding with Schematic data. I found many of the existing code share the following pattern: case class Datum1( col1: String = &...
tribbloid's user avatar
  • 3,792
1 vote
1 answer
811 views

During the running of a scala script, I would like it to generate some code and execute this. I thought I had found two examples online that might work, but they aren't successful import scala.reflect....
user avatar
1 vote
1 answer
132 views

I'm trying to defer ScalaJS Linking to runtime, which allows multi-stage compilation to be more flexible and less dependent on sbt. The setup looks like this: Instead of using scalajs-sbt plugin, I ...
tribbloid's user avatar
  • 3,792
0 votes
1 answer
136 views

I'm trying to define a case class using Scala Reflection Toolbox and to instantiate it. What is the best way to do it? At the moment I do val codeToCompile = q"""case class ...
andreacappelletti97's user avatar
2 votes
2 answers
87 views

When I'm debugging a complex scala plugin, I sometimes encounter unknown errors, I want the compiler to print out the stacktrace that triggers each error, to make sure that those errors are not caused ...
tribbloid's user avatar
  • 3,792
3 votes
1 answer
269 views

I have been stuck on this issue for a week and don't seem to be getting anywhere. I am trying to copy some methods and fields from one class to another. I have two phases that are involved in this. ...
sinanspd's user avatar
  • 2,744
5 votes
1 answer
1k views

I am researching about existential types in Scala 2.12.x. For that I'm testing the following code: trait Parent class ChildA extends Parent class ChildB extends Parent def whatIsInside(opt: Option[_ &...
Nicolas Schejtman's user avatar
2 votes
2 answers
313 views

I am working my way through Scala (ver. 2.13.2), and here I've defined a simple linked list with a trait ListSeq. Also, I wanted to override a toString method for pretty-printing. For this, I decided ...
Igor Kozlinskyi's user avatar
0 votes
1 answer
94 views

I've enterprise polyglot codebase which is made of java and scala. We have lot of places where we do map function on Option[T] and the mapping function is legacy code which returns null. Option(2).map(...
user51's user avatar
  • 10.6k
0 votes
0 answers
700 views

According to https://alexn.org/blog/2020/05/26/scala-fatal-warnings.html "-Wconf:cat=deprecation:ws,any:e" Will turn warnings into errors, except for deprecations. But it gives this: [error]...
samthebest's user avatar
  • 31.7k
1 vote
1 answer
104 views

I am writing a Scala Compiler Plugin with a component the executes after the "jvm" phase where there is need to know that a method is overridden. Here is a distilled version of a test case I ...
daltontf1212's user avatar
1 vote
1 answer
285 views

I would like this plugin to fetch the contents of an annotation (@Typestate(filename)). But at the moment even if I print out the entire tree I can't find the annotation anywhere. How to get an ...
aurorarized's user avatar
3 votes
1 answer
145 views

I did run into an scala compiler issue with implicit methods. The scenario is quite easy. The task of the implicit method is to turn an object of the case class A into an object of the case class B. ...
joel's user avatar
  • 480
3 votes
1 answer
868 views

Although IntelliJ Scala Plugin uses Scala compiler proper to generate the actual bytecode, it seems to use its own implementation of presentation compiler to provide real-time type-aware error ...
Mario Galic's user avatar
  • 48.6k
0 votes
0 answers
381 views

I deployed a Spark application and encounter this error: org.apache.spark.SparkException: Job aborted due to stage failure: Failed to serialize task 602, not attempting to retry it. Exception during ...
tribbloid's user avatar
  • 3,792
2 votes
0 answers
2k views

I'm switching from Scala 2.12 to 2.13.1. When I compile the project in sbt I get this error: [error] java.lang.NoClassDefFoundError: scala/collection/TraversableOnce [error] java.lang.Class.forName0(...
M.G.'s user avatar
  • 407
1 vote
1 answer
283 views

Using -Xprint flag in scalac we get output of different compiler phases, for example given the following Foo.scala object Foo { val x = 42 } then scalac -Xprint:jvm Foo.scala outputs package <...
Mario Galic's user avatar
  • 48.6k
0 votes
2 answers
214 views

This is a question about the Scala compiler. Let's say I have a List, and that I transform that list through several maps and flatMaps. val myList = List(1,2,3,4,5) val transformed = myList.map(_+1)...
Allen Han's user avatar
  • 1,163
0 votes
0 answers
116 views

When I debug, I see that the inner class here gets a reference to its outer class, even though it's not using any values from the outer class. The only reason the inner class is an inner class is so ...
KeyboardDrummer's user avatar
11 votes
2 answers
1k views

Consider the default codec as offered in the io package. implicitly[io.Codec].name //res0: String = UTF-8 It's a "low priority" implicit so it's easy to override without ambiguity. implicit val ...
jwvh's user avatar
  • 51.3k
4 votes
1 answer
122 views

In the following block of code (with both scala 2.11 and 2.12) the method apply does not compile, while applyInlined does. package blar trait Bar[T] class A class B class C trait Exploder[T] { //...
samthebest's user avatar
  • 31.7k
1 vote
1 answer
75 views

Could someone give a simple example of how I'd use scala.tools.nsc to compile a Scala class during runtime from within a JVM? I'm experimenting with some dynamic behavior where I want to be able to ...
John Stanford's user avatar