Minimize nullability of parameters for StubInconsistencyReportUtil.reportStubTreeAndIndexDoNotMatch for IDEA-331326

GitOrigin-RevId: 47bb118c811852bcc96453bd03113f7a7b1370c0
This commit is contained in:
Elena Shaverdova
2024-03-27 23:06:24 +00:00
committed by intellij-monorepo-bot
parent 59e5fced54
commit f821605ec8
5 changed files with 9 additions and 14 deletions
@@ -80,5 +80,5 @@ public interface StubInconsistencyReporter {
*/
enum StubTreeAndIndexDoNotMatchSource {FileTreesPsiReconciliation, WrongPsiFileClassInNonPsiStub, ZeroStubIdList, StubPsiCheck}
void reportStubTreeAndIndexDoNotMatch(@NotNull Project project, @Nullable StubTreeAndIndexDoNotMatchSource source);
void reportStubTreeAndIndexDoNotMatch(@NotNull Project project, @NotNull StubTreeAndIndexDoNotMatchSource source);
}
@@ -68,7 +68,7 @@ public abstract class StubTreeLoader {
@Nullable ObjectStubTree<?> stubTree,
@NotNull PsiFileWithStubSupport psiFile,
@Nullable Throwable cause,
@Nullable StubInconsistencyReporter.StubTreeAndIndexDoNotMatchSource source
@NotNull StubInconsistencyReporter.StubTreeAndIndexDoNotMatchSource source
) {
return ProgressManager.getInstance().computeInNonCancelableSection(() -> {
return doCreateCoarseExceptionStubTreeAndIndexDoNotMatch(stubTree, psiFile, cause, source).doCreateCompleteException();
@@ -84,7 +84,7 @@ public abstract class StubTreeLoader {
@Nullable ObjectStubTree<?> stubTree,
@NotNull PsiFileWithStubSupport psiFile,
@Nullable Throwable cause,
@Nullable StubInconsistencyReporter.StubTreeAndIndexDoNotMatchSource source
@NotNull StubInconsistencyReporter.StubTreeAndIndexDoNotMatchSource source
) {
return ProgressManager.getInstance().computeInNonCancelableSection(() -> {
return doCreateCoarseExceptionStubTreeAndIndexDoNotMatch(stubTree, psiFile, cause, source);
@@ -95,7 +95,7 @@ public abstract class StubTreeLoader {
@Nullable ObjectStubTree<?> stubTree,
@NotNull PsiFileWithStubSupport psiFile,
@Nullable Throwable cause,
@Nullable StubInconsistencyReporter.StubTreeAndIndexDoNotMatchSource source
@NotNull StubInconsistencyReporter.StubTreeAndIndexDoNotMatchSource source
) {
return ProgressManager.getInstance().computeInNonCancelableSection(() -> {
VirtualFile file = psiFile.getViewProvider().getVirtualFile();
@@ -82,7 +82,7 @@ public abstract class StubProcessingHelperBase {
private <Psi extends PsiElement> boolean checkType(@NotNull Class<Psi> requiredClass, PsiFile psiFile, @Nullable PsiElement psiElement,
@NotNull Computable<String> debugOperationName, @NotNull StubIdList debugStubIdList,
@Nullable StubInconsistencyReporter.StubTreeAndIndexDoNotMatchSource source) {
@NotNull StubInconsistencyReporter.StubTreeAndIndexDoNotMatchSource source) {
if (requiredClass.isInstance(psiElement)) return true;
String extraMessage = "psiElement is not instance of requiredClass.\n" +
@@ -159,7 +159,7 @@ public abstract class StubProcessingHelperBase {
@Nullable ObjectStubTree<?> stubTree,
@NotNull PsiFileWithStubSupport psiFile,
@NotNull String extraMessage,
@Nullable StubInconsistencyReporter.StubTreeAndIndexDoNotMatchSource source
@NotNull StubInconsistencyReporter.StubTreeAndIndexDoNotMatchSource source
) {
try {
StubTextInconsistencyException.checkStubTextConsistency(psiFile, SourceOfCheck.WrongTypePsiInStubHelper);
@@ -47,13 +47,8 @@ object StubInconsistencyReportUtil {
)
@JvmStatic
fun reportStubTreeAndIndexDoNotMatch(project: Project, source: StubTreeAndIndexDoNotMatchSource?) {
if (source == null) {
STUB_TREE_AND_INDEX_DO_NOT_MATCH_EVENT.log(project)
}
else {
STUB_TREE_AND_INDEX_DO_NOT_MATCH_EVENT.log(project, EventPair(STUB_TREE_AND_INDEX_DO_NOT_MATCH_SOURCE_FIELD, source))
}
fun reportStubTreeAndIndexDoNotMatch(project: Project, source: StubTreeAndIndexDoNotMatchSource) {
STUB_TREE_AND_INDEX_DO_NOT_MATCH_EVENT.log(project, EventPair(STUB_TREE_AND_INDEX_DO_NOT_MATCH_SOURCE_FIELD, source))
}
private val CHECK_REASON_FIELD = EventFields.Enum<SourceOfCheck>("reason")
@@ -44,7 +44,7 @@ public class StubInconsistencyReporterImpl implements StubInconsistencyReporter
}
@Override
public void reportStubTreeAndIndexDoNotMatch(@NotNull Project project, @Nullable StubTreeAndIndexDoNotMatchSource source) {
public void reportStubTreeAndIndexDoNotMatch(@NotNull Project project, @NotNull StubTreeAndIndexDoNotMatchSource source) {
StubInconsistencyReportUtil.reportStubTreeAndIndexDoNotMatch(project, source);
}
}