From a43c1e670d5545d698752425df084334b6aad588 Mon Sep 17 00:00:00 2001 From: Dmitry Jemerov Date: Thu, 28 Dec 2017 11:52:08 +0100 Subject: [PATCH] Annotate 'element' parameter of RefactoringFactory.createRename() as @NotNull --- .../impl/JavaRefactoringFactoryImpl.java | 18 +++------------- .../refactoring/JavaRefactoringFactory.java | 16 ++------------ .../refactoring/RefactoringFactory.java | 21 +++++-------------- .../openapi/impl/RefactoringFactoryImpl.java | 19 ++++------------- 4 files changed, 14 insertions(+), 60 deletions(-) diff --git a/java/java-impl/src/com/intellij/refactoring/openapi/impl/JavaRefactoringFactoryImpl.java b/java/java-impl/src/com/intellij/refactoring/openapi/impl/JavaRefactoringFactoryImpl.java index 0db60480cd0c..92c8dc2b054d 100644 --- a/java/java-impl/src/com/intellij/refactoring/openapi/impl/JavaRefactoringFactoryImpl.java +++ b/java/java-impl/src/com/intellij/refactoring/openapi/impl/JavaRefactoringFactoryImpl.java @@ -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); } diff --git a/java/openapi/src/com/intellij/refactoring/JavaRefactoringFactory.java b/java/openapi/src/com/intellij/refactoring/JavaRefactoringFactory.java index e625e4fd6bda..c8796e5d2c9d 100644 --- a/java/openapi/src/com/intellij/refactoring/JavaRefactoringFactory.java +++ b/java/openapi/src/com/intellij/refactoring/JavaRefactoringFactory.java @@ -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, diff --git a/platform/lang-api/src/com/intellij/refactoring/RefactoringFactory.java b/platform/lang-api/src/com/intellij/refactoring/RefactoringFactory.java index 7c666bc788e3..794ee7207c37 100644 --- a/platform/lang-api/src/com/intellij/refactoring/RefactoringFactory.java +++ b/platform/lang-api/src/com/intellij/refactoring/RefactoringFactory.java @@ -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); } diff --git a/platform/lang-impl/src/com/intellij/refactoring/openapi/impl/RefactoringFactoryImpl.java b/platform/lang-impl/src/com/intellij/refactoring/openapi/impl/RefactoringFactoryImpl.java index 0857535fa125..cf07e4ff8d89 100644 --- a/platform/lang-impl/src/com/intellij/refactoring/openapi/impl/RefactoringFactoryImpl.java +++ b/platform/lang-impl/src/com/intellij/refactoring/openapi/impl/RefactoringFactoryImpl.java @@ -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); }