cleanup, notnull

GitOrigin-RevId: 18883c05ffe3ea5ff0a64236ccb058e5146b2026
This commit is contained in:
Alexey Kudravtsev
2022-04-07 18:28:19 +02:00
committed by intellij-monorepo-bot
parent 8bc977c08c
commit 65b11bf5fc
3 changed files with 13 additions and 12 deletions

View File

@@ -1004,7 +1004,7 @@ public class JavaMatchingVisitor extends JavaElementVisitor {
final PsiTypeElement typeElement1 = var.getTypeElement();
if (typeElement1 != null) {
PsiTypeElement typeElement2 = other.getTypeElement();
if (typeElement2 == null) { // e.g. lambda parameter without explicit type
if (typeElement2 == null) { // e.g., lambda parameter without explicit type
typeElement2 = JavaPsiFacade.getElementFactory(other.getProject()).createTypeElement(other.getType());
final MatchingHandler matchingHandler = context.getPattern().getHandler(typeElement1);
if (matchingHandler instanceof SubstitutionHandler) {
@@ -1737,7 +1737,7 @@ public class JavaMatchingVisitor extends JavaElementVisitor {
}
private boolean matchAnnotations(@NotNull PsiElement pattern, PsiElement matched) {
// can't use PsiAnnotationOwner api because it is not implemented completely yet (see e.g. ClsTypeParameterImpl)
// can't use PsiAnnotationOwner api because it is not implemented completely yet (see e.g., ClsTypeParameterImpl)
final PsiAnnotation[] annotations = PsiTreeUtil.getChildrenOfType(pattern, PsiAnnotation.class);
if (annotations == null) {
return true;

View File

@@ -40,6 +40,7 @@ import static com.intellij.ide.actions.DragEditorTabsFusEventFields.SAME_WINDOW;
import static javax.swing.SwingConstants.*;
public final class DockableEditorTabbedContainer implements DockContainer.Persistent, Activatable, Disposable {
@NotNull
private final EditorsSplitters mySplitters;
private final Project myProject;
@@ -285,7 +286,7 @@ public final class DockableEditorTabbedContainer implements DockContainer.Persis
return mySplitters;
}
public EditorsSplitters getSplitters() {
public @NotNull EditorsSplitters getSplitters() {
return mySplitters;
}

View File

@@ -213,7 +213,7 @@ public class FileEditorManagerImpl extends FileEditorManagerEx implements Persis
}, myProject);
}
private void registerEditor(Editor editor) {
private void registerEditor(@NotNull Editor editor) {
Project project = editor.getProject();
if (project == null || project.isDisposed()) {
return;
@@ -268,7 +268,7 @@ public class FileEditorManagerImpl extends FileEditorManagerEx implements Persis
public void dispose() {
}
private void dumbModeFinished(Project project) {
private void dumbModeFinished(@NotNull Project project) {
VirtualFile[] files = getOpenFiles();
for (VirtualFile file : files) {
List<EditorComposite> composites = getAllComposites(file);
@@ -350,6 +350,7 @@ public class FileEditorManagerImpl extends FileEditorManagerEx implements Persis
return result;
}
@NotNull
private EditorsSplitters getActiveSplittersSync() {
assertDispatchThread();
if (Registry.is("ide.navigate.to.recently.focused.editor", false)) {
@@ -670,8 +671,7 @@ public class FileEditorManagerImpl extends FileEditorManagerEx implements Persis
@Override
public EditorWindow getCurrentWindow() {
if (!ApplicationManager.getApplication().isDispatchThread()) return null;
EditorsSplitters splitters = getActiveSplittersSync();
return splitters == null ? null : splitters.getCurrentWindow();
return getActiveSplittersSync().getCurrentWindow();
}
@Override
@@ -766,8 +766,7 @@ public class FileEditorManagerImpl extends FileEditorManagerEx implements Persis
@Nullable
private EditorWindow findWindowInAllSplitters(@NotNull VirtualFile file) {
EditorsSplitters activeSplitters = getActiveSplittersSync();
EditorWindow activeCurrentWindow = activeSplitters.getCurrentWindow();
EditorWindow activeCurrentWindow = getActiveSplittersSync().getCurrentWindow();
if (activeCurrentWindow != null && isFileOpenInWindow(file, activeCurrentWindow)) {
return activeCurrentWindow;
}
@@ -1378,9 +1377,7 @@ public class FileEditorManagerImpl extends FileEditorManagerEx implements Persis
@Override
public @NotNull EditorsSplitters getSplitters() {
EditorsSplitters active = null;
if (ApplicationManager.getApplication().isDispatchThread()) active = getActiveSplittersSync();
return active == null ? getMainSplitters() : active;
return ApplicationManager.getApplication().isDispatchThread() ? getActiveSplittersSync() : getMainSplitters();
}
@Override
@@ -1402,18 +1399,21 @@ public class FileEditorManagerImpl extends FileEditorManagerEx implements Persis
@Override
public @Nullable FileEditorWithProvider getSelectedEditorWithProvider(@NotNull VirtualFile file) {
ApplicationManager.getApplication().assertIsDispatchThread();
EditorComposite composite = getComposite(file);
return composite == null ? null : composite.getSelectedWithProvider();
}
@Override
public @NotNull Pair<FileEditor[], FileEditorProvider[]> getEditorsWithProviders(@NotNull VirtualFile file) {
ApplicationManager.getApplication().assertIsDispatchThread();
EditorComposite composite = getComposite(file);
return EditorComposite.retrofit(composite);
}
@Override
public FileEditor @NotNull [] getEditors(@NotNull VirtualFile file) {
ApplicationManager.getApplication().assertIsDispatchThread();
return getEditorsWithProviders(file).getFirst();
}