Hardcoded strings
Reports any instances of hardcoded String
literals.
Hardcoded String
literals are probably errors in an internationalized environment. This inspection won't report empty strings and strings consisting only of whitespaces. A quick-fix is available to transform a string literal into a java.util.ResourceBundle.getString()
method call.
Inspection options
Option | Type | Default |
---|---|---|
TabSet | None | |
General | Tab | None |
Ignore if target is not annotated with @Nls | Checkbox | false |
Report unannotated references | Checkbox | false |
Suppression comment (regular expression) | ExpandableString | NON-NLS |
Context | Tab | None |
Do not report literals in the following contexts | Group | None |
Assert statement arguments | Checkbox | true |
JUnit assert arguments | Checkbox | true |
Literals assigned to constants | Checkbox | false |
Inside toString() method | Checkbox | false |
Enum constant arguments | Checkbox | false |
Constructor arguments of the following exception classes | Checkbox | true |
StringList | [] | |
String Content | Tab | None |
Do not report literals, whose content... | Group | None |
...is equal to existing qualified class name | Checkbox | true |
...is equal to existing property key | Checkbox | true |
...does not contain alphabetic characters | Checkbox | true |
...matches this regular expression | ExpandableString | ((?i)https?://.+)|\w*(\.\w+)+|\w*[$]\w*|((?i)</?(html|b|i|body|br|li|ol|ul|code)/?>)*|&\w+;|[A-Za-z][a-z0-9]*([A-Z]+[a-z0-9]*)+ |
Inspection Details | |
---|---|
Available in: | IntelliJ IDEA 2023.3, Qodana for JVM 2023.3 |
Plugin: | Java Internationalization, 233.SNAPSHOT |