Refactoring: ArrayList -> List and parameters annotations

GitOrigin-RevId: edb20461f7735a0c9e96574801bbeb60480686d3
This commit is contained in:
Alexandr Evstigneev
2023-08-20 11:43:53 +04:00
committed by intellij-monorepo-bot
parent b07eabd319
commit 1558ebcc44
2 changed files with 11 additions and 21 deletions

View File

@@ -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> {
E join(ArrayList<E> ins);
E join(@NotNull List<E> ins);
boolean eq(E e1, E e2);
boolean eq(@NotNull E e1, @NotNull E e2);
}

View File

@@ -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<ScopeVariable> {
@Override
public boolean eq(DFAMap<ScopeVariable> e1, DFAMap<ScopeVariable> e2) {
public boolean eq(@NotNull DFAMap<ScopeVariable> e1, @NotNull DFAMap<ScopeVariable> 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<ScopeVariable>
}
@Override
public DFAMap<ScopeVariable> join(ArrayList<DFAMap<ScopeVariable>> ins) {
public DFAMap<ScopeVariable> join(@NotNull List<DFAMap<ScopeVariable>> ins) {
if (ins.isEmpty()) {
return DFAMap.empty();
}
@@ -58,7 +59,7 @@ public class PyReachingDefsSemilattice implements MapSemilattice<ScopeVariable>
}
@Nullable
private static Set<String> getResultNames(final ArrayList<DFAMap<ScopeVariable>> ins) {
private static Set<String> getResultNames(final List<DFAMap<ScopeVariable>> ins) {
// Compute intersection of all the names
Set<String> names2Include = null;
for (DFAMap<ScopeVariable> map : ins) {