mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[java] inner class detection: optimization
This commit is contained in:
@@ -29,10 +29,7 @@ import com.intellij.psi.impl.PsiManagerImpl;
|
||||
import com.intellij.psi.impl.compiled.ClsFileImpl;
|
||||
import com.intellij.psi.impl.file.PsiBinaryFileImpl;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.org.objectweb.asm.ClassReader;
|
||||
import org.jetbrains.org.objectweb.asm.ClassVisitor;
|
||||
import org.jetbrains.org.objectweb.asm.Label;
|
||||
import org.jetbrains.org.objectweb.asm.Opcodes;
|
||||
import org.jetbrains.org.objectweb.asm.*;
|
||||
|
||||
/**
|
||||
* @author max
|
||||
@@ -79,7 +76,7 @@ public class ClassFileViewProvider extends SingleRootFileViewProvider {
|
||||
|
||||
final Ref<Boolean> ref = Ref.create(Boolean.FALSE);
|
||||
try {
|
||||
new MyClassReader(file.contentsToByteArray(false)).accept(new ClassVisitor(Opcodes.ASM5) {
|
||||
new ClassReader(file.contentsToByteArray(false)).accept(new ClassVisitor(Opcodes.ASM5) {
|
||||
@Override
|
||||
public void visitOuterClass(String owner, String name, String desc) {
|
||||
ref.set(Boolean.TRUE);
|
||||
@@ -94,6 +91,11 @@ public class ClassFileViewProvider extends SingleRootFileViewProvider {
|
||||
throw new ProcessCanceledException();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public FieldVisitor visitField(int access, String name, String desc, String signature, Object value) {
|
||||
throw new ProcessCanceledException();
|
||||
}
|
||||
}, ClassReader.SKIP_CODE | ClassReader.SKIP_DEBUG | ClassReader.SKIP_FRAMES);
|
||||
}
|
||||
catch (ProcessCanceledException ignored) { }
|
||||
@@ -111,15 +113,4 @@ public class ClassFileViewProvider extends SingleRootFileViewProvider {
|
||||
public SingleRootFileViewProvider createCopy(@NotNull VirtualFile copy) {
|
||||
return new ClassFileViewProvider(getManager(), copy, false);
|
||||
}
|
||||
|
||||
private static class MyClassReader extends ClassReader {
|
||||
public MyClassReader(byte[] b) {
|
||||
super(b);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Label readLabel(int offset, Label[] labels) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user