mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-05 01:50:56 +07:00
copy also nullable annotations when create constructor parameter from field (IDEA-164493)
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -43,7 +43,6 @@ import com.intellij.psi.util.PsiTreeUtil;
|
||||
import com.intellij.psi.util.PsiUtil;
|
||||
import com.intellij.refactoring.changeSignature.ParameterInfoImpl;
|
||||
import com.intellij.refactoring.util.RefactoringUtil;
|
||||
import com.intellij.util.Function;
|
||||
import com.intellij.util.IncorrectOperationException;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import com.intellij.util.containers.MultiMap;
|
||||
@@ -334,7 +333,7 @@ public class CreateConstructorParameterFromFieldFix implements IntentionAction {
|
||||
if (parameter == null) {
|
||||
continue;
|
||||
}
|
||||
NullableNotNullManager.getInstance(field.getProject()).copyNotNullAnnotation(field, parameter);
|
||||
NullableNotNullManager.getInstance(field.getProject()).copyNullableOrNotNullAnnotation(field, parameter);
|
||||
cleanupElements.add(manager.createSmartPsiElementPointer(parameter));
|
||||
final PsiElement assignmentStatement = AssignFieldFromParameterAction.addFieldAssignmentStatement(project, field, parameter, editor);
|
||||
if (assignmentStatement != null) {
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
// "Add constructor parameter" "true"
|
||||
import org.jetbrains.annotations.*;
|
||||
class A {
|
||||
@Nullable private final Object field;
|
||||
|
||||
A(@Nullable Object field, String... strs) {
|
||||
this.field = field;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
// "Add constructor parameter" "true"
|
||||
import org.jetbrains.annotations.*;
|
||||
class A {
|
||||
@Nullable private final Object <caret>field;
|
||||
|
||||
A(String... strs) {
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user