From bc82284d839b82f4bbd1d141607fa1b453d6441a Mon Sep 17 00:00:00 2001 From: Stepan Koltsov Date: Sat, 9 Jun 2012 00:19:34 +0400 Subject: [PATCH] add stdlib to repl classpath --- .../jet/cli/jvm/repl/ReplInterpreter.java | 23 ++++++++++--------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/compiler/cli/src/org/jetbrains/jet/cli/jvm/repl/ReplInterpreter.java b/compiler/cli/src/org/jetbrains/jet/cli/jvm/repl/ReplInterpreter.java index 342b4a69457..55c25c5c4ce 100644 --- a/compiler/cli/src/org/jetbrains/jet/cli/jvm/repl/ReplInterpreter.java +++ b/compiler/cli/src/org/jetbrains/jet/cli/jvm/repl/ReplInterpreter.java @@ -100,20 +100,21 @@ public class ReplInterpreter { Collections.emptyList()); injector = new InjectorForTopDownAnalyzerForJvm(project, topDownAnalysisParameters, trace, module, compilerDependencies); - if (extraClasspath.size() > 0) { - URL[] urls = new URL[extraClasspath.size()]; - for (int i = 0; i < extraClasspath.size(); ++i) { - try { - urls[i] = extraClasspath.get(i).toURI().toURL(); - } catch (Exception e) { - throw ExceptionUtils.rethrow(e); + List classpath = Lists.newArrayList(); + + try { + if (compilerDependencies.getRuntimeJar() != null) { + classpath.add(compilerDependencies.getRuntimeJar().toURI().toURL()); + + for (File extra : extraClasspath) { + classpath.add(extra.toURI().toURL()); } } - classLoader = new ReplClassLoader(new URLClassLoader(urls)); - } - else { - classLoader = new ReplClassLoader(); + } catch (Exception e) { + throw ExceptionUtils.rethrow(e); } + + classLoader = new ReplClassLoader(new URLClassLoader(classpath.toArray(new URL[0]))); } public Object eval(@NotNull String line) {