2

When benchmarking some scala code using Java Flight Recorder/ Mission Control, I can see a bunch of methods that have an $adapted$ in the name. I can think of a few possibilities for this, looking at the signature.

  • Are these the same as java-8 function lambdas? i.e. that won't generate heap allocations?
  • Are they specializations of generics (in scala, or templates in java)?
  • Or are they some other sort of optimization?

Where can I read more about this?

Luciano
  • 2,388
  • 1
  • 22
  • 33
  • This is some sort of fixtures I think. Scala compiler usually abuses with $, and may generates some additional methods, packages, etc. when you create say static object object Foo – Igor Yudnikov Apr 22 '19 at 13:57
  • Thanks for posting this question, I'm noticing `$adapted$` appears with curried functions. Have you found any other patterns with what determines this name? Useful for reflection purposes... – ecoe Mar 25 '22 at 15:08

1 Answers1

0

This is some sort of fixtures I think. Scala compiler usually abuses with $ in class names and some java code may fail, it may generate some additional methods, packages, etc. when you create say static object

object Foo {
    case class Bar()
}

val bar = new Foo.Bar().getClass().getSimpleName() shouldEqual "Foo$Bar"

So, probably it was just generated by compiler or some other type-level-magic-macro-library

Igor Yudnikov
  • 434
  • 1
  • 6
  • 14