mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[simple change for 143 backport] introduce ourCompiledClassContentHintKey to help Decompiler implementation to avoid reading class content for understanding if it should be used
This commit is contained in:
@@ -16,6 +16,7 @@
|
||||
package com.intellij.psi.impl.compiled;
|
||||
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.util.Key;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.psi.compiled.ClassFileDecompilers;
|
||||
import com.intellij.psi.stubs.BinaryFileStubBuilder;
|
||||
@@ -39,6 +40,7 @@ public class ClassFileStubBuilder implements BinaryFileStubBuilder {
|
||||
private static final Logger LOG = Logger.getInstance("#com.intellij.psi.impl.compiled.ClassFileStubBuilder");
|
||||
|
||||
public static final int STUB_VERSION = 12;
|
||||
public static final Key<byte[]> ourCompiledClassContentHintKey = Key.create("compiled.class.content.hint");
|
||||
|
||||
@Override
|
||||
public boolean acceptsFile(@NotNull VirtualFile file) {
|
||||
@@ -51,6 +53,7 @@ public class ClassFileStubBuilder implements BinaryFileStubBuilder {
|
||||
byte[] content = fileContent.getContent();
|
||||
|
||||
try {
|
||||
file.putUserData(ourCompiledClassContentHintKey, content);
|
||||
ClassFileDecompilers.Decompiler decompiler = ClassFileDecompilers.find(file);
|
||||
if (decompiler instanceof Full) {
|
||||
return ((Full)decompiler).getStubBuilder().buildFileStub(fileContent);
|
||||
@@ -59,6 +62,9 @@ public class ClassFileStubBuilder implements BinaryFileStubBuilder {
|
||||
catch (ClsFormatException e) {
|
||||
LOG.debug(e);
|
||||
}
|
||||
finally {
|
||||
file.putUserData(ourCompiledClassContentHintKey, null);
|
||||
}
|
||||
|
||||
try {
|
||||
PsiFileStub<?> stub = ClsFileImpl.buildFileStub(file, content);
|
||||
|
||||
Reference in New Issue
Block a user