cleanup JavaTelescope

GitOrigin-RevId: 881c66ff97088cd4e97cf2567c9fd7935578ddf0
This commit is contained in:
Max Medvedev
2024-08-25 17:05:53 +02:00
committed by intellij-monorepo-bot
parent 2d386a48c8
commit 1729cd94d5
2 changed files with 6 additions and 6 deletions

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2020 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.
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.codeInsight.daemon.impl;
import com.intellij.concurrency.JobLauncher;
@@ -20,6 +20,7 @@ import com.intellij.psi.search.searches.OverridingMethodsSearch;
import com.intellij.util.ObjectUtils;
import org.jetbrains.annotations.Nls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.List;
import java.util.concurrent.atomic.AtomicInteger;
@@ -41,7 +42,7 @@ final class JavaTelescope {
}
}
static @Nls UsagesHint usagesHint(@NotNull PsiMember member, @NotNull PsiFile file) {
static @Nullable UsagesHint usagesHint(@NotNull PsiMember member, @NotNull PsiFile file) {
int totalUsageCount = UsagesCountManager.getInstance(member.getProject()).countMemberUsages(file, member);
if (totalUsageCount == TOO_MANY_USAGES) return null;
if (totalUsageCount < AdvancedSettings.getInt("code.vision.java.minimal.usages")) return null;

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.codeInsight.daemon.impl
import com.intellij.codeInsight.codeVision.CodeVisionRelativeOrdering
@@ -24,9 +24,8 @@ class JavaReferencesCodeVisionProvider : RenameAwareReferencesCodeVisionProvider
private fun getVisionInfo(element: PsiElement, file: PsiFile): CodeVisionProviderBase.CodeVisionInfo? {
val inspection = UnusedDeclarationInspectionBase.findUnusedDeclarationInspection(element)
if (inspection.isEntryPoint(element)) return null
return JavaTelescope.usagesHint(element as PsiMember, file)?.let {
CodeVisionProviderBase.CodeVisionInfo(it.hint, it.count)
}
val usagesHint = JavaTelescope.usagesHint(element as PsiMember, file) ?: return null
return CodeVisionProviderBase.CodeVisionInfo(usagesHint.hint, usagesHint.count)
}
override fun getHint(element: PsiElement, file: PsiFile): String? {