From 1558ebcc44a7258d5a687cba143102bee3501972 Mon Sep 17 00:00:00 2001 From: Alexandr Evstigneev Date: Sun, 20 Aug 2023 11:43:53 +0400 Subject: [PATCH] Refactoring: ArrayList -> List and parameters annotations GitOrigin-RevId: edb20461f7735a0c9e96574801bbeb60480686d3 --- .../codeInsight/dataflow/Semilattice.java | 23 +++++-------------- .../dataflow/PyReachingDefsSemilattice.java | 9 ++++---- 2 files changed, 11 insertions(+), 21 deletions(-) diff --git a/platform/analysis-impl/src/com/intellij/codeInsight/dataflow/Semilattice.java b/platform/analysis-impl/src/com/intellij/codeInsight/dataflow/Semilattice.java index 0b1e89a7eaeb..fa2885054d8f 100644 --- a/platform/analysis-impl/src/com/intellij/codeInsight/dataflow/Semilattice.java +++ b/platform/analysis-impl/src/com/intellij/codeInsight/dataflow/Semilattice.java @@ -1,23 +1,12 @@ -/* - * Copyright 2000-2007 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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.codeInsight.dataflow; -import java.util.ArrayList; +import org.jetbrains.annotations.NotNull; + +import java.util.List; public interface Semilattice { - E join(ArrayList ins); + E join(@NotNull List ins); - boolean eq(E e1, E e2); + boolean eq(@NotNull E e1, @NotNull E e2); } \ No newline at end of file diff --git a/python/python-psi-impl/src/com/jetbrains/python/codeInsight/dataflow/PyReachingDefsSemilattice.java b/python/python-psi-impl/src/com/jetbrains/python/codeInsight/dataflow/PyReachingDefsSemilattice.java index 3ce9e600b6b5..c036c9c7c7e7 100644 --- a/python/python-psi-impl/src/com/jetbrains/python/codeInsight/dataflow/PyReachingDefsSemilattice.java +++ b/python/python-psi-impl/src/com/jetbrains/python/codeInsight/dataflow/PyReachingDefsSemilattice.java @@ -6,15 +6,16 @@ import com.intellij.codeInsight.dataflow.map.MapSemilattice; import com.intellij.psi.PsiElement; import com.jetbrains.python.codeInsight.dataflow.scope.ScopeVariable; import com.jetbrains.python.codeInsight.dataflow.scope.impl.ScopeVariableImpl; +import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import java.util.ArrayList; import java.util.HashSet; +import java.util.List; import java.util.Set; public class PyReachingDefsSemilattice implements MapSemilattice { @Override - public boolean eq(DFAMap e1, DFAMap e2) { + public boolean eq(@NotNull DFAMap e1, @NotNull DFAMap e2) { if (e1 == PyReachingDefsDfaInstance.INITIAL_MAP && e2 != PyReachingDefsDfaInstance.INITIAL_MAP || e2 == PyReachingDefsDfaInstance.INITIAL_MAP && e1 != PyReachingDefsDfaInstance.INITIAL_MAP) { return false; @@ -23,7 +24,7 @@ public class PyReachingDefsSemilattice implements MapSemilattice } @Override - public DFAMap join(ArrayList> ins) { + public DFAMap join(@NotNull List> ins) { if (ins.isEmpty()) { return DFAMap.empty(); } @@ -58,7 +59,7 @@ public class PyReachingDefsSemilattice implements MapSemilattice } @Nullable - private static Set getResultNames(final ArrayList> ins) { + private static Set getResultNames(final List> ins) { // Compute intersection of all the names Set names2Include = null; for (DFAMap map : ins) {