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

Some non null annotations #4486

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Some non null annotations #4486

wants to merge 2 commits into from

Conversation

clinique
Copy link
Contributor

@clinique clinique commented Dec 9, 2024

No description provided.

Signed-off-by: Gaël L'hopital <gael@lhopital.org>
@clinique clinique requested a review from a team as a code owner December 9, 2024 10:47
import org.openhab.core.common.registry.Identifiable;

/**
* A listener to be informed before entities are added respectively after they are removed.
*
* @author Simon Kaufmann - Initial contribution
*/
@NonNullByDefault
public interface RegistryHook<E extends Identifiable<?>> {
Copy link
Member

Choose a reason for hiding this comment

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

@wborn @kaikreuzer Do you know about the use case for this Hook? This is only used in registries, which just forward the calls. addRegistryHook - which seems to be the only method for adding hooks - seems never being called. I could not trace it down to a single use in our core repo, no use in webui, and only 2 uses in add-ons test. However, it is a public interface to register for add/remove of elements in the registries.

It was introduced in ESH times and seems no longer be in use, at least not how it was before.

Shall I create a PR to deprecate this functions in the registries and this class?

return getText(null, key, locale);
}

private String getTranslatedText(String resourceName, String key, Locale locale) {
private @Nullable String getTranslatedText(String resourceName, String key, Locale locale) {
Copy link
Member

Choose a reason for hiding this comment

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

The parameters may be Nullable as well. According to the docs, it would cause a NullpointerException in getBundle, which leads to returning null.

Not sure if this is the way to go, but at least it would be more consistent with the other methods above.

Signed-off-by: gael@lhopital.org <gael@lhopital.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants