eclipse-jdt / eclipse-jdt/eclipse.jdt.ui

NLS @NonNull keys and the link towards messages.properties

Open
#884 6 comments 0 reactions 0 assignees View on GitHub
null
Dominant language
Java
Stars
59
Forks
127
Avg merge
22h 47m
Merged PRs (30d)
28

Description

In my project, we want to use the externalized strings and NLS mechanisms.
And we want the string constants to be non-null annotated, so it is not needed to use a

````
var msg = MessageFormat.format(requireNonNull(Messages.mykey), value );
````

To achieve this, we tried to have a Builder, that patches the Messages class to be like

````
@NonNullByDefault
class Messages {
public static String myKey = ""; //$NON-NLS-1$
}
var msg = MessageFormat.format(Messages.mykey, value );
````

The initialization with empty string avoid to get errors from the null-analysis.

However, with this initialization, the feature that you can Ctrl-Click on the constant and it jumps to the properties file location does no more work.

Is this a Bug or missing feature? Or is there a completely different approach I can go?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.