void (@NotNull File source, @NotNull File out, String @NotNull ... options) { assertTrue("source does not exist: " + source.getPath(), source.isFile()); List<String> args = new ArrayList<>(); args.add("-d"); args.add(out.getAbsolutePath()); ContainerUtil.addAll(args, options); args.add(source.getAbsolutePath()); if (source.getName().endsWith(".groovy")) { try { org.codehaus.groovy.tools.FileSystemCompiler.commandLineCompile(ArrayUtilRt.toStringArray(args)); } catch (Exception e) { throw new IllegalStateException(e); } } else { int result = com.sun.tools.javac.Main.compile(ArrayUtilRt.toStringArray(args)); if (result != 0) throw new IllegalStateException("javac failed with exit code " + result); } }