Skip to content

Commit 3f6e121

Browse files
dkimitsaTom-Ski
andauthored
Revert "* workaround: idea debugger doesn't stop in Inner classes that extend…" (#815)
This reverts commit f8a81f5. Co-authored-by: Tomski <tomwojciechowski@asidik.com>
1 parent cbf9869 commit 3f6e121

File tree

3 files changed

+0
-123
lines changed

3 files changed

+0
-123
lines changed

compiler/compiler/src/main/java/org/robovm/compiler/plugin/objc/ObjCMemberPlugin.java

Lines changed: 0 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@
4646
import org.robovm.compiler.plugin.AbstractCompilerPlugin;
4747
import org.robovm.compiler.plugin.CompilerPlugin;
4848
import org.robovm.compiler.target.framework.FrameworkTarget;
49-
import org.robovm.compiler.util.generic.SootClassUtils;
5049
import org.robovm.compiler.util.generic.SootMethodType;
5150
import soot.Body;
5251
import soot.BooleanType;
@@ -88,7 +87,6 @@
8887
import soot.tagkit.SignatureTag;
8988
import soot.util.Chain;
9089

91-
import java.io.UnsupportedEncodingException;
9290
import java.util.ArrayList;
9391
import java.util.Arrays;
9492
import java.util.Collections;
@@ -696,7 +694,6 @@ public void beforeClass(Config config, Clazz clazz, ModuleBuilder moduleBuilder)
696694
@Override
697695
public void beforeLinker(Config config, Linker linker, Set<Clazz> classes) {
698696
preloadClassesForFramework(config, linker, classes);
699-
preloadObjCClassHosts(config, linker, classes);
700697
}
701698

702699
private static <E> List<E> l(E head, List<E> tail) {
@@ -2032,49 +2029,6 @@ private void preloadClassesForFramework(Config config, Linker linker, Set<Clazz>
20322029
}
20332030
}
20342031

2035-
private void preloadObjCClassHosts(Config config, Linker linker, Set<Clazz> classes) {
2036-
// TODO: remove once resolved on Idea side
2037-
// affects only debug builds
2038-
// workaround for Idea Bug: https://youtrack.jetbrains.com/issue/IDEA-332794
2039-
// Idea debugger is not happy if inner class is being loaded before host ones and
2040-
// ignores breakpoints inside.
2041-
// preload if all ObjCClass's is happening in ObjCClass.java, static initializer
2042-
// workaround -- is to preload all hosts before loading ObjCClass
2043-
if (config.isDebug()) {
2044-
SootClass objCObjectClazz = classes.stream()
2045-
.filter( c -> c.getClassName().equals(OBJC_OBJECT))
2046-
.map(Clazz::getSootClass)
2047-
.findFirst()
2048-
.orElse(null);
2049-
Set<String> objClassHosts = new HashSet<>();
2050-
if (objCObjectClazz != null) {
2051-
// proceed if we link with ObjObject
2052-
// look for all ObjCClasses, and these are internal -- preload hosts as well
2053-
for (Clazz clazz : classes) {
2054-
SootClass sootClass = clazz.getSootClass();
2055-
// skip if doesn't extend ObjCClass
2056-
if (!SootClassUtils.isAssignableFrom(sootClass, objCObjectClazz))
2057-
continue;
2058-
// skip if not inner
2059-
String hostClassName = SootClassUtils.getEnclosingClassName(sootClass);
2060-
if (hostClassName == null)
2061-
hostClassName = SootClassUtils.getDeclaringClassName(sootClass);
2062-
if (hostClassName != null)
2063-
objClassHosts.add(hostClassName);
2064-
}
2065-
2066-
if (!objClassHosts.isEmpty()) {
2067-
try {
2068-
byte[] bytes = StringUtils.join(objClassHosts, ",").getBytes("UTF8");
2069-
linker.addRuntimeData(OBJC_CLASS + ".preloadClasses", bytes);
2070-
} catch (UnsupportedEncodingException e) {
2071-
config.getLogger().error("Failed to prepare ObjCClass' hosts preload list");
2072-
}
2073-
}
2074-
}
2075-
}
2076-
}
2077-
20782032
public static class MethodCompiler extends AbstractMethodCompiler {
20792033
// structure to expose CustomClasses to objc side
20802034
// check https://opensource.apple.com/source/objc4/objc4-437/runtime/objc-runtime-new.h for details

compiler/compiler/src/main/java/org/robovm/compiler/util/generic/SootClassUtils.java

Lines changed: 0 additions & 51 deletions
This file was deleted.

compiler/objc/src/main/java/org/robovm/objc/ObjCClass.java

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
*/
1616
package org.robovm.objc;
1717

18-
import java.io.UnsupportedEncodingException;
1918
import java.lang.reflect.Method;
2019
import java.util.ArrayList;
2120
import java.util.Collections;
@@ -57,31 +56,6 @@ public final class ObjCClass extends ObjCObject {
5756

5857
static {
5958
ObjCRuntime.bind(ObjCClass.class);
60-
61-
// TODO: remove once resolved on Idea side
62-
// affects only debug builds
63-
// workaround for Idea Bug: https://youtrack.jetbrains.com/issue/IDEA-332794
64-
// there is code bellow loads all ObjCClass' and some of them might be Inner ones
65-
// idea seems to be ignoring PREPARE class events in case Inner class is
66-
// being loaded before the host one
67-
byte[] data = VM.getRuntimeData(ObjCClass.class.getName() + ".preloadClasses");
68-
if (data != null) {
69-
String[] innerClassHosts;
70-
try {
71-
innerClassHosts = new String(data, "UTF8").split(",");
72-
} catch (UnsupportedEncodingException e) {
73-
innerClassHosts = new String[0];
74-
}
75-
for (String host : innerClassHosts) {
76-
try {
77-
// preload class.
78-
Class.forName(host);
79-
} catch (Throwable t) {
80-
System.err.println("Failed to preload inner ObjCClass host class " + host + ": " + t.getMessage());
81-
}
82-
}
83-
}
84-
8559
@SuppressWarnings("unchecked")
8660
Class<? extends ObjCObject>[] classes = (Class<? extends ObjCObject>[])
8761
VM.listClasses(ObjCObject.class, ClassLoader.getSystemClassLoader());

0 commit comments

Comments
 (0)