spxbhuhb / adaptive

Consolidated full-stack application development library for Kotlin
https://adaptive.fun
Apache License 2.0
3 stars 0 forks source link

Solve the class lookup problem #10

Closed toth-istvan-zoltan closed 4 months ago

toth-istvan-zoltan commented 4 months ago

The problem

  1. The compiler plugin creates classes for adaptive functions.
  2. The compiler exports the metadata of these classes only when they are generated by a FIR plugin.
  3. Generation of top level declarations is faulty, therefore this FIR plugin is switched off.
  4. The plugin cannot find the classes because they are not exported from FIR.

Possible workaround

Add an export holder manually to the codes. This is quite cumbersome but it would probably work:

@AdaptiveExports
object exports

Then the compiler plugin can add functions to this export which can in turn return with the actual fragment instance.

toth-istvan-zoltan commented 4 months ago

Confirmed that this is a compiler bug and wont' be fixed up until 2.1.0.

https://youtrack.jetbrains.com/issue/KT-58886

I'll go with the workaround.

toth-istvan-zoltan commented 4 months ago

The workaround to be implemented:

toth-istvan-zoltan commented 4 months ago

Works in sandbox with JS (489df2e).