From 4fc1a679c13996d47066fbb574a2bd870200b136 Mon Sep 17 00:00:00 2001 From: Max Medvedev Date: Wed, 15 Jan 2025 17:48:03 +0100 Subject: [PATCH] get rid of PsiBuilderImpl.ProductionMarker usages GitOrigin-RevId: ac54e3e125a787666a1157f0d16c35bf9c00142b --- platform/core-api/api-dump-unreviewed.txt | 1 + .../core-api/src/com/intellij/lang/SyntaxTreeBuilder.java | 4 +++- platform/core-impl/api-dump-unreviewed.txt | 1 - .../src/com/intellij/lang/impl/PsiBuilderImpl.java | 6 +----- 4 files changed, 5 insertions(+), 7 deletions(-) diff --git a/platform/core-api/api-dump-unreviewed.txt b/platform/core-api/api-dump-unreviewed.txt index 7651bb246760..eefc34d8a93f 100644 --- a/platform/core-api/api-dump-unreviewed.txt +++ b/platform/core-api/api-dump-unreviewed.txt @@ -650,6 +650,7 @@ com.intellij.lang.SyntaxTreeBuilder$Production - getStartOffset():I - getTokenType():com.intellij.psi.tree.IElementType - isCollapsed():Z +- remapTokenType(com.intellij.psi.tree.IElementType):V com.intellij.lang.TokenSeparatorGenerator - a:generateWhitespaceBetweenTokens(com.intellij.lang.ASTNode,com.intellij.lang.ASTNode):com.intellij.lang.ASTNode c:com.intellij.lang.TreeBackedLighterAST diff --git a/platform/core-api/src/com/intellij/lang/SyntaxTreeBuilder.java b/platform/core-api/src/com/intellij/lang/SyntaxTreeBuilder.java index d44ba8355e5e..078f5d411066 100644 --- a/platform/core-api/src/com/intellij/lang/SyntaxTreeBuilder.java +++ b/platform/core-api/src/com/intellij/lang/SyntaxTreeBuilder.java @@ -1,4 +1,4 @@ -// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. +// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.lang; import com.intellij.openapi.util.NlsContexts; @@ -204,6 +204,8 @@ public interface SyntaxTreeBuilder { default boolean isCollapsed() { return false; } + + default void remapTokenType(@NotNull IElementType newType) {throw new UnsupportedOperationException("not implemented for this kind of markers");} } /** diff --git a/platform/core-impl/api-dump-unreviewed.txt b/platform/core-impl/api-dump-unreviewed.txt index 0eb4c3921b06..5b4493b02451 100644 --- a/platform/core-impl/api-dump-unreviewed.txt +++ b/platform/core-impl/api-dump-unreviewed.txt @@ -762,7 +762,6 @@ a:com.intellij.lang.impl.PsiBuilderImpl$ProductionMarker - getStartIndex():I - getStartOffset():I - isCollapsed():Z -- remapTokenType(com.intellij.psi.tree.IElementType):V - a:tokenTextMatches(java.lang.CharSequence):Z c:com.intellij.lexer.DelegateLexer - com.intellij.lexer.LexerBase diff --git a/platform/core-impl/src/com/intellij/lang/impl/PsiBuilderImpl.java b/platform/core-impl/src/com/intellij/lang/impl/PsiBuilderImpl.java index 17af35825379..7e05ed91f9b2 100644 --- a/platform/core-impl/src/com/intellij/lang/impl/PsiBuilderImpl.java +++ b/platform/core-impl/src/com/intellij/lang/impl/PsiBuilderImpl.java @@ -19,8 +19,8 @@ import com.intellij.psi.impl.DiffLog; import com.intellij.psi.impl.PsiDocumentManagerBase; import com.intellij.psi.impl.source.CharTableImpl; import com.intellij.psi.impl.source.resolve.FileContextUtil; -import com.intellij.psi.impl.source.tree.Factory; import com.intellij.psi.impl.source.tree.*; +import com.intellij.psi.impl.source.tree.Factory; import com.intellij.psi.text.BlockSupport; import com.intellij.psi.tree.*; import com.intellij.util.CharTable; @@ -275,10 +275,6 @@ public class PsiBuilderImpl extends UnprotectedUserDataHolder implements PsiBuil return myBuilder.myOptionalData.isCollapsed(markerId); } - public void remapTokenType(@NotNull IElementType type) { - throw new UnsupportedOperationException("Shall not be called on this kind of markers"); - } - @Override public int getStartIndex() { return myLexemeIndex;