[java-inspections] Internationalize inspection message for IDEA-370683

GitOrigin-RevId: 811c4c00965ea6efdc68204ae45f88be321ff689
This commit is contained in:
Tagir Valeev
2025-04-15 15:49:00 +00:00
committed by intellij-monorepo-bot
parent 41f8ec155d
commit 60f631689c
3 changed files with 7 additions and 5 deletions
@@ -250,6 +250,7 @@ inspection.nullable.problems.at.wildcard=Nullability annotation is not applicabl
inspection.nullable.problems.at.local.variable=Nullability annotation is not applicable to local variables
inspection.nullable.problems.at.type.parameter=Nullability annotation is not applicable to type parameters
inspection.nullable.problems.at.reference.list=Nullability annotation is not applicable to extends/implements clause
inspection.nullable.problems.constructor.not.compatible.non.null.type.argument=Constructor is not compatible with a non-null type argument
inspection.objects.equals.can.be.simplified.display.name='Objects.equals()' can be replaced with 'equals()'
inspection.redundant.cast.problem.descriptor=Casting <code>{0}</code> to <code>#ref</code> #loc is redundant
inspection.redundant.cast.methodref.descriptor=Cast is redundant
@@ -153,7 +153,8 @@ public class NullableStuffInspectionBase extends AbstractBaseJavaLocalInspection
typeElement.acceptsAnnotations()) {
fix = new AddTypeAnnotationFix(typeElement, manager.getDefaultNullable(), notNulls);
}
holder.problem(expression, "Constructor is not compatible with non-null type argument")
holder.problem(expression,
JavaAnalysisBundle.message("inspection.nullable.problems.constructor.not.compatible.non.null.type.argument"))
.maybeFix(fix)
.register();
}
@@ -11,12 +11,12 @@ import java.util.stream.Collectors;
@NullMarked
class Main {
public static void main(String[] args) {
AtomicReference<String> ref = <warning descr="Constructor is not compatible with non-null type argument">new AtomicReference<caret><>()</warning>;
AtomicReference<String> ref1 = <warning descr="Constructor is not compatible with non-null type argument">new AtomicReference<String>()</warning>;
AtomicReference<String> ref = <warning descr="Constructor is not compatible with a non-null type argument">new AtomicReference<caret><>()</warning>;
AtomicReference<String> ref1 = <warning descr="Constructor is not compatible with a non-null type argument">new AtomicReference<String>()</warning>;
AtomicReference<String> ref2 = new AtomicReference<>(null);
AtomicReference<String> ref3 = new AtomicReference<>("");
ThreadLocal<String> tl = <warning descr="Constructor is not compatible with non-null type argument">new ThreadLocal<>()</warning>;
ThreadLocal<String> tl = <warning descr="Constructor is not compatible with a non-null type argument">new ThreadLocal<>()</warning>;
ThreadLocal<String> tl2 = new ThreadLocal<>() {
@Override
protected String initialValue() {
@@ -25,7 +25,7 @@ class Main {
};
ThreadLocal<String> tl3 = ThreadLocal.withInitial(() -> null);
AtomicReferenceArray<String> arr = <warning descr="Constructor is not compatible with non-null type argument">new AtomicReferenceArray<>(10)</warning>;
AtomicReferenceArray<String> arr = <warning descr="Constructor is not compatible with a non-null type argument">new AtomicReferenceArray<>(10)</warning>;
AtomicReferenceArray<String> arr2 = new AtomicReferenceArray<>(new String[10]); // technically wrong and should be highlighted, as array contains nulls
@Nullable String[] data = new String[10];
AtomicReferenceArray<String> arr3 = new AtomicReferenceArray<>(data); // technically wrong and should be highlighted, as array contains nulls