Questions tagged [kotlin-inline-class]

From version 1.3+, Kotlin introduces a special kind of class called an inline class, which is declared by placing an 'inline' modifier before the name of the class. They provide a way to wrap a type, thus adding functionality and creating a new type by itself. As opposed to regular wrappers, they will benefit from improved performance. This happens because the data is inlined into its usages, and object instantiation is skipped in the compiled code.

Inline classes provide us with a way to wrap a type, thus adding functionality and creating a new type by itself.

As opposed to regular (non-inlined) wrappers, they will benefit from improved performance. This happens because the data is inlined into its usages, and object instantiation is skipped in the resulting compiled code.

17 questions
0
votes
1 answer

Memory leak: Anonymous class implementing io.reactivex.Observer

I am working on an Android project. Some of my Activities are extending SiteFinderActivity. This class is responsible to validate the current session and pass it down to its children via a few abstract functions. I use JakeWharton's RxRelay in order…
Hesam
  • 52,260
  • 74
  • 224
  • 365
0
votes
0 answers

Is there a way to implement the Cleaner with primitives other than boxing them in classes?

So, we have a kotlin wrapper around vulkan which relies on inline classes for vulkan identifiers (which are usually Longs) As far as I got, Java (9+) Cleaner is supposed to work only with classes. Here an example I tried to modify that in order to…
elect
  • 6,765
  • 10
  • 53
  • 119
1
2