Skip to content
Merged
Show file tree
Hide file tree
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 @@ -114,7 +114,10 @@ protected Object evalSingle(String code) {
throw new RuntimeException(e);
}

if (!event.status().isDefined()) {
// Undefined snippets are generally bad, unless we can still recover from them. E.g.,
// "Unresolved dependencies" errors are recoverable when those dependencies are defined in the later
// snippets.
if (event.status() != Snippet.Status.RECOVERABLE_NOT_DEFINED && !event.status().isDefined()) {
throw new CompilationException(event);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,15 @@ public JJavaLoaderDelegate() {
@Override
public void load(ExecutionControl.ClassBytecodes[] cbcs) throws ExecutionControl.ClassInstallException {
boolean[] installed = new boolean[cbcs.length];
int i = 0;

// Must record all defined classes before attempting to load them. Otherwise, classes depending on other,
// not yet loaded classes, may fail (see https://github.com/dflib/jjava/issues/65)
for (ExecutionControl.ClassBytecodes cbc : cbcs) {
declaredClasses.put(cbc.name(), cbc.bytecodes());
}

int i = 0;
for (ExecutionControl.ClassBytecodes cbc : cbcs) {
try {
Class<?> loaderClass = classLoader.findClass(cbc.name());
loadedClasses.put(cbc.name(), loaderClass);
Expand Down