fix typo in dfa warning text

This commit is contained in:
peter
2018-02-07 15:49:56 +01:00
parent c533157970
commit 7ea47bbbb0
13 changed files with 23 additions and 23 deletions
@@ -562,13 +562,13 @@ public class DataFlowInspectionBase extends AbstractBaseJavaLocalInspectionTool
if (reportedAnchors.contains(expr)) continue;
if (expr.getParent() instanceof PsiMethodReferenceExpression) {
holder.registerProblem(expr.getParent(), "Method reference argument might be null but passed to non annotated parameter");
holder.registerProblem(expr.getParent(), "Method reference argument might be null but passed to non-annotated parameter");
continue;
}
final String text = isNullLiteralExpression(expr)
? "Passing <code>null</code> argument to non annotated parameter"
: "Argument <code>#ref</code> #loc might be null but passed to non annotated parameter";
? "Passing <code>null</code> argument to non-annotated parameter"
: "Argument <code>#ref</code> #loc might be null but passed to non-annotated parameter";
List<LocalQuickFix> fixes = createNPEFixes((PsiExpression)expr, (PsiExpression)expr, holder.isOnTheFly());
final PsiElement parent = expr.getParent();
if (parent instanceof PsiExpressionList) {
@@ -5,7 +5,7 @@ class BrokenAlignment {
String unknown(String s) { return s; }
public void example(@Nullable String value) {
value = unknown(<warning descr="Argument 'value' might be null but passed to non annotated parameter">value</warning>);
value = unknown(<warning descr="Argument 'value' might be null but passed to non-annotated parameter">value</warning>);
if (value.contains("%")) {
}
}
@@ -9,7 +9,7 @@ class BrokenAlignment {
System.out.println(data.getText().hashCode());
}
data = new Data(null, <warning descr="Passing 'null' argument to non annotated parameter">null</warning>);
data = new Data(null, <warning descr="Passing 'null' argument to non-annotated parameter">null</warning>);
System.out.println(data.getText().<warning descr="Method invocation 'hashCode' may produce 'java.lang.NullPointerException'">hashCode</warning>());
if (data.getInner() != null) {
@@ -19,7 +19,7 @@ class BrokenAlignment {
System.out.println(data.getInner().hashCode());
}
data = new Data(null, <warning descr="Passing 'null' argument to non annotated parameter">null</warning>);
data = new Data(null, <warning descr="Passing 'null' argument to non-annotated parameter">null</warning>);
System.out.println(data.getInner().<warning descr="Method invocation 'hashCode' may produce 'java.lang.NullPointerException'">hashCode</warning>());
}
}
@@ -6,7 +6,7 @@ class BrokenAlignment {
System.out.println(data.text.hashCode());
}
data = new Data(null, <warning descr="Passing 'null' argument to non annotated parameter">null</warning>);
data = new Data(null, <warning descr="Passing 'null' argument to non-annotated parameter">null</warning>);
System.out.println(data.text.<warning descr="Method invocation 'hashCode' may produce 'java.lang.NullPointerException'">hashCode</warning>());
if (data.inner != null) {
@@ -16,7 +16,7 @@ class BrokenAlignment {
System.out.println(data.inner.hashCode());
}
data = new Data(null, <warning descr="Passing 'null' argument to non annotated parameter">null</warning>);
data = new Data(null, <warning descr="Passing 'null' argument to non-annotated parameter">null</warning>);
System.out.println(data.inner.<warning descr="Method invocation 'hashCode' may produce 'java.lang.NullPointerException'">hashCode</warning>());
}
}
@@ -11,7 +11,7 @@ class Test {
}
void usage() {
dangerousMethod(<warning descr="Passing 'null' argument to non annotated parameter">null</warning>);
dangerousMethod(<warning descr="Passing 'null' argument to non-annotated parameter">null</warning>);
}
}
@@ -9,7 +9,7 @@ class Test {
throw new IllegalStateException();
}
public static void main(String[] args) {
printAndThrow("test", <warning descr="Passing 'null' argument to non annotated parameter">null</warning>);
printAndThrow(<warning descr="Passing 'null' argument to non annotated parameter">null</warning>, new NullPointerException());
printAndThrow("test", <warning descr="Passing 'null' argument to non-annotated parameter">null</warning>);
printAndThrow(<warning descr="Passing 'null' argument to non-annotated parameter">null</warning>, new NullPointerException());
}
}
@@ -24,6 +24,6 @@ class Test {
}
public static void main(String[] args) {
testMethod(<warning descr="Passing 'null' argument to non annotated parameter">null</warning>, <warning descr="Passing 'null' argument to non annotated parameter">null</warning>, <warning descr="Passing 'null' argument to non annotated parameter">null</warning>, <warning descr="Passing 'null' argument to non annotated parameter">null</warning>, 10);
testMethod(<warning descr="Passing 'null' argument to non-annotated parameter">null</warning>, <warning descr="Passing 'null' argument to non-annotated parameter">null</warning>, <warning descr="Passing 'null' argument to non-annotated parameter">null</warning>, <warning descr="Passing 'null' argument to non-annotated parameter">null</warning>, 10);
}
}
@@ -21,6 +21,6 @@ class Test {
}
public static void main(String[] args) {
testMethod(<warning descr="Passing 'null' argument to non annotated parameter">null</warning>, "I am not null", <warning descr="Passing 'null' argument to non annotated parameter">null</warning>, <warning descr="Passing 'null' argument to non annotated parameter">null</warning>, 10);
testMethod(<warning descr="Passing 'null' argument to non-annotated parameter">null</warning>, "I am not null", <warning descr="Passing 'null' argument to non-annotated parameter">null</warning>, <warning descr="Passing 'null' argument to non-annotated parameter">null</warning>, 10);
}
}
@@ -1,6 +1,6 @@
class NullLiteralAndInferredMethodContract {
{
initExpressionConstraints(<warning descr="Passing 'null' argument to non annotated parameter">null</warning>);
initExpressionConstraints(<warning descr="Passing 'null' argument to non-annotated parameter">null</warning>);
}
public void initExpressionConstraints(Object parent) {
@@ -1,7 +1,7 @@
class Test {
void m() {
throwAnException(<warning descr="Passing 'null' argument to non annotated parameter">null</warning>);
throwAnException(<warning descr="Passing 'null' argument to non-annotated parameter">null</warning>);
}
static void throwAnException(String arg) {
@@ -8,6 +8,6 @@ class Test {
}
void m() {
useAndReturnValue(<warning descr="Passing 'null' argument to non annotated parameter">null</warning>);
useAndReturnValue(<warning descr="Passing 'null' argument to non-annotated parameter">null</warning>);
}
}
@@ -129,7 +129,7 @@ public class OptionalInlining {
}
void testGuavaTransform(com.google.common.base.Optional<String> opt) {
String trimmed = com.google.common.base.Optional.fromNullable(<warning descr="Argument 'nullableMethod()' might be null but passed to non annotated parameter">nullableMethod()</warning>).transform(xx -> xx.trim()).or("");
String trimmed = com.google.common.base.Optional.fromNullable(<warning descr="Argument 'nullableMethod()' might be null but passed to non-annotated parameter">nullableMethod()</warning>).transform(xx -> xx.trim()).or("");
if(<warning descr="Condition 'trimmed == null' is always 'false'">trimmed == null</warning>) {
System.out.println("impossible");
}
@@ -145,7 +145,7 @@ public class OptionalInlining {
void testToJavaUtil() {
String xyz = nullableMethod();
Object n = com.google.common.base.Optional.fromNullable(<warning descr="Argument 'xyz' might be null but passed to non annotated parameter">xyz</warning>).transform(String::trim).toJavaUtil().map(this::getObj).orElse(null);
Object n = com.google.common.base.Optional.fromNullable(<warning descr="Argument 'xyz' might be null but passed to non-annotated parameter">xyz</warning>).transform(String::trim).toJavaUtil().map(this::getObj).orElse(null);
if(n instanceof Integer) {
// n instanceof Integer -> n is not null -> xyz was not null -> safe to dereference
System.out.println(xyz.trim());
@@ -5,11 +5,11 @@ class OptionalTooComplex {
// Should not be too complex
public Long fetch() {
final PreparedStatement ps = builder
.setInteger(<warning descr="Argument 'opt().orElse(null)' might be null but passed to non annotated parameter">opt().orElse(null)</warning>)
.setInteger(<warning descr="Argument 'opt().orElse(null)' might be null but passed to non annotated parameter">opt().orElse(null)</warning>)
.setInteger(<warning descr="Argument 'opt().orElse(null)' might be null but passed to non annotated parameter">opt().orElse(null)</warning>)
.setInteger(<warning descr="Argument 'opt().orElse(null)' might be null but passed to non annotated parameter">opt().orElse(null)</warning>)
.setInteger(<warning descr="Argument 'opt().orElse(null)' might be null but passed to non annotated parameter">opt().orElse(null)</warning>)
.setInteger(<warning descr="Argument 'opt().orElse(null)' might be null but passed to non-annotated parameter">opt().orElse(null)</warning>)
.setInteger(<warning descr="Argument 'opt().orElse(null)' might be null but passed to non-annotated parameter">opt().orElse(null)</warning>)
.setInteger(<warning descr="Argument 'opt().orElse(null)' might be null but passed to non-annotated parameter">opt().orElse(null)</warning>)
.setInteger(<warning descr="Argument 'opt().orElse(null)' might be null but passed to non-annotated parameter">opt().orElse(null)</warning>)
.setInteger(<warning descr="Argument 'opt().orElse(null)' might be null but passed to non-annotated parameter">opt().orElse(null)</warning>)
.build();
ResultSet rs = null;