eclipse-jdt / eclipse-jdt/eclipse.jdt.ui
NLS @NonNull keys and the link towards messages.properties
- 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
Assessment
This issue has not been assessed yet.