mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-05 01:50:56 +07:00
[kotlin] J2K: make sure that thrown expression is not-null
KTIJ-29147 GitOrigin-RevId: 5d66e5d781c83589d9e6c176a27da3c56b72cfe8
This commit is contained in:
committed by
intellij-monorepo-bot
parent
2230a6b862
commit
ff9ec9140f
@@ -5341,6 +5341,11 @@ public abstract class NewJavaToKotlinConverterSingleFileTestGenerated extends Ab
|
||||
runTest("../../shared/tests/testData/newJ2k/nullability/synchronized.java");
|
||||
}
|
||||
|
||||
@TestMetadata("throw.java")
|
||||
public void testThrow() throws Exception {
|
||||
runTest("../../shared/tests/testData/newJ2k/nullability/throw.java");
|
||||
}
|
||||
|
||||
@TestMetadata("VariableAssignedWithNull.java")
|
||||
public void testVariableAssignedWithNull() throws Exception {
|
||||
runTest("../../shared/tests/testData/newJ2k/nullability/VariableAssignedWithNull.java");
|
||||
|
||||
@@ -5341,6 +5341,11 @@ public abstract class K2JavaToKotlinConverterSingleFileTestGenerated extends Abs
|
||||
runTest("../../shared/tests/testData/newJ2k/nullability/synchronized.java");
|
||||
}
|
||||
|
||||
@TestMetadata("throw.java")
|
||||
public void testThrow() throws Exception {
|
||||
runTest("../../shared/tests/testData/newJ2k/nullability/throw.java");
|
||||
}
|
||||
|
||||
@TestMetadata("VariableAssignedWithNull.java")
|
||||
public void testVariableAssignedWithNull() throws Exception {
|
||||
runTest("../../shared/tests/testData/newJ2k/nullability/VariableAssignedWithNull.java");
|
||||
|
||||
@@ -426,7 +426,10 @@ class J2KNullityInferrer {
|
||||
private boolean processParameter(@NotNull PsiParameter parameter, @NotNull PsiReferenceExpression expr, PsiElement parent) {
|
||||
if (PsiUtil.isAccessedForWriting(expr)) return true;
|
||||
|
||||
if (parent instanceof PsiSynchronizedStatement) {
|
||||
if (parent instanceof PsiThrowStatement) {
|
||||
registerNotNullAnnotation(parameter);
|
||||
return true;
|
||||
} else if (parent instanceof PsiSynchronizedStatement) {
|
||||
registerNotNullAnnotation(parameter);
|
||||
return true;
|
||||
} else if (parent instanceof PsiArrayAccessExpression) {
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
public class J {
|
||||
void foo(Exception notNull) throws Exception {
|
||||
throw notNull;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
class J {
|
||||
@Throws(Exception::class)
|
||||
fun foo(notNull: Exception) {
|
||||
throw notNull
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user