Hello I have created `Map<String,My_Info_Class&...
# announcements
r
Hello I have created
Map<String,My_Info_Class>
during annotation processing. So Map is created during compile time. Is there any way I could access the same
Map object
I created in Different module ?
z
Most annotation processors exist mostly to do code generation. I would expect your annotation processor to probably write a code file that initializes the map you want, probably using something like KotlinPoet.
r
I am creating
HashMap<String,ArrayList<DataClass>>
I am facing problem how to write the initialization for this Map
z
To be clear, are you saying your annotation processor is creating this map in memory as it's running and processing annotations?
r
Yes
Its creating in memory
I know ideal way would be to create a file and write the code for its initialization. But if in Memory map could be shared it would save the day
z
What do mean by access it in a different module? You mean when processing annotations on a different module?
r
image.png
So annotation processor is
TunnelCompiler
which makes the in memory Map and I want to access the map in
Tunnel
Module
z
Tunnel
is a module that is processed by
TunnelCompiler
?
r
No, Tunnel Compiler creates a
MAP
and Tunnel just wants to use the
ResultantMap
and In turn
Tunnel
is main module that is exposed as Library to client App
z
Is
Tunnel
a module that is expected to be included as a runtime dependency by code that is processed by
TunnelCompiler
? I'm trying to understand how the modules are related.
r
IMG_20200823_194147.jpg
Yes it as added as dependency by Code that is processed by
TunnelCompiler
z
Compilation/annotation processing happens completely independently from runtime. They happen at different times, in different processes, and probably even different physical machines. There is no way for the annotation processor to share memory with the VM that will eventually run the code it's processing.
r
Hmm I understood map is making in Compile Time and I wanted use it in runtime. But Still wanted to know if there is any possibilty to do so to share the memory. Thanks for confirming @Zach Klippenstein (he/him) [MOD]
BTW I finally end up using KotlinPoet only