// requires class _javax static boolean isSafeCompilable(String src) { File srcDir = _javax.TempDirMaker_make(); File classesDir = _javax.TempDirMaker_make(); _javax.saveTextFile(new File(srcDir, "main.java").getPath(), src); new List libraries; _javax.safeTranslate = true; File transpiledDir = _javax.topLevelTranslate(srcDir, libraries); try { _javax.compileJava(transpiledDir, libraries, classesDir); } catch (RuntimeException e) { // TODO: check if it's actually a compile fail, not any other error return false; } return true; }