zsmartsystems / com.zsmartsystems.zigbee

ZigBee Cluster Library Java framework supporting multiple dongles
Eclipse Public License 1.0
138 stars 87 forks source link

Fix missing line break when outputting in class generators #1399

Closed ViToni closed 1 year ago

ViToni commented 1 year ago

Fixes the method outputWithLinebreak which doesn't output line breaks in some cases.

cdjackson commented 1 year ago

I think it would be good to also run the code generators, so that any changes are picked up as well. Otherwise we'll get unrelated changes next time someone makes a change.

ViToni commented 1 year ago

The change is to preserve actual formatting. Running the generators without this change, changes formatting in com.zsmartsystems.zigbee.dongle.telegesis/src/main/java/com/zsmartsystems/zigbee/dongle/telegesis/internal/protocol/TelegesisDeviceType.java. The other generators were changed for consistency.

cdjackson commented 1 year ago

Ok, I'm not sure I understand how this change doesn't change something in the code? You say that without this change the files will change - doesn't that mean there is a change in some files? Or did the previous PR make some changes that are reverted without this PR?

Sorry - just trying to understand...

ViToni commented 1 year ago

If one would run the Telegesis generator as it is right now, the generator output would differ from what is currently checked in. The output would also no longer look like as expected. It would mangle empty Javadocs in ˋTelegesisDeviceTypeˋ. One can check the diff which would result by running the Telegesis generator code on ˋmasterˋ. The diff led me to look at the code in the generator and for me it looked like a bug and I saw the same pattern used in the other generators. With this PR applied the output stays stable, which means for Telegesis the output will look like the checked in version, even on succeeding runs. For the other generators there is no change in the output with / without this change. My assumption is that some (XML) data for Telegesis triggered this bug. The data is untouched but the code now handles the situation which triggered the bug. I hope this explains it better than my first attempt.

cdjackson commented 1 year ago

Thanks for the explanation. All good.