@@ -39,6 +39,7 @@ import com.demonwav.mcdev.util.loggerForTopLevel
39
39
import com.demonwav.mcdev.util.mapToArray
40
40
import com.demonwav.mcdev.util.realName
41
41
import com.demonwav.mcdev.util.toJavaIdentifier
42
+ import com.intellij.byteCodeViewer.ByteCodeViewerManager
42
43
import com.intellij.codeEditor.JavaEditorFileSwapper
43
44
import com.intellij.ide.highlighter.JavaFileType
44
45
import com.intellij.openapi.module.Module
@@ -86,7 +87,6 @@ import com.llamalad7.mixinextras.expression.impl.utils.ExpressionASMUtils
86
87
import java.io.PrintWriter
87
88
import java.io.StringWriter
88
89
import java.lang.reflect.InvocationTargetException
89
- import java.lang.reflect.Method
90
90
import java.util.concurrent.ConcurrentHashMap
91
91
import java.util.concurrent.ConcurrentMap
92
92
import org.objectweb.asm.ClassReader
@@ -183,12 +183,6 @@ fun internalNameToShortName(internalName: String) = internalName.substringAfterL
183
183
val ClassNode .shortName
184
184
get() = internalNameToShortName(name)
185
185
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
-
192
186
private val INNER_CLASS_NODES_KEY = Key .create<CachedValue <ConcurrentMap <String , ClassNode ?>>>(" mcdev.innerClassNodes" )
193
187
194
188
/* *
@@ -224,7 +218,7 @@ private val NODE_BY_PSI_CLASS_KEY = Key.create<CachedValue<ClassNode?>>("mcdev.n
224
218
fun findClassNodeByPsiClass (psiClass : PsiClass , module : Module ? = psiClass.findModule()): ClassNode ? {
225
219
return psiClass.lockedCached(NODE_BY_PSI_CLASS_KEY ) {
226
220
try {
227
- val bytes = LOAD_CLASS_FILE_BYTES ?.invoke( null , psiClass) as ? ByteArray
221
+ val bytes = ByteCodeViewerManager .loadClassFileBytes( psiClass)
228
222
if (bytes == null ) {
229
223
// find compiler output
230
224
if (module == null ) return @lockedCached null
0 commit comments