diff --git a/java/java-analysis-api/resources/messages/JavaAnalysisBundle.properties b/java/java-analysis-api/resources/messages/JavaAnalysisBundle.properties index 3877866036d8..f12e26a2bc25 100644 --- a/java/java-analysis-api/resources/messages/JavaAnalysisBundle.properties +++ b/java/java-analysis-api/resources/messages/JavaAnalysisBundle.properties @@ -132,8 +132,8 @@ annotate.overridden.methods.parameters=Annotate overriding method parameters as anonymous.ref.loc.can.be.replaced.with.0=Anonymous #ref #loc can be replaced with {0} anonymous.ref.loc.can.be.replaced.with.lambda=Anonymous #ref #loc can be replaced with lambda assigning.a.collection.of.nullable.elements=Assigning a collection of nullable elements into a collection of non-null elements -returning.a.class.with.nullable.parameters=Returning a class with nullable type parameters when a class with non-null type parameters is expected -returning.a.class.with.notnull.parameters=Returning a class with non-null type parameters when a class with nullable type parameters is expected +returning.a.class.with.nullable.arguments=Returning a class with nullable type arguments when a class with not-null type arguments is expected +returning.a.class.with.notnull.arguments=Returning a class with not-null type arguments when a class with nullable type arguments is expected conflicting.nullability.annotations=Conflicting nullability annotations nullable.stuff.error.overriding.nullable.with.notnull=Overriding a collection of nullable elements with a collection of non-null elements nullable.stuff.error.overriding.notnull.with.nullable=Overriding a collection of non-null elements with a collection of nullable elements diff --git a/java/java-analysis-impl/src/com/intellij/codeInspection/nullable/NullableStuffInspectionBase.java b/java/java-analysis-impl/src/com/intellij/codeInspection/nullable/NullableStuffInspectionBase.java index d5ee37966f53..24660d075f09 100644 --- a/java/java-analysis-impl/src/com/intellij/codeInspection/nullable/NullableStuffInspectionBase.java +++ b/java/java-analysis-impl/src/com/intellij/codeInspection/nullable/NullableStuffInspectionBase.java @@ -538,7 +538,7 @@ public class NullableStuffInspectionBase extends AbstractBaseJavaLocalInspection REPORT_NOT_NULL_TO_NULLABLE_CONFLICTS_IN_ASSIGNMENTS); if (conflict == JavaTypeNullabilityUtil.NullabilityConflict.UNKNOWN) return; String messageKey = conflict == JavaTypeNullabilityUtil.NullabilityConflict.NOT_NULL_TO_NULL ? - "returning.a.class.with.notnull.parameters" : "returning.a.class.with.nullable.parameters"; + "returning.a.class.with.notnull.arguments" : "returning.a.class.with.nullable.arguments"; reportProblem(holder, returnValue, messageKey); } diff --git a/java/java-tests/testData/inspection/nullableProblems/PassingNullableCollectionWhereNotNullIsExpected.java b/java/java-tests/testData/inspection/nullableProblems/PassingNullableCollectionWhereNotNullIsExpected.java index a08c8f55d33c..d3129e9964bd 100644 --- a/java/java-tests/testData/inspection/nullableProblems/PassingNullableCollectionWhereNotNullIsExpected.java +++ b/java/java-tests/testData/inspection/nullableProblems/PassingNullableCollectionWhereNotNullIsExpected.java @@ -31,9 +31,9 @@ class JC { Supplier> supplier = () -> list; Supplier> supplierRef = this::getNullableList; - Supplier> supplier3 = () -> { return list;}; + Supplier> supplier3 = () -> { return list;}; - return list; + return list; } } diff --git a/java/java-tests/testData/inspection/nullableProblems/PassingNullableMapValueWhereNotNullIsExpected.java b/java/java-tests/testData/inspection/nullableProblems/PassingNullableMapValueWhereNotNullIsExpected.java index 8c84e78c925a..5a5bda28b306 100644 --- a/java/java-tests/testData/inspection/nullableProblems/PassingNullableMapValueWhereNotNullIsExpected.java +++ b/java/java-tests/testData/inspection/nullableProblems/PassingNullableMapValueWhereNotNullIsExpected.java @@ -9,6 +9,6 @@ class Test { @NotNull Map<@NotNull String, @NotNull ArrayList<@Nullable String>> map = new HashMap<>(); map.put("x", arrayList); - return map; + return map; } } \ No newline at end of file diff --git a/java/java-tests/testData/inspection/nullableProblems/ReturnIncompatibilitiesWithGeneric.java b/java/java-tests/testData/inspection/nullableProblems/ReturnIncompatibilitiesWithGeneric.java index 6295ec287413..eb5500ba3eb8 100644 --- a/java/java-tests/testData/inspection/nullableProblems/ReturnIncompatibilitiesWithGeneric.java +++ b/java/java-tests/testData/inspection/nullableProblems/ReturnIncompatibilitiesWithGeneric.java @@ -6,15 +6,15 @@ import java.util.Collection; class B { B<@NotNull String> simpleNullableToNotNull(B<@Nullable String> arg) { - return arg; + return arg; } B<@Nullable String> simpleNotNullToNullable(B<@NotNull String> arg) { - return arg; + return arg; } B> nested(B> arg) { - return arg; + return arg; } B extendsWildcardNullable(B<@NotNull Object> arg) { @@ -22,7 +22,7 @@ class B { } B extendsWildcardNotNull(B<@Nullable String> arg) { - return arg; + return arg; } B SupperWildcard(B<@Nullable Object> arg) { @@ -30,7 +30,7 @@ class B { } B extendsWildcardBothNotNull(B arg) { - return arg; + return arg; } B extendsWildcardBothNullable(B arg) { @@ -42,35 +42,35 @@ class B { } B> nestedWithWildcard(B> arg) { - return arg; + return arg; } Map, List<@Nullable String>> checkIsPerformedIfSecondTypeArgumentIsTheSame(Map, List<@NotNull String>> arg) { - return arg; + return arg; } B<@NotNull String>[] array(B<@Nullable String>[] arg) { - return arg; + return arg; } Object[] @NotNull [] nullabilityInNestedArray(Object[] @Nullable [] arg) { - return arg; + return arg; } B<@NotNull String>[][] multiDimensionalArray(B<@Nullable String>[][] arg) { - return arg; + return arg; } static class C { C secondArgument(C arg) { - return arg; + return arg; } } interface I {} List<@Nullable String> intersectionSimple(Object arg) { - return (List<@NotNull String> & I) arg; + return (List<@NotNull String> & I) arg; } Collection<@Nullable String> intersectionTreatsFirstMatchingUnknown(Object arg) { @@ -78,11 +78,11 @@ class B { } Collection<@Nullable String> intersectionTreatsFirstMatchingMismatch(Object arg) { - return (Collection<@NotNull String> & List<@NotNull String> & I) arg; + return (Collection<@NotNull String> & List<@NotNull String> & I) arg; } List> nestedIntersection(Object arg) { - return (List> & I) arg; + return (List> & I) arg; } static class NoStackOverflow { diff --git a/java/java-tests/testData/inspection/nullableProblems/StreamFilterPatching.java b/java/java-tests/testData/inspection/nullableProblems/StreamFilterPatching.java index 6ff75f84a7ea..3a3ec238fd35 100644 --- a/java/java-tests/testData/inspection/nullableProblems/StreamFilterPatching.java +++ b/java/java-tests/testData/inspection/nullableProblems/StreamFilterPatching.java @@ -10,7 +10,7 @@ public class StreamFilterPatching { } public static List getIntegersMR2(List<@Nullable Integer> integers) { - return integers.stream().filter(Objects::isNull).toList(); + return integers.stream().filter(Objects::isNull).toList(); } public static List getIntegersLambda(List<@Nullable Integer> integers) { @@ -18,7 +18,7 @@ public class StreamFilterPatching { } public static List getIntegersLambda2(List<@Nullable Integer> integers) { - return integers.stream().filter(obj -> Objects.isNull(obj)).toList(); + return integers.stream().filter(obj -> Objects.isNull(obj)).toList(); } public static List getIntegersLambda3(List<@Nullable Integer> integers) { diff --git a/java/java-tests/testSrc/com/intellij/java/codeInspection/JSpecifyFilteredAnnotationTest.java b/java/java-tests/testSrc/com/intellij/java/codeInspection/JSpecifyFilteredAnnotationTest.java index 0254c0c85f38..1da1b38e3e9c 100644 --- a/java/java-tests/testSrc/com/intellij/java/codeInspection/JSpecifyFilteredAnnotationTest.java +++ b/java/java-tests/testSrc/com/intellij/java/codeInspection/JSpecifyFilteredAnnotationTest.java @@ -575,8 +575,8 @@ public class JSpecifyFilteredAnnotationTest extends LightJavaCodeInsightFixtureT case "inspection.nullable.problems.Nullable.method.overrides.NotNull", "inspection.nullable.problems.NotNull.parameter.overrides.Nullable", "assigning.a.collection.of.nullable.elements", - "returning.a.class.with.nullable.parameters", - "returning.a.class.with.notnull.parameters" + "returning.a.class.with.nullable.arguments", + "returning.a.class.with.notnull.arguments" //, "non.null.type.argument.is.expected" //todo see IDEA-377707 -> warnings.put(anchor, "jspecify_nullness_mismatch"); case "inspection.nullable.problems.method.overrides.NotNull", "inspection.nullable.problems.parameter.overrides.NotNull" -> diff --git a/java/openapi/resources/messages/JavaBundle.properties b/java/openapi/resources/messages/JavaBundle.properties index 95f4a565d173..b9a7ac34e99c 100644 --- a/java/openapi/resources/messages/JavaBundle.properties +++ b/java/openapi/resources/messages/JavaBundle.properties @@ -562,7 +562,7 @@ inspection.nullable.problems.not.annotated.getters.for.annotated.fields=Report n inspection.nullable.problems.notnull.overrides.option=Report @NotNull ¶meters overriding non-annotated inspection.nullable.problems.notnull.parameters.with.null.literal.option=Report @NotNull parameters with null-literal argument usages inspection.nullable.problems.nullability.on.locals=Report nullability annotations on local variables when they are non-applicable -inspection.nullable.problems.notnull.to.nullable.assignment.conflicts=Report assignment of a @NotNull type parameter to @Nullable type parameter +inspection.nullable.problems.notnull.to.nullable.assignment.conflicts=Report assignment of a not-null type argument to a nullable type argument inspection.nullable.problems.redundant.nullability.inside.container=Report redundant nullability annotation in the scope of annotated container inspection.optional.get.without.is.present.message={0}.#ref() without ''isPresent()'' check inspection.optional.get.without.is.present.method.reference.message=#ref without 'isPresent()' check