mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-04-19 21:11:28 +07:00
IDEA-179871 Automatically use nullable annotations in constructor generation
This commit is contained in:
@@ -275,7 +275,7 @@ public class GenerateConstructorHandler extends GenerateMembersHandlerBase {
|
||||
parmName = javaStyle.suggestUniqueVariableName(parmName, dummyConstructor, true);
|
||||
PsiParameter parm = factory.createParameter(parmName, field.getType(), aClass);
|
||||
|
||||
NullableNotNullManager.getInstance(project).copyNotNullAnnotation(field, parm);
|
||||
NullableNotNullManager.getInstance(project).copyNullableOrNotNullAnnotation(field, parm);
|
||||
|
||||
if (constructor.isVarArgs()) {
|
||||
final PsiParameterList parameterList = constructor.getParameterList();
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
class C {
|
||||
private @Nullable String s;
|
||||
|
||||
public C(@Nullable String s) {
|
||||
this.s = s;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
class C {
|
||||
private @Nullable String s;
|
||||
|
||||
<caret>
|
||||
}
|
||||
@@ -92,6 +92,8 @@ public class GenerateConstructorTest extends LightCodeInsightFixtureTestCase {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testNullableField() { doTest(); }
|
||||
|
||||
private void doTest() {
|
||||
doTest(false);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user