Fix build after change api

This commit is contained in:
Zalim Bashorov
2013-11-08 12:21:33 +04:00
parent ae8ac28ddc
commit 4cea0a3de4
16 changed files with 112 additions and 82 deletions
@@ -17,6 +17,7 @@
package org.jetbrains.jet.codegen;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.jet.OutputFile;
import java.net.URL;
import java.net.URLClassLoader;
@@ -32,11 +33,14 @@ public class GeneratedClassLoader extends URLClassLoader {
@NotNull
@Override
protected Class<?> findClass(@NotNull String name) throws ClassNotFoundException {
String file = name.replace('.', '/') + ".class";
if (state.getOutputFiles().contains(file)) {
byte[] bytes = state.asBytes(file);
String classFilePath = name.replace('.', '/') + ".class";
OutputFile outputFile = state.get(classFilePath);
if (outputFile != null) {
byte[] bytes = outputFile.asByteArray();
return defineClass(name, bytes, 0, bytes.length);
}
return super.findClass(name);
}