Skip to main content
Stack Overflow for Teams is now Stack Internal: See how we’re powering the human intelligence layer of enterprise AI. Read more >
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
50 views

I'm trying to restore a project named Scala-IDE. One of the scala files is JavaSig.scala: package org.scalaide.core.internal.compiler import org.scalaide.core.compiler.IScalaPresentationCompiler....
Sybuser's user avatar
  • 1,562
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
1 vote
0 answers
111 views

I have a multi-module application which has a java HTTP application (springboot, java 11) in one module and scala code in the second module. The second module is included as a dependency in the first ...
Alokh P's user avatar
  • 11
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
1 answer
86 views

This is a follow-up question of: In Scala 3: Why runtime pattern matching can't work reliably on duck type using JVM reflection? I'm trying to create a pattern matching implementation in Scala ...
tribbloid's user avatar
  • 3,992
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,992
2 votes
1 answer
275 views

This never happened as I never turn off my pc. Seeing this message after recent update. IntelliJ IDEA 2022.3 (Community Edition) Build #IC-223.7571.182, built on November 29, 2022 Runtime version: 17....
Always_a_learner's user avatar
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
2 votes
0 answers
97 views

I have the same question as this previously asked question, but I want to achieve this in Scala 3. I have searched for the libraries used in the first answer for Scala 3, but I couldn't find them. How ...
M Ahsan Al Mahir's user avatar
1 vote
1 answer
130 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,992
1 vote
1 answer
210 views

I have a Scala project that can only be compiled with Gradle, recently someone has asked it to be ported to Scala.js, ideally by cross-build. When I read the code of Scala.js, I realised that the bulk ...
tribbloid's user avatar
  • 3,992
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
0 votes
1 answer
151 views

We have a simple java project with unit tests written in scalatest: no scala library in compile scope (autoScalaLibrary := false) scala-compiler added to test scope to compile unit tests written in ...
mogli's user avatar
  • 1,629
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,992
1 vote
2 answers
203 views

After the parser phase of the Scalac process, the following case class case class ExampleCaseClass(var s:String, var i:Int) extends ContextuallyMutable takes the intermediate form: Clazz(case class ...
Ben McKenneby's user avatar
3 votes
1 answer
267 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
2 votes
1 answer
92 views

Suppose I want to use macros in Scala 3 to count the number of places a certain method doSomething() was used in the code: // Macros.scala import scala.quoted.{Expr, Quotes} object Macros { ...
Otavio Macedo's user avatar
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
1 answer
57 views

In order to use infix notation, I have the following example of scala code. implicit class myclass(n:Int ){ private def mapCombineReduce(map : Int => Double, combine: (Double,Double) => ...
f_s's user avatar
  • 113
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
2 votes
1 answer
358 views

It is known in scala 2 that macros are strictly local and are only executed once, when the class is defined. This feature seems particularly weak when combining with abstract type, as the process to ...
tribbloid's user avatar
  • 3,992
0 votes
1 answer
93 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
110 views

I have a project that is a Scala 3 plugin. Right now I publishLocal and run another project that imports my plugin for every test. Not very convenient. How can I set up my plugin project so I can ...
Greg's user avatar
  • 11.7k
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
2 votes
1 answer
176 views

This post: Where does Scala look for implicits? described the implicit search precedence & algorithm used by modern scala compiler. In the above list, directly imported implicit functions should ...
tribbloid's user avatar
  • 3,992
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
1k views

I would like to understand is there a way to write a method to existing class at runtime and to create a jar dynamically in scala. So far i tried to create a class dynamically and able to run it thru ...
user3569397's user avatar
1 vote
1 answer
283 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
1 vote
0 answers
144 views

I have a type class that has only 1 implementation: class ConstDomain[N1, N2]( val a1: Const[N1], val a2: Const[N2] ) { ... } object ConstDomain { implicit def summon[N1, N2]( ...
tribbloid's user avatar
  • 3,992
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
2 votes
2 answers
1k views

I'm writing a Scala program and I want it to work with two version of a big library. This big library's version 2 changes the API very slightly (only one class constructor signature has an extra ...
sscarduzio's user avatar
  • 6,268
3 votes
1 answer
867 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
2 votes
3 answers
854 views

When defining a Scala case class, an apply function is automatically generated which behaves similarly to the way the default constructor in java behaves. How can I see the code which automatically ...
Isaac Flaum's user avatar
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,992
5 votes
3 answers
921 views

I want to inspect my codebase to find both "Fruitless type test" warnings and "Comparing Unrelated types" warning Basically had a pretty big bug in our codebase which could have been avoided had we ...
Rahil Shah's user avatar
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
0 votes
1 answer
64 views

Lets say I have something like: case class StringList(list: List[String]) { final def isEmpty(): Boolean = list.isEmpty } Theoretically, the Scala compiler could optimise calls to the method ...
Cheetah's user avatar
  • 14.5k
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
2 votes
1 answer
954 views

I have the following code and I would like to compile it on the fly and run it. object HelloWorld { def main(args: Array[String]): Unit = { println("Hello, world!") } } So far I have tried ...
Vishal's user avatar
  • 20.7k
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
4 votes
2 answers
638 views

I have a trait Foo[T, U] and a type-level algorithm that given an L <: HList and a target type U, tells me whether there exists T in L such that there is an implicit Foo[T, U] in scope. This is ...
jbwheatley's user avatar
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
7 votes
1 answer
237 views

I have a custom class, A, and I have defined some operations within the class as follows: def +(that: A) = ... def -(that: A) = ... def *(that: A) = ... def +(that: Double) = ... def -(that: Double) ...
darsnack's user avatar
  • 935
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
1 vote
1 answer
276 views

Is there a repository with parser written using scala combinators? I am considering using scala combinators and it is dependent on finding existing parsers for popular languages (python, c, java, cpp, ...
Eytan's user avatar
  • 798
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
0 answers
109 views

The scala compiler seems to give false type-errors for statements with multiple lower bounds. Given class Foo with the method g using a lower bound for A and B class Foo[A, B](a: A, b: B) { def g[...
anselm's user avatar
  • 76
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
0 votes
1 answer
74 views

I'm using scala language to define 2 operators: :++ and ++: that serves as the exact mirror of each other: a :++ b == b ++: a, they are obviously not commutative: a :++ b != a ++: b. This is my scala ...
tribbloid's user avatar
  • 3,992