From f4fde2a91a4eab7f9d5aac824c1cc5a878d9fab5 Mon Sep 17 00:00:00 2001 From: Bartek Pacia Date: Tue, 8 Jul 2025 11:28:23 +0200 Subject: [PATCH] [ByteCodeViewer] IDEA-375621 Enable Kotlin "explicit API mode" GitOrigin-RevId: 4699d8a32823b9a5e94031f4be8a8dd8f0bdc092 --- .../intellij.java.byteCodeViewer.iml | 16 ++++++++++++++++ .../byteCodeViewer/ByteCodeViewerManager.kt | 8 ++++---- .../com/intellij/byteCodeViewer/ClassSearcher.kt | 4 ++-- .../byteCodeViewer/BytecodeLineMappingTest.kt | 2 +- 4 files changed, 23 insertions(+), 7 deletions(-) diff --git a/plugins/ByteCodeViewer/intellij.java.byteCodeViewer.iml b/plugins/ByteCodeViewer/intellij.java.byteCodeViewer.iml index 0ce85faa7f43..22b12490dbb0 100644 --- a/plugins/ByteCodeViewer/intellij.java.byteCodeViewer.iml +++ b/plugins/ByteCodeViewer/intellij.java.byteCodeViewer.iml @@ -1,5 +1,21 @@ + + + + + + + + + + + + + + + diff --git a/plugins/ByteCodeViewer/src/com/intellij/byteCodeViewer/ByteCodeViewerManager.kt b/plugins/ByteCodeViewer/src/com/intellij/byteCodeViewer/ByteCodeViewerManager.kt index 5229d4fde589..ed38067b1c17 100644 --- a/plugins/ByteCodeViewer/src/com/intellij/byteCodeViewer/ByteCodeViewerManager.kt +++ b/plugins/ByteCodeViewer/src/com/intellij/byteCodeViewer/ByteCodeViewerManager.kt @@ -19,7 +19,7 @@ import com.intellij.psi.util.PsiUtil import com.intellij.psi.util.parentsOfType import java.util.* -object ByteCodeViewerManager { +public object ByteCodeViewerManager { private val CLASS_SEARCHER_EP = ExtensionPointName("ByteCodeViewer.classSearcher") private fun PsiClass.containingClassFileClass(): PsiClass { @@ -28,7 +28,7 @@ object ByteCodeViewerManager { .first() } - internal fun findClassFile(aClass: PsiClass): VirtualFile? { + public fun findClassFile(aClass: PsiClass): VirtualFile? { val fileClass = aClass.containingClassFileClass() val file = fileClass.originalElement.containingFile.virtualFile ?: return null val fileIndex = ProjectFileIndex.getInstance(aClass.project) @@ -49,12 +49,12 @@ object ByteCodeViewerManager { @Deprecated(message = "Use findClassFile instead") @JvmStatic - fun loadClassFileBytes(aClass: PsiClass): ByteArray? { + public fun loadClassFileBytes(aClass: PsiClass): ByteArray? { return findClassFile(aClass)?.contentsToByteArray(false) } @JvmStatic - fun getContainingClass(psiElement: PsiElement): PsiClass? { + public fun getContainingClass(psiElement: PsiElement): PsiClass? { for (searcher in CLASS_SEARCHER_EP.extensionList) { val aClass = searcher.findClass(psiElement) if (aClass != null) return aClass diff --git a/plugins/ByteCodeViewer/src/com/intellij/byteCodeViewer/ClassSearcher.kt b/plugins/ByteCodeViewer/src/com/intellij/byteCodeViewer/ClassSearcher.kt index 0a841445e6e9..429c3d182122 100644 --- a/plugins/ByteCodeViewer/src/com/intellij/byteCodeViewer/ClassSearcher.kt +++ b/plugins/ByteCodeViewer/src/com/intellij/byteCodeViewer/ClassSearcher.kt @@ -4,6 +4,6 @@ package com.intellij.byteCodeViewer import com.intellij.psi.PsiClass import com.intellij.psi.PsiElement -interface ClassSearcher { - fun findClass(place: PsiElement): PsiClass? +public interface ClassSearcher { + public fun findClass(place: PsiElement): PsiClass? } diff --git a/plugins/ByteCodeViewer/test/com/intellij/byteCodeViewer/BytecodeLineMappingTest.kt b/plugins/ByteCodeViewer/test/com/intellij/byteCodeViewer/BytecodeLineMappingTest.kt index 91c08e83ea55..97f1ac0772cf 100644 --- a/plugins/ByteCodeViewer/test/com/intellij/byteCodeViewer/BytecodeLineMappingTest.kt +++ b/plugins/ByteCodeViewer/test/com/intellij/byteCodeViewer/BytecodeLineMappingTest.kt @@ -5,7 +5,7 @@ import com.intellij.openapi.application.PathManager import com.intellij.testFramework.PlatformTestUtil import com.intellij.testFramework.fixtures.BasePlatformTestCase -class BytecodeLineMappingTest : BasePlatformTestCase() { +internal class BytecodeLineMappingTest : BasePlatformTestCase() { private fun getSelectionFromSource(text: String): Pair { myFixture.configureByText(getTestName(false) + ".java", text) val sourceDocument = myFixture.editor.document