@SuppressWarnings("unchecked") private static List<String> getProtocols(long handle, boolean isProtocol) { final long protocols = isProtocol ? ObjCRuntime.protocol_copyProtocolList(handle, 0) : ObjCRuntime.class_copyProtocolList(handle, 0); if (protocols == 0) { return (List<String>) Collections.EMPTY_LIST; } ArrayList<String> names = new ArrayList<>(); for (long protos = protocols; VM.getPointer(protos) != 0; protos += Bro.IS_64BIT ? 8 : 4) { long protocol = VM.getPointer(protocols); names.add(VM.newStringUTF(ObjCRuntime.protocol_getName(protocol))); } for (long protos = protocols; VM.getPointer(protos) != 0; protos += Bro.IS_64BIT ? 8 : 4) { long protocol = VM.getPointer(protocols); names.addAll(getProtocols(protocol, true)); } VM.free(protocols); return names; }
for (String protocol : getProtocols(classPtr, false)) { Class<? extends ObjCObject> cls = allNativeProtocolProxies.get(protocol); if (cls != null) { c = getByNameNotLoaded(VM.newStringUTF(ObjCRuntime.class_getName(classPtr))); if (c == null) { for (String protocol : getProtocols(classPtr, false)) { Class<? extends ObjCObject> cls = allNativeProtocolProxies.get(protocol); if (cls != null) {
@SuppressWarnings("unchecked") private static List<String> getProtocols(long handle, boolean isProtocol) { final long protocols = isProtocol ? ObjCRuntime.protocol_copyProtocolList(handle, 0) : ObjCRuntime.class_copyProtocolList(handle, 0); if (protocols == 0) { return (List<String>) Collections.EMPTY_LIST; } ArrayList<String> names = new ArrayList<>(); for (long protos = protocols; VM.getPointer(protos) != 0; protos += Bro.IS_64BIT ? 8 : 4) { long protocol = VM.getPointer(protocols); names.add(VM.newStringUTF(ObjCRuntime.protocol_getName(protocol))); } for (long protos = protocols; VM.getPointer(protos) != 0; protos += Bro.IS_64BIT ? 8 : 4) { long protocol = VM.getPointer(protocols); names.addAll(getProtocols(protocol, true)); } VM.free(protocols); return names; }
for (String protocol : getProtocols(classPtr, false)) { Class<? extends ObjCObject> cls = allNativeProtocolProxies.get(protocol); if (cls != null) { c = getByNameNotLoaded(VM.newStringUTF(ObjCRuntime.class_getName(classPtr))); if (c == null) { for (String protocol : getProtocols(classPtr, false)) { Class<? extends ObjCObject> cls = allNativeProtocolProxies.get(protocol); if (cls != null) {