Annotate 'element' parameter of RefactoringFactory.createRename() as @NotNull

This commit is contained in:
Dmitry Jemerov
2017-12-28 11:57:37 +01:00
parent b8e32d164d
commit a43c1e670d
4 changed files with 14 additions and 60 deletions
@@ -1,17 +1,5 @@
/*
* Copyright 2000-2009 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.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
*/
package com.intellij.refactoring.openapi.impl;
@@ -36,12 +24,12 @@ public class JavaRefactoringFactoryImpl extends JavaRefactoringFactory {
myProject = project;
}
public JavaRenameRefactoring createRename(PsiElement element, String newName) {
public JavaRenameRefactoring createRename(@NotNull PsiElement element, String newName) {
return new JavaRenameRefactoringImpl(myProject, element, newName, true, true);
}
@Override
public RenameRefactoring createRename(PsiElement element, String newName, boolean searchInComments, boolean searchInNonJavaFiles) {
public RenameRefactoring createRename(@NotNull PsiElement element, String newName, boolean searchInComments, boolean searchInNonJavaFiles) {
return new JavaRenameRefactoringImpl(myProject, element, newName, searchInComments, searchInNonJavaFiles);
}
@@ -1,17 +1,5 @@
/*
* Copyright 2000-2009 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.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
*/
package com.intellij.refactoring;
@@ -30,7 +18,7 @@ public abstract class JavaRefactoringFactory extends RefactoringFactory {
return (JavaRefactoringFactory) ServiceManager.getService(project, RefactoringFactory.class);
}
public abstract JavaRenameRefactoring createRename(PsiElement element, String newName);
public abstract JavaRenameRefactoring createRename(@NotNull PsiElement element, String newName);
@Nullable("in case the source file is not located under any source root")
public abstract MoveInnerRefactoring createMoveInner(PsiClass innerClass, String newName,
@@ -1,23 +1,12 @@
/*
* Copyright 2000-2009 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.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
*/
package com.intellij.refactoring;
import com.intellij.openapi.components.ServiceManager;
import com.intellij.openapi.project.Project;
import com.intellij.psi.*;
import com.intellij.psi.PsiElement;
import org.jetbrains.annotations.NotNull;
/**
* @author dsl
@@ -27,8 +16,8 @@ public abstract class RefactoringFactory {
return ServiceManager.getService(project, RefactoringFactory.class);
}
public abstract RenameRefactoring createRename(PsiElement element, String newName);
public abstract RenameRefactoring createRename(PsiElement element, String newName, boolean searchInComments, boolean searchInNonJavaFiles);
public abstract RenameRefactoring createRename(@NotNull PsiElement element, String newName);
public abstract RenameRefactoring createRename(@NotNull PsiElement element, String newName, boolean searchInComments, boolean searchInNonJavaFiles);
public abstract SafeDeleteRefactoring createSafeDelete(PsiElement[] elements);
}
@@ -1,17 +1,5 @@
/*
* Copyright 2000-2009 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.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
*/
package com.intellij.refactoring.openapi.impl;
@@ -21,6 +9,7 @@ import com.intellij.psi.PsiElement;
import com.intellij.refactoring.RefactoringFactory;
import com.intellij.refactoring.RenameRefactoring;
import com.intellij.refactoring.SafeDeleteRefactoring;
import org.jetbrains.annotations.NotNull;
/**
* @author yole
@@ -33,12 +22,12 @@ public class RefactoringFactoryImpl extends RefactoringFactory {
}
@Override
public RenameRefactoring createRename(final PsiElement element, final String newName) {
public RenameRefactoring createRename(@NotNull final PsiElement element, final String newName) {
return new RenameRefactoringImpl(myProject, element, newName, true, true);
}
@Override
public RenameRefactoring createRename(PsiElement element, String newName, boolean searchInComments, boolean searchInNonJavaFiles) {
public RenameRefactoring createRename(@NotNull PsiElement element, String newName, boolean searchInComments, boolean searchInNonJavaFiles) {
return new RenameRefactoringImpl(myProject, element, newName, searchInComments, searchInNonJavaFiles);
}