mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
show bytecode for any class file (e.g. from the output)
This commit is contained in:
@@ -84,6 +84,24 @@ public class CompilerPathsEx extends CompilerPaths {
|
||||
String getPath();
|
||||
}
|
||||
|
||||
private static class VirtualFileClassFileDescriptor implements ClassFileDescriptor {
|
||||
private final VirtualFile myClassFile;
|
||||
|
||||
public VirtualFileClassFileDescriptor(VirtualFile file) {
|
||||
myClassFile = file;
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte[] loadFileBytes() throws IOException {
|
||||
return myClassFile.contentsToByteArray(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPath() {
|
||||
return myClassFile.getPath();
|
||||
}
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static ClassFileDescriptor findClassFileInOutput(@NotNull PsiClass aClass) {
|
||||
String jvmClassName = getJVMClassName(aClass);
|
||||
@@ -100,19 +118,12 @@ public class CompilerPathsEx extends CompilerPaths {
|
||||
if (classRoot != null) {
|
||||
VirtualFile classFile = classRoot.findFileByRelativePath(relativePath);
|
||||
if (classFile != null) {
|
||||
return new ClassFileDescriptor() {
|
||||
@Override
|
||||
public byte[] loadFileBytes() throws IOException {
|
||||
return classFile.contentsToByteArray(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPath() {
|
||||
return classFile.getPath();
|
||||
}
|
||||
};
|
||||
return new VirtualFileClassFileDescriptor(classFile);
|
||||
}
|
||||
}
|
||||
else {
|
||||
return new VirtualFileClassFileDescriptor(file);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
||||
Reference in New Issue
Block a user