@@ -39,6 +39,7 @@ import com.demonwav.mcdev.util.loggerForTopLevel
3939import com.demonwav.mcdev.util.mapToArray
4040import com.demonwav.mcdev.util.realName
4141import com.demonwav.mcdev.util.toJavaIdentifier
42+ import com.intellij.byteCodeViewer.ByteCodeViewerManager
4243import com.intellij.codeEditor.JavaEditorFileSwapper
4344import com.intellij.ide.highlighter.JavaFileType
4445import com.intellij.openapi.module.Module
@@ -86,7 +87,6 @@ import com.llamalad7.mixinextras.expression.impl.utils.ExpressionASMUtils
8687import java.io.PrintWriter
8788import java.io.StringWriter
8889import java.lang.reflect.InvocationTargetException
89- import java.lang.reflect.Method
9090import java.util.concurrent.ConcurrentHashMap
9191import java.util.concurrent.ConcurrentMap
9292import org.objectweb.asm.ClassReader
@@ -183,12 +183,6 @@ fun internalNameToShortName(internalName: String) = internalName.substringAfterL
183183val ClassNode .shortName
184184 get() = internalNameToShortName(name)
185185
186- private val LOAD_CLASS_FILE_BYTES : Method ? = runCatching {
187- com.intellij.byteCodeViewer.ByteCodeViewerManager ::class .java
188- .getDeclaredMethod(" loadClassFileBytes" , PsiClass ::class .java)
189- .let { it.isAccessible = true ; it }
190- }.getOrNull()
191-
192186private val INNER_CLASS_NODES_KEY = Key .create<CachedValue <ConcurrentMap <String , ClassNode ?>>>(" mcdev.innerClassNodes" )
193187
194188/* *
@@ -224,7 +218,7 @@ private val NODE_BY_PSI_CLASS_KEY = Key.create<CachedValue<ClassNode?>>("mcdev.n
224218fun findClassNodeByPsiClass (psiClass : PsiClass , module : Module ? = psiClass.findModule()): ClassNode ? {
225219 return psiClass.lockedCached(NODE_BY_PSI_CLASS_KEY ) {
226220 try {
227- val bytes = LOAD_CLASS_FILE_BYTES ?.invoke( null , psiClass) as ? ByteArray
221+ val bytes = ByteCodeViewerManager .loadClassFileBytes( psiClass)
228222 if (bytes == null ) {
229223 // find compiler output
230224 if (module == null ) return @lockedCached null
0 commit comments