var options = new Hashtable<String, String>()
options.put("org.eclipse.jdt.core.compiler.codegen.targetPlatform", "1.8")
options.put("org.eclipse.jdt.core.compiler.compliance", "1.8")
options.put("org.eclipse.jdt.core.compiler.source", "1.8")
var codeFormatter = ToolFactory.createCodeFormatter(options)
var textEdit = codeFormatter.format(CodeFormatter.K_COMPILATION_UNIT, result, 0, result.length(), 0, "");
.format is for some reason unavailable except on deprecated createCodeFormatter() method.
.formatis for some reason unavailable except on deprecatedcreateCodeFormatter()method.