Skip to content

Commit

Permalink
Fallback to default frames computation
Browse files Browse the repository at this point in the history
  • Loading branch information
zuevmaxim committed Dec 9, 2024
1 parent 41f485d commit d954eda
Showing 1 changed file with 18 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,12 @@ class ClassWriterImpl extends ClassWriter {
myClassReaders = classReaders;
}

@Override
protected ClassLoader getClassLoader() {
if (myClassLoader != null) return myClassLoader;
return super.getClassLoader();
}

protected String getCommonSuperClass(String type1, String type2) {
try {
ClassReader info1 = getOrLoadClassReader(type1);
Expand Down Expand Up @@ -69,6 +75,12 @@ protected String getCommonSuperClass(String type1, String type2) {
return result;
}
}
} catch (FrameComputationClassNotFoundException e) {
try {
return super.getCommonSuperClass(type1, type2);
} catch (TypeNotPresentException ignored) {
throw e;
}
} catch (IOException e) {
throw new RuntimeException(e.toString());
}
Expand Down Expand Up @@ -124,9 +136,12 @@ private synchronized ClassReader getOrLoadClassReader(String className) throws I
InputStream is = null;
try {
String resource = className + ".class";
is = myClassLoader == null
? ClassLoader.getSystemResourceAsStream(resource)
: myClassLoader.getResourceAsStream(resource);
if (myClassLoader != null) {
is = myClassLoader.getResourceAsStream(resource);
}
if (is == null) {
is = ClassLoader.getSystemResourceAsStream(resource);
}
if (is == null) {
throw new FrameComputationClassNotFoundException("Class " + className + " not found");
}
Expand Down

0 comments on commit d954eda

Please sign in to comment.