mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
fixed our classByName not searching the same way as in VirtualMachineProxy
This commit is contained in:
@@ -242,7 +242,7 @@ public class MethodBytecodeUtil {
|
||||
visit(applicableMethods.get(0), new MethodVisitor(Opcodes.API_VERSION) {
|
||||
@Override
|
||||
public void visitMethodInsn(int opcode, String owner, String name, String desc, boolean itf) {
|
||||
ReferenceType cls = ContainerUtil.getFirstItem(vm.classesByName(owner.replace("/", ".")));
|
||||
ReferenceType cls = ContainerUtil.getFirstItem(vm.classesByName(owner));
|
||||
if (cls != null) {
|
||||
Method method = DebuggerUtils.findMethod(cls, name, desc);
|
||||
if (method != null) {
|
||||
|
||||
@@ -35,6 +35,7 @@ import com.intellij.util.containers.MultiMap;
|
||||
import com.sun.jdi.*;
|
||||
import com.sun.jdi.event.EventQueue;
|
||||
import com.sun.jdi.request.EventRequestManager;
|
||||
import com.sun.tools.jdi.JNITypeParser;
|
||||
import com.sun.tools.jdi.TargetVM;
|
||||
import org.jetbrains.annotations.Contract;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -100,12 +101,41 @@ public class VirtualMachineProxyImpl implements JdiTimer, VirtualMachineProxy {
|
||||
return myVirtualMachine;
|
||||
}
|
||||
|
||||
static final class JNITypeParserReflect {
|
||||
static final Method typeNameToSignatureMethod;
|
||||
|
||||
static {
|
||||
typeNameToSignatureMethod = ReflectionUtil.getDeclaredMethod(JNITypeParser.class, "typeNameToSignature", String.class);
|
||||
if (typeNameToSignatureMethod == null) {
|
||||
LOG.warn("Unable to find JNITypeParser.typeNameToSignature method");
|
||||
}
|
||||
}
|
||||
|
||||
@Nullable
|
||||
static String typeNameToSignature(@NotNull String name) {
|
||||
if (typeNameToSignatureMethod != null) {
|
||||
try {
|
||||
return (String)typeNameToSignatureMethod.invoke(null, name);
|
||||
}
|
||||
catch (Exception ignored) {
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public List<ReferenceType> classesByName(String s) {
|
||||
if (myAllClassesByName == null) {
|
||||
myAllClassesByName = new MultiMap<>();
|
||||
allClasses().forEach(t -> myAllClassesByName.putValue(t.name(), t));
|
||||
String signature = JNITypeParserReflect.typeNameToSignature(s);
|
||||
if (signature != null) {
|
||||
if (myAllClassesByName == null) {
|
||||
myAllClassesByName = new MultiMap<>();
|
||||
allClasses().forEach(t -> myAllClassesByName.putValue(t.signature(), t));
|
||||
}
|
||||
return (List<ReferenceType>)myAllClassesByName.get(signature);
|
||||
}
|
||||
else {
|
||||
return myVirtualMachine.classesByName(s);
|
||||
}
|
||||
return (List<ReferenceType>)myAllClassesByName.get(s);
|
||||
}
|
||||
|
||||
public List<ReferenceType> nestedTypes(ReferenceType refType) {
|
||||
|
||||
Reference in New Issue
Block a user