diff --git a/package.json b/package.json index 4f40942b3d..9b7966a086 100644 --- a/package.json +++ b/package.json @@ -648,10 +648,12 @@ { "type": "string", "enum": [ - "eclipse" + "eclipse", + "google" ], "enumDescriptions": [ - "Use the eclipse formatter." + "Use the eclipse formatter.", + "Use the google-java-format formatter." ], "markdownDescription": "Specifies the formatter style." }, @@ -664,10 +666,12 @@ "style": { "type": "string", "enum": [ - "eclipse" + "eclipse", + "google" ], "enumDescriptions": [ - "Use the eclipse formatter." + "Use the eclipse formatter.", + "Use the google-java-format formatter." ], "markdownDescription": "Specifies the formatter style." }, diff --git a/src/javaServerStarter.ts b/src/javaServerStarter.ts index 34ba23da76..345075873e 100644 --- a/src/javaServerStarter.ts +++ b/src/javaServerStarter.ts @@ -82,6 +82,19 @@ function prepareParams(requirements: RequirementsData, javaConfiguration, worksp 'java.base/java.util=ALL-UNNAMED', '--add-opens', 'java.base/java.lang=ALL-UNNAMED', + // See https://github.com/google/google-java-format#as-a-library + '--add-opens', + 'jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED', + '--add-opens', + 'jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED', + '--add-opens', + 'jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED', + '--add-opens', + 'jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED', + '--add-opens', + 'jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED', + '--add-opens', + 'jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED', // See https://github.com/redhat-developer/vscode-java/issues/2264 // It requires the internal API sun.nio.fs.WindowsFileAttributes.isDirectoryLink() to check if a Windows directory is symlink. '--add-opens',