Reorder method parameters

This commit is contained in:
Andrey Breslav
2013-04-22 15:35:51 +04:00
parent 2ce6d16433
commit ddb474ea8e
3 changed files with 7 additions and 6 deletions
@@ -88,11 +88,12 @@ public class CompilerRunnerUtil {
}
}
public static Object invokeExecMethod(CompilerEnvironment environment,
PrintStream out,
MessageCollector messageCollector, String[] arguments, String name) throws Exception {
public static Object invokeExecMethod(
String className, String[] arguments, CompilerEnvironment environment,
MessageCollector messageCollector, PrintStream out
) throws Exception {
URLClassLoader loader = getOrCreateClassLoader(environment.getKotlinPaths(), messageCollector);
Class<?> kompiler = Class.forName(name, true, loader);
Class<?> kompiler = Class.forName(className, true, loader);
Method exec = kompiler.getMethod("exec", PrintStream.class, String[].class);
return exec.invoke(kompiler.newInstance(), out, arguments);
}
@@ -74,7 +74,7 @@ public class KotlinCompilerRunner {
messageCollector.report(CompilerMessageSeverity.INFO,
"Invoking in-process compiler " + compilerClassName + " with arguments " + Arrays.asList(arguments),
CompilerMessageLocation.NO_LOCATION);
Object rc = CompilerRunnerUtil.invokeExecMethod(environment, out, messageCollector, arguments, compilerClassName);
Object rc = CompilerRunnerUtil.invokeExecMethod(compilerClassName, arguments, environment, messageCollector, out);
// exec() returns a K2JVMCompiler.ExitCode object, that class is not accessible here,
// so we take it's contents through reflection
return CompilerRunnerUtil.getReturnCodeFromObject(rc);
@@ -129,7 +129,7 @@ public final class K2JSCompiler implements TranslatingCompiler {
File outDir = environment.getOutput();
File outFile = new File(outDir, module.getName() + ".js");
String[] commandLineArgs = constructArguments(module, outFile);
Object rc = invokeExecMethod(environment, out, messageCollector, commandLineArgs, "org.jetbrains.jet.cli.js.K2JSCompiler");
Object rc = invokeExecMethod("org.jetbrains.jet.cli.js.K2JSCompiler", commandLineArgs, environment, messageCollector, out);
if (!ApplicationManager.getApplication().isUnitTestMode()) {
VirtualFile virtualFile = LocalFileSystem.getInstance().findFileByIoFile(outDir);