Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -100,14 +100,18 @@ public static Class<?> loadCapturingClass(String capturingClass) throws ClassNot
}

public static Class<?> loadClass(String className) throws ClassNotFoundException {
return Class.forName(className, false, getClassLoader());
}

private static ClassLoader getClassLoader() {
ClassLoader cl = Thread.currentThread().getContextClassLoader();
if (cl == null) {
cl = ReflectionUtils.class.getClassLoader();
if (cl == null) {
cl = ClassLoader.getSystemClassLoader();
}
}
return cl.loadClass(className);
return cl;
}

public static Object functionFromSerialized(SerializedLambda sl)
Expand All @@ -126,8 +130,7 @@ public static Optional<MethodType> methodType(Object fn) {
public static MethodType inferMethodType(SerializedLambda sl) {
// getInstantiatedMethodType() provides the exact generic signature resolved
// by the compiler, completely bypassing captured variables and method kind switches!
return MethodType.fromMethodDescriptorString(
sl.getInstantiatedMethodType(), sl.getClass().getClassLoader());
return MethodType.fromMethodDescriptorString(sl.getInstantiatedMethodType(), getClassLoader());
}

public static SerializedLambda serializedLambda(Object fn)
Expand Down
Loading