diff --git a/platform/core-api/api-dump-unreviewed.txt b/platform/core-api/api-dump-unreviewed.txt index a58b3e564a21..ff84c54d9bab 100644 --- a/platform/core-api/api-dump-unreviewed.txt +++ b/platform/core-api/api-dump-unreviewed.txt @@ -664,6 +664,7 @@ com.intellij.lang.WhitespaceSkippedCallback - a:onSkip(com.intellij.psi.tree.IElementType,I,I):V com.intellij.lang.WhitespacesAndCommentsBinder - a:getEdgePosition(java.util.List,Z,com.intellij.lang.WhitespacesAndCommentsBinder$TokenTextGetter):I +- isRecursive():Z com.intellij.lang.WhitespacesAndCommentsBinder$RecursiveBinder - com.intellij.lang.WhitespacesAndCommentsBinder com.intellij.lang.WhitespacesAndCommentsBinder$TokenTextGetter diff --git a/platform/core-api/src/com/intellij/lang/WhitespacesAndCommentsBinder.java b/platform/core-api/src/com/intellij/lang/WhitespacesAndCommentsBinder.java index 7d2191169e5d..f1d3187cee37 100644 --- a/platform/core-api/src/com/intellij/lang/WhitespacesAndCommentsBinder.java +++ b/platform/core-api/src/com/intellij/lang/WhitespacesAndCommentsBinder.java @@ -1,4 +1,4 @@ -// Copyright 2000-2019 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-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.psi.tree.IElementType; @@ -24,9 +24,14 @@ public interface WhitespacesAndCommentsBinder { /** * Recursive binder is allowed to adjust nested elements positions. + * @deprecated override {@link #isRecursive()} instead. */ + @Deprecated interface RecursiveBinder extends WhitespacesAndCommentsBinder { + } + default boolean isRecursive() { + return this instanceof RecursiveBinder; } /** 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 3b2b18030c53..17af35825379 100644 --- a/platform/core-impl/src/com/intellij/lang/impl/PsiBuilderImpl.java +++ b/platform/core-impl/src/com/intellij/lang/impl/PsiBuilderImpl.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.impl; import com.intellij.lang.*; @@ -1197,7 +1197,7 @@ public class PsiBuilderImpl extends UnprotectedUserDataHolder implements PsiBuil } int lexemeIndex = item.getLexemeIndex(done); - boolean recursive = binder instanceof WhitespacesAndCommentsBinder.RecursiveBinder; + boolean recursive = binder.isRecursive(); int prevProductionLexIndex; if (recursive) { prevProductionLexIndex = 0;