Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[gardena] Fix compiler warnings #12947

Merged
merged 1 commit into from
Jun 16, 2022
Merged

Conversation

andrewfg
Copy link
Contributor

Fixes #12898

Signed-off-by: Andrew Fiddian-Green software@whitebear.ch

Signed-off-by: Andrew Fiddian-Green <software@whitebear.ch>
@andrewfg andrewfg requested a review from gerrieg as a code owner June 16, 2022 17:05
@andrewfg andrewfg added the enhancement An enhancement or new feature for an existing add-on label Jun 16, 2022
@andrewfg andrewfg requested a review from kaikreuzer June 16, 2022 17:09
@jlaur
Copy link
Contributor

jlaur commented Jun 16, 2022

@andrewfg - I see only one compiler warning which hasn't been fixed by this PR?

Warning: /home/runner/work/openhab-addons/openhab-addons/bundles/org.openhab.binding.gardena/src/main/java/org/openhab/binding/gardena/internal/model/dto/api/DataItem.java:[31,14] The field attributes may not have been initialized, whereas its type 'T' is a free type variable that may represent a '@NonNull' type

Perhaps you can add some details as there seem to be a mismatch between PR title and actual result.

@andrewfg
Copy link
Contributor Author

see only one compiler warning which hasn't been fixed by this PR

@jlaur that is correct. I would have fixed that too, but I don't know how. (It concerns a nullable furld in a dto, so it should already be implicitly nullable and nulled..)

@jlaur
Copy link
Contributor

jlaur commented Jun 16, 2022

@jlaur that is correct. I would have fixed that too, but I don't know how. (It concerns a nullable furld in a dto, so it should already be implicitly nullable and nulled..)

OK, so now I follow. I missed that the lines you changed actually triggered some SAT warnings. I was looking for compiler warnings and only found the one that wasn't fixed. Will perform review now - less confused. :-)

Copy link
Contributor

@jlaur jlaur left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks.

@jlaur jlaur merged commit 4036888 into openhab:main Jun 16, 2022
@jlaur jlaur added this to the 3.3 milestone Jun 16, 2022
@andrewfg
Copy link
Contributor Author

Warning: /home/runner/work/openhab-addons/openhab-addons/bundles/org.openhab.binding.gardena/src/main/java/org/openhab/binding/gardena/internal/model/dto/api/DataItem.java:[31,14] The field attributes may not have been initialized, whereas its type 'T' is a free type variable that may represent a '@nonnull' type

It concerns a nullable generic field in a dto, so it should already be implicitly nullable and nulled..)

@jlaur your own PR today with an interesting null annotation made me think more about this case: The binding code is definitely an edge case where null annotations and null checking falls over, so I would not change the code in any way. However I could eliminate the compiler warning by adding a @SuppressWarnings("null") to it. It is probably a trivial issue but what do you suggest? Personally I always aim for a totally clean build if I can..

@jlaur
Copy link
Contributor

jlaur commented Jun 18, 2022

@andrewfg - it's a tricky case. Type T can either be nullable or non-null. If we explicitly annotate it as nullable, we get into null constraint mismatch troubles. But actually it would make sense to annotate it as non-null. Now we have another problem, since attributes is not initialized by constructor (but later by deserialization).

I have created #12957 as a proposed solution, where attributes is annotated as nullable and corresponding null-checks have been made.

@andrewfg andrewfg deleted the gardena-oddments branch September 26, 2022 16:29
leifbladt pushed a commit to leifbladt/openhab-addons that referenced this pull request Oct 15, 2022
Signed-off-by: Andrew Fiddian-Green <software@whitebear.ch>
andan67 pushed a commit to andan67/openhab-addons that referenced this pull request Nov 6, 2022
Signed-off-by: Andrew Fiddian-Green <software@whitebear.ch>
andrasU pushed a commit to andrasU/openhab-addons that referenced this pull request Nov 12, 2022
Signed-off-by: Andrew Fiddian-Green <software@whitebear.ch>
Signed-off-by: Andras Uhrin <andras.uhrin@gmail.com>
psmedley pushed a commit to psmedley/openhab-addons that referenced this pull request Feb 23, 2023
Signed-off-by: Andrew Fiddian-Green <software@whitebear.ch>
nemerdaud pushed a commit to nemerdaud/openhab-addons that referenced this pull request Feb 28, 2023
Signed-off-by: Andrew Fiddian-Green <software@whitebear.ch>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement An enhancement or new feature for an existing add-on
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[gardena] Build system issues compiler warnings
2 participants