[homematic] Reduce SAT warnings#20651
Conversation
Co-authored-by: Copilot <copilot@github.com> Signed-off-by: Leo Siepel <leosiepel@gmail.com>
Co-authored-by: Copilot <copilot@github.com> Signed-off-by: Leo Siepel <leosiepel@gmail.com>
Signed-off-by: Leo Siepel <leosiepel@gmail.com>
|
Damn, now that I see this, it reminds me I started similar work and completely forgot about it :-/ - see this branch. I wonder whether it would make sense to compare the approaches and see what can be incorporated here? On a first glance it looks like I kept a bit more stuff non-null, e.g. in |
|
It did cost me a full day :-/ |
Same :-( I finished it to the state where it compiled, didn't have any time for testing at that point, thus pushed to a branch and forgot said branch because I was busy with other things. Edit: I'll try to prepare a diff. |
|
So here's the diff between our branches (from yours to mine). Unfortunately, it's huge, mainly because we made some different choices about nullability in the base classes of the parsers and the model classes. For the latter I'm somewhat certain mine are a bit more correct (my approach also makes some of their fields immutable, which helps a lot in figuring out nullability); for everything else I'm open for discussions. Again, sorry for not making you aware of my changes so now either yours or mine is wasted - I genuinely forgot to create a draft PR for this 😞 |
Co-authored-by: Copilot <copilot@github.com> Signed-off-by: Leo Siepel <leosiepel@gmail.com>
|
Let's try to reduce the diff and see what actual issues remain. I made a start, but have to leave now and will continue later. I post my findings here, and will push changes while working on it, these changes contain everything i bluntly copied from your gist. I assume that is ok. WIP Originally, getChannel() was used without null checks. If it commonly returned null, I’d expect more issues to have surfaced. === Semantically the same, the inline version is imo a bit cleaner. === Moved the xstream dto's to a subfolder to prevent them from having SAT issues. |
I definitely do not like having 2 methods here, because the differentiation between both is unclear (before looking it up in the source). I opted for making the method nullable for two reasons:
In addition I view the previous behavior as inconsistent: some code places (4 to be precise) assume channel 0 to be present, others (1 to be precise) check if it's present. (In reality it will always be present for a proper device) I think it's better to add a few useless null checks than to preserve this inconsistency.
Yeah, the difference here is irrelevant, it's fine either way.
Maybe OK, but I think we should still keep null annotations correct where possible (e.g. in
Sure 🙂 |
Signed-off-by: Leo Siepel <leosiepel@gmail.com>
|
Would it be possible to mass replace your null annotations to be inline, and regenerate the diff, That would remove all clutter and i have adopted many parts of your code so the diff should be much less now. |
I regenerated the diff and removed all fluff (Nullable annotation placement, imports etc.) manually. Result is here. |
- Did not introduce the wrong loop bound bug in DeleteDevicesParser. - Did not remove null-safe option handling in CcuVariablesAndScriptsParser. - Kept empty-message guard logic in GetParamsetDescriptionParser. Co-authored-by: Copilot <copilot@github.com> Signed-off-by: Leo Siepel <leosiepel@gmail.com>
Co-authored-by: Copilot <copilot@github.com> Signed-off-by: Leo Siepel <leosiepel@gmail.com>
Co-authored-by: Copilot <copilot@github.com> Signed-off-by: Leo Siepel <leosiepel@gmail.com>
Co-authored-by: Copilot <copilot@github.com> Signed-off-by: Leo Siepel <leosiepel@gmail.com>
Signed-off-by: Leo Siepel <leosiepel@gmail.com>
This should reduce the SAT warnings the binding generates. While doing so i tried not to change the behaviour. This is also the reason that i could not fix all compile warnings.
To do so another refactoring pass is needed.
While working on it, some rare bugs might be fixed in the proces.
A JAR file to do some testing is here: (5.2.x) https://1drv.ms/u/c/70ea7ac46bc61c73/IQBH2Mogs5aaRLmsWgPpfpHFAfwgIZIBPg_emuVVgjHsz30?e=nbHpKc