JsonToKotlinClass
JsonToKotlinClass copied to clipboard
If destination class exists - IDE freezes
Generating a class that already exists in a project make the latest Inellij IDEA freeze.
IntelliJ IDEA Version: Build #IU-223.8214.52, built on December 20, 2022 JSON to Kotlin Plugin Verison: 3.7.4 System: Debian/Bullseye
Oh, Thanks for feed back, will check it later
I checked local on MacOS, it doesn't freeze when generate a exists class name file here, is that convenient to record a video to show the problem?
Well, there's not much to record. After I click the generate button, the dialog simply disappears and I cannot do much. Looking at the log, I see the following. I cleared the log before, so it is only shown what happens when I use the plugin to create a file and do the same again. Also, my CPU has extreme loads after that. Only way is to hard kill the process.
22-12-27 16:22:58,969 [ 70971] INFO - #c.i.c.ComponentStoreImpl - Saving appAcceptedLanguageLevels took 25 ms, SonarLintGlobalSettings took 13 ms
2022-12-27 16:22:59,025 [ 71027] INFO - #c.i.c.ComponentStoreImpl - Saving Project(name=k8s-playground, containerState=COMPONENT_CREATED, componentStore=/home/marcel/k8s-playground)RunManager took 22 ms
2022-12-27 16:23:07,679 [ 79681] INFO - #c.i.c.ComponentStoreImpl - Saving appCodeStyleSchemeSettings took 13 ms, Perl5ApplicationSettings took 12 ms
2022-12-27 16:23:07,717 [ 79719] INFO - #c.i.c.ComponentStoreImpl - Saving Project(name=k8s-playground, containerState=COMPONENT_CREATED, componentStore=/home/marcel/k8s-playground)RemoteRepositoriesConfiguration took 11 ms
2022-12-27 16:23:09,108 [ 81110] INFO - #c.i.c.ComponentStoreImpl - Saving appGeneralSettings took 14 ms
2022-12-27 16:23:09,148 [ 81150] INFO - #c.i.c.ComponentStoreImpl - Saving Project(name=k8s-playground, containerState=COMPONENT_CREATED, componentStore=/home/marcel/k8s-playground)CheckStyle-IDEA took 18 ms
2022-12-27 16:23:10,738 [ 82740] INFO - #c.i.o.a.i.PopupMenuPreloader - 22493 ms since showing to preload popup menu 'Project View Popup Menu' at 'ProjectViewPopup(preload-bgt)' in 11 ms
2022-12-27 16:23:10,742 [ 82744] INFO - #c.i.o.a.i.PopupMenuPreloader - 22121 ms since showing to preload popup menu '' at 'StructureViewPopup(preload-bgt)' in 13 ms
2022-12-27 16:23:10,976 [ 82978] INFO - #c.i.o.a.i.PopupMenuPreloader - 22673 ms since showing to preload popup menu 'Editor Popup Menu' at 'EditorPopup(preload-bgt)' in 247 ms
2022-12-27 16:23:10,996 [ 82998] INFO - #c.i.o.a.i.PopupMenuPreloader - 12020 ms since showing to preload popup menu 'Editor Popup Menu' at 'EditorPopup(preload-bgt)' in 267 ms
2022-12-27 16:23:38,170 [ 110172] INFO - JSON To Kotlin Class - ListClassGeneratorByJSONArray jsonArray allElementAreSamePrimitiveType, return GenericListClass with generic type Int
2022-12-27 16:23:38,171 [ 110173] INFO - JSON To Kotlin Class - ListClassGeneratorByJSONArray jsonArray allItemAreObjectElement, return GenericListClass with generic type MasterNode
2022-12-27 16:23:38,172 [ 110174] INFO - JSON To Kotlin Class - ListClassGeneratorByJSONArray jsonArray allElementAreSamePrimitiveType, return GenericListClass with generic type Int
2022-12-27 16:23:38,172 [ 110174] INFO - JSON To Kotlin Class - ListClassGeneratorByJSONArray jsonArray allItemAreObjectElement, return GenericListClass with generic type WorkerNode
2022-12-27 16:24:25,984 [ 157986] INFO - #c.i.o.u.LowMemoryWatcher - Low memory signal received: afterGc=false
2022-12-27 16:24:26,288 [ 158290] INFO - #c.i.o.u.LowMemoryWatcher - Low memory signal received: afterGc=false
2022-12-27 16:24:26,610 [ 158612] INFO - #c.i.o.u.LowMemoryWatcher - Low memory signal received: afterGc=false
2022-12-27 16:24:26,916 [ 158918] INFO - #c.i.o.u.LowMemoryWatcher - Low memory signal received: afterGc=false
2022-12-27 16:24:27,223 [ 159225] INFO - #c.i.o.u.LowMemoryWatcher - Low memory signal received: afterGc=false
2022-12-27 16:24:27,524 [ 159526] INFO - #c.i.o.u.LowMemoryWatcher - Low memory signal received: afterGc=false
2022-12-27 16:24:27,827 [ 159829] INFO - #c.i.o.u.LowMemoryWatcher - Low memory signal received: afterGc=false
2022-12-27 16:24:28,131 [ 160133] INFO - #c.i.o.u.LowMemoryWatcher - Low memory signal received: afterGc=false
2022-12-27 16:24:28,422 [ 160424] INFO - #c.i.o.u.LowMemoryWatcher - Low memory signal received: afterGc=false
2022-12-27 16:24:28,716 [ 160718] INFO - #c.i.o.u.LowMemoryWatcher - Low memory signal received: afterGc=false
2022-12-27 16:24:29,019 [ 161021] INFO - #c.i.o.u.LowMemoryWatcher - Low memory signal received: afterGc=false
2022-12-27 16:24:29,324 [ 161326] INFO - #c.i.o.u.LowMemoryWatcher - Low memory signal received: afterGc=false
2022-12-27 16:24:29,626 [ 161628] INFO - #c.i.o.u.LowMemoryWatcher - Low memory signal received: afterGc=false
2022-12-27 16:24:29,939 [ 161941] INFO - #c.i.o.u.LowMemoryWatcher - Low memory signal received: afterGc=false
2022-12-27 16:24:30,256 [ 162258] INFO - #c.i.o.u.LowMemoryWatcher - Low memory signal received: afterGc=false
2022-12-27 16:24:30,568 [ 162570] INFO - #c.i.o.u.LowMemoryWatcher - Low memory signal received: afterGc=false
2022-12-27 16:24:30,887 [ 162889] INFO - #c.i.o.u.LowMemoryWatcher - Low memory signal received: afterGc=false
How big is your JSON, is it too much content in the JSON?
No, it is very simple.
{
"cluster": {
"masterNodes": [
{
"id": 0,
"status": "provisioned",
"snapshots": [
1670448150
]
}
],
"workerNodes": [
{
"id": 1,
"status": "provisioned",
"snapshots": [
1670448151
]
}
]
}
}
So, I tried around a bit more. When I use the default settings (after plugin install) and try to generate a class with the same name that already exists, new files appear with an X appended. For instance, If a class 'Clsuter.kt' already existes, a class 'ClusterX.kt' would be created. Running the plugin again and telling it to generate the class 'Cluster' would create a class 'ClusterXX.kt', and so forth.
The IDE freezes in my case, where I use the following settings:

If I generate a class, e.g. 'Cluster', with these settings and that class already exists, then the IDE freezes and I see the output as shown in the log excerpt above.
I will check it later